plugins ext FEATURE initial schema-mount support
Only for XML data for now. Includes lots of other
changes needed to support this extension.
diff --git a/tests/utests/basic/test_context.c b/tests/utests/basic/test_context.c
index 7899079..8b79a1c 100644
--- a/tests/utests/basic/test_context.c
+++ b/tests/utests/basic/test_context.c
@@ -440,7 +440,10 @@
struct lys_glob_unres unres = {0};
unsigned int index = 0;
- const char *names[] = {"ietf-yang-metadata", "yang", "ietf-inet-types", "ietf-yang-types", "ietf-datastores", "ietf-yang-library", "a", "a", "a"};
+ const char *names[] = {
+ "ietf-yang-metadata", "yang", "ietf-inet-types", "ietf-yang-types", "ietf-yang-schema-mount",
+ "ietf-datastores", "ietf-yang-library", "a", "a", "a"
+ };
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str0, &in0));
assert_int_equal(LY_SUCCESS, ly_in_new_memory(str1, &in1));
@@ -507,7 +510,7 @@
while ((mod = (struct lys_module *)ly_ctx_get_module_iter(UTEST_LYCTX, &index))) {
assert_string_equal(names[index - 1], mod->name);
}
- assert_int_equal(9, index);
+ assert_int_equal(10, index);
/* cleanup */
ly_in_free(in0, 0);
diff --git a/tests/utests/basic/test_plugins.c b/tests/utests/basic/test_plugins.c
index 95b190f..dd50347 100644
--- a/tests/utests/basic/test_plugins.c
+++ b/tests/utests/basic/test_plugins.c
@@ -68,61 +68,6 @@
}
static void
-test_validation(void **state)
-{
- struct lys_module *mod;
- struct lyd_node *tree;
- const char *data;
- const char *schema = "module libyang-plugins-validate {"
- " namespace urn:libyang:tests:plugins:validate;"
- " prefix v;"
- " extension extra-validation;"
- " typedef note { type string { v:extra-validation;}}"
- " leaf test1 {"
- " type v:note;"
- " }"
- " leaf test2 {"
- " type string;"
- " v:extra-validation;"
- " }"
- " leaf test3 {"
- " type string {v:extra-validation;}"
- " }"
- " leaf test4 {"
- " type string;"
- " }"
- "}";
-
- assert_int_equal(LY_SUCCESS, lyplg_add(TESTS_BIN "/plugins/plugin_validate" LYPLG_SUFFIX));
-
- UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, &mod);
-
- /* test1 - extra-validation done based on typedef's extension */
- data = "<test1 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test1>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX("Extension plugin \"libyang 2 - validation test, version 1\": extra validation callback invoked on test1", NULL);
- lyd_free_all(tree);
-
- /* test2 - extra-validation done based on node's extension */
- data = "<test2 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test2>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX("Extension plugin \"libyang 2 - validation test, version 1\": extra validation callback invoked on test2", NULL);
- lyd_free_all(tree);
-
- /* test3 - extra-validation done based on node type's extension */
- data = "<test3 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test3>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX("Extension plugin \"libyang 2 - validation test, version 1\": extra validation callback invoked on test3", NULL);
- lyd_free_all(tree);
-
- /* test4 - extra-validation not done */
- data = "<test4 xmlns=\"urn:libyang:tests:plugins:validate\">xxx</test4>";
- assert_int_equal(LY_SUCCESS, lyd_parse_data_mem(UTEST_LYCTX, data, LYD_XML, 0, LYD_VALIDATE_PRESENT, &tree));
- CHECK_LOG_CTX(NULL, NULL);
- lyd_free_all(tree);
-}
-
-static void
test_not_implemented(void **state)
{
struct lys_module *mod;
@@ -157,7 +102,6 @@
const struct CMUnitTest tests[] = {
UTEST(test_add_invalid),
UTEST(test_add_simple),
- UTEST(test_validation),
UTEST(test_not_implemented),
};
diff --git a/tests/utests/basic/test_xml.c b/tests/utests/basic/test_xml.c
index 1999f65..7e8132d 100644
--- a/tests/utests/basic/test_xml.c
+++ b/tests/utests/basic/test_xml.c
@@ -23,7 +23,6 @@
#include "xml.h"
LY_ERR lyxml_ns_add(struct lyxml_ctx *xmlctx, const char *prefix, size_t prefix_len, char *uri);
-LY_ERR lyxml_ns_rm(struct lyxml_ctx *xmlctx);
static void
test_element(void **state)
diff --git a/tests/utests/extensions/test_schema_mount.c b/tests/utests/extensions/test_schema_mount.c
index 5209dd1..4e3b650 100644
--- a/tests/utests/extensions/test_schema_mount.c
+++ b/tests/utests/extensions/test_schema_mount.c
@@ -1,9 +1,10 @@
-/*
+/**
* @file test_schema_mount.c
- * @author: Tadeas Vintrlik <xvintr04@stud.fit.vutbr.cz>
+ * @author Tadeas Vintrlik <xvintr04@stud.fit.vutbr.cz>
+ * @author Michal Vasko <mvasko@cesnet.cz>
* @brief unit tests for Schema Mount extension support
*
- * Copyright (c) 2021 CESNET, z.s.p.o.
+ * Copyright (c) 2021 - 2022 CESNET, z.s.p.o.
*
* This source code is licensed under BSD 3-Clause License (the "License").
* You may not use this file except in compliance with the License.
@@ -11,47 +12,1043 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
+
#define _UTEST_MAIN_
#include "utests.h"
#include "libyang.h"
+void **glob_state;
+
static int
setup(void **state)
{
+ const char *schema =
+ "module sm {yang-version 1.1;namespace \"urn:sm\";prefix \"sm\";"
+ "import ietf-yang-schema-mount {prefix yangmnt;}"
+ "import ietf-interfaces {prefix if;}"
+ "container root {yangmnt:mount-point \"root\";}"
+ "container root2 {yangmnt:mount-point \"root\";}"
+ "container root3 {"
+ " list ls { key name; leaf name {type string;}"
+ " container mnt-root {yangmnt:mount-point \"mnt-root\";}"
+ " }"
+ "}"
+ "leaf target{type string;}"
+ "augment /if:interfaces/if:interface {"
+ " leaf sm-name {type leafref {path \"/sm:target\";}}"
+ "}"
+ "}";
+
UTEST_SETUP;
+ glob_state = state;
assert_int_equal(LY_SUCCESS, ly_ctx_set_searchdir(UTEST_LYCTX, TESTS_DIR_MODULES_YANG));
- assert_non_null(ly_ctx_load_module(UTEST_LYCTX, "ietf-yang-schema-mount", "2019-01-14", NULL));
+ assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
+ assert_non_null(ly_ctx_load_module(UTEST_LYCTX, "iana-if-type", NULL, NULL));
return 0;
}
static void
-test_compile(void **state)
+test_schema(void **state)
{
struct lys_module *mod;
- const char *data = "module test-parent {yang-version 1.1;namespace \"urn:test-parent\";"
- "prefix \"tp\"; import ietf-yang-schema-mount {prefix yangmnt;} container root {"
- "yangmnt:mount-point \"root\" {}}}";
+ const char *schema;
+ char *str;
- assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, &mod));
+ /* invalid */
+ schema =
+ "module sm {\n"
+ " namespace \"urn:sm\";\n"
+ " prefix sm;\n"
+ "\n"
+ " import ietf-yang-schema-mount {\n"
+ " prefix yangmnt;\n"
+ " }\n"
+ "\n"
+ " container root {\n"
+ " yangmnt:mount-point \"root\";\n"
+ " }\n"
+ "}\n";
+ assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Extension \"yangmnt:mount-point\" instance not allowed in YANG version 1 module.",
+ "/sm:root/{extension='yangmnt:mount-point'}/root");
+
+ schema =
+ "module sm {\n"
+ " yang-version 1.1;\n"
+ " namespace \"urn:sm\";\n"
+ " prefix sm;\n"
+ "\n"
+ " import ietf-yang-schema-mount {\n"
+ " prefix yangmnt;\n"
+ " }\n"
+ "\n"
+ " yangmnt:mount-point \"root\";\n"
+ "}\n";
+ assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Extension \"yangmnt:mount-point\" instance allowed only in container or list statement.",
+ "/sm:{extension='yangmnt:mount-point'}/root");
+
+ schema =
+ "module sm {\n"
+ " yang-version 1.1;\n"
+ " namespace \"urn:sm\";\n"
+ " prefix sm;\n"
+ "\n"
+ " import ietf-yang-schema-mount {\n"
+ " prefix yangmnt;\n"
+ " }\n"
+ "\n"
+ " container root {\n"
+ " leaf l {\n"
+ " type empty;\n"
+ " yangmnt:mount-point \"root\";\n"
+ " }\n"
+ " }\n"
+ "}\n";
+ assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Extension \"yangmnt:mount-point\" instance allowed only in container or list statement.",
+ "/sm:root/l/{extension='yangmnt:mount-point'}/root");
+
+ schema =
+ "module sm {\n"
+ " yang-version 1.1;\n"
+ " namespace \"urn:sm\";\n"
+ " prefix sm;\n"
+ "\n"
+ " import ietf-yang-schema-mount {\n"
+ " prefix yangmnt;\n"
+ " }\n"
+ "\n"
+ " list l {\n"
+ " key \"k\";\n"
+ " leaf k {\n"
+ " type string;\n"
+ " }\n"
+ " yangmnt:mount-point \"root\";\n"
+ " yangmnt:mount-point \"root2\";\n"
+ " }\n"
+ "}\n";
+ assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Multiple extension \"yangmnt:mount-point\" instances.",
+ "/sm:l/{extension='yangmnt:mount-point'}/root2");
+
+ /* valid */
+ schema =
+ "module sm {\n"
+ " yang-version 1.1;\n"
+ " namespace \"urn:sm\";\n"
+ " prefix sm;\n"
+ "\n"
+ " import ietf-yang-schema-mount {\n"
+ " prefix yangmnt;\n"
+ " }\n"
+ "\n"
+ " container root {\n"
+ " yangmnt:mount-point \"root\";\n"
+ " }\n"
+ "}\n";
+ assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, &mod));
+ lys_print_mem(&str, mod, LYS_YIN, 0);
+ assert_string_equal(str, schema);
+ free(str);
+}
+
+static LY_ERR
+test_ext_data_clb(const struct lysc_ext_instance *ext, void *user_data, void **ext_data, ly_bool *ext_data_free)
+{
+ void **state = glob_state;
+ struct lyd_node *data = NULL;
+
+ (void)ext;
+
+ if (user_data) {
+ CHECK_PARSE_LYD_PARAM(user_data, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ }
+
+ *ext_data = data;
+ *ext_data_free = 1;
+ return LY_SUCCESS;
}
static void
-test_parse_no_yanglib(void **state)
+test_parse_xml_invalid(void **state)
{
- struct ly_ctx *new;
- const char *data = "<root/>";
+ const char *xml;
+ struct lyd_node *data;
- assert_int_equal(LY_SUCCESS, ly_ctx_new(NULL, 0, &new));
+ /* no callback set */
+ xml =
+ "<root xmlns=\"urn:sm\">"
+ " <unknown xmlns=\"unknown\">"
+ " <interface>"
+ " <name>bu</name>"
+ " <type xmlns:ii=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ii:ethernetCsmacd</type>"
+ " </interface>"
+ " </unknown>"
+ "</root>";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EINVAL, data);
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": Failed to get extension data, no callback set.",
+ NULL);
+
+ /* unknown data */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb, NULL);
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ assert_string_equal(LYD_NAME(data), "root");
+ assert_null(lyd_child(data));
+ assert_non_null(data->next);
+ assert_true(data->next->flags & LYD_DEFAULT);
+ lyd_free_siblings(data);
+
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("No module with namespace \"unknown\" in the context.",
+ "Schema location /sm:root, data location /sm:root, line number 1.");
+
+ /* missing required callback data */
+ xml =
+ "<root xmlns=\"urn:sm\">"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">"
+ " <interface>"
+ " <name>bu</name>"
+ " </interface>"
+ " </interfaces>"
+ "</root>";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.",
+ "Schema location /sm:root, data location /sm:root, line number 1.");
+
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>");
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", NULL);
+
+ /* missing module in yang-library data */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <inline/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", NULL);
+
+ /* callback data correct, invalid YANG data */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <inline/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Mandatory node \"type\" instance does not exist.",
+ "Schema location /ietf-interfaces:interfaces/interface/type.");
+
+ /* validation fail */
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT | LYD_PARSE_ONLY, 0, LY_SUCCESS, data);
+ assert_int_equal(LY_EVALID, lyd_validate_all(&data, NULL, LYD_VALIDATE_PRESENT, NULL));
+ lyd_free_siblings(data);
+
+ /* success */
+ xml =
+ "<root xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ "</root>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+ lyd_free_siblings(data);
+}
+
+static void
+test_parse_xml_inline(void **state)
+{
+ const char *xml;
+ struct lyd_node *data;
+
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <inline/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ xml =
+ "<root xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " <interfaces-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <oper-status>not-present</oper-status>\n"
+ " <statistics>\n"
+ " <discontinuity-time>2022-01-01T10:00:00-00:00</discontinuity-time>\n"
+ " </statistics>\n"
+ " </interface>\n"
+ " </interfaces-state>\n"
+ "</root>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+ lyd_free_siblings(data);
+
+ /* different yang-lib data */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-ip</name>"
+ " <revision>2014-06-16</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <inline/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+ lyd_free_siblings(data);
+}
+
+static void
+test_parse_xml_shared(void **state)
+{
+ const char *xml;
+ struct lyd_node *data;
+
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <shared-schema/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ xml =
+ "<root xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " <interfaces-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <oper-status>not-present</oper-status>\n"
+ " <statistics>\n"
+ " <discontinuity-time>2022-01-01T10:00:00-00:00</discontinuity-time>\n"
+ " </statistics>\n"
+ " </interface>\n"
+ " </interfaces-state>\n"
+ "</root>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+ lyd_free_siblings(data);
+
+ /* different yang-lib data */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-ip</name>"
+ " <revision>2014-06-16</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>2</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <shared-schema/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ xml =
+ "<root2 xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " <interfaces-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <oper-status>not-present</oper-status>\n"
+ " <statistics>\n"
+ " <discontinuity-time>2022-01-01T10:00:00-00:00</discontinuity-time>\n"
+ " </statistics>\n"
+ " </interface>\n"
+ " </interfaces-state>\n"
+ "</root2>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Shared-schema yang-library content-id \"2\" differs from \"1\" used previously.",
+ "/ietf-yang-library:yang-library/content-id");
+
+ /* data for 2 mount points */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <shared-schema/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ xml =
+ "<root xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " <interfaces-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <oper-status>not-present</oper-status>\n"
+ " <statistics>\n"
+ " <discontinuity-time>2022-01-01T10:00:00-00:00</discontinuity-time>\n"
+ " </statistics>\n"
+ " </interface>\n"
+ " </interfaces-state>\n"
+ "</root>\n"
+ "<root2 xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>fu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:fddi</type>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " <interfaces-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>fu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:fddi</type>\n"
+ " <oper-status>down</oper-status>\n"
+ " <statistics>\n"
+ " <discontinuity-time>2020-01-01T10:00:00-00:00</discontinuity-time>\n"
+ " </statistics>\n"
+ " </interface>\n"
+ " </interfaces-state>\n"
+ "</root2>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+ lyd_free_siblings(data);
+}
+
+static void
+test_parse_xml_shared_parent_ref(void **state)
+{
+ const char *xml;
+ struct lyd_node *data;
+
+ /* wrong leafref value */
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>sm</name>"
+ " <namespace>urn:sm</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <namespace>"
+ " <prefix>smp</prefix>"
+ " <uri>urn:sm</uri>"
+ " </namespace>"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>mnt-root</label>"
+ " <shared-schema>"
+ " <parent-reference>/smp:target[. = current()/../smp:name]</parent-reference>"
+ " </shared-schema>"
+ " </mount-point>"
+ "</schema-mounts>");
+ xml =
+ "<root3 xmlns=\"urn:sm\">\n"
+ " <ls>\n"
+ " <name>target-value</name>\n"
+ " <mnt-root>\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <sm-name xmlns=\"urn:sm\">target-value</sm-name>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " </mnt-root>\n"
+ " </ls>\n"
+ "</root3>\n"
+ "<target xmlns=\"urn:sm\">wrong-target-value</target>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
+ CHECK_LOG_CTX("Extension plugin \"libyang 2 - Schema Mount, version 1\": "
+ "Invalid leafref value \"target-value\" - no existing target instance \"/sm:target\".",
+ "Schema location /ietf-interfaces:interfaces/interface/sm:sm-name, "
+ "data location /ietf-interfaces:interfaces/interface[name='bu']/sm:sm-name.");
+
+ /* success */
+ xml =
+ "<root3 xmlns=\"urn:sm\">\n"
+ " <ls>\n"
+ " <name>target-value</name>\n"
+ " <mnt-root>\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <sm-name xmlns=\"urn:sm\">target-value</sm-name>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ " </mnt-root>\n"
+ " </ls>\n"
+ "</root3>\n"
+ "<target xmlns=\"urn:sm\">target-value</target>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+ lyd_free_siblings(data);
+}
+
+static void
+test_parse_xml_config(void **state)
+{
+ const char *xml;
+ struct lyd_node *data;
+ const struct lyd_node *node;
+
+ ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
+ "<yang-library xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\" "
+ " xmlns:ds=\"urn:ietf:params:xml:ns:yang:ietf-datastores\">"
+ " <module-set>"
+ " <name>test-set</name>"
+ " <module>"
+ " <name>ietf-datastores</name>"
+ " <revision>2018-02-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-datastores</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-library</name>"
+ " <revision>2019-01-04</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-library</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-yang-schema-mount</name>"
+ " <revision>2019-01-14</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount</namespace>"
+ " </module>"
+ " <module>"
+ " <name>ietf-interfaces</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-interfaces</namespace>"
+ " </module>"
+ " <module>"
+ " <name>iana-if-type</name>"
+ " <revision>2014-05-08</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:iana-if-type</namespace>"
+ " </module>"
+ " <import-only-module>"
+ " <name>ietf-yang-types</name>"
+ " <revision>2013-07-15</revision>"
+ " <namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace>"
+ " </import-only-module>"
+ " </module-set>"
+ " <schema>"
+ " <name>test-schema</name>"
+ " <module-set>test-set</module-set>"
+ " </schema>"
+ " <datastore>"
+ " <name>ds:running</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <datastore>"
+ " <name>ds:operational</name>"
+ " <schema>test-schema</schema>"
+ " </datastore>"
+ " <content-id>1</content-id>"
+ "</yang-library>"
+ "<modules-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\">"
+ " <module-set-id>1</module-set-id>"
+ "</modules-state>"
+ "<schema-mounts xmlns=\"urn:ietf:params:xml:ns:yang:ietf-yang-schema-mount\">"
+ " <mount-point>"
+ " <module>sm</module>"
+ " <label>root</label>"
+ " <config>false</config>"
+ " <inline/>"
+ " </mount-point>"
+ "</schema-mounts>");
+ xml =
+ "<root xmlns=\"urn:sm\">\n"
+ " <interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\">\n"
+ " <interface>\n"
+ " <name>bu</name>\n"
+ " <type xmlns:ianaift=\"urn:ietf:params:xml:ns:yang:iana-if-type\">ianaift:ethernetCsmacd</type>\n"
+ " <enabled>true</enabled>\n"
+ " </interface>\n"
+ " </interfaces>\n"
+ "</root>\n";
+ CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
+ CHECK_LYD_STRING_PARAM(data, xml, LYD_XML, LYD_PRINT_WITHSIBLINGS);
+
+ node = lyd_child(data);
+ assert_string_equal(LYD_NAME(node), "interfaces");
+ assert_true(node->schema->flags & LYS_CONFIG_R);
+ node = lyd_child(node);
+ assert_string_equal(LYD_NAME(node), "interface");
+ assert_true(node->schema->flags & LYS_CONFIG_R);
+ node = lyd_child(node);
+ assert_string_equal(LYD_NAME(node), "name");
+ assert_true(node->schema->flags & LYS_CONFIG_R);
+ node = node->next;
+ assert_string_equal(LYD_NAME(node), "type");
+ assert_true(node->schema->flags & LYS_CONFIG_R);
+
+ lyd_free_siblings(data);
}
int
main(void)
{
const struct CMUnitTest tests[] = {
- UTEST(test_compile, setup),
+ UTEST(test_schema),
+ UTEST(test_parse_xml_invalid, setup),
+ UTEST(test_parse_xml_inline, setup),
+ UTEST(test_parse_xml_shared, setup),
+ UTEST(test_parse_xml_shared_parent_ref, setup),
+ UTEST(test_parse_xml_config, setup),
};
return cmocka_run_group_tests(tests, NULL, NULL);
diff --git a/tests/utests/utests.h b/tests/utests/utests.h
index 46b3d04..7e85a66 100644
--- a/tests/utests/utests.h
+++ b/tests/utests/utests.h
@@ -126,16 +126,25 @@
* @param[in] INPUT_FORMAT Format of the input data to be parsed. Can be 0 to try to detect format from the input handler.
* @param[in] PARSE_OPTIONS Options for parser, see @ref dataparseroptions.
* @param[in] VALIDATE_OPTIONS Options for the validation phase, see @ref datavalidationoptions.
- * @param[in] OUT_STATUS expected return status
- * @param[out] OUT_NODE Resulting data tree built from the input data. Note that NULL can be a valid result as a representation of an empty YANG data tree.
- * The returned data are expected to be freed using LYD_TREE_DESTROY().
+ * @param[in] RET expected return status
+ * @param[out] OUT_NODE Resulting data tree built from the input data. Note that NULL can be a valid result as a
+ * representation of an empty YANG data tree.
*/
-#define CHECK_PARSE_LYD_PARAM(INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, OUT_STATUS, OUT_NODE) \
- assert_int_equal(OUT_STATUS, lyd_parse_data_mem(_UC->ctx, INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, &OUT_NODE)); \
- if (OUT_STATUS == LY_SUCCESS) { \
- assert_non_null(OUT_NODE); \
- } else { \
- assert_null(OUT_NODE); \
+#define CHECK_PARSE_LYD_PARAM(INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, RET, OUT_NODE) \
+ { \
+ LY_ERR _r = lyd_parse_data_mem(_UC->ctx, INPUT, INPUT_FORMAT, PARSE_OPTIONS, VALIDATE_OPTIONS, &OUT_NODE); \
+ if (_r != RET) { \
+ if (_r) { \
+ fail_msg("%s != 0x%d; MSG: %s", #RET, _r, ly_err_last(_UC->ctx)->msg); \
+ } else { \
+ fail_msg("%s != 0x%d", #RET, _r); \
+ } \
+ } \
+ if (RET == LY_SUCCESS) { \
+ assert_non_null(OUT_NODE); \
+ } else { \
+ assert_null(OUT_NODE); \
+ } \
}
/**
@@ -147,10 +156,13 @@
*/
#define CHECK_LYD_STRING_PARAM(NODE, TEXT, FORMAT, PARAM) \
{ \
- char *test; \
- lyd_print_mem(&test, NODE, FORMAT, PARAM); \
- assert_string_equal(test, TEXT); \
- free(test); \
+ char *str; \
+ LY_ERR _r = lyd_print_mem(&str, NODE, FORMAT, PARAM); \
+ if (_r) { \
+ fail_msg("Print err 0x%d; MSG: %s", _r, ly_err_last(_UC->ctx)->msg); \
+ } \
+ assert_string_equal(str, TEXT); \
+ free(str); \
}
/**
@@ -160,15 +172,15 @@
*/
#define CHECK_LYD(NODE_1, NODE_2) \
{ \
- char *test_1; \
- char *test_2; \
- assert_int_equal(LY_SUCCESS, lyd_print_mem(&test_1, NODE_1, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
- assert_int_equal(LY_SUCCESS, lyd_print_mem(&test_2, NODE_2, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
- assert_non_null(test_1); \
- assert_non_null(test_2); \
- assert_string_equal(test_1, test_2); \
- free(test_1); \
- free(test_2); \
+ char *str1; \
+ char *str2; \
+ assert_int_equal(LY_SUCCESS, lyd_print_mem(&str1, NODE_1, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
+ assert_int_equal(LY_SUCCESS, lyd_print_mem(&str2, NODE_2, LYD_XML, LYD_PRINT_WITHSIBLINGS | LYD_PRINT_SHRINK)); \
+ assert_non_null(str1); \
+ assert_non_null(str2); \
+ assert_string_equal(str1, str2); \
+ free(str1); \
+ free(str2); \
}
/*
@@ -215,6 +227,7 @@
/**
* @brief check compileted type
+ *
* @param[in] NODE pointer to lysc_type value
* @param[in] TYPE expected type [LY_DATA_TYPE](@ref LY_DATA_TYPE)
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
@@ -225,7 +238,9 @@
CHECK_ARRAY((NODE)->exts, EXTS); \
assert_ptr_equal((NODE)->plugin, lyplg_find(LYPLG_TYPE, "", NULL, ly_data_type2str[TYPE]))
-/* @brief check compileted numeric type
+/**
+ * @brief check compileted numeric type
+ *
* @param[in] NODE pointer to lysc_type_num value
* @param[in] TYPE expected type [LY_DATA_TYPE](@ref LY_DATA_TYPE)
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
@@ -235,7 +250,9 @@
CHECK_LYSC_TYPE(NODE, TYPE, EXTS);\
CHECK_POINTER((NODE)->range, RANGE)
-/* @brief check compiled string type
+/**
+ * @brief check compiled string type
+ *
* @param[in] NODE pointer to lysc_type_num value
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
* @param[in] LENGTH 0 -> node dosnt have length limitation, 1 -> node have length limitation
@@ -247,7 +264,9 @@
CHECK_POINTER((NODE)->length, LENGTH); \
CHECK_ARRAY((NODE)->patterns, PATTERNS)
-/* @brief check compiled bits type
+/**
+ * @brief check compiled bits type
+ *
* @param[in] NODE pointer to lysc_type_num value
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
* @param[in] BITS expected number of bits
@@ -266,7 +285,9 @@
CHECK_STRING((NODE)->name, NAME); \
CHECK_STRING((NODE)->ref, REF) \
-/* @brief check range
+/**
+ * @brief check range
+ *
* @param[in] NODE pointer to lysc_range value
* @param[in] DSC expected descriptin (string)
* @param[in] EAPPTAG expected string reprezenting error-app-tag value
@@ -284,7 +305,9 @@
CHECK_ARRAY((NODE)->parts, PARTS); \
CHECK_STRING((NODE)->ref, REF)
-/* @brief check pattern
+/**
+ * @brief check pattern
+ *
* @param[in] NODE pointer to lysc_pattern value
* @param[in] DSC expected descriptin (string)
* @param[in] EAPPTAG expected string reprezenting error-app-tag value
@@ -307,6 +330,7 @@
/**
* @brief assert that lysp_action_inout structure members are correct
+ *
* @param[in] NODE pointer to lysp_action_inout variable
* @param[in] DATA 0 -> check if pointer to data is NULL, 1 -> check if pointer to data is not null
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of extens list
@@ -328,6 +352,7 @@
/**
* @brief assert that lysp_action structure members are correct
+ *
* @param[in] NODE pointer to lysp_action variable
* @param[in] DSC expected description
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of extension list
@@ -367,6 +392,7 @@
/**
* @brief assert that lysp_when structure members are correct
+ *
* @param[in] NODE pointer to lysp_when variable
* @param[in] COND expected string specifid condition
* @param[in] DSC expected string description statement
@@ -387,6 +413,7 @@
/**
* @brief assert that lysp_restr structure members are correct
+ *
* @param[in] NODE pointer to lysp_restr variable
* @param[in] ARG_STR expected string. The restriction expression/value
* @param[in] DSC expected descrition
@@ -408,6 +435,7 @@
/**
* @brief assert that lysp_import structure members are correct
+ *
* @param[in] NODE pointer to lysp_import variable
* @param[in] DSC expected description or NULL
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of extensions
@@ -428,6 +456,7 @@
/**
* @brief assert that lysp_ext structure members are correct
+ *
* @param[in] NODE pointer to lysp_ext_instance variable
* @param[in] ARGNAME expected argument name
* @param[in] COMPILED 0 -> compiled data dosnt exists, 1 -> compiled data exists
@@ -449,6 +478,7 @@
/**
* @brief assert that lysp_ext_instance structure members are correct
+ *
* @param[in] NODE pointer to lysp_ext_instance variable
* @param[in] ARGUMENT expected optional value of the extension's argument
* @param[in] CHILD 0 -> node doesnt have child, 1 -> node have children
@@ -468,6 +498,7 @@
/**
* @brief assert that lysp_stmt structure members are correct
+ *
* @param[in] NODE pointer to lysp_stmt variable
* @param[in] ARG expected statemet argumet
* @param[in] CHILD 0 -> node doesnt have child, 1 -> node have children
@@ -487,6 +518,7 @@
/**
* @brief assert that lysp_type_enum structure members are correct
+ *
* @param[in] NODE pointer to lysp_type_enum variable
* @param[in] DSC expected description
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -508,6 +540,7 @@
/**
* @brief assert that lysp_type_enum structure members are correct
+ *
* @param[in] NODE pointer to lysp_type variable
* @param[in] BASES expected [sized array](@ref sizedarrays) size of list of indentifiers
* @param[in] BITS expected [sized array](@ref sizedarrays) size of list of bits
@@ -546,6 +579,7 @@
/**
* @brief assert that lysp_node structure members are correct
+ *
* @param[in] NODE pointer to lysp_node variable
* @param[in] DSC expected description statement
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -575,6 +609,7 @@
/**
* @brief assert that lysp_node structure members are correct
+ *
* @param[in] NODE pointer to lysp_node variable
* @param[in] DSC expected description statement
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -598,6 +633,7 @@
/**
* @brief assert that lysc_notif structure members are correct
+ *
* @param[in] NODE pointer to lysp_notif variable
* @param[in] DATA 0 pointer is null, 1 pointer is not null
* @param[in] DSC expected description
@@ -628,6 +664,7 @@
/**
* @brief assert that lysc_action_inout structure members are correct
+ *
* @param[in] NODE pointer to lysp_notif variable
* @param[in] DATA 0 pointer is null, 1 pointer is not null
* @param[in] MUST expected [sized array](@ref sizedarrays) size of list of must restrictions
@@ -641,6 +678,7 @@
/**
* @brief assert that lysc_action structure members are correct
+ *
* @param[in] NODE pointer to lysp_action variable
* @param[in] DSC string description statement
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -679,6 +717,7 @@
/**
* @brief assert that lysc_node structure members are correct
+ *
* @param[in] NODE pointer to lysc_node variable
* @param[in] DSC expected description
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -712,6 +751,7 @@
/**
* @brief assert that lysc_node_leaf structure members are correct
+ *
* @param[in] NODE pointer to lysc_node variable
* @param[in] DSC expected description
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -745,6 +785,7 @@
/**
* @brief assert that lysc_node_leaf structure members are correct
+ *
* @param[in] NODE pointer to lysc_node variable
* @param[in] DSC expected description
* @param[in] EXTS expected [sized array](@ref sizedarrays) size of list of the extension instances
@@ -770,6 +811,7 @@
/**
* @brief assert that lyd_meta structure members are correct
+ *
* @param[in] NODE pointer to lyd_meta variable
* @param[in] ANNOTATION 0 pointer is null, 1 pointer is not null
* @param[in] NAME expected name
@@ -788,6 +830,7 @@
/**
* @brief assert that lyd_node_term structure members are correct
+ *
* @param[in] NODE pointer to lyd_node_term variable
* @param[in] FLAGS expected [data node flags](@ref dnodeflags)
* @param[in] META 0 -> meta is not prezent, 1 -> meta is prezent
@@ -808,6 +851,7 @@
/**
* @brief assert that lyd_node_any structure members are correct
+ *
* @param[in] NODE pointer to lyd_node_term variable
* @param[in] FLAGS expected [data node flags](@ref dnodeflags)
* @param[in] META 0 meta isnt present , 1 meta is present
@@ -825,6 +869,7 @@
/**
* @brief assert that lyd_node_opaq structure members are correct
+ *
* @param[in] NODE pointer to lyd_node_opaq variable
* @param[in] ATTR 0 if pointer is null ,1 if pointer is not null
* @param[in] CHILD 0 if pointer is null ,1 if pointer is not null
@@ -849,6 +894,7 @@
/**
* @brief assert that lyd_node_opaq structure members are correct
+ *
* @param[in] NODE pointer to lyd_node_opaq variable
* @param[in] CHILD 1 if node has children other 0
* @param[in] HILD_HT 1 if node has children hash table other 0
@@ -873,6 +919,7 @@
/**
* @brief assert that lyd_value structure members are correct
+ *
* @param[in] NODE lyd_value
* @param[in] TYPE_VAL value type. EMPTY, UNION, BITS, INST, ENUM, INT8, INT16, UINT8, STRING, LEAFREF, DEC64, BINARY, BOOL, IDENT
* part of text reprezenting LY_DATA_TYPE.
@@ -890,6 +937,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type EMPTY
* Example CHECK_LYD_VALUE(node->value, EMPTY, "");
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
*/
@@ -903,6 +951,7 @@
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type UNION
* Example CHECK_LYD_VALUE(node->value, UNION, "12", INT8, "12", 12);
* @warning type of subvalue cannot be UNION. Example of calling
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] TYPE_VAL value type. EMPTY, UNION, BITS, INST, ENUM, INT8, INT16, UINT8, STRING, LEAFREF, DEC64, BINARY, BOOL, IDENT
@@ -927,6 +976,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type BITS
* Example arr[] = {"a", "b"}; CHECK_LYD_VALUE(node->value, BITS, "a b", arr);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected array of bits names
@@ -949,6 +999,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type INST
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected array of enum ly_path_pred_type
@@ -970,6 +1021,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type ENUM.
* Example CHECK_LYD_VALUE(node->value, ENUM, "item_name", "item_name");
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected enum item name
@@ -984,6 +1036,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type INT8
* Example CHECK_LYD_VALUE(node->value, INT8, "12", 12);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected inteager value (-128 to 127).
@@ -998,6 +1051,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type INT16
* Example CHECK_LYD_VALUE(node->value, INT8, "12", 12);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected inteager value.
@@ -1012,6 +1066,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type UINT8.
* Example CHECK_LYD_VALUE(node->value, UINT8, "12", 12);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected inteager (0 to 255).
@@ -1026,6 +1081,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type UINT32.
* Example CHECK_LYD_VALUE(node->value, UINT32, "12", 12);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected inteager (0 to MAX_UINT32).
@@ -1040,6 +1096,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type STRING.
* Example CHECK_LYD_VALUE(node->value, STRING, "text");
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
*/
@@ -1051,7 +1108,8 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type LEAFREF
- * @brief Example CHECK_LYD_VALUE(node->value, LEAFREF, "");
+ * Example CHECK_LYD_VALUE(node->value, LEAFREF, "");
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
*/
@@ -1065,6 +1123,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type DEC64
* Example CHECK_LYD_VALUE(node->value, DEC64, "125", 125);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected value 64bit inteager
@@ -1079,6 +1138,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type BINARY.
* Example CHECK_LYD_VALUE(node->value, BINARY, "aGVs\nbG8=");
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected value data
@@ -1099,6 +1159,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type BOOL.
* Example CHECK_LYD_VALUE(node->value, BOOL, "true", 1);
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected boolean value 0,1
@@ -1113,6 +1174,7 @@
/**
* @brief Internal macro. Assert that lyd_value structure members are correct. Lyd value is type IDENT.
* Example CHECK_LYD_VALUE(node->value, IDENT, "types:gigabit-ethernet", "gigabit-ethernet");
+ *
* @param[in] NODE lyd_value variable
* @param[in] CANNONICAL_VAL expected cannonical value
* @param[in] VALUE expected ident name
@@ -1126,6 +1188,7 @@
/**
* @brief Macro testing parser when parsing incorrect module;
+ *
* @param[in] DATA String storing the schema module representation.
* @param[in] FORMAT Schema format of the @p DATA
* @param[in] FEATURES Array of module's features to enable
@@ -1143,6 +1206,7 @@
/**
* @brief Add module (from a string) into the used libyang context.
+ *
* @param[in] DATA String storing the schema module representation.
* @param[in] FORMAT Schema format of the @p DATA
* @param[in] FEATURES Array of module's features to enable
@@ -1157,6 +1221,7 @@
/**
* @brief Internal macro to compare error info record with the expected error message and path.
* If NULL is provided as MSG, no error info record (NULL) is expected.
+ *
* @param[in] ERR Error information record from libyang context.
* @param[in] MSG Expected error message.
* @param[in] PATH Expected error path.