libyang REFACTOR major logging updates
Structured error information instead of a
single error message.
diff --git a/tests/utests/extensions/test_metadata.c b/tests/utests/extensions/test_metadata.c
index f1edd29..fcaa9da 100644
--- a/tests/utests/extensions/test_metadata.c
+++ b/tests/utests/extensions/test_metadata.c
@@ -53,7 +53,7 @@
"md:annotation aa;}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Missing mandatory keyword \"type\" as a child of \"md:annotation aa\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ "/aa:{extension='md:annotation'}/aa", 0);
/* not allowed substatement */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -61,31 +61,28 @@
"md:annotation aa {default x;}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Invalid keyword \"default\" as a child of \"md:annotation aa\" extension instance.",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ "/aa:{extension='md:annotation'}/aa", 0);
/* invalid cardinality of units substatement */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
"import ietf-yang-metadata {prefix md;}"
"md:annotation aa {type string; units x; units y;}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Duplicate keyword \"units\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ CHECK_LOG_CTX("Duplicate keyword \"units\".", "/aa:{extension='md:annotation'}/aa", 0);
/* invalid cardinality of status substatement */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
"import ietf-yang-metadata {prefix md;}"
"md:annotation aa {type string; status current; status obsolete;}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Duplicate keyword \"status\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ CHECK_LOG_CTX("Duplicate keyword \"status\".", "/aa:{extension='md:annotation'}/aa", 0);
/* invalid cardinality of status substatement */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
"import ietf-yang-metadata {prefix md;}"
"md:annotation aa {type string; type uint8;}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Duplicate keyword \"type\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ CHECK_LOG_CTX("Duplicate keyword \"type\".", "/aa:{extension='md:annotation'}/aa", 0);
/* duplication of the same annotation */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:metadata:aa; prefix aa;"
@@ -93,7 +90,7 @@
"md:annotation aa {type string;} md:annotation aa {type uint8;}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Extension md:annotation is instantiated multiple times.",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ "/aa:{extension='md:annotation'}/aa", 0);
}
static void
@@ -134,7 +131,7 @@
"</module>";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Missing mandatory keyword \"type\" as a child of \"md:annotation aa\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ "/aa:{extension='md:annotation'}/aa", 0);
/* not allowed substatement */
data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -145,7 +142,7 @@
"</md:annotation></module>";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
CHECK_LOG_CTX("Invalid keyword \"default\" as a child of \"md:annotation aa\" extension instance.",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ "/aa:{extension='md:annotation'}/aa", 0);
/* invalid cardinality of units substatement */
data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -157,8 +154,7 @@
" <units name=\"y\"/>\n"
"</md:annotation></module>";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
- CHECK_LOG_CTX("Duplicate keyword \"units\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ CHECK_LOG_CTX("Duplicate keyword \"units\".", "/aa:{extension='md:annotation'}/aa", 0);
/* invalid cardinality of status substatement */
data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -170,8 +166,7 @@
" <status value=\"obsolete\"/>\n"
"</md:annotation></module>";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
- CHECK_LOG_CTX("Duplicate keyword \"status\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ CHECK_LOG_CTX("Duplicate keyword \"status\".", "/aa:{extension='md:annotation'}/aa", 0);
/* invalid cardinality of status substatement */
data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -182,8 +177,7 @@
" <type name=\"uint8\"/>\n"
"</md:annotation></module>";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
- CHECK_LOG_CTX("Duplicate keyword \"type\".",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ CHECK_LOG_CTX("Duplicate keyword \"type\".", "/aa:{extension='md:annotation'}/aa", 0);
/* duplication of the same annotation */
data = "<module xmlns=\"urn:ietf:params:xml:ns:yang:yin:1\" xmlns:md=\"urn:ietf:params:xml:ns:yang:ietf-yang-metadata\" name=\"aa\">\n"
@@ -196,7 +190,7 @@
"</md:annotation></module>";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YIN, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 metadata v1\": Extension md:annotation is instantiated multiple times.",
- "Path \"/aa:{extension='md:annotation'}/aa\".");
+ "/aa:{extension='md:annotation'}/aa", 0);
}
int
diff --git a/tests/utests/extensions/test_nacm.c b/tests/utests/extensions/test_nacm.c
index 5f7028e..0b1cb8b 100644
--- a/tests/utests/extensions/test_nacm.c
+++ b/tests/utests/extensions/test_nacm.c
@@ -58,7 +58,7 @@
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
"Extension nacm:default-deny-all is allowed only in a data nodes, but it is placed in \"module\" statement.",
- "Path \"/b:{extension='nacm:default-deny-all'}\".");
+ "/b:{extension='nacm:default-deny-all'}", 0);
/* invalid */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:nacm:aa; prefix en;"
@@ -67,7 +67,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
"Extension nacm:default-deny-write is mixed with nacm:default-deny-all.",
- "Path \"/aa:l/{extension='nacm:default-deny-all'}\".");
+ "/aa:l/{extension='nacm:default-deny-all'}", 0);
}
static void
@@ -100,7 +100,7 @@
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
"Extension nacm:default-deny-write is not allowed in notification statement.",
- "Path \"/b:notif/{extension='nacm:default-deny-write'}\".");
+ "/b:notif/{extension='nacm:default-deny-write'}", 0);
/* invalid */
data = "module aa {yang-version 1.1; namespace urn:tests:extensions:nacm:aa; prefix en;"
@@ -109,7 +109,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 NACM v1\": "
"Extension nacm:default-deny-write is instantiated multiple times.",
- "Path \"/aa:l/{extension='nacm:default-deny-write'}\".");
+ "/aa:l/{extension='nacm:default-deny-write'}", 0);
}
int
diff --git a/tests/utests/extensions/test_schema_mount.c b/tests/utests/extensions/test_schema_mount.c
index 17a4c94..f27e168 100644
--- a/tests/utests/extensions/test_schema_mount.c
+++ b/tests/utests/extensions/test_schema_mount.c
@@ -75,7 +75,7 @@
assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Extension \"yangmnt:mount-point\" instance not allowed in YANG version 1 module.",
- "Path \"/sm:root/{extension='yangmnt:mount-point'}/root\".");
+ "/sm:root/{extension='yangmnt:mount-point'}/root", 0);
schema =
"module sm {\n"
@@ -92,7 +92,7 @@
assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Extension \"yangmnt:mount-point\" instance allowed only in container or list statement.",
- "Path \"/sm:{extension='yangmnt:mount-point'}/root\".");
+ "/sm:{extension='yangmnt:mount-point'}/root", 0);
schema =
"module sm {\n"
@@ -114,7 +114,7 @@
assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Extension \"yangmnt:mount-point\" instance allowed only in container or list statement.",
- "Path \"/sm:root/l/{extension='yangmnt:mount-point'}/root\".");
+ "/sm:root/l/{extension='yangmnt:mount-point'}/root", 0);
schema =
"module sm {\n"
@@ -138,7 +138,7 @@
assert_int_equal(LY_EINVAL, lys_parse_mem(UTEST_LYCTX, schema, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Multiple extension \"yangmnt:mount-point\" instances.",
- "Path \"/sm:l/{extension='yangmnt:mount-point'}/root\".");
+ "/sm:l/{extension='yangmnt:mount-point'}/root", 0);
/* valid */
schema =
@@ -196,7 +196,7 @@
"</root>";
CHECK_PARSE_LYD_PARAM(xml, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EINVAL, data);
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": Failed to get extension data, no callback set.",
- NULL);
+ NULL, 0);
json =
"{"
@@ -213,7 +213,7 @@
"}";
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, 0, LYD_VALIDATE_PRESENT, LY_EINVAL, data);
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": Failed to get extension data, no callback set.",
- NULL);
+ NULL, 0);
/* unknown data */
ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb, NULL);
@@ -225,8 +225,7 @@
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.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("No module with namespace \"unknown\" in the context.", "/sm:root", 1);
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, 0, LYD_VALIDATE_PRESENT, LY_SUCCESS, data);
assert_string_equal(LYD_NAME(data), "root");
@@ -236,8 +235,7 @@
lyd_free_siblings(data);
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
- CHECK_LOG_CTX("No module named \"unknown\" in the context.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("No module named \"unknown\" in the context.", "/sm:root", 1);
/* missing required callback data */
xml =
@@ -249,8 +247,7 @@
" </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.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", "/sm:root", 1);
json =
"{"
@@ -265,8 +262,7 @@
" }"
"}";
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
- CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", "/sm:root", 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\" "
@@ -297,11 +293,9 @@
" <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.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", "/sm:root", 1);
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
- CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", "/sm:root", 1);
/* missing module in yang-library data */
ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
@@ -340,11 +334,9 @@
" </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.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", "/sm:root", 1);
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
- CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.",
- "Data location \"/sm:root\", line number 1.");
+ CHECK_LOG_CTX("Node \"interfaces\" not found as a child of \"root\" node.", "/sm:root", 1);
/* callback data correct, invalid YANG data */
ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
@@ -408,27 +400,23 @@
" </mount-point>"
"</schema-mounts>");
CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
- CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
- "Mandatory node \"type\" instance does not exist.",
- "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
+ CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": Mandatory node \"type\" instance does not exist.",
+ "/ietf-interfaces:interfaces/interface[name='bu']", 0);
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
- CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
- "Mandatory node \"type\" instance does not exist.",
- "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
+ CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": Mandatory node \"type\" instance does not exist.",
+ "/ietf-interfaces:interfaces/interface[name='bu']", 0);
/* same validation fail in separate validation */
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));
- CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
- "Mandatory node \"type\" instance does not exist.",
- "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
+ CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": Mandatory node \"type\" instance does not exist.",
+ "/ietf-interfaces:interfaces/interface[name='bu']", 0);
lyd_free_siblings(data);
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT | LYD_PARSE_ONLY, 0, LY_SUCCESS, data);
assert_int_equal(LY_EVALID, lyd_validate_all(&data, NULL, LYD_VALIDATE_PRESENT, NULL));
- CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
- "Mandatory node \"type\" instance does not exist.",
- "Data location \"/ietf-interfaces:interfaces/interface[name='bu']\".");
+ CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": Mandatory node \"type\" instance does not exist.",
+ "/ietf-interfaces:interfaces/interface[name='bu']", 0);
lyd_free_siblings(data);
/* success */
@@ -878,7 +866,7 @@
CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Shared-schema yang-library content-id \"2\" differs from \"1\" used previously.",
- "Path \"/ietf-yang-library:yang-library/content-id\".");
+ "/ietf-yang-library:yang-library/content-id", 0);
/* data for 2 mount points */
ly_ctx_set_ext_data_clb(UTEST_LYCTX, test_ext_data_clb,
@@ -1134,7 +1122,7 @@
CHECK_PARSE_LYD_PARAM(xml, LYD_XML, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Invalid leafref value \"target-value\" - no target instance \"/sm:target\" with the same value.",
- "Data location \"/ietf-interfaces:interfaces/interface[name='bu']/sm:sm-name\".");
+ "/ietf-interfaces:interfaces/interface[name='bu']/sm:sm-name", 0);
json =
"{\n"
@@ -1159,7 +1147,7 @@
CHECK_PARSE_LYD_PARAM(json, LYD_JSON, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, LY_EVALID, data);
CHECK_LOG_CTX("Ext plugin \"ly2 schema mount v1\": "
"Invalid leafref value \"target-value\" - no target instance \"/sm:target\" with the same value.",
- "Data location \"/ietf-interfaces:interfaces/interface[name='bu']/sm:sm-name\".");
+ "/ietf-interfaces:interfaces/interface[name='bu']/sm:sm-name", 0);
/* success */
xml =
diff --git a/tests/utests/extensions/test_structure.c b/tests/utests/extensions/test_structure.c
index 9bad7a7..cc8ed71 100644
--- a/tests/utests/extensions/test_structure.c
+++ b/tests/utests/extensions/test_structure.c
@@ -148,7 +148,7 @@
"sx:structure struct {import yang;}}";
UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
CHECK_LOG_CTX("Invalid keyword \"import\" as a child of \"sx:structure struct\" extension instance.",
- "Path \"/a:{extension='sx:structure'}/struct\".");
+ "/a:{extension='sx:structure'}/struct", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
"import ietf-yang-structure-ext {prefix sx;}"
@@ -156,14 +156,14 @@
UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
CHECK_LOG_CTX("Ext plugin \"ly2 structure v1\": "
"Extension sx:structure must not be used as a non top-level statement in \"container\" statement.",
- "Path \"/a:b/{extension='sx:structure'}/struct\".");
+ "/a:b/{extension='sx:structure'}/struct", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
"import ietf-yang-structure-ext {prefix sx;}"
"sx:structure { container x { leaf x {type string;}}}}";
UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
- CHECK_LOG_CTX("Parsing module \"a\" failed.", NULL);
- CHECK_LOG_CTX("Extension instance \"sx:structure\" missing argument element \"name\".", NULL);
+ CHECK_LOG_CTX("Parsing module \"a\" failed.", NULL, 0);
+ CHECK_LOG_CTX("Extension instance \"sx:structure\" missing argument element \"name\".", NULL, 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
"import ietf-yang-structure-ext {prefix sx;}"
@@ -171,7 +171,7 @@
"sx:structure struct { container y { leaf y {type string;}}}}";
UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
CHECK_LOG_CTX("Ext plugin \"ly2 structure v1\": Extension sx:structure is instantiated multiple times.",
- "Path \"/a:{extension='sx:structure'}/struct\".");
+ "/a:{extension='sx:structure'}/struct", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix self;"
"import ietf-yang-structure-ext {prefix sx;}"
@@ -179,7 +179,7 @@
"choice struct { container y { leaf y {type string;}}}}";
UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_EVALID);
CHECK_LOG_CTX("Ext plugin \"ly2 structure v1\": Extension sx:structure collides with a choice with the same identifier.",
- "Path \"/a:{extension='sx:structure'}/struct\".");
+ "/a:{extension='sx:structure'}/struct", 0);
/* augment-structure */
data = "module a {yang-version 1.1; namespace urn:tests:extensions:structure:a; prefix a;"
@@ -199,7 +199,7 @@
"}}";
UTEST_INVALID_MODULE(data, LYS_IN_YANG, NULL, LY_ENOTFOUND);
CHECK_LOG_CTX("Augment extension target node \"/a:n1\" from module \"b\" was not found.",
- "Path \"/b:{extension='sx:augment-structure'}/{augment='/a:n1'}\".");
+ "/b:{extension='sx:augment-structure'}/{augment='/a:n1'}", 0);
}
static void
diff --git a/tests/utests/extensions/test_yangdata.c b/tests/utests/extensions/test_yangdata.c
index 57caaf2..4de8980 100644
--- a/tests/utests/extensions/test_yangdata.c
+++ b/tests/utests/extensions/test_yangdata.c
@@ -119,7 +119,7 @@
assert_null(mod->compiled->exts);
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
"Extension rc:yang-data is ignored since it appears as a non top-level statement in \"container\" statement.",
- "Path \"/b:b/{extension='rc:yang-data'}/template\".");
+ "/b:b/{extension='rc:yang-data'}/template", 0);
assert_int_equal(LY_SUCCESS, lys_print_mem(&printed, mod, LYS_OUT_YANG_COMPILED, 0));
assert_string_equal(printed, info);
free(printed);
@@ -168,7 +168,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Invalid keyword \"leaf\" as a child of \"rc:yang-data template\" extension instance.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "/a:{extension='rc:yang-data'}/template", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -176,8 +176,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
"Extension rc:yang-data is instantiated with leaf top level data node (inside a choice), "
- "but only a single container data node is allowed.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "but only a single container data node is allowed.", "/a:{extension='rc:yang-data'}/template", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -185,8 +184,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
"Extension rc:yang-data is instantiated with multiple top level data nodes (inside a single choice's case), "
- "but only a single container data node is allowed.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "but only a single container data node is allowed.", "/a:{extension='rc:yang-data'}/template", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -194,8 +192,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
"Extension rc:yang-data is instantiated with multiple top level data nodes, "
- "but only a single container data node is allowed.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "but only a single container data node is allowed.", "/a:{extension='rc:yang-data'}/template", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -203,15 +200,14 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
"Extension rc:yang-data is instantiated without any top level data node, "
- "but exactly one container data node is expected.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "but exactly one container data node is expected.", "/a:{extension='rc:yang-data'}/template", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
"rc:yang-data { container x { leaf x {type string;}}}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Parsing module \"a\" failed.", NULL);
- CHECK_LOG_CTX("Extension instance \"rc:yang-data\" missing argument element \"name\".", NULL);
+ CHECK_LOG_CTX("Parsing module \"a\" failed.", NULL, 0);
+ CHECK_LOG_CTX("Extension instance \"rc:yang-data\" missing argument element \"name\".", NULL, 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -219,8 +215,7 @@
"rc:yang-data template { container y { leaf y {type string;}}}}";
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
- "Extension rc:yang-data is instantiated multiple times.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "Extension rc:yang-data is instantiated multiple times.", "/a:{extension='rc:yang-data'}/template", 0);
data = "module a {yang-version 1.1; namespace urn:tests:extensions:yangdata:a; prefix self;"
"import ietf-restconf {revision-date 2017-01-26; prefix rc;}"
@@ -229,8 +224,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, data, LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Ext plugin \"ly2 yang-data v1\": "
"Extension rc:yang-data is instantiated with leaf-list top level data node, "
- "but only a single container data node is allowed.",
- "Path \"/a:{extension='rc:yang-data'}/template\".");
+ "but only a single container data node is allowed.", "/a:{extension='rc:yang-data'}/template", 0);
}
static void