libyang REFACTOR simplify logging and extend location information
Simplify logger interface by using location information maintained in
the background. logger now prints all the available information: schema
path, data path and line numbers. However, the line number are quite
inaccurate (e.g. points to XML closing parent element) and some future
tuning would be great.
diff --git a/tests/utests/basic/test_xml.c b/tests/utests/basic/test_xml.c
index b6935e2..9c9c62a 100644
--- a/tests/utests/basic/test_xml.c
+++ b/tests/utests/basic/test_xml.c
@@ -377,6 +377,7 @@
/* empty value but in single quotes */
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\'\'", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_SUCCESS, lyxml_ctx_next(xmlctx));
assert_int_equal(LYXML_ATTR_CONTENT, xmlctx->status);
@@ -388,6 +389,7 @@
/* empty element content - only formating before defining child */
assert_int_equal(LY_SUCCESS, ly_in_new_memory(">\n <y>", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ELEMENT;
assert_int_equal(LY_SUCCESS, lyxml_ctx_next(xmlctx));
assert_int_equal(LYXML_ELEM_CONTENT, xmlctx->status);
@@ -399,6 +401,7 @@
/* empty element content is invalid - missing content terminating character < */
assert_int_equal(LY_SUCCESS, ly_in_new_memory("", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ELEM_CONTENT;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Unexpected end-of-input.", "Line number 1.");
@@ -406,6 +409,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory("xxx", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ELEM_CONTENT;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character sequence \"xxx\", expected element tag start ('<').", "Line number 1.");
@@ -430,6 +434,7 @@
/* test using n-bytes UTF8 hexadecimal code points */
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\'$¢€𐍈\'", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_SUCCESS, lyxml_ctx_next(xmlctx));
assert_int_equal(LYXML_ATTR_CONTENT, xmlctx->status);
@@ -442,6 +447,7 @@
/* invalid characters in string */
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\'R\'", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character sequence \"'\", expected ;.", "Line number 1.");
@@ -449,6 +455,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\"R\"", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character sequence \"\"\", expected ;.", "Line number 1.");
@@ -456,6 +463,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\"&nonsense;\"", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Entity reference \"&nonsense;\" not supported, only predefined references allowed.", "Line number 1.");
@@ -463,6 +471,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory(">&#o122;", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ELEMENT;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character reference \"&#o122;\".", "Line number 1.");
@@ -470,6 +479,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\'\'", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character reference \"\'\" (0x00000006).", "Line number 1.");
@@ -477,6 +487,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\'\'", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character reference \"\'\" (0x0000fdd0).", "Line number 1.");
@@ -484,6 +495,7 @@
assert_int_equal(LY_SUCCESS, ly_in_new_memory("=\'\'", &in));
xmlctx->in = in;
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, in);
xmlctx->status = LYXML_ATTRIBUTE;
assert_int_equal(LY_EVALID, lyxml_ctx_next(xmlctx));
CHECK_LOG_CTX("Invalid character reference \"\'\" (0x0000ffff).", "Line number 1.");
diff --git a/tests/utests/data/test_new.c b/tests/utests/data/test_new.c
index 12155a6..55ac4ec 100644
--- a/tests/utests/data/test_new.c
+++ b/tests/utests/data/test_new.c
@@ -80,13 +80,13 @@
lyd_free_tree(node);
assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[]", 0, &node), LY_EVALID);
- CHECK_LOG_CTX("Unexpected XPath token \"]\" (\"]\").", NULL);
+ CHECK_LOG_CTX("Unexpected XPath token \"]\" (\"]\").", "Schema location /a:l1.");
assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[key1='a'][key2='b']", 0, &node), LY_ENOTFOUND);
- CHECK_LOG_CTX("Not found node \"key1\" in path.", NULL);
+ CHECK_LOG_CTX("Not found node \"key1\" in path.", "Schema location /a:l1.");
assert_int_equal(lyd_new_list2(NULL, mod, "l1", "[a='a'][b='b'][c='c']", 0, &node), LY_EVALID);
- CHECK_LOG_CTX("Key expected instead of leaf \"c\" in path.", "/a:l1/c");
+ CHECK_LOG_CTX("Key expected instead of leaf \"c\" in path.", "Schema location /a:l1.");
assert_int_equal(lyd_new_list2(NULL, mod, "c", "[a='a'][b='b']", 0, &node), LY_ENOTFOUND);
CHECK_LOG_CTX("List node \"c\" not found.", NULL);
@@ -105,7 +105,7 @@
/* leaf */
assert_int_equal(lyd_new_term(NULL, mod, "foo", "[a='a'][b='b'][c='c']", 0, &node), LY_EVALID);
- CHECK_LOG_CTX("Invalid uint16 value \"[a='a'][b='b'][c='c']\".", "/a:foo");
+ CHECK_LOG_CTX("Invalid uint16 value \"[a='a'][b='b'][c='c']\".", "Schema location /a:foo.");
assert_int_equal(lyd_new_term(NULL, mod, "c", "value", 0, &node), LY_ENOTFOUND);
CHECK_LOG_CTX("Term node \"c\" not found.", NULL);
@@ -133,7 +133,7 @@
/* key-less list */
assert_int_equal(lyd_new_list2(NULL, mod, "l2", "[a='a'][b='b']", 0, &node), LY_EVALID);
- CHECK_LOG_CTX("List predicate defined for keyless list \"l2\" in path.", NULL);
+ CHECK_LOG_CTX("List predicate defined for keyless list \"l2\" in path.", "Schema location /a:l2.");
assert_int_equal(lyd_new_list2(NULL, mod, "l2", "", 0, &node), LY_SUCCESS);
lyd_free_tree(node);
@@ -215,7 +215,7 @@
/* try LYD_NEWOPT_OPAQ */
ret = lyd_new_path2(NULL, UTEST_LYCTX, "/a:l1", NULL, 0, 0, NULL, NULL);
assert_int_equal(ret, LY_EINVAL);
- CHECK_LOG_CTX("Predicate missing for list \"l1\" in path.", NULL);
+ CHECK_LOG_CTX("Predicate missing for list \"l1\" in path \"/a:l1\".", "Schema location /a:l1.");
ret = lyd_new_path2(NULL, UTEST_LYCTX, "/a:l1", NULL, 0, LYD_NEW_PATH_OPAQ, NULL, &root);
assert_int_equal(ret, LY_SUCCESS);
@@ -226,7 +226,7 @@
ret = lyd_new_path2(NULL, UTEST_LYCTX, "/a:foo", NULL, 0, 0, NULL, NULL);
assert_int_equal(ret, LY_EVALID);
- CHECK_LOG_CTX("Invalid empty uint16 value.", "/a:foo");
+ CHECK_LOG_CTX("Invalid empty uint16 value.", "Schema location /a:foo.");
ret = lyd_new_path2(NULL, UTEST_LYCTX, "/a:foo", NULL, 0, LYD_NEW_PATH_OPAQ, NULL, &root);
assert_int_equal(ret, LY_SUCCESS);
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index 921c494..aa11927 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -131,15 +131,15 @@
lyd_free_all(tree);
PARSER_CHECK_ERROR(data, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Unknown (or not implemented) YANG module \"x\" for metadata \"x:xxx\".", "/a:foo");
+ "Unknown (or not implemented) YANG module \"x\" for metadata \"x:xxx\".", "Data location /@a:foo, line number 1.");
/* missing referenced metadata node */
PARSER_CHECK_ERROR("{\"@a:foo\" : { \"a:hint\" : 1 }}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Missing JSON data instance to be coupled with @a:foo metadata.", "/");
+ "Missing JSON data instance to be coupled with @a:foo metadata.", "Data location /@a:foo, line number 1.");
/* missing namespace for meatadata*/
PARSER_CHECK_ERROR("{\"a:foo\" : \"value\", \"@a:foo\" : { \"hint\" : 1 }}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Metadata in JSON must be namespace-qualified, missing prefix for \"hint\".", "/a:foo");
+ "Metadata in JSON must be namespace-qualified, missing prefix for \"hint\".", "Schema location /a:foo, line number 1.");
}
static void
@@ -223,13 +223,13 @@
/* missing referenced metadata node */
PARSER_CHECK_ERROR("{\"@a:ll1\":[{\"a:hint\":1}]}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Missing JSON data instance to be coupled with @a:ll1 metadata.", "/");
+ "Missing JSON data instance to be coupled with @a:ll1 metadata.", "Data location /@a:ll1, line number 1.");
PARSER_CHECK_ERROR("{\"a:ll1\":[1],\"@a:ll1\":[{\"a:hint\":1},{\"a:hint\":2}]}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Missing JSON data instance no. 2 of a:ll1 to be coupled with metadata.", "/");
+ "Missing JSON data instance no. 2 of a:ll1 to be coupled with metadata.", "Schema location /a:ll1, line number 1.");
PARSER_CHECK_ERROR("{\"@a:ll1\":[{\"a:hint\":1},{\"a:hint\":2},{\"a:hint\":3}],\"a:ll1\" : [1, 2]}", 0, LYD_VALIDATE_PRESENT,
- tree, LY_EVALID, "Missing 3rd JSON data instance to be coupled with @a:ll1 metadata.", "/");
+ tree, LY_EVALID, "Missing 3rd JSON data instance to be coupled with @a:ll1 metadata.", "Data location /@a:ll1, line number 1.");
}
static void
@@ -271,17 +271,17 @@
/* missing keys */
PARSER_CHECK_ERROR("{ \"a:l1\": [ {\"c\" : 1, \"b\" : \"b\"}]}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"a\".", "/a:l1[b='b'][c='1']");
+ "List instance is missing its key \"a\".", "Schema location /a:l1, data location /a:l1[b='b'][c='1'], line number 1.");
PARSER_CHECK_ERROR("{ \"a:l1\": [ {\"a\" : \"a\"}]}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"b\".", "/a:l1[a='a']");
+ "List instance is missing its key \"b\".", "Schema location /a:l1, data location /a:l1[a='a'], line number 1.");
PARSER_CHECK_ERROR("{ \"a:l1\": [ {\"b\" : \"b\", \"a\" : \"a\"}]}", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"c\".", "/a:l1[a='a'][b='b']");
+ "List instance is missing its key \"c\".", "Schema location /a:l1, data location /a:l1[a='a'][b='b'], line number 1.");
/* key duplicate */
PARSER_CHECK_ERROR("{ \"a:l1\": [ {\"c\" : 1, \"b\" : \"b\", \"a\" : \"a\", \"c\" : 1}]}", 0, LYD_VALIDATE_PRESENT,
- tree, LY_EVALID, "Duplicate instance of \"c\".", "/a:l1[a='a'][b='b'][c='1'][c='1']/c");
+ tree, LY_EVALID, "Duplicate instance of \"c\".", "Schema location /a:l1/c, data location /a:l1[a='a'][b='b'][c='1'][c='1']/c, line number 1.");
/* keys order, in contrast to XML, JSON accepts keys in any order even in strict mode */
CHECK_PARSE_LYD("{ \"a:l1\": [ {\"d\" : \"d\", \"a\" : \"a\", \"c\" : 1, \"b\" : \"b\"}]}", 0, LYD_VALIDATE_PRESENT, tree);
@@ -373,7 +373,7 @@
/* invalid value, no flags */
data = "{\"a:foo3\":[null]}";
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Invalid non-number-encoded uint32 value \"\".", "/a:foo3");
+ "Invalid non-number-encoded uint32 value \"\".", "Schema location /a:foo3, line number 1.");
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
@@ -384,7 +384,7 @@
/* missing key, no flags */
data = "{\"a:l1\":[{\"a\":\"val_a\",\"b\":\"val_b\",\"d\":\"val_d\"}]}";
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"c\".", "/a:l1[a='val_a'][b='val_b']");
+ "List instance is missing its key \"c\".", "Schema location /a:l1, data location /a:l1[a='val_a'][b='val_b'], line number 1.");
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
@@ -395,7 +395,7 @@
/* invalid key, no flags */
data = "{\"a:l1\":[{\"a\":\"val_a\",\"b\":\"val_b\",\"c\":\"val_c\"}]}";
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Invalid non-number-encoded int16 value \"val_c\".", "/a:l1/c");
+ "Invalid non-number-encoded int16 value \"val_c\".", "Schema location /a:l1/c, data location /a:l1[a='val_a'][b='val_b'], line number 1.");
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, LYD_VALIDATE_PRESENT, tree);
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index ca43007..a74bc7a 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -167,17 +167,17 @@
/* missing keys */
PARSER_CHECK_ERROR("<l1 xmlns=\"urn:tests:a\"><c>1</c><b>b</b></l1>", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"a\".", "/a:l1[b='b'][c='1']");
+ "List instance is missing its key \"a\".", "Schema location /a:l1, data location /a:l1[b='b'][c='1'], line number 1.");
PARSER_CHECK_ERROR("<l1 xmlns=\"urn:tests:a\"><a>a</a></l1>", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"b\".", "/a:l1[a='a']");
+ "List instance is missing its key \"b\".", "Schema location /a:l1, data location /a:l1[a='a'], line number 1.");
PARSER_CHECK_ERROR("<l1 xmlns=\"urn:tests:a\"><b>b</b><a>a</a></l1>", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"c\".", "/a:l1[a='a'][b='b']");
+ "List instance is missing its key \"c\".", "Schema location /a:l1, data location /a:l1[a='a'][b='b'], line number 1.");
/* key duplicate */
PARSER_CHECK_ERROR("<l1 xmlns=\"urn:tests:a\"><c>1</c><b>b</b><a>a</a><c>1</c></l1>", 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Duplicate instance of \"c\".", "/a:l1[a='a'][b='b'][c='1'][c='1']/c");
+ "Duplicate instance of \"c\".", "Schema location /a:l1/c, data location /a:l1[a='a'][b='b'][c='1'][c='1']/c, line number 1.");
/* keys order */
CHECK_PARSE_LYD("<l1 xmlns=\"urn:tests:a\"><d>d</d><a>a</a><c>1</c><b>b</b></l1>", 0, LYD_VALIDATE_PRESENT, tree);
@@ -209,7 +209,7 @@
lyd_free_all(tree);
PARSER_CHECK_ERROR(data, LYD_PARSE_STRICT, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Invalid position of the key \"b\" in a list.", "Line number 1.");
+ "Invalid position of the key \"b\" in a list.", "Schema location /a:l1/b, data location /a:b, line number 1.");
}
static void
@@ -243,7 +243,7 @@
/* invalid value, no flags */
data = "<foo3 xmlns=\"urn:tests:a\"/>";
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Invalid empty uint32 value.", "/a:foo3");
+ "Invalid empty uint32 value.", "Schema location /a:foo3, line number 1.");
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
@@ -258,7 +258,7 @@
" <d>val_d</d>\n"
"</l1>\n";
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "List instance is missing its key \"c\".", "/a:l1[a='val_a'][b='val_b']");
+ "List instance is missing its key \"c\".", "Schema location /a:l1, data location /a:l1[a='val_a'][b='val_b'], line number 5.");
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
@@ -273,7 +273,7 @@
" <c>val_c</c>\n"
"</l1>\n";
PARSER_CHECK_ERROR(data, 0, LYD_VALIDATE_PRESENT, tree, LY_EVALID,
- "Invalid int16 value \"val_c\".", "/a:l1/c");
+ "Invalid int16 value \"val_c\".", "Schema location /a:l1/c, data location /a:l1[a='val_a'][b='val_b'], line number 4.");
/* opaq flag */
CHECK_PARSE_LYD(data, LYD_PARSE_OPAQ | LYD_PARSE_ONLY, 0, tree);
diff --git a/tests/utests/data/test_types.c b/tests/utests/data/test_types.c
index b1826b3..80f6c86 100644
--- a/tests/utests/data/test_types.c
+++ b/tests/utests/data/test_types.c
@@ -117,11 +117,11 @@
value.realtype->plugin->free(UTEST_LYCTX, &value); \
}
-#define TEST_TYPE_ERROR(TYPE, VALUE, ERROR_MSG) \
+#define TEST_TYPE_ERROR(TYPE, VALUE, ERROR_MSG, LINE) \
{ \
const char *data = "<" TYPE " xmlns=\"urn:tests:types\">" VALUE "</" TYPE">"; \
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree); \
- CHECK_LOG_CTX(ERROR_MSG, "/types:"TYPE); \
+ CHECK_LOG_CTX(ERROR_MSG, "Schema location /types:"TYPE", line number "LINE"."); \
}
#define TEST_PRINTED_VALUE(VALUE, EXPECTED, FORMAT, PREFIX_DATA) \
@@ -152,19 +152,19 @@
/* invalid range */
error_msg = "Value \"1\" does not satisfy the range constraint.";
- TEST_TYPE_ERROR("int8", "1", error_msg);
+ TEST_TYPE_ERROR("int8", "1", error_msg, "1");
error_msg = "Value \"100\" does not satisfy the range constraint.";
- TEST_TYPE_ERROR("int16", "100", error_msg);
+ TEST_TYPE_ERROR("int16", "100", error_msg, "1");
/* invalid value */
error_msg = "Invalid int32 value \"0x01\".";
- TEST_TYPE_ERROR("int32", "0x01", error_msg);
+ TEST_TYPE_ERROR("int32", "0x01", error_msg, "1");
error_msg = "Invalid empty int64 value.";
- TEST_TYPE_ERROR("int64", "", error_msg);
+ TEST_TYPE_ERROR("int64", "", error_msg, "1");
error_msg = "Invalid empty int64 value.";
- TEST_TYPE_ERROR("int64", " ", error_msg);
+ TEST_TYPE_ERROR("int64", " ", error_msg, "1");
error_msg = "Invalid int64 value \"-10 xxx\".";
- TEST_TYPE_ERROR("int64", "-10 xxx", error_msg);
+ TEST_TYPE_ERROR("int64", "-10 xxx", error_msg, "1");
}
static void
@@ -181,17 +181,17 @@
/* invalid range */
TEST_TYPE_ERROR("uint8", "\n 15 \t\n ",
- "Value \"15\" does not satisfy the range constraint.");
+ "Value \"15\" does not satisfy the range constraint.", "3");
TEST_TYPE_ERROR("uint16", "\n 1500 \t\n ",
- "Value \"1500\" does not satisfy the range constraint.");
+ "Value \"1500\" does not satisfy the range constraint.", "3");
/* invalid value */
TEST_TYPE_ERROR("uint32", "-10",
- "Value \"-10\" is out of uint32's min/max bounds.");
+ "Value \"-10\" is out of uint32's min/max bounds.", "1");
CHECK_PARSE_LYD_PARAM("<uint64 xmlns=\"urn:tests:types\"/>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid empty uint64 value.", "/types:uint64");
- TEST_TYPE_ERROR("uint64", " ", "Invalid empty uint64 value.");
- TEST_TYPE_ERROR("uint64", "10 xxx", "Invalid uint64 value \"10 xxx\".");
+ CHECK_LOG_CTX("Invalid empty uint64 value.", "Schema location /types:uint64, line number 1.");
+ TEST_TYPE_ERROR("uint64", " ", "Invalid empty uint64 value.", "1");
+ TEST_TYPE_ERROR("uint64", "10 xxx", "Invalid uint64 value \"10 xxx\".", "1");
}
static void
@@ -225,16 +225,16 @@
lyd_free_all(tree);
/* invalid range */
- TEST_TYPE_ERROR("dec64", "\n 15 \t\n ", "Value \"15.0\" does not satisfy the range constraint.");
- TEST_TYPE_ERROR("dec64", "\n 0 \t\n ", "Value \"0.0\" does not satisfy the range constraint.");
+ TEST_TYPE_ERROR("dec64", "\n 15 \t\n ", "Value \"15.0\" does not satisfy the range constraint.", "3");
+ TEST_TYPE_ERROR("dec64", "\n 0 \t\n ", "Value \"0.0\" does not satisfy the range constraint.", "3");
/* invalid value */
- TEST_TYPE_ERROR("dec64", "xxx", "Invalid 1. character of decimal64 value \"xxx\".");
+ TEST_TYPE_ERROR("dec64", "xxx", "Invalid 1. character of decimal64 value \"xxx\".", "1");
CHECK_PARSE_LYD_PARAM("<dec64 xmlns=\"urn:tests:types\"/>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid empty decimal64 value.", "/types:dec64");
- TEST_TYPE_ERROR("dec64", " ", "Invalid empty decimal64 value.");
- TEST_TYPE_ERROR("dec64", "8.5 xxx", "Invalid 6. character of decimal64 value \"8.5 xxx\".");
- TEST_TYPE_ERROR("dec64", "8.55 xxx", "Value \"8.55\" of decimal64 type exceeds defined number (1) of fraction digits.");
+ CHECK_LOG_CTX("Invalid empty decimal64 value.", "Schema location /types:dec64, line number 1.");
+ TEST_TYPE_ERROR("dec64", " ", "Invalid empty decimal64 value.", "1");
+ TEST_TYPE_ERROR("dec64", "8.5 xxx", "Invalid 6. character of decimal64 value \"8.5 xxx\".", "1");
+ TEST_TYPE_ERROR("dec64", "8.55 xxx", "Value \"8.55\" of decimal64 type exceeds defined number (1) of fraction digits.", "1");
}
static void
@@ -258,20 +258,20 @@
/*error */
TEST_TYPE_ERROR("str-utf8", "€",
- "Length \"1\" does not satisfy the length constraint.");
+ "Length \"1\" does not satisfy the length constraint.", "1");
TEST_TYPE_ERROR("str-utf8", "€€€€€€",
- "Length \"6\" does not satisfy the length constraint.");
+ "Length \"6\" does not satisfy the length constraint.", "1");
TEST_TYPE_ERROR("str-utf8", "€€x",
- "String \"€€x\" does not conform to the pattern \"€*\".");
+ "String \"€€x\" does not conform to the pattern \"€*\".", "1");
/* invalid length */
TEST_TYPE_ERROR("str", "short",
- "Length \"5\" does not satisfy the length constraint.");
+ "Length \"5\" does not satisfy the length constraint.", "1");
TEST_TYPE_ERROR("str", "tooooo long",
- "Length \"11\" does not satisfy the length constraint.");
+ "Length \"11\" does not satisfy the length constraint.", "1");
/* invalid pattern */
- TEST_TYPE_ERROR("str", "string15", "String \"string15\" does not conform to the pattern \"[a-z ]*\".");
+ TEST_TYPE_ERROR("str", "string15", "String \"string15\" does not conform to the pattern \"[a-z ]*\".", "1");
}
static void
@@ -295,16 +295,16 @@
lyd_free_all(tree);
/* disabled feature */
- TEST_TYPE_ERROR("bits", " \t one \n\t ", "Invalid bit value \"one\".");
+ TEST_TYPE_ERROR("bits", " \t one \n\t ", "Invalid bit value \"one\".", "2");
/* disabled feature */
- TEST_TYPE_ERROR("bits", "\t one \n\t", "Invalid bit value \"one\".");
+ TEST_TYPE_ERROR("bits", "\t one \n\t", "Invalid bit value \"one\".", "2");
/* multiple instances of the bit */
- TEST_TYPE_ERROR("bits", "one zero one", "Invalid bit value \"one\".");
+ TEST_TYPE_ERROR("bits", "one zero one", "Invalid bit value \"one\".", "1");
/* invalid bit value */
- TEST_TYPE_ERROR("bits", "one xero one", "Invalid bit value \"one\".");
+ TEST_TYPE_ERROR("bits", "one xero one", "Invalid bit value \"one\".", "1");
}
static void
@@ -320,14 +320,14 @@
lyd_free_all(tree);
/* disabled feature */
- TEST_TYPE_ERROR("enums", "yellow", "Invalid enumeration value \"yellow\".");
+ TEST_TYPE_ERROR("enums", "yellow", "Invalid enumeration value \"yellow\".", "1");
/* leading/trailing whitespaces are not valid */
- TEST_TYPE_ERROR("enums", " white", "Invalid enumeration value \" white\".");
- TEST_TYPE_ERROR("enums", "white\n", "Invalid enumeration value \"white\n\".");
+ TEST_TYPE_ERROR("enums", " white", "Invalid enumeration value \" white\".", "1");
+ TEST_TYPE_ERROR("enums", "white\n", "Invalid enumeration value \"white\n\".", "2");
/* invalid enumeration value */
- TEST_TYPE_ERROR("enums", "black", "Invalid enumeration value \"black\".");
+ TEST_TYPE_ERROR("enums", "black", "Invalid enumeration value \"black\".", "1");
}
static void
@@ -368,19 +368,19 @@
lyd_free_all(tree);
/* invalid base64 character */
- TEST_TYPE_ERROR("binary-norestr", "a@bcd=", "Invalid Base64 character (@).");
+ TEST_TYPE_ERROR("binary-norestr", "a@bcd=", "Invalid Base64 character (@).", "1");
/* missing data */
- TEST_TYPE_ERROR("binary-norestr", "aGVsbG8", "Base64 encoded value length must be divisible by 4.");
+ TEST_TYPE_ERROR("binary-norestr", "aGVsbG8", "Base64 encoded value length must be divisible by 4.", "1");
- TEST_TYPE_ERROR("binary-norestr", "VsbG8=", "Base64 encoded value length must be divisible by 4.");
+ TEST_TYPE_ERROR("binary-norestr", "VsbG8=", "Base64 encoded value length must be divisible by 4.", "1");
/* invalid binary length */
/* helloworld */
- TEST_TYPE_ERROR("binary", "aGVsbG93b3JsZA==", "This base64 value must be of length 5.");
+ TEST_TYPE_ERROR("binary", "aGVsbG93b3JsZA==", "This base64 value must be of length 5.", "1");
/* M */
- TEST_TYPE_ERROR("binary", "TQ==", "This base64 value must be of length 5.");
+ TEST_TYPE_ERROR("binary", "TQ==", "This base64 value must be of length 5.", "1");
}
static void
@@ -408,9 +408,9 @@
lyd_free_all(tree);
/* invalid value */
- TEST_TYPE_ERROR("bool", "unsure", "Invalid boolean value \"unsure\".");
+ TEST_TYPE_ERROR("bool", "unsure", "Invalid boolean value \"unsure\".", "1");
- TEST_TYPE_ERROR("bool", " true", "Invalid boolean value \" true\".");
+ TEST_TYPE_ERROR("bool", " true", "Invalid boolean value \" true\".", "1");
}
static void
@@ -438,9 +438,9 @@
lyd_free_all(tree);
/* invalid value */
- TEST_TYPE_ERROR("empty", "x", "Invalid empty value \"x\".");
+ TEST_TYPE_ERROR("empty", "x", "Invalid empty value \"x\".", "1");
- TEST_TYPE_ERROR("empty", " ", "Invalid empty value \" \".");
+ TEST_TYPE_ERROR("empty", " ", "Invalid empty value \" \".", "1");
}
static void
@@ -473,22 +473,22 @@
/* invalid value */
TEST_TYPE_ERROR("ident", "fast-ethernet",
- "Invalid identityref \"fast-ethernet\" value - identity not found in module \"types\".");
+ "Invalid identityref \"fast-ethernet\" value - identity not found in module \"types\".", "1");
CHECK_PARSE_LYD_PARAM("<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:slow-ethernet</ident>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid identityref \"x:slow-ethernet\" value - identity not found in module \"defs\".",
- "/types:ident");
+ "Schema location /types:ident, line number 1.");
CHECK_PARSE_LYD_PARAM("<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:defs\">x:crypto-alg</ident>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid identityref \"x:crypto-alg\" value - identity not derived from the base \"defs:interface-type\".",
- "/types:ident");
+ "Schema location /types:ident, line number 1.");
CHECK_PARSE_LYD_PARAM("<ident xmlns=\"urn:tests:types\" xmlns:x=\"urn:tests:unknown\">x:fast-ethernet</ident>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid identityref \"x:fast-ethernet\" value - unable to map prefix to YANG schema.",
- "/types:ident");
+ "Schema location /types:ident, line number 1.");
}
/* dummy get_prefix callback for test_instanceid() */
@@ -659,131 +659,131 @@
"<list xmlns=\"urn:tests:types\"><id>b</id><value>x</value></list>"
"<xdf:inst xmlns:xdf=\"urn:tests:types\">/xdf:list[2]/xdf:value</xdf:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/xdf:list[2]/xdf:value\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/xdf:list[2]/xdf:value\" value - semantic error.", "Schema location /types:inst.");
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:1leaftarget</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:1leaftarget\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:1leaftarget\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont:t:1leaftarget</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont:t:1leaftarget\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont:t:1leaftarget\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:invalid/t:path</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:invalid/t:path\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:invalid/t:path\" value - semantic error.", "Schema location /types:inst.");
data = "<inst xmlns=\"urn:tests:types\" xmlns:t=\"urn:tests:invalid\">/t:cont/t:leaftarget</inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaftarget\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaftarget\" value - semantic error.", "Schema location /types:inst.");
- TEST_TYPE_ERROR("inst", "/cont/leaftarget", "Invalid instance-identifier \"/cont/leaftarget\" value - syntax error.");
+ TEST_TYPE_ERROR("inst", "/cont/leaftarget", "Invalid instance-identifier \"/cont/leaftarget\" value - syntax error.", "1");
/* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
data = "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_ENOTFOUND, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found.", "Schema location /types:inst, data location /types:inst.");
/* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
data = "<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaftarget</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_ENOTFOUND, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/leaftarget\" value - required instance not found.", "Schema location /types:inst, data location /types:inst.");
data = "<leaflisttarget xmlns=\"urn:tests:types\">x</leaflisttarget>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:leaflisttarget[1</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:leaflisttarget[1\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:leaflisttarget[1\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">/t:cont[1]</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont[1]\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont[1]\" value - semantic error.", "Schema location /types:inst.");
data = "<cont xmlns=\"urn:tests:types\"/><t:inst xmlns:t=\"urn:tests:types\">[1]</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"[1]\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"[1]\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[id='1']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[id='1']\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[id='1']\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[t:id='1']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[t:id='1']\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[t:id='1']\" value - semantic error.", "Schema location /types:inst.");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget><leaflisttarget>2</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[4]</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[4]\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[4]\" value - semantic error.", "Schema location /types:inst.");
data = "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[6]</t:inst-noreq>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[6]\" value - semantic error.", "/types:inst-noreq");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[6]\" value - semantic error.", "Schema location /types:inst-noreq.");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:value='x']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - semantic error.", "Schema location /types:inst.");
data = "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:value='x']</t:inst-noreq>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - semantic error.", "/types:inst-noreq");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:value='x']\" value - semantic error.", "Schema location /types:inst-noreq.");
data = "<t:inst-noreq xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:x='x']</t:inst-noreq>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_ENOTFOUND, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:x='x']\" value - semantic error.", "/types:inst-noreq");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:x='x']\" value - semantic error.", "Schema location /types:inst-noreq.");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[.='x']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[.='x']\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[.='x']\" value - semantic error.", "Schema location /types:inst.");
/* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='2']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_ENOTFOUND, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/leaflisttarget[.='2']\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/leaflisttarget[.='2']\" value - required instance not found.", "Schema location /types:inst, data location /types:inst.");
data = "<cont xmlns=\"urn:tests:types\"><leaflisttarget>1</leaflisttarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:leaflisttarget[.='x']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[.='x']\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:leaflisttarget[.='x']\" value - semantic error.", "Schema location /types:inst.");
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='x']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:id='x']\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/t:cont/t:listtarget[t:id='x']\" value - semantic error.", "Schema location /types:inst.");
/* instance-identifier is here in JSON format because it is already in internal representation without canonical prefixes */
data = "<cont xmlns=\"urn:tests:types\"><listtarget><id>1</id><value>x</value></listtarget></cont>"
"<t:inst xmlns:t=\"urn:tests:types\">/t:cont/t:listtarget[t:id='2']</t:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_ENOTFOUND, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/listtarget[id='2']\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:cont/listtarget[id='2']\" value - required instance not found.", "Schema location /types:inst, data location /types:inst.");
data = "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
"<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:leaflisttarget[1][2]</a:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/a:leaflisttarget[1][2]\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/a:leaflisttarget[1][2]\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<leaflisttarget xmlns=\"urn:tests:types\">a</leaflisttarget>"
"<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:leaflisttarget[.='a'][.='b']</a:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/a:leaflisttarget[.='a'][.='b']\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/a:leaflisttarget[.='a'][.='b']\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<list xmlns=\"urn:tests:types\"><id>a</id><value>x</value></list>"
"<list xmlns=\"urn:tests:types\"><id>b</id><value>y</value></list>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list[a:id='a'][a:id='b']/a:value</a:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/a:list[a:id='a'][a:id='b']/a:value\" value - syntax error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/a:list[a:id='a'][a:id='b']/a:value\" value - syntax error.", "Schema location /types:inst, line number 1.");
data = "<list2 xmlns=\"urn:tests:types\"><id>a</id><value>x</value></list2>"
"<list2 xmlns=\"urn:tests:types\"><id>b</id><value>y</value></list2>"
"<a:inst xmlns:a=\"urn:tests:types\">/a:list2[a:id='a']/a:value</a:inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/a:list2[a:id='a']/a:value\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/a:list2[a:id='a']/a:value\" value - semantic error.", "Schema location /types:inst.");
/* check for validting instance-identifier with a complete data tree */
data = "<list2 xmlns=\"urn:tests:types\"><id>a</id><value>a</value></list2>"
@@ -796,24 +796,24 @@
data = "/types:list2[id='a'][value='b']/id";
assert_int_equal(LY_ENOTFOUND, lyd_value_validate(UTEST_LYCTX, (const struct lyd_node_term *)tree->prev, data, strlen(data),
tree, NULL));
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:list2[id='a'][value='b']/id\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:list2[id='a'][value='b']/id\" value - required instance not found.", "Data location /types:inst.");
/* leaf-list-predicate */
data = "/types:leaflisttarget[.='c']";
assert_int_equal(LY_ENOTFOUND, lyd_value_validate(UTEST_LYCTX, (const struct lyd_node_term *)tree->prev, data, strlen(data),
tree, NULL));
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:leaflisttarget[.='c']\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:leaflisttarget[.='c']\" value - required instance not found.", "Data location /types:inst.");
/* position predicate */
data = "/types:list_keyless[4]";
assert_int_equal(LY_ENOTFOUND, lyd_value_validate(UTEST_LYCTX, (const struct lyd_node_term *)tree->prev, data, strlen(data),
tree, NULL));
- CHECK_LOG_CTX("Invalid instance-identifier \"/types:list_keyless[4]\" value - required instance not found.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/types:list_keyless[4]\" value - required instance not found.", "Data location /types:inst.");
lyd_free_all(tree);
data = "<leaflisttarget xmlns=\"urn:tests:types\">b</leaflisttarget>"
"<inst xmlns=\"urn:tests:types\">/a:leaflisttarget[1]</inst>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid instance-identifier \"/a:leaflisttarget[1]\" value - semantic error.", "/types:inst");
+ CHECK_LOG_CTX("Invalid instance-identifier \"/a:leaflisttarget[1]\" value - semantic error.", "Schema location /types:inst.");
}
static void
@@ -892,7 +892,7 @@
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid leafref value \"y\" - "
"no target instance \"/leaflisttarget\" with the same value.",
- "/types:lref");
+ "Schema location /types:lref, data location /types:lref.");
data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
"<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
@@ -900,7 +900,7 @@
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid leafref value \"b\" - "
"no target instance \"../list[id = current()/../str-norestr]/targets\" with the same value.",
- "/types:lref2");
+ "Schema location /types:lref2, data location /types:lref2.");
data = "<list xmlns=\"urn:tests:types\"><id>x</id><targets>a</targets><targets>b</targets></list>"
"<list xmlns=\"urn:tests:types\"><id>y</id><targets>x</targets><targets>y</targets></list>"
@@ -908,19 +908,19 @@
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid leafref value \"b\" - "
"no existing target instance \"../list[id = current()/../str-norestr]/targets\".",
- "/types:lref2");
+ "Schema location /types:lref2, data location /types:lref2.");
data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr><lref2 xmlns=\"urn:tests:types\">b</lref2>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid leafref value \"b\" - "
"no existing target instance \"../list[id = current()/../str-norestr]/targets\".",
- "/types:lref2");
+ "Schema location /types:lref2, data location /types:lref2.");
data = "<str-norestr xmlns=\"urn:tests:types\">y</str-norestr>"
"<c xmlns=\"urn:tests:leafrefs\"><l><id>x</id><value>x</value><lr1>a</lr1></l></c>";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid leafref value \"a\" - no target instance \"../../../t:str-norestr\" with the same value.",
- "/leafrefs:c/l[id='x'][value='x']/lr1");
+ "Schema location /leafrefs:c/l/lr1, data location /leafrefs:c/l[id='x'][value='x']/lr1.");
data = "<str-norestr xmlns=\"urn:tests:types\">z</str-norestr>"
"<c xmlns=\"urn:tests:leafrefs\"><l><id>y</id><value>y</value></l>"
@@ -928,7 +928,7 @@
CHECK_PARSE_LYD_PARAM(data, LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Invalid leafref value \"z\" - no existing target instance \"../../l[id=current()/../../../t:str-norestr]"
"[value=current()/../../../t:str-norestr]/value\".",
- "/leafrefs:c/l[id='x'][value='x']/lr2");
+ "Schema location /leafrefs:c/l/lr2, data location /leafrefs:c/l[id='x'][value='x']/lr2.");
}
static void
@@ -1012,7 +1012,7 @@
lyd_free_all(tree);
TEST_TYPE_ERROR("un1", "123456789012345678901",
- "Invalid union value \"123456789012345678901\" - no matching subtype found.");
+ "Invalid union value \"123456789012345678901\" - no matching subtype found.", "1");
}
int
diff --git a/tests/utests/data/test_validation.c b/tests/utests/data/test_validation.c
index 37a69ea..df6404c 100644
--- a/tests/utests/data/test_validation.c
+++ b/tests/utests/data/test_validation.c
@@ -57,7 +57,7 @@
UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
CHECK_PARSE_LYD_PARAM("<c xmlns=\"urn:tests:a\">hey</c>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("When condition \"/cont/b = 'val_b'\" not satisfied.", "/a:c");
+ CHECK_LOG_CTX("When condition \"/cont/b = 'val_b'\" not satisfied.", "Schema location /a:c, data location /a:c.");
LYD_TREE_CREATE("<cont xmlns=\"urn:tests:a\"><b>val_b</b></cont><c xmlns=\"urn:tests:a\">hey</c>", tree);
CHECK_LYSC_NODE(tree->next->schema, NULL, 0, LYS_CONFIG_W | LYS_STATUS_CURR, 1, "c", 0, LYS_LEAF, 0, 0, NULL, 1);
@@ -105,13 +105,13 @@
UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
CHECK_PARSE_LYD_PARAM("<d xmlns=\"urn:tests:b\"/>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Mandatory node \"choic\" instance does not exist.", "/b:choic");
+ CHECK_LOG_CTX("Mandatory node \"choic\" instance does not exist.", "Schema location /b:choic.");
CHECK_PARSE_LYD_PARAM("<l xmlns=\"urn:tests:b\">string</l><d xmlns=\"urn:tests:b\"/>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Mandatory node \"c\" instance does not exist.", "/b:c");
+ CHECK_LOG_CTX("Mandatory node \"c\" instance does not exist.", "Schema location /b:c.");
CHECK_PARSE_LYD_PARAM("<a xmlns=\"urn:tests:b\">string</a>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Mandatory node \"c\" instance does not exist.", "/b:c");
+ CHECK_LOG_CTX("Mandatory node \"c\" instance does not exist.", "Schema location /b:c.");
LYD_TREE_CREATE("<a xmlns=\"urn:tests:b\">string</a><c xmlns=\"urn:tests:b\">string2</c>", tree);
lyd_free_siblings(tree);
@@ -153,12 +153,12 @@
UTEST_ADD_MODULE(schema, LYS_IN_YANG, NULL, NULL);
CHECK_PARSE_LYD_PARAM("<d xmlns=\"urn:tests:c\"/>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Too few \"l\" instances.", "/c:choic/b/l");
+ CHECK_LOG_CTX("Too few \"l\" instances.", "Schema location /c:choic/b/l.");
CHECK_PARSE_LYD_PARAM("<l xmlns=\"urn:tests:c\">val1</l>"
"<l xmlns=\"urn:tests:c\">val2</l>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Too few \"l\" instances.", "/c:choic/b/l");
+ CHECK_LOG_CTX("Too few \"l\" instances.", "Schema location /c:choic/b/l.");
LYD_TREE_CREATE("<l xmlns=\"urn:tests:c\">val1</l>"
"<l xmlns=\"urn:tests:c\">val2</l>"
@@ -172,8 +172,9 @@
"<lt xmlns=\"urn:tests:c\"><k>val2</k></lt>"
"<lt xmlns=\"urn:tests:c\"><k>val3</k></lt>"
"<lt xmlns=\"urn:tests:c\"><k>val4</k></lt>"
- "<lt xmlns=\"urn:tests:c\"><k>val5</k></lt>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Too many \"lt\" instances.", "/c:lt");
+ "<lt xmlns=\"urn:tests:c\"><k>val5</k></lt>"
+ "<lt xmlns=\"urn:tests:c\"><k>val6</k></lt>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
+ CHECK_LOG_CTX("Too many \"lt\" instances.", "Schema location /c:lt, data location /c:lt[k='val5'].");
}
const char *schema_d =
@@ -260,7 +261,8 @@
" <k>val2</k>\n"
" <l1>same</l1>\n"
"</lt>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val1']\" and \"/d:lt[k='val2']\".", "/d:lt[k='val2']");
+ CHECK_LOG_CTX("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val1']\" and \"/d:lt[k='val2']\".",
+ "Schema location /d:lt, data location /d:lt[k='val2'].");
/* now try with more instances */
LYD_TREE_CREATE("<lt xmlns=\"urn:tests:d\">\n"
@@ -357,7 +359,8 @@
" <k>val8</k>\n"
" <l1>8</l1>\n"
"</lt>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val7']\" and \"/d:lt[k='val2']\".", "/d:lt[k='val2']");
+ CHECK_LOG_CTX("Unique data leaf(s) \"l1\" not satisfied in \"/d:lt[k='val7']\" and \"/d:lt[k='val2']\".",
+ "Schema location /d:lt, data location /d:lt[k='val2'].");
}
static void
@@ -481,9 +484,8 @@
" <l3>3</l3>\n"
" </lt3>\n"
"</lt2>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Unique data leaf(s) \"l3\" not satisfied in"
- " \"/d:lt2[k='val2']/lt3[kk='val3']\" and"
- " \"/d:lt2[k='val2']/lt3[kk='val1']\".", "/d:lt2[k='val2']/lt3[kk='val1']");
+ CHECK_LOG_CTX("Unique data leaf(s) \"l3\" not satisfied in \"/d:lt2[k='val2']/lt3[kk='val3']\" and \"/d:lt2[k='val2']/lt3[kk='val1']\".",
+ "Schema location /d:lt2/lt3, data location /d:lt2[k='val2']/lt3[kk='val1'].");
CHECK_PARSE_LYD_PARAM("<lt2 xmlns=\"urn:tests:d\">\n"
" <k>val1</k>\n"
@@ -520,7 +522,8 @@
" </cont>\n"
" <l4>5</l4>\n"
"</lt2>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Unique data leaf(s) \"cont/l2 l4\" not satisfied in \"/d:lt2[k='val4']\" and \"/d:lt2[k='val2']\".", "/d:lt2[k='val2']");
+ CHECK_LOG_CTX("Unique data leaf(s) \"cont/l2 l4\" not satisfied in \"/d:lt2[k='val4']\" and \"/d:lt2[k='val2']\".",
+ "Schema location /d:lt2, data location /d:lt2[k='val2'].");
CHECK_PARSE_LYD_PARAM("<lt2 xmlns=\"urn:tests:d\">\n"
" <k>val1</k>\n"
@@ -566,7 +569,7 @@
" <l6>3</l6>\n"
"</lt2>", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
CHECK_LOG_CTX("Unique data leaf(s) \"l5 l6\" not satisfied in \"/d:lt2[k='val5']\" and \"/d:lt2[k='val3']\".",
- "/d:lt2[k='val3']");
+ "Schema location /d:lt2, data location /d:lt2[k='val3'].");
}
static void
@@ -627,28 +630,28 @@
CHECK_PARSE_LYD_PARAM("<d xmlns=\"urn:tests:e\">25</d><d xmlns=\"urn:tests:e\">50</d>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"d\".", "/e:d");
+ CHECK_LOG_CTX("Duplicate instance of \"d\".", "Schema location /e:d, data location /e:d.");
CHECK_PARSE_LYD_PARAM("<lt xmlns=\"urn:tests:e\"><k>A</k></lt>"
"<lt xmlns=\"urn:tests:e\"><k>B</k></lt>"
"<lt xmlns=\"urn:tests:e\"><k>A</k></lt>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"lt\".", "/e:lt[k='A']");
+ CHECK_LOG_CTX("Duplicate instance of \"lt\".", "Schema location /e:lt, data location /e:lt[k='A'].");
CHECK_PARSE_LYD_PARAM("<ll xmlns=\"urn:tests:e\">A</ll>"
"<ll xmlns=\"urn:tests:e\">B</ll>"
"<ll xmlns=\"urn:tests:e\">B</ll>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"ll\".", "/e:ll[.='B']");
+ CHECK_LOG_CTX("Duplicate instance of \"ll\".", "Schema location /e:ll, data location /e:ll[.='B'].");
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:e\"></cont><cont xmlns=\"urn:tests:e\"/>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"cont\".", "/e:cont");
+ CHECK_LOG_CTX("Duplicate instance of \"cont\".", "Schema location /e:cont, data location /e:cont.");
/* same tests again but using hashes */
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:e\"><d>25</d><d>50</d><ll>1</ll><ll>2</ll><ll>3</ll><ll>4</ll></cont>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"d\".", "/e:cont/d");
+ CHECK_LOG_CTX("Duplicate instance of \"d\".", "Schema location /e:cont/d, data location /e:cont/d, line number 1.");
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:e\"><ll>1</ll><ll>2</ll><ll>3</ll><ll>4</ll>"
"<lt><k>a</k></lt>"
@@ -657,12 +660,12 @@
"<lt><k>d</k></lt>"
"<lt><k>c</k></lt></cont>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"lt\".", "/e:cont/lt[k='c']");
+ CHECK_LOG_CTX("Duplicate instance of \"lt\".", "Schema location /e:cont/lt, data location /e:cont/lt[k='c'], line number 1.");
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:e\"><ll>1</ll><ll>2</ll><ll>3</ll><ll>4</ll>"
"<ll>a</ll><ll>b</ll><ll>c</ll><ll>d</ll><ll>d</ll></cont>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"ll\".", "/e:cont/ll[.='d']");
+ CHECK_LOG_CTX("Duplicate instance of \"ll\".", "Schema location /e:cont/ll, data location /e:cont/ll[.='d'], line number 1.");
/* cases */
CHECK_PARSE_LYD_PARAM("<l xmlns=\"urn:tests:e\">a</l>"
@@ -670,13 +673,13 @@
"<l xmlns=\"urn:tests:e\">c</l>"
"<l xmlns=\"urn:tests:e\">b</l>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Duplicate instance of \"l\".", "/e:l[.='b']");
+ CHECK_LOG_CTX("Duplicate instance of \"l\".", "Schema location /e:choic/b/l, data location /e:l[.='b'].");
CHECK_PARSE_LYD_PARAM("<l xmlns=\"urn:tests:e\">a</l><l xmlns=\"urn:tests:e\">b</l>"
"<l xmlns=\"urn:tests:e\">c</l>"
"<a xmlns=\"urn:tests:e\">aa</a>",
LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Data for both cases \"a\" and \"b\" exist.", "/e:choic");
+ CHECK_LOG_CTX("Data for both cases \"a\" and \"b\" exist.", "Schema location /e:choic.");
}
static void
@@ -963,11 +966,13 @@
" </cont2>\n"
"</cont>\n";
CHECK_PARSE_LYD_PARAM(data, LYD_XML, LYD_PARSE_ONLY | LYD_PARSE_NO_STATE, 0, LY_EVALID, tree);
- CHECK_LOG_CTX("Invalid state data node \"cont2\" found.", "/h:cont/cont2");
+ CHECK_LOG_CTX("Invalid state data node \"cont2\" found.",
+ "Schema location /h:cont/cont2, data location /h:cont, line number 3.");
CHECK_PARSE_LYD_PARAM(data, LYD_XML, LYD_PARSE_ONLY, 0, LY_SUCCESS, tree);
assert_int_equal(LY_EVALID, lyd_validate_all(&tree, NULL, LYD_VALIDATE_PRESENT | LYD_VALIDATE_NO_STATE, NULL));
- CHECK_LOG_CTX("Invalid state data node \"cont2\" found.", "/h:cont/cont2");
+ CHECK_LOG_CTX("Invalid state data node \"cont2\" found.",
+ "Schema location /h:cont/cont2, data location /h:cont/cont2.");
lyd_free_all(tree);
}
@@ -998,7 +1003,8 @@
" <l>wrong</l>\n"
" <l2>val</l2>\n"
"</cont>\n", LYD_XML, 0, LYD_VALIDATE_PRESENT, LY_EVALID, tree);
- CHECK_LOG_CTX("Must condition \"../l = 'right'\" not satisfied.", "/i:cont/l2");
+ CHECK_LOG_CTX("Must condition \"../l = 'right'\" not satisfied.",
+ "Schema location /i:cont/l2, data location /i:cont/l2.");
LYD_TREE_CREATE("<cont xmlns=\"urn:tests:i\">\n"
" <l>right</l>\n"
@@ -1080,7 +1086,8 @@
/* missing leafref */
assert_int_equal(LY_EVALID, lyd_validate_op(op_tree, NULL, LYD_VALIDATE_OP_RPC, NULL));
- CHECK_LOG_CTX("Invalid leafref value \"target\" - no existing target instance \"/lf3\".", "/j:cont/l1[k='val1']/act/lf2");
+ CHECK_LOG_CTX("Invalid leafref value \"target\" - no existing target instance \"/lf3\".",
+ "Schema location /j:cont/l1/act/lf2, data location /j:cont/l1[k='val1']/act/lf2.");
ly_in_free(in, 0);
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:j\">\n"
@@ -1091,7 +1098,8 @@
/* input must false */
assert_int_equal(LY_EVALID, lyd_validate_op(op_tree, tree, LYD_VALIDATE_OP_RPC, NULL));
- CHECK_LOG_CTX("Must condition \"../../lf1 = 'true'\" not satisfied.", "/j:cont/l1[k='val1']/act");
+ CHECK_LOG_CTX("Must condition \"../../lf1 = 'true'\" not satisfied.",
+ "Data location /j:cont/l1[k='val1']/act.");
lyd_free_all(tree);
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:j\">\n"
@@ -1130,7 +1138,8 @@
/* missing leafref */
assert_int_equal(LY_EVALID, lyd_validate_op(op_tree, NULL, LYD_VALIDATE_OP_REPLY, NULL));
- CHECK_LOG_CTX("Invalid leafref value \"target\" - no existing target instance \"/lf4\".", "/j:cont/l1[k='val1']/act/lf2");
+ CHECK_LOG_CTX("Invalid leafref value \"target\" - no existing target instance \"/lf4\".",
+ "Schema location /j:cont/l1/act/lf2, data location /j:cont/l1[k='val1']/act/lf2.");
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:j\">\n"
" <lf1>not true</lf1>\n"
@@ -1140,7 +1149,7 @@
/* input must false */
assert_int_equal(LY_EVALID, lyd_validate_op(op_tree, tree, LYD_VALIDATE_OP_REPLY, NULL));
- CHECK_LOG_CTX("Must condition \"../../lf1 = 'true2'\" not satisfied.", "/j:cont/l1[k='val1']/act");
+ CHECK_LOG_CTX("Must condition \"../../lf1 = 'true2'\" not satisfied.", "Data location /j:cont/l1[k='val1']/act.");
lyd_free_all(tree);
CHECK_PARSE_LYD_PARAM("<cont xmlns=\"urn:tests:j\">\n"
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index f0193fb..c1fcab7 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -69,7 +69,8 @@
#define YCTX_INIT \
struct ly_in in = {0}; \
in.line = 1; \
- YCTX->in = &in
+ YCTX->in = ∈ \
+ LOG_LOCINIT(UTEST_LYCTX, NULL, NULL, NULL, &in)
static int
setup(void **state)
@@ -79,7 +80,6 @@
/* allocate parser context */
YCTX = calloc(1, sizeof(*YCTX));
YCTX->format = LYS_IN_YANG;
- YCTX->pos_type = LY_VLOG_LINE;
/* allocate new parsed module */
YCTX->parsed_mod = calloc(1, sizeof *YCTX->parsed_mod);
@@ -550,6 +550,8 @@
ctx->parsed_mod->mod->parsed = ctx->parsed_mod;
ctx->parsed_mod->mod->ctx = ly_ctx;
+ ctx->in->line = 1;
+
return ctx->parsed_mod;
}
@@ -683,14 +685,16 @@
/* import - prefix collision */
in.current = SCHEMA_BEGINNING "import zzz {prefix x;}}";
assert_int_equal(LY_EVALID, parse_module(YCTX, mod));
- CHECK_LOG_CTX("Prefix \"x\" already used as module prefix.", "Line number 2.");
+ CHECK_LOG_CTX("Prefix \"x\" already used as module prefix.", "Line number 1.");
mod = mod_renew(YCTX);
in.current = SCHEMA_BEGINNING "import zzz {prefix y;}import zzz {prefix y;}}";
assert_int_equal(LY_EVALID, parse_module(YCTX, mod));
- CHECK_LOG_CTX("Prefix \"y\" already used to import \"zzz\" module.", "Line number 2.");
+ CHECK_LOG_CTX("Prefix \"y\" already used to import \"zzz\" module.", "Line number 1.");
mod = mod_renew(YCTX);
+ LOG_LOCBACK(UTEST_LYCTX, 0, 0, 0, 1);
+
in.current = "module name10 {yang-version 1.1;namespace urn:x;prefix \"x\";import zzz {prefix y;}import zzz {prefix z;}}";
assert_int_equal(lys_parse_mem(YCTX->parsed_mod->mod->ctx, in.current, LYS_IN_YANG, NULL), LY_SUCCESS);
CHECK_LOG_CTX("Single revision of the module \"zzz\" imported twice.", NULL);
@@ -739,11 +743,11 @@
/* yang-version */
in.current = SCHEMA_BEGINNING2 "\n\tyang-version 10;}";
assert_int_equal(LY_EVALID, parse_module(YCTX, mod));
- CHECK_LOG_CTX("Invalid value \"10\" of \"yang-version\".", "Line number 3.");
+ CHECK_LOG_CTX("Invalid value \"10\" of \"yang-version\".", NULL);
mod = mod_renew(YCTX);
in.current = SCHEMA_BEGINNING2 "yang-version 1;yang-version 1.1;}";
assert_int_equal(LY_EVALID, parse_module(YCTX, mod));
- CHECK_LOG_CTX("Duplicate keyword \"yang-version\".", "Line number 3.");
+ CHECK_LOG_CTX("Duplicate keyword \"yang-version\".", NULL);
mod = mod_renew(YCTX);
in.current = SCHEMA_BEGINNING2 "yang-version 1;}";
assert_int_equal(LY_SUCCESS, parse_module(YCTX, mod));
@@ -754,9 +758,6 @@
assert_int_equal(2, mod->version);
mod = mod_renew(YCTX);
- /* reset line */
- in.line = 1;
-
in.current = "module " SCHEMA_BEGINNING "} module q {namespace urn:q;prefixq;}";
m = calloc(1, sizeof *m);
m->ctx = YCTX->parsed_mod->mod->ctx;
@@ -790,7 +791,7 @@
/* invalid substatement */
in.current = SCHEMA_BEGINNING "must false;}";
assert_int_equal(LY_EVALID, parse_module(YCTX, mod));
- CHECK_LOG_CTX("Invalid keyword \"must\" as a child of \"module\".", "Line number 1.");
+ CHECK_LOG_CTX("Invalid keyword \"must\" as a child of \"module\".", NULL);
/* submodule */
submod = submod_renew(YCTX);
@@ -798,7 +799,7 @@
/* missing mandatory substatements */
in.current = " subname {}";
assert_int_equal(LY_EVALID, parse_submodule(YCTX, submod));
- CHECK_LOG_CTX("Missing mandatory keyword \"belongs-to\" as a child of \"submodule\".", "Line number 1.");
+ CHECK_LOG_CTX("Missing mandatory keyword \"belongs-to\" as a child of \"submodule\".", NULL);
assert_string_equal("subname", submod->name);
submod = submod_renew(YCTX);
@@ -814,17 +815,17 @@
/* duplicated namespace, prefix */
in.current = " subname {belongs-to name {prefix x;}belongs-to module1;belongs-to module2;} ...";
assert_int_equal(LY_EVALID, parse_submodule(YCTX, submod));
- CHECK_LOG_CTX("Duplicate keyword \"belongs-to\".", "Line number 1.");
+ CHECK_LOG_CTX("Duplicate keyword \"belongs-to\".", NULL);
submod = submod_renew(YCTX);
/* not allowed in submodule (module-specific) */
in.current = SCHEMA_BEGINNING "namespace \"urn:z\";}";
assert_int_equal(LY_EVALID, parse_submodule(YCTX, submod));
- CHECK_LOG_CTX("Invalid keyword \"namespace\" as a child of \"submodule\".", "Line number 1.");
+ CHECK_LOG_CTX("Invalid keyword \"namespace\" as a child of \"submodule\".", NULL);
submod = submod_renew(YCTX);
in.current = SCHEMA_BEGINNING "prefix m;}}";
assert_int_equal(LY_EVALID, parse_submodule(YCTX, submod));
- CHECK_LOG_CTX("Invalid keyword \"prefix\" as a child of \"submodule\".", "Line number 1.");
+ CHECK_LOG_CTX("Invalid keyword \"prefix\" as a child of \"submodule\".", NULL);
submod = submod_renew(YCTX);
in.current = "submodule " SCHEMA_BEGINNING "} module q {namespace urn:q;prefixq;}";
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index ab4b3b2..250a2e6 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -189,61 +189,61 @@
str = "module a {namespace urn:a; prefix a; typedef binary {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"binary\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"binary\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef bits {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"bits\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"bits\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef boolean {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"boolean\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"boolean\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef decimal64 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"decimal64\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"decimal64\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef empty {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"empty\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"empty\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef enumeration {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"enumeration\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"enumeration\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef int8 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"int8\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"int8\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef int16 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"int16\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"int16\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef int32 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"int32\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"int32\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef int64 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"int64\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"int64\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef instance-identifier {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"instance-identifier\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"instance-identifier\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef identityref {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"identityref\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"identityref\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef leafref {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"leafref\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"leafref\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef string {type int8;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"string\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"string\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef union {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"union\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"union\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef uint8 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"uint8\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"uint8\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef uint16 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"uint16\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"uint16\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef uint32 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"uint32\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"uint32\" of typedef - name collision with a built-in type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef uint64 {type string;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"uint64\" of typedef - name collision with a built-in type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"uint64\" of typedef - name collision with a built-in type.", NULL);
str = "module mytypes {namespace urn:types; prefix t; typedef binary_ {type string;} typedef bits_ {type string;} typedef boolean_ {type string;} "
"typedef decimal64_ {type string;} typedef empty_ {type string;} typedef enumeration_ {type string;} typedef int8_ {type string;} typedef int16_ {type string;}"
@@ -254,34 +254,34 @@
str = "module a {namespace urn:a; prefix a; typedef test {type string;} typedef test {type int8;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"test\" of typedef - name collision with another top-level type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"test\" of typedef - name collision with another top-level type.", NULL);
str = "module a {namespace urn:a; prefix a; typedef x {type string;} container c {typedef x {type int8;}}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"x\" of typedef - scoped type collide with a top-level type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"x\" of typedef - scoped type collide with a top-level type.", NULL);
str = "module a {namespace urn:a; prefix a; container c {container d {typedef y {type int8;}} typedef y {type string;}}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"y\" of typedef - name collision with another scoped type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"y\" of typedef - name collision with another scoped type.", NULL);
str = "module a {namespace urn:a; prefix a; container c {typedef y {type int8;} typedef y {type string;}}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"y\" of typedef - name collision with sibling type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"y\" of typedef - name collision with sibling type.", NULL);
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule b {belongs-to a {prefix a;} typedef x {type string;}}");
str = "module a {namespace urn:a; prefix a; include b; typedef x {type int8;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"x\" of typedef - name collision with another top-level type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"x\" of typedef - name collision with another top-level type.", NULL);
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule b {belongs-to a {prefix a;} container c {typedef x {type string;}}}");
str = "module a {namespace urn:a; prefix a; include b; typedef x {type int8;}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"x\" of typedef - scoped type collide with a top-level type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"x\" of typedef - scoped type collide with a top-level type.", NULL);
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule b {belongs-to a {prefix a;} typedef x {type int8;}}");
str = "module a {namespace urn:a; prefix a; include b; container c {typedef x {type string;}}}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EEXIST);
- CHECK_LOG("Invalid name \"x\" of typedef - scoped type collide with a top-level type.", "Line number 1.");
+ CHECK_LOG("Invalid name \"x\" of typedef - scoped type collide with a top-level type.", NULL);
}
void
@@ -330,7 +330,7 @@
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EVALID);
CHECK_LOG_CTX("Invalid leafref path \"/cont/l\" - target is supposed to represent configuration data"
- " (as the leafref does), but it does not.", "/b:cont2/l2");
+ " (as the leafref does), but it does not.", "Schema location /b:cont2/l2.");
/* config -> state must */
str = "module b {\n"
@@ -480,7 +480,7 @@
" }\n"
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EVALID);
- CHECK_LOG_CTX("Not found node \"l\" in path.", "/h:rp/l2");
+ CHECK_LOG_CTX("Not found node \"l\" in path.", "Schema location /h:rp/l2.");
/* rpc input -> rpc output must */
str = "module h {\n"
@@ -523,7 +523,7 @@
" }\n"
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EVALID);
- CHECK_LOG_CTX("Not found node \"notif\" in path.", "/i:rp/l2");
+ CHECK_LOG_CTX("Not found node \"notif\" in path.", "Schema location /i:rp/l2.");
/* rpc input -> notif must */
str = "module i {\n"
@@ -606,7 +606,7 @@
" }\n"
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_EVALID);
- CHECK_LOG_CTX("Not found node \"l\" in path.", "/k:cont/ll/act/l2");
+ CHECK_LOG_CTX("Not found node \"l\" in path.", "Schema location /k:cont/ll/act/l2.");
/* action output -> action input must */
str = "module k {\n"
diff --git a/tests/utests/schema/test_schema_stmts.c b/tests/utests/schema/test_schema_stmts.c
index 1cd8ced..4f53ba8 100644
--- a/tests/utests/schema/test_schema_stmts.c
+++ b/tests/utests/schema/test_schema_stmts.c
@@ -104,11 +104,11 @@
assert_int_equal(1, LY_ARRAY_COUNT(mod->identities[1].derived));
assert_ptr_equal(mod->identities[1].derived[0], &mod->identities[0]);
- TEST_SCHEMA_ERR(0, 0, "inv", "identity i1;identity i1;", "Duplicate identifier \"i1\" of identity statement.", "Line number 1.");
+ TEST_SCHEMA_ERR(0, 0, "inv", "identity i1;identity i1;", "Duplicate identifier \"i1\" of identity statement.", NULL);
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule inv_sub {belongs-to inv {prefix inv;} identity i1;}");
TEST_SCHEMA_ERR(0, 0, "inv", "include inv_sub;identity i1;",
- "Duplicate identifier \"i1\" of identity statement.", "Line number 1.");
+ "Duplicate identifier \"i1\" of identity statement.", NULL);
TEST_SCHEMA_ERR(0, 0, "inv", "identity i1 {base i2;}", "Unable to find base (i2) of identity \"i1\".", "/inv:{identity='i1'}");
TEST_SCHEMA_ERR(0, 0, "inv", "identity i1 {base i1;}", "Identity \"i1\" is derived from itself.", "/inv:{identity='i1'}");
TEST_SCHEMA_ERR(0, 0, "inv", "identity i1 {base i2;}identity i2 {base i3;}identity i3 {base i1;}",
@@ -122,12 +122,12 @@
/* default value from non-implemented module */
TEST_SCHEMA_ERR(0, 0, "ident2", "import base {prefix b;} leaf l {type identityref {base b:i1;} default b:i2;}",
"Invalid default - value does not fit the type (Invalid identityref \"b:i2\" value"
- " - identity found in non-implemented module \"base\".).", "/ident2:l");
+ " - identity found in non-implemented module \"base\".).", "Schema location /ident2:l.");
/* default value in typedef from non-implemented module */
TEST_SCHEMA_ERR(0, 0, "ident2", "import base {prefix b;} typedef t1 {type identityref {base b:i1;} default b:i2;}"
"leaf l {type t1;}", "Invalid default - value does not fit the type (Invalid"
- " identityref \"b:i2\" value - identity found in non-implemented module \"base\".).", "/ident2:l");
+ " identityref \"b:i2\" value - identity found in non-implemented module \"base\".).", "Schema location /ident2:l.");
/*
* printing
@@ -227,11 +227,11 @@
TEST_SCHEMA_ERR(0, 0, "inv", "feature f1; feature f2{if-feature 'not f1';}",
"Invalid value \"not f1\" of if-feature - YANG 1.1 expression in YANG 1.0 module.", NULL);
TEST_SCHEMA_ERR(0, 0, "inv", "feature f1; feature f1;",
- "Duplicate identifier \"f1\" of feature statement.", "Line number 1.");
+ "Duplicate identifier \"f1\" of feature statement.", NULL);
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "submodule inv_sub {belongs-to inv {prefix inv;} feature f1;}");
TEST_SCHEMA_ERR(0, 0, "inv", "include inv_sub;feature f1;",
- "Duplicate identifier \"f1\" of feature statement.", "Line number 1.");
+ "Duplicate identifier \"f1\" of feature statement.", NULL);
TEST_SCHEMA_ERR(0, 0, "inv", "feature f1 {if-feature f2;} feature f2 {if-feature f1;}",
"Feature \"f1\" is indirectly referenced from itself.", NULL);
TEST_SCHEMA_ERR(0, 0, "inv", "feature f1 {if-feature f1;}",
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index c2c0913..c745546 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -300,7 +300,7 @@
CHECK_LOG_CTX("Leaf-list of type \"empty\" is allowed only in YANG 1.1 modules.", "/aa:ll");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module bb {yang-version 1.1;namespace urn:bb;prefix bb;leaf-list ll {type empty; default x;}}", LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Invalid default - value does not fit the type (Invalid empty value \"x\".).", "/bb:ll");
+ CHECK_LOG_CTX("Invalid default - value does not fit the type (Invalid empty value \"x\".).", "Schema location /bb:ll.");
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module cc {yang-version 1.1;namespace urn:cc;prefix cc;"
"leaf-list ll {config false;type string; default one;default two;default one;}}", LYS_IN_YANG, &mod));
@@ -315,7 +315,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ee {yang-version 1.1; namespace urn:ee;prefix ee;"
"leaf ref {type instance-identifier {require-instance true;} default \"/ee:g\";}}", LYS_IN_YANG, NULL));
CHECK_LOG_CTX("Invalid default - value does not fit the type "
- "(Invalid instance-identifier \"/ee:g\" value - semantic error.).", "/ee:ref");
+ "(Invalid instance-identifier \"/ee:g\" value - semantic error.).", "Schema location /ee:ref.");
}
static void
@@ -413,7 +413,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module cc {yang-version 1.1;namespace urn:cc;prefix cc;feature f;"
"list l {key x; leaf x {type string; if-feature f;}}}", LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Key \"x\" is disabled by its if-features.", "/cc:l/x");
+ CHECK_LOG_CTX("Key \"x\" is disabled by its if-features.", "Schema location /cc:l/x.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module dd {namespace urn:dd;prefix dd;"
"list l {key x; leaf x {type string; config false;}}}", LYS_IN_YANG, NULL));
@@ -1636,26 +1636,26 @@
/* invalid paths */
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa;container a {leaf target2 {type uint8;}}"
"leaf ref1 {type leafref {path ../a/invalid;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Not found node \"invalid\" in path.", "/aa:ref1");
+ CHECK_LOG_CTX("Not found node \"invalid\" in path.", "Schema location /aa:ref1.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module bb {namespace urn:bb;prefix bb;container a {leaf target2 {type uint8;}}"
"leaf ref1 {type leafref {path ../../toohigh;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Too many parent references in path.", "/bb:ref1");
+ CHECK_LOG_CTX("Too many parent references in path.", "Schema location /bb:ref1.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module cc {namespace urn:cc;prefix cc;container a {leaf target2 {type uint8;}}"
"leaf ref1 {type leafref {path /a:invalid;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("No module connected with the prefix \"a\" found (prefix format schema stored mapping).", "/cc:ref1");
+ CHECK_LOG_CTX("No module connected with the prefix \"a\" found (prefix format schema stored mapping).", "Schema location /cc:ref1.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module dd {namespace urn:dd;prefix dd;leaf target1 {type string;}"
"container a {leaf target2 {type uint8;}} leaf ref1 {type leafref {"
"path '/a[target2 = current()/../target1]/target2';}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("List predicate defined for container \"a\" in path.", "/dd:ref1");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ee {namespace urn:ee;prefix ee;container a {leaf target2 {type uint8;}}"
+ CHECK_LOG_CTX("List predicate defined for container \"a\" in path.", "Schema location /dd:ref1.");
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ee {namespace urn:ee;prefix ee;\n container a {leaf target2 {type uint8;}}\n"
"leaf ref1 {type leafref {path /a!invalid;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid character 0x21 ('!'), perhaps \"a\" is supposed to be a function call.", NULL);
+ CHECK_LOG_CTX("Invalid character 0x21 ('!'), perhaps \"a\" is supposed to be a function call.", "Line number 3.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ff {namespace urn:ff;prefix ff;container a {leaf target2 {type uint8;}}"
"leaf ref1 {type leafref {path /a;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid leafref path \"/a\" - target node is container instead of leaf or leaf-list.", "/ff:ref1");
+ CHECK_LOG_CTX("Invalid leafref path \"/a\" - target node is container instead of leaf or leaf-list.", "Schema location /ff:ref1.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module gg {namespace urn:gg;prefix gg;container a {leaf target2 {type uint8;"
"status deprecated;}} leaf ref1 {type leafref {path /a/target2;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("A current definition \"ref1\" is not allowed to reference deprecated definition \"target2\".", "/gg:ref1");
+ CHECK_LOG_CTX("A current definition \"ref1\" is not allowed to reference deprecated definition \"target2\".", "Schema location /gg:ref1.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module hh {namespace urn:hh;prefix hh;"
"leaf ref1 {type leafref;}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Missing path substatement for leafref type.", "/hh:ref1");
@@ -1664,10 +1664,10 @@
CHECK_LOG_CTX("Missing path substatement for leafref type mytype.", "/ii:ref1");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module jj {namespace urn:jj;prefix jj;feature f;"
"leaf ref {type leafref {path /target;}}leaf target {if-feature f;type string;}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Not found node \"target\" in path.", "/jj:ref");
+ CHECK_LOG_CTX("Not found node \"target\" in path.", "Schema location /jj:ref.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module kk {namespace urn:kk;prefix kk;"
"leaf ref {type leafref {path /target;}}leaf target {type string;config false;}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid leafref path \"/target\" - target is supposed to represent configuration data (as the leafref does), but it does not.", "/kk:ref");
+ CHECK_LOG_CTX("Invalid leafref path \"/target\" - target is supposed to represent configuration data (as the leafref does), but it does not.", "Schema location /kk:ref.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ll {namespace urn:ll;prefix ll;"
"leaf ref {type leafref {path /target; require-instance true;}}leaf target {type string;}}", LYS_IN_YANG, &mod));
@@ -1676,127 +1676,127 @@
"leaf ref {type mytype;}leaf target {type string;}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Leafref type \"mytype\" can be restricted by require-instance statement only in YANG 1.1 modules.", "/mm:ref");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module nn {namespace urn:nn;prefix nn;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}"
- "leaf address {type leafref{ path \"/interface[name is current()/../ifname]/ip\";}}}",
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module nn {namespace urn:nn;prefix nn;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}\n"
+ "leaf address {type leafref{\n path \"/interface[name is current()/../ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid character 0x69 ('i'), perhaps \"name\" is supposed to be a function call.", NULL);
+ CHECK_LOG_CTX("Invalid character 0x69 ('i'), perhaps \"name\" is supposed to be a function call.", "Line number 5.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module oo {namespace urn:oo;prefix oo;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}"
- "leaf address {type leafref{ path \"/interface[name=current()/../ifname/ip\";}}}",
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module oo {namespace urn:oo;prefix oo;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}\n"
+ "leaf address {type leafref{\n path \"/interface[name=current()/../ifname/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Unexpected XPath expression end.", NULL);
+ CHECK_LOG_CTX("Unexpected XPath expression end.", "Line number 5.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module pp {namespace urn:pp;prefix pp;"
"list interface{key name;leaf name{type string;}leaf ip {type string;}}"
"leaf ifname{type leafref{ path \"../interface/name\";}}"
"leaf address {type leafref{ path \"/interface[x:name=current()/../ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("No module connected with the prefix \"x\" found (prefix format schema stored mapping).", "/pp:address");
+ CHECK_LOG_CTX("No module connected with the prefix \"x\" found (prefix format schema stored mapping).", "Schema location /pp:address.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module qq {namespace urn:qq;prefix qq;"
"list interface{key name;leaf name{type string;}leaf ip {type string;}}"
"leaf ifname{type leafref{ path \"../interface/name\";}}"
"leaf address {type leafref{ path \"/interface[id=current()/../ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Not found node \"id\" in path.", "/qq:address");
+ CHECK_LOG_CTX("Not found node \"id\" in path.", "Schema location /qq:address.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module rr {namespace urn:rr;prefix rr;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module rr {namespace urn:rr;prefix rr;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name=current() / .. / ifname][name=current()/../test]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Duplicate predicate key \"name\" in path.", NULL);
+ CHECK_LOG_CTX("Duplicate predicate key \"name\" in path.", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ss {namespace urn:ss;prefix ss;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ss {namespace urn:ss;prefix ss;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name = ../ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Unexpected XPath token \"..\" (\"../ifname]/ip\"), expected \"FunctionName\".", NULL);
+ CHECK_LOG_CTX("Unexpected XPath token \"..\" (\"../ifname]/ip\"), expected \"FunctionName\".", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module tt {namespace urn:tt;prefix tt;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module tt {namespace urn:tt;prefix tt;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name = current()../ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Unexpected XPath token \"..\" (\"../ifname]/ip\"), expected \"]\".", NULL);
+ CHECK_LOG_CTX("Unexpected XPath token \"..\" (\"../ifname]/ip\"), expected \"]\".", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module uu {namespace urn:uu;prefix uu;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module uu {namespace urn:uu;prefix uu;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name = current()/..ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid character number 31 of expression '/interface[name = current()/..ifname]/ip'.", NULL);
+ CHECK_LOG_CTX("Invalid character number 31 of expression '/interface[name = current()/..ifname]/ip'.", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module vv {namespace urn:vv;prefix vv;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module vv {namespace urn:vv;prefix vv;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name = current()/ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Unexpected XPath token \"NameTest\" (\"ifname]/ip\"), expected \"..\".", NULL);
+ CHECK_LOG_CTX("Unexpected XPath token \"NameTest\" (\"ifname]/ip\"), expected \"..\".", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ww {namespace urn:ww;prefix ww;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ww {namespace urn:ww;prefix ww;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name = current()/../]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Unexpected XPath token \"]\" (\"]/ip\").", NULL);
+ CHECK_LOG_CTX("Unexpected XPath token \"]\" (\"]/ip\").", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module xx {namespace urn:xx;prefix xx;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module xx {namespace urn:xx;prefix xx;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}leaf test{type string;}\n"
"leaf address {type leafref{ path \"/interface[name = current()/../$node]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid character 0x24 ('$'), perhaps \"\" is supposed to be a function call.", NULL);
+ CHECK_LOG_CTX("Invalid character 0x24 ('$'), perhaps \"\" is supposed to be a function call.", "Line number 4.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module yy {namespace urn:yy;prefix yy;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module yy {namespace urn:yy;prefix yy;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}\n"
"leaf address {type leafref{ path \"/interface[name=current()/../x:ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("No module connected with the prefix \"x\" found (prefix format schema stored mapping).", "/yy:address");
+ CHECK_LOG_CTX("No module connected with the prefix \"x\" found (prefix format schema stored mapping).", "Schema location /yy:address.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zz {namespace urn:zz;prefix zz;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zz {namespace urn:zz;prefix zz;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}\n"
"leaf address {type leafref{ path \"/interface[name=current()/../xxx]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Not found node \"xxx\" in path.", "/zz:address");
+ CHECK_LOG_CTX("Not found node \"xxx\" in path.", "Schema location /zz:address.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zza {namespace urn:zza;prefix zza;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}container c;"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zza {namespace urn:zza;prefix zza;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}container c;\n"
"leaf address {type leafref{ path \"/interface[name=current()/../c]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Leaf expected instead of container \"c\" in leafref predicate in path.", "/zza:address");
+ CHECK_LOG_CTX("Leaf expected instead of container \"c\" in leafref predicate in path.", "Schema location /zza:address.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zzb {namespace urn:zzb;prefix zzb;"
- "list interface{key name;leaf name{type string;}leaf ip {type string;}container c;}"
- "leaf ifname{type leafref{ path \"../interface/name\";}}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zzb {namespace urn:zzb;prefix zzb;\n"
+ "list interface{key name;leaf name{type string;}leaf ip {type string;}container c;}\n"
+ "leaf ifname{type leafref{ path \"../interface/name\";}}\n"
"leaf address {type leafref{ path \"/interface[c=current()/../ifname]/ip\";}}}",
LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Key expected instead of container \"c\" in path.", "/zzb:address");
+ CHECK_LOG_CTX("Key expected instead of container \"c\" in path.", "Schema location /zzb:address.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zzc {namespace urn:zzc;prefix zzc;"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zzc {namespace urn:zzc;prefix zzc;\n"
"leaf source {type leafref {path \"../target\";}default true;}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Not found node \"target\" in path.", "/zzc:source");
+ CHECK_LOG_CTX("Not found node \"target\" in path.", "Schema location /zzc:source.");
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zzd {namespace urn:zzd;prefix zzd;"
- "leaf source {type leafref {path \"../target\";}default true;}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module zzd {namespace urn:zzd;prefix zzd;\n"
+ "leaf source {type leafref {path \"../target\";}default true;}\n"
"leaf target {type uint8;}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid default - value does not fit the type (Invalid uint8 value \"true\".).", "/zzd:source");
+ CHECK_LOG_CTX("Invalid default - value does not fit the type (Invalid uint8 value \"true\".).", "Schema location /zzd:source.");
/* circular chain */
- assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aaa {namespace urn:aaa;prefix aaa;"
- "leaf ref1 {type leafref {path /ref2;}}"
- "leaf ref2 {type leafref {path /ref3;}}"
- "leaf ref3 {type leafref {path /ref4;}}"
+ assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aaa {namespace urn:aaa;prefix aaa;\n"
+ "leaf ref1 {type leafref {path /ref2;}}\n"
+ "leaf ref2 {type leafref {path /ref3;}}\n"
+ "leaf ref3 {type leafref {path /ref4;}}\n"
"leaf ref4 {type leafref {path /ref1;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Invalid leafref path \"/ref1\" - circular chain of leafrefs detected.", "/aaa:ref4");
+ CHECK_LOG_CTX("Invalid leafref path \"/ref1\" - circular chain of leafrefs detected.", "Schema location /aaa:ref4.");
}
static void
@@ -1806,7 +1806,7 @@
/* invalid */
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa;"
"leaf l {type empty; default x;}}", LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("Invalid default - value does not fit the type (Invalid empty value \"x\".).", "/aa:l");
+ CHECK_LOG_CTX("Invalid default - value does not fit the type (Invalid empty value \"x\".).", "Schema location /aa:l.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module bb {namespace urn:bb;prefix bb;typedef mytype {type empty; default x;}"
"leaf l {type mytype;}}", LYS_IN_YANG, NULL));
@@ -1989,7 +1989,7 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module cc {namespace urn:dd;prefix d;"
"container c {leaf l {status obsolete; type string;}}"
"container d {leaf m {when \"../../c/l\"; type string;}}}", LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("A current definition \"m\" is not allowed to reference obsolete definition \"l\".", "/cc:d/m");
+ CHECK_LOG_CTX("A current definition \"m\" is not allowed to reference obsolete definition \"l\".", "Schema location /cc:d/m.");
}
static void
@@ -2296,13 +2296,13 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ee {namespace urn:ee;prefix ee;import grp {prefix g;}"
"uses g:grp {refine c/l {mandatory true;}}}", LYS_IN_YANG, &mod));
- // CHECK_LOG_CTX("Invalid refine of mandatory - leaf already has \"default\" statement.", "/ee:{uses='g:grp'}/{refine='c/l'}");
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ee:{uses='g:grp'}/ee:c/l");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ee:{uses='g:grp'}/ee:c/l",
+ "Invalid mandatory leaf with a default value.", "/ee:{uses='g:grp'}/ee:c/l");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ef {namespace urn:ef;prefix ef;import grp {prefix g;}"
"uses g:grp {refine c/ch {mandatory true;}}}", LYS_IN_YANG, &mod));
- // CHECK_LOG_CTX("Invalid refine of mandatory - choice already has \"default\" statement.", "/ef:{uses='g:grp'}/{refine='c/ch'}");
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ef:{uses='g:grp'}/ef:c/ch");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ef:{uses='g:grp'}/ef:c/ch",
+ "Invalid mandatory choice with a default case.", "/ef:{uses='g:grp'}/ef:c/ch");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ff {namespace urn:ff;prefix ff;import grp {prefix g;}"
"uses g:grp {refine c/ch/ca/ca {mandatory true;}}}", LYS_IN_YANG, &mod));
@@ -2310,13 +2310,13 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module gg {namespace urn:gg;prefix gg;import grp {prefix g;}"
"uses g:grp {refine c/x {default hello;}}}", LYS_IN_YANG, &mod));
- // CHECK_LOG_CTX("Invalid refine of default - the node is mandatory.", "/gg:{uses='g:grp'}/{refine='c/x'}");
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/gg:{uses='g:grp'}/gg:c/x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/gg:{uses='g:grp'}/gg:c/x",
+ "Invalid mandatory leaf with a default value.", "/gg:{uses='g:grp'}/gg:c/x");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module hh {namespace urn:hh;prefix hh;import grp {prefix g;}"
"uses g:grp {refine c/c/l {config true;}}}", LYS_IN_YANG, &mod));
- // CHECK_LOG_CTX("Invalid refine of config - configuration node cannot be child of any state data node.", "/hh:{uses='g:grp'}/{refine='c/c/l'}");
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/hh:{uses='g:grp'}/hh:c/c/l");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/hh:{uses='g:grp'}/hh:c/c/l",
+ "Configuration node cannot be child of any state data node.", "/hh:{uses='g:grp'}/hh:c/c/l");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ii {namespace urn:ii;prefix ii;grouping grp {leaf l {type string; status deprecated;}}"
"uses grp {status obsolete;}}", LYS_IN_YANG, &mod));
@@ -2466,7 +2466,7 @@
assert_int_equal(LY_ENOTFOUND, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa; container c {leaf a {type string;}}"
"augment /x {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Augment target node \"/x\" from module \"aa\" was not found.", NULL);
+ CHECK_LOG_CTX("Augment target node \"/x\" from module \"aa\" was not found.", "/aa:{augment='/x'}");
assert_int_equal(LY_EEXIST, lys_parse_mem(UTEST_LYCTX, "module bb {namespace urn:bb;prefix bb; container c {leaf a {type string;}}"
"augment /c {leaf a {type int8;}}}", LYS_IN_YANG, &mod));
@@ -2873,7 +2873,7 @@
assert_int_equal(LY_ENOTFOUND, lys_parse_mem(UTEST_LYCTX, "module aa1 {namespace urn:aa1;prefix aa1;import a {prefix a;}"
"deviation /a:top/a:z {deviate not-supported;}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Deviation(s) target node \"/a:top/a:z\" from module \"aa1\" was not found.", NULL);
+ CHECK_LOG_CTX("Deviation(s) target node \"/a:top/a:z\" from module \"aa1\" was not found.", "/a:{deviation='/a:top/a:z'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa2 {namespace urn:aa2;prefix aa2;import a {prefix a;}"
"deviation /a:top/a:a {deviate not-supported;}"
@@ -2931,13 +2931,12 @@
CHECK_LOG_CTX("Invalid deviation adding \"default\" property which already exists (with value \"x:ba\").", "/gg1:{deviation='/e:b'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module gg2 {namespace urn:gg2;prefix gg2; import e {prefix e;}"
"deviation /e:a {deviate add {default x:a;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation adding \"default\" property \"x:a\" of choice. "
- "The prefix does not match any imported module of the deviation module. /gg2:{deviation='/e:a'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/e:a");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/e:a",
+ "Default case prefix \"x\" not found in imports of \"gg2\".", "/e:a");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module gg3 {namespace urn:gg3;prefix gg3; import e {prefix e;}"
"deviation /e:a {deviate add {default a;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation adding \"default\" property \"a\" of choice - the specified case does not exists.", "/gg3:{deviation='/e:a'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/e:a");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/e:a",
+ "Default case \"a\" not found.", "/e:a");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module gg4 {namespace urn:gg4;prefix gg4; import e {prefix e;}"
"deviation /e:c {deviate add {default hi;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid deviation adding \"default\" property which already exists (with value \"hello\").", "/gg4:{deviation='/e:c'}");
@@ -2947,8 +2946,8 @@
CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/e:a");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module gg5 {namespace urn:gg5;prefix gg5; leaf x {type string; mandatory true;}"
"deviation /x {deviate add {default error;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation combining default value and mandatory leaf.", "/gg5:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/gg5:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/gg5:{deviation='/x'}",
+ "Invalid mandatory leaf with a default value.", "/gg5:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module hh1 {yang-version 1.1; namespace urn:hh1;prefix hh1; import e {prefix e;}"
"deviation /e:d {deviate replace {default hi;}}}", LYS_IN_YANG, &mod));
@@ -2972,8 +2971,8 @@
CHECK_LOG_CTX("Invalid deviation of case node - it is not possible to add \"config\" property.", "/jj1:{deviation='/ch/a'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module jj2 {namespace urn:jj2;prefix jj2; container top {config false; leaf x {type string;}}"
"deviation /top/x {deviate add {config true;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation of config - configuration node cannot be child of any state data node.", "/jj2:{deviation='/top/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/jj2:top/x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/jj2:{deviation='/top/x'}",
+ "Configuration node cannot be child of any state data node.", "/jj2:{deviation='/top/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module jj3 {namespace urn:jj3;prefix jj3; container top {leaf x {type string;}}"
"deviation /top/x {deviate replace {config false;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid deviation replacing \"config\" property \"config false\" which is not present.", "/jj3:{deviation='/top/x'}");
@@ -2982,8 +2981,8 @@
CHECK_LOG_CTX("Invalid deviation of case node - it is not possible to replace \"config\" property.", "/jj4:{deviation='/ch/a'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module jj5 {namespace urn:jj5;prefix jj5; container top {leaf x {type string; config true;}}"
"deviation /top {deviate add {config false;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation of config - configuration node cannot be child of any state data node.", "/jj5:{deviation='/top'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/jj5:top");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/jj5:top",
+ "Configuration node cannot be child of any state data node.", "/jj5:top/x");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module jj6 {namespace urn:jj6;prefix jj6; leaf x {config false; type string;}"
"deviation /x {deviate add {config true;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid deviation adding \"config\" property which already exists (with value \"config false\").", "/jj6:{deviation='/x'}");
@@ -3003,33 +3002,33 @@
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ll1 {namespace urn:ll1;prefix ll1; leaf x {default test; type string;}"
"deviation /x {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation combining default value and mandatory leaf.", "/ll1:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ll1:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ll1:{deviation='/x'}",
+ "Invalid mandatory leaf with a default value.", "/ll1:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ll2 {yang-version 1.1; namespace urn:ll2;prefix ll2; leaf-list x {default test; type string;}"
"deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation combining default value and mandatory leaf-list.", "/ll2:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ll2:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ll2:{deviation='/x'}",
+ "The default statement is present on leaf-list with a nonzero min-elements.", "/ll2:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module ll2 {namespace urn:ll2;prefix ll2; choice ch {default a; leaf a {type string;} leaf b {type string;}}"
"deviation /ch {deviate add {mandatory true;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid deviation combining default case and mandatory choice.", "/ll2:{deviation='/ch'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ll2:ch");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/ll2:ch",
+ "Invalid mandatory choice with a default case.", "/ll2:ch");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module mm1 {namespace urn:mm1;prefix mm1; leaf-list x {min-elements 10; type string;}"
"deviation /x {deviate add {max-elements 5;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid combination of min-elements and max-elements after deviation: min value 10 is bigger than max value 5.", "/mm1:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm1:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm1:{deviation='/x'}",
+ "Leaf-list min-elements 10 is bigger than max-elements 5.", "/mm1:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module mm2 {namespace urn:mm2;prefix mm2; leaf-list x {max-elements 10; type string;}"
"deviation /x {deviate add {min-elements 20;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid combination of min-elements and max-elements after deviation: min value 20 is bigger than max value 10.", "/mm2:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm2:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm2:{deviation='/x'}",
+ "Leaf-list min-elements 20 is bigger than max-elements 10.", "/mm2:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module mm3 {namespace urn:mm3;prefix mm3; list x {min-elements 5; max-elements 10; config false;}"
"deviation /x {deviate replace {max-elements 1;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid combination of min-elements and max-elements after deviation: min value 5 is bigger than max value 1.", "/mm3:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm3:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm3:{deviation='/x'}",
+ "List min-elements 5 is bigger than max-elements 1.", "/mm3:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module mm4 {namespace urn:mm4;prefix mm4; list x {min-elements 5; max-elements 10; config false;}"
"deviation /x {deviate replace {min-elements 20;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Invalid combination of min-elements and max-elements after deviation: min value 20 is bigger than max value 10.", "/mm4:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm4:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/mm4:{deviation='/x'}",
+ "List min-elements 20 is bigger than max-elements 10.", "/mm4:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module mm5 {namespace urn:mm5;prefix mm5; leaf-list x {type string; min-elements 5;}"
"deviation /x {deviate add {min-elements 1;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid deviation adding \"min-elements\" property which already exists (with value \"5\").", "/mm5:{deviation='/x'}");
@@ -3060,27 +3059,27 @@
CHECK_LOG_CTX("Invalid deviation of anyxml node - it is not possible to replace \"type\" property.", "/nn1:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module nn2 {namespace urn:nn2;prefix nn2; leaf-list x {type string;}"
"deviation /x {deviate replace {type empty;}}}", LYS_IN_YANG, &mod));
- /*CHECK_LOG_CTX("Leaf-list of type \"empty\" is allowed only in YANG 1.1 modules.", "/nn2:{deviation='/x'}");*/
- CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/nn2:x");
+ CHECK_LOG_CTX("Compilation of a deviated and/or refined node failed.", "/nn2:{deviation='/x'}",
+ "Leaf-list of type \"empty\" is allowed only in YANG 1.1 modules.", "/nn2:{deviation='/x'}");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module oo1 {namespace urn:oo1;prefix oo1; leaf x {type uint16; default 300;}"
"deviation /x {deviate replace {type uint8;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid default - value does not fit the type "
- "(Value \"300\" is out of uint8's min/max bounds.).", "/oo1:x");
+ "(Value \"300\" is out of uint8's min/max bounds.).", "Schema location /oo1:x.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module oo2 {yang-version 1.1;namespace urn:oo2;prefix oo2; leaf-list x {type uint16; default 10; default 300;}"
"deviation /x {deviate replace {type uint8;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid default - value does not fit the type "
- "(Value \"300\" is out of uint8's min/max bounds.).", "/oo2:x");
+ "(Value \"300\" is out of uint8's min/max bounds.).", "Schema location /oo2:x.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module oo3 {namespace urn:oo3;prefix oo3; leaf x {type uint8;}"
"deviation /x {deviate add {default 300;}}}", LYS_IN_YANG, &mod));
CHECK_LOG_CTX("Invalid default - value does not fit the type "
- "(Value \"300\" is out of uint8's min/max bounds.).", "/oo3:x");
+ "(Value \"300\" is out of uint8's min/max bounds.).", "Schema location /oo3:x.");
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module pp {namespace urn:pp;prefix pp; leaf l { type leafref {path /c/x;}}"
"container c {leaf x {type string;} leaf y {type string;}}}", LYS_IN_YANG, &mod));
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module pp1 {namespace urn:pp1;prefix pp1; import pp {prefix pp;}"
"deviation /pp:c/pp:x {deviate not-supported;}}", LYS_IN_YANG, &mod));
- CHECK_LOG_CTX("Not found node \"x\" in path.", "/pp:l");
+ CHECK_LOG_CTX("Not found node \"x\" in path.", "Schema location /pp:l.");
}
static void
@@ -3112,7 +3111,7 @@
" }\n"
"}",
LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("When condition of \"val\" includes a self-reference (referenced by when of \"cont2\").", "/a:cont/lst/val");
+ CHECK_LOG_CTX("When condition includes a self-reference.", "Schema location /a:cont/lst/val.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX,
"module a {\n"
@@ -3140,7 +3139,7 @@
" }\n"
"}",
LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("When condition of \"val\" includes a self-reference (referenced by when of \"cont2\").", "/a:cont/lst/val");
+ CHECK_LOG_CTX("When condition includes a self-reference.", "Schema location /a:cont/lst/val.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX,
"module a {\n"
@@ -3152,7 +3151,7 @@
" }\n"
"}",
LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("When condition of \"val\" is accessing its own conditional node.", "/a:val");
+ CHECK_LOG_CTX("When condition is accessing its own conditional node.", "Schema location /a:val.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX,
"module a {\n"
@@ -3168,7 +3167,7 @@
" }\n"
"}",
LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("When condition of \"val\" is accessing its own conditional node.", "/a:val");
+ CHECK_LOG_CTX("When condition is accessing its own conditional node.", "Schema location /a:val.");
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX,
"module a {\n"
@@ -3183,7 +3182,7 @@
" container cont;\n"
"}",
LYS_IN_YANG, NULL));
- CHECK_LOG_CTX("When condition of \"val\" is accessing its own conditional node.", "/a:cont/val");
+ CHECK_LOG_CTX("When condition is accessing its own conditional node.", "Schema location /a:cont/val.");
}
int