schema CHANGE unify actions, inouts and notification with lys*_node
diff --git a/tests/utests/data/test_parser_json.c b/tests/utests/data/test_parser_json.c
index aa11927..b71e9b8 100644
--- a/tests/utests/data/test_parser_json.c
+++ b/tests/utests/data/test_parser_json.c
@@ -441,12 +441,12 @@
assert_non_null(op);
- CHECK_LYSC_ACTION((struct lysc_action *)op->schema, dsc, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, dsc, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "edit-config", LYS_RPC,
0, 0, 0, 0, 0, ref, 0);
node = tree;
- CHECK_LYSC_ACTION((struct lysc_action *)node->schema, dsc, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)node->schema, dsc, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "edit-config", LYS_RPC,
0, 0, 0, 0, 0, ref, 0);
node = lyd_child(node)->next;
@@ -483,7 +483,7 @@
ly_in_free(in, 0);
assert_non_null(op);
- CHECK_LYSC_ACTION((struct lysc_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "act", LYS_ACTION,
1, 0, 0, 1, 0, NULL, 0);
@@ -507,7 +507,7 @@
ly_in_free(in, 0);
assert_non_null(ntf);
- CHECK_LYSC_NOTIF((struct lysc_notif *)ntf->schema, 1, NULL, 0, 0x4, 1, 0, "n1", 1, 0, NULL, 0);
+ CHECK_LYSC_NOTIF((struct lysc_node_notif *)ntf->schema, 1, NULL, 0, 0x4, 1, 0, "n1", 1, 0, NULL, 0);
CHECK_LYSC_NODE(tree->schema, NULL, 0, LYS_CONFIG_W | LYS_STATUS_CURR, 1, "c", 1, LYS_CONTAINER, 0, 0, NULL, 0);
@@ -520,7 +520,7 @@
ly_in_free(in, 0);
assert_non_null(ntf);
- CHECK_LYSC_NOTIF((struct lysc_notif *)ntf->schema, 0, NULL, 0, 0x4, 1, 0, "n2", 0, 0, NULL, 0);
+ CHECK_LYSC_NOTIF((struct lysc_node_notif *)ntf->schema, 0, NULL, 0, 0x4, 1, 0, "n2", 0, 0, NULL, 0);
assert_non_null(tree);
assert_ptr_equal(ntf, tree);
@@ -546,7 +546,7 @@
ly_in_free(in, 0);
assert_non_null(op);
- CHECK_LYSC_ACTION((struct lysc_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "act", LYS_ACTION,
1, 0, 0, 1, 0, NULL, 0);
node = lyd_child(op);
diff --git a/tests/utests/data/test_parser_xml.c b/tests/utests/data/test_parser_xml.c
index a74bc7a..d2cbca4 100644
--- a/tests/utests/data/test_parser_xml.c
+++ b/tests/utests/data/test_parser_xml.c
@@ -326,14 +326,14 @@
assert_non_null(op);
- CHECK_LYSC_ACTION((struct lysc_action *)op->schema, dsc, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, dsc, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "edit-config", LYS_RPC,
0, 0, 0, 0, 0, ref, 0);
assert_non_null(tree);
node = tree;
- CHECK_LYSC_ACTION((struct lysc_action *)node->schema, dsc, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)node->schema, dsc, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "edit-config", LYS_RPC,
0, 0, 0, 0, 0, ref, 0);
node = lyd_child(node)->next;
@@ -391,7 +391,7 @@
ly_in_free(in, 0);
assert_non_null(op);
- CHECK_LYSC_ACTION((struct lysc_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "act", LYS_ACTION,
1, 0, 0, 1, 0, NULL, 0);
@@ -425,7 +425,7 @@
ly_in_free(in, 0);
assert_non_null(ntf);
- CHECK_LYSC_NOTIF((struct lysc_notif *)ntf->schema, 1, NULL, 0, 0x4, 1, 0, "n1", 1, 0, NULL, 0);
+ CHECK_LYSC_NOTIF((struct lysc_node_notif *)ntf->schema, 1, NULL, 0, 0x4, 1, 0, "n1", 1, 0, NULL, 0);
CHECK_LYSC_NODE(tree->schema, NULL, 0, LYS_CONFIG_W | LYS_STATUS_CURR, 1, "c", 1, LYS_CONTAINER, 0, 0, NULL, 0);
@@ -439,7 +439,7 @@
ly_in_free(in, 0);
assert_non_null(ntf);
- CHECK_LYSC_NOTIF((struct lysc_notif *)ntf->schema, 0, NULL, 0, 0x4, 1, 0, "n2", 0, 0, NULL, 0);
+ CHECK_LYSC_NOTIF((struct lysc_node_notif *)ntf->schema, 0, NULL, 0, 0x4, 1, 0, "n2", 0, 0, NULL, 0);
assert_non_null(tree);
assert_ptr_equal(ntf, tree);
@@ -470,7 +470,7 @@
assert_non_null(op);
- CHECK_LYSC_ACTION((struct lysc_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
+ CHECK_LYSC_ACTION((struct lysc_node_action *)op->schema, NULL, 0, LYS_STATUS_CURR,
1, 0, 0, 1, "act", LYS_ACTION,
1, 0, 0, 1, 0, NULL, 0);
node = lyd_child(op);
diff --git a/tests/utests/data/test_validation.c b/tests/utests/data/test_validation.c
index df6404c..c06c474 100644
--- a/tests/utests/data/test_validation.c
+++ b/tests/utests/data/test_validation.c
@@ -1087,7 +1087,7 @@
/* 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\".",
- "Schema location /j:cont/l1/act/lf2, data location /j:cont/l1[k='val1']/act/lf2.");
+ "Schema location /j:cont/l1/act/input/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"
@@ -1139,7 +1139,7 @@
/* 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\".",
- "Schema location /j:cont/l1/act/lf2, data location /j:cont/l1[k='val1']/act/lf2.");
+ "Schema location /j:cont/l1/act/output/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"
diff --git a/tests/utests/schema/test_parser_yang.c b/tests/utests/schema/test_parser_yang.c
index 66dba0d..1aa43e3 100644
--- a/tests/utests/schema/test_parser_yang.c
+++ b/tests/utests/schema/test_parser_yang.c
@@ -27,10 +27,8 @@
/* originally static functions from tree_schema_free.c and parser_yang.c */
void lysp_ext_instance_free(struct ly_ctx *ctx, struct lysp_ext_instance *ext);
void lysp_deviation_free(struct ly_ctx *ctx, struct lysp_deviation *dev);
-void lysp_grp_free(struct ly_ctx *ctx, struct lysp_grp *grp);
-void lysp_action_free(struct ly_ctx *ctx, struct lysp_action *action);
-void lysp_notif_free(struct ly_ctx *ctx, struct lysp_notif *notif);
-void lysp_augment_free(struct ly_ctx *ctx, struct lysp_augment *augment);
+void lysp_grp_free(struct ly_ctx *ctx, struct lysp_node_grp *grp);
+void lysp_augment_free(struct ly_ctx *ctx, struct lysp_node_augment *augment);
void lysp_deviate_free(struct ly_ctx *ctx, struct lysp_deviate *d);
void lysp_node_free(struct ly_ctx *ctx, struct lysp_node *node);
void lysp_when_free(struct ly_ctx *ctx, struct lysp_when *when);
@@ -43,14 +41,14 @@
uint16_t *flags, char **word_p, char **word_b, size_t *word_len);
LY_ERR skip_comment(struct lys_yang_parser_ctx *ctx, uint8_t comment);
-LY_ERR parse_action(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_action **actions);
+LY_ERR parse_action(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_action **actions);
LY_ERR parse_any(struct lys_yang_parser_ctx *ctx, enum ly_stmt kw, struct lysp_node *parent, struct lysp_node **siblings);
-LY_ERR parse_augment(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_augment **augments);
+LY_ERR parse_augment(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_augment **augments);
LY_ERR parse_case(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
LY_ERR parse_container(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
LY_ERR parse_deviate(struct lys_yang_parser_ctx *ctx, struct lysp_deviate **deviates);
LY_ERR parse_deviation(struct lys_yang_parser_ctx *ctx, struct lysp_deviation **deviations);
-LY_ERR parse_grouping(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_grp **groupings);
+LY_ERR parse_grouping(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_grp **groupings);
LY_ERR parse_choice(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
LY_ERR parse_leaf(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
LY_ERR parse_leaflist(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
@@ -58,7 +56,7 @@
LY_ERR parse_maxelements(struct lys_yang_parser_ctx *ctx, uint32_t *max, uint16_t *flags, struct lysp_ext_instance **exts);
LY_ERR parse_minelements(struct lys_yang_parser_ctx *ctx, uint32_t *min, uint16_t *flags, struct lysp_ext_instance **exts);
LY_ERR parse_module(struct lys_yang_parser_ctx *ctx, struct lysp_module *mod);
-LY_ERR parse_notif(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_notif **notifs);
+LY_ERR parse_notif(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node_notif **notifs);
LY_ERR parse_submodule(struct lys_yang_parser_ctx *ctx, struct lysp_submodule *submod);
LY_ERR parse_uses(struct lys_yang_parser_ctx *ctx, struct lysp_node *parent, struct lysp_node **siblings);
LY_ERR parse_when(struct lys_yang_parser_ctx *ctx, struct lysp_when **when_p);
@@ -1291,7 +1289,7 @@
static void
test_grouping(void **state)
{
- struct lysp_grp *grp = NULL;
+ struct lysp_node_grp *grp = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
@@ -1300,7 +1298,7 @@
in.current = "l {" MEMBER" "VALUE1";"MEMBER" "VALUE2";} ..."; \
assert_int_equal(LY_EVALID, parse_grouping(YCTX, NULL, &grp)); \
CHECK_LOG_CTX("Duplicate keyword \""MEMBER"\".", "Line number 1."); \
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, grp, lysp_grp_free); grp = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, &grp->node); grp = NULL;
TEST_DUP("description", "text1", "text2");
TEST_DUP("reference", "1", "2");
@@ -1320,24 +1318,27 @@
assert_null(grp->parent);
assert_int_equal(LYS_STATUS_CURR, grp->flags);
ly_set_erase(&YCTX->tpdfs_nodes, NULL);
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, grp, lysp_grp_free); grp = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, &grp->node);
+ grp = NULL;
/* invalid content */
in.current = "grp {config true} ...";
assert_int_equal(LY_EVALID, parse_grouping(YCTX, NULL, &grp));
CHECK_LOG_CTX("Invalid keyword \"config\" as a child of \"grouping\".", "Line number 1.");
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, grp, lysp_grp_free); grp = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, &grp->node);
+ grp = NULL;
in.current = "grp {must 'expr'} ...";
assert_int_equal(LY_EVALID, parse_grouping(YCTX, NULL, &grp));
CHECK_LOG_CTX("Invalid keyword \"must\" as a child of \"grouping\".", "Line number 1.");
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, grp, lysp_grp_free); grp = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, &grp->node);
+ grp = NULL;
}
static void
test_action(void **state)
{
- struct lysp_action *rpcs = NULL;
+ struct lysp_node_action *rpcs = NULL;
struct lysp_node_container *c = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
@@ -1347,7 +1348,7 @@
in.current = "func {" MEMBER" "VALUE1";"MEMBER" "VALUE2";} ..."; \
assert_int_equal(LY_EVALID, parse_action(YCTX, NULL, &rpcs)); \
CHECK_LOG_CTX("Duplicate keyword \""MEMBER"\".", "Line number 1."); \
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, rpcs, lysp_action_free); rpcs = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node*)rpcs); rpcs = NULL;
TEST_DUP("description", "text1", "text2");
TEST_DUP("input", "{leaf l1 {type empty;}} description a", "{leaf l2 {type empty;}} description a");
@@ -1391,13 +1392,13 @@
assert_non_null(rpcs->output.data);
ly_set_erase(&YCTX->tpdfs_nodes, NULL);
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, rpcs, lysp_action_free); rpcs = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)rpcs); rpcs = NULL;
/* invalid content */
in.current = "func {config true} ...";
assert_int_equal(LY_EVALID, parse_action(YCTX, NULL, &rpcs));
CHECK_LOG_CTX("Invalid keyword \"config\" as a child of \"rpc\".", "Line number 1.");
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, rpcs, lysp_action_free); rpcs = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)rpcs); rpcs = NULL;
lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)c);
}
@@ -1405,7 +1406,7 @@
static void
test_notification(void **state)
{
- struct lysp_notif *notifs = NULL;
+ struct lysp_node_notif *notifs = NULL;
struct lysp_node_container *c = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
@@ -1415,7 +1416,7 @@
in.current = "func {" MEMBER" "VALUE1";"MEMBER" "VALUE2";} ..."; \
assert_int_equal(LY_EVALID, parse_notif(YCTX, NULL, ¬ifs)); \
CHECK_LOG_CTX("Duplicate keyword \""MEMBER"\".", "Line number 1."); \
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, notifs, lysp_notif_free); notifs = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node*)notifs); notifs = NULL;
TEST_DUP("description", "text1", "text2");
TEST_DUP("reference", "1", "2");
@@ -1442,13 +1443,13 @@
assert_int_equal(LYS_STATUS_CURR, notifs->flags);
ly_set_erase(&YCTX->tpdfs_nodes, NULL);
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, notifs, lysp_notif_free); notifs = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)notifs); notifs = NULL;
/* invalid content */
in.current = "ntf {config true} ...";
assert_int_equal(LY_EVALID, parse_notif(YCTX, NULL, ¬ifs));
CHECK_LOG_CTX("Invalid keyword \"config\" as a child of \"notification\".", "Line number 1.");
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, notifs, lysp_notif_free); notifs = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)notifs); notifs = NULL;
lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)c);
}
@@ -1485,7 +1486,7 @@
static void
test_augment(void **state)
{
- struct lysp_augment *a = NULL;
+ struct lysp_node_augment *a = NULL;
YCTX->parsed_mod->version = 2; /* simulate YANG 1.1 */
@@ -1494,7 +1495,7 @@
in.current = "l {" MEMBER" "VALUE1";"MEMBER" "VALUE2";} ..."; \
assert_int_equal(LY_EVALID, parse_augment(YCTX, NULL, &a)); \
CHECK_LOG_CTX("Duplicate keyword \""MEMBER"\".", "Line number 1."); \
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, a, lysp_augment_free); a = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)a); a = NULL;
TEST_DUP("description", "text1", "text2");
TEST_DUP("reference", "1", "2");
@@ -1516,7 +1517,7 @@
assert_non_null(a->when);
assert_null(a->parent);
assert_int_equal(LYS_STATUS_CURR, a->flags);
- FREE_ARRAY(YCTX->parsed_mod->mod->ctx, a, lysp_augment_free); a = NULL;
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)a); a = NULL;
}
static void
diff --git a/tests/utests/schema/test_parser_yin.c b/tests/utests/schema/test_parser_yin.c
index 5adcf3a..8fa9914 100644
--- a/tests/utests/schema/test_parser_yin.c
+++ b/tests/utests/schema/test_parser_yin.c
@@ -70,7 +70,7 @@
struct inout_meta {
struct lysp_node *parent; /**< Parent node. */
- struct lysp_action_inout *inout_p; /**< inout_p Input/output pointer to write to. */
+ struct lysp_node_action_inout *inout_p; /**< inout_p Input/output pointer to write to. */
};
struct minmax_dev_meta {
@@ -110,11 +110,8 @@
void lysp_include_free(struct ly_ctx *ctx, struct lysp_include *include);
void lysp_feature_free(struct ly_ctx *ctx, struct lysp_feature *feat);
void lysp_ident_free(struct ly_ctx *ctx, struct lysp_ident *ident);
-void lysp_notif_free(struct ly_ctx *ctx, struct lysp_notif *notif);
-void lysp_grp_free(struct ly_ctx *ctx, struct lysp_grp *grp);
-void lysp_action_inout_free(struct ly_ctx *ctx, struct lysp_action_inout *inout);
-void lysp_action_free(struct ly_ctx *ctx, struct lysp_action *action);
-void lysp_augment_free(struct ly_ctx *ctx, struct lysp_augment *augment);
+void lysp_grp_free(struct ly_ctx *ctx, struct lysp_node_grp *grp);
+void lysp_augment_free(struct ly_ctx *ctx, struct lysp_node_augment *augment);
void lysp_deviate_free(struct ly_ctx *ctx, struct lysp_deviate *d);
void lysp_deviation_free(struct ly_ctx *ctx, struct lysp_deviation *dev);
void lysp_import_free(struct ly_ctx *ctx, struct lysp_import *import);
@@ -2603,7 +2600,7 @@
test_notification_elem(void **state)
{
const char *data;
- struct lysp_notif *notifs = NULL;
+ struct lysp_node_notif *notifs = NULL;
struct tree_node_meta notif_meta = {NULL, (struct lysp_node **)¬ifs};
/* max subelems */
@@ -2657,14 +2654,14 @@
assert_string_equal(notifs->ref, "ref");
assert_string_equal(notifs->typedefs->name, "tpdf");
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(notifs->exts[0]), LYEXT_SUBSTMT_SELF);
- FREE_ARRAY(UTEST_LYCTX, notifs, lysp_notif_free);
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)notifs);
notifs = NULL;
/* min subelems */
data = ELEMENT_WRAPPER_START "<notification name=\"notif-name\" />" ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, ¬if_meta, NULL, NULL), LY_SUCCESS);
assert_string_equal(notifs->name, "notif-name");
- FREE_ARRAY(UTEST_LYCTX, notifs, lysp_notif_free);
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)notifs);
notifs = NULL;
}
@@ -2672,7 +2669,7 @@
test_grouping_elem(void **state)
{
const char *data;
- struct lysp_grp *grps = NULL;
+ struct lysp_node_grp *grps = NULL;
struct tree_node_meta grp_meta = {NULL, (struct lysp_node **)&grps};
/* max subelems */
@@ -2719,14 +2716,14 @@
assert_string_equal(grps->data->next->next->next->next->next->next->next->name, "choice");
assert_int_equal(grps->data->next->next->next->next->next->next->next->nodetype, LYS_CHOICE);
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(grps->exts[0]), LYEXT_SUBSTMT_SELF);
- FREE_ARRAY(UTEST_LYCTX, grps, lysp_grp_free);
+ lysp_node_free(UTEST_LYCTX, &grps->node);
grps = NULL;
/* min subelems */
data = ELEMENT_WRAPPER_START "<grouping name=\"grp-name\" />" ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, &grp_meta, NULL, NULL), LY_SUCCESS);
assert_string_equal(grps->name, "grp-name");
- FREE_ARRAY(UTEST_LYCTX, grps, lysp_grp_free);
+ lysp_node_free(UTEST_LYCTX, &grps->node);
grps = NULL;
}
@@ -2954,7 +2951,7 @@
test_inout_elem(void **state)
{
const char *data;
- struct lysp_action_inout inout = {};
+ struct lysp_node_action_inout inout = {};
struct inout_meta inout_meta = {NULL, &inout};
/* max subelements */
@@ -2998,7 +2995,7 @@
assert_int_equal(inout.data->next->next->next->next->next->next->next->nodetype, LYS_USES);
assert_null(inout.data->next->next->next->next->next->next->next->next);
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(inout.exts[0]), LYEXT_SUBSTMT_SELF);
- lysp_action_inout_free(UTEST_LYCTX, &inout);
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)&inout);
memset(&inout, 0, sizeof inout);
/* max subelements */
@@ -3042,18 +3039,18 @@
assert_int_equal(inout.data->next->next->next->next->next->next->next->nodetype, LYS_USES);
assert_null(inout.data->next->next->next->next->next->next->next->next);
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(inout.exts[0]), LYEXT_SUBSTMT_SELF);
- lysp_action_inout_free(UTEST_LYCTX, &inout);
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)&inout);
memset(&inout, 0, sizeof inout);
/* min subelems */
data = ELEMENT_WRAPPER_START "<input><leaf name=\"l\"><type name=\"empty\"/></leaf></input>" ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, &inout_meta, NULL, NULL), LY_SUCCESS);
- lysp_action_inout_free(UTEST_LYCTX, &inout);
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)&inout);
memset(&inout, 0, sizeof inout);
data = ELEMENT_WRAPPER_START "<output><leaf name=\"l\"><type name=\"empty\"/></leaf></output>" ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, &inout_meta, NULL, NULL), LY_SUCCESS);
- lysp_action_inout_free(UTEST_LYCTX, &inout);
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)&inout);
memset(&inout, 0, sizeof inout);
/* invalid combinations */
@@ -3067,7 +3064,7 @@
test_action_elem(void **state)
{
const char *data;
- struct lysp_action *actions = NULL;
+ struct lysp_node_action *actions = NULL;
struct tree_node_meta act_meta = {NULL, (struct lysp_node **)&actions};
uint16_t flags;
@@ -3105,7 +3102,7 @@
assert_string_equal(actions->output.musts->arg.str, "cond");
assert_string_equal(actions->input.data->name, "uses-name");
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(actions->exts[0]), LYEXT_SUBSTMT_SELF);
- FREE_ARRAY(UTEST_LYCTX, actions, lysp_action_free)
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)actions);
actions = NULL;
YCTX->parsed_mod->version = LYS_VERSION_1_1;
@@ -3138,14 +3135,14 @@
assert_string_equal(actions->input.data->name, "uses-name");
assert_string_equal(actions->output.musts->arg.str, "cond");
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(actions->exts[0]), LYEXT_SUBSTMT_SELF);
- FREE_ARRAY(UTEST_LYCTX, actions, lysp_action_free)
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)actions);
actions = NULL;
/* min subelems */
data = ELEMENT_WRAPPER_START "<action name=\"act\" />" ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, &act_meta, NULL, NULL), LY_SUCCESS);
assert_string_equal(actions->name, "act");
- FREE_ARRAY(UTEST_LYCTX, actions, lysp_action_free)
+ lysp_node_free(UTEST_LYCTX, (struct lysp_node *)actions);
actions = NULL;
}
@@ -3153,7 +3150,7 @@
test_augment_elem(void **state)
{
const char *data;
- struct lysp_augment *augments = NULL;
+ struct lysp_node_augment *augments = NULL;
struct tree_node_meta aug_meta = {NULL, (struct lysp_node **)&augments};
YCTX->parsed_mod->version = LYS_VERSION_1_1;
@@ -3209,13 +3206,13 @@
assert_string_equal(augments->actions->name, "action");
assert_string_equal(augments->notifs->name, "notif");
TEST_1_CHECK_LYSP_EXT_INSTANCE(&(augments->exts[0]), LYEXT_SUBSTMT_SELF);
- FREE_ARRAY(UTEST_LYCTX, augments, lysp_augment_free)
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)augments);
augments = NULL;
data = ELEMENT_WRAPPER_START "<augment target-node=\"target\" />" ELEMENT_WRAPPER_END;
assert_int_equal(test_element_helper(state, data, &aug_meta, NULL, NULL), LY_SUCCESS);
assert_string_equal(augments->nodeid, "target");
- FREE_ARRAY(UTEST_LYCTX, augments, lysp_augment_free)
+ lysp_node_free(YCTX->parsed_mod->mod->ctx, (struct lysp_node *)augments);
augments = NULL;
}
diff --git a/tests/utests/schema/test_schema_common.c b/tests/utests/schema/test_schema_common.c
index 8d9e42e..6885e0c 100644
--- a/tests/utests/schema/test_schema_common.c
+++ b/tests/utests/schema/test_schema_common.c
@@ -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.", "Schema location /h:rp/l2.");
+ CHECK_LOG_CTX("Not found node \"l\" in path.", "Schema location /h:rp/input/l2.");
/* rpc input -> rpc output must */
str = "module h {\n"
@@ -501,7 +501,7 @@
" }\n"
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_SUCCESS);
- CHECK_LOG_CTX("Schema node \"l\" not found (\"../l\") with context node \"/h:rp/l2\".", NULL);
+ CHECK_LOG_CTX("Schema node \"l\" not found (\"../l\") with context node \"/h:rp/input/l2\".", NULL);
/* rpc input -> notif leafref */
str = "module i {\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.", "Schema location /i:rp/l2.");
+ CHECK_LOG_CTX("Not found node \"notif\" in path.", "Schema location /i:rp/input/l2.");
/* rpc input -> notif must */
str = "module i {\n"
@@ -544,7 +544,7 @@
" }\n"
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_SUCCESS);
- CHECK_LOG_CTX("Schema node \"l\" not found (\"/notif/l\") with context node \"/i:rp/l2\".", NULL);
+ CHECK_LOG_CTX("Schema node \"l\" not found (\"/notif/l\") with context node \"/i:rp/input/l2\".", NULL);
/* action output -> state */
str = "module j {\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.", "Schema location /k:cont/ll/act/l2.");
+ CHECK_LOG_CTX("Not found node \"l\" in path.", "Schema location /k:cont/ll/act/output/l2.");
/* action output -> action input must */
str = "module k {\n"
@@ -636,7 +636,7 @@
" }\n"
"}";
assert_int_equal(lys_parse_mem(UTEST_LYCTX, str, LYS_IN_YANG, NULL), LY_SUCCESS);
- CHECK_LOG_CTX("Schema node \"l\" not found (\"/cont/ll/act/l\") with context node \"/k:cont/ll/act/l2\".", NULL);
+ CHECK_LOG_CTX("Schema node \"l\" not found (\"/cont/ll/act/l\") with context node \"/k:cont/ll/act/output/l2\".", NULL);
}
struct module_clb_list {
diff --git a/tests/utests/schema/test_tree_schema_compile.c b/tests/utests/schema/test_tree_schema_compile.c
index 58b2526..aa3ebc0 100644
--- a/tests/utests/schema/test_tree_schema_compile.c
+++ b/tests/utests/schema/test_tree_schema_compile.c
@@ -546,13 +546,13 @@
test_action(void **state)
{
const struct lys_module *mod;
- const struct lysc_action *rpc;
+ const struct lysc_node_action *rpc;
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module a {namespace urn:a;prefix a;"
"rpc a {input {leaf x {type int8;} leaf y {type int8;}} output {leaf result {type int16;}}}}", LYS_IN_YANG, &mod));
rpc = mod->compiled->rpcs;
assert_non_null(rpc);
- assert_int_equal(1, LY_ARRAY_COUNT(rpc));
+ assert_null(rpc->next);
assert_int_equal(LYS_RPC, rpc->nodetype);
assert_int_equal(LYS_STATUS_CURR, rpc->flags);
assert_string_equal("a", rpc->name);
@@ -563,7 +563,7 @@
"augment /top/b/output {leaf result2 {type string;}}}", LYS_IN_YANG, &mod));
rpc = lysc_node_actions(mod->compiled->data);
assert_non_null(rpc);
- assert_int_equal(1, LY_ARRAY_COUNT(rpc));
+ assert_null(rpc->next);
assert_int_equal(LYS_ACTION, rpc->nodetype);
assert_int_equal(LYS_STATUS_CURR, rpc->flags);
assert_string_equal("b", rpc->name);
@@ -603,38 +603,42 @@
test_notification(void **state)
{
const struct lys_module *mod;
- const struct lysc_notif *notif;
+ const struct lysc_node_notif *notif;
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module a {namespace urn:a;prefix a;"
"notification a1 {leaf x {type int8;}} notification a2;}", LYS_IN_YANG, &mod));
notif = mod->compiled->notifs;
assert_non_null(notif);
- assert_int_equal(2, LY_ARRAY_COUNT(notif));
+ assert_non_null(notif->next);
+ assert_null(notif->next->next);
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("a1", notif->name);
assert_non_null(notif->data);
assert_string_equal("x", notif->data->name);
- assert_int_equal(LYS_NOTIF, notif[1].nodetype);
- assert_int_equal(LYS_STATUS_CURR, notif[1].flags);
- assert_string_equal("a2", notif[1].name);
- assert_null(notif[1].data);
+ notif = notif->next;
+ assert_int_equal(LYS_NOTIF, notif->nodetype);
+ assert_int_equal(LYS_STATUS_CURR, notif->flags);
+ assert_string_equal("a2", notif->name);
+ assert_null(notif->data);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module b {yang-version 1.1; namespace urn:b;prefix b; container top {"
"notification b1 {leaf x {type int8;}} notification b2 {must \"/top\";}}}", LYS_IN_YANG, &mod));
notif = lysc_node_notifs(mod->compiled->data);
assert_non_null(notif);
- assert_int_equal(2, LY_ARRAY_COUNT(notif));
+ assert_non_null(notif->next);
+ assert_null(notif->next->next);
assert_int_equal(LYS_NOTIF, notif->nodetype);
assert_int_equal(LYS_STATUS_CURR, notif->flags);
assert_string_equal("b1", notif->name);
assert_non_null(notif->data);
assert_string_equal("x", notif->data->name);
- assert_int_equal(LYS_NOTIF, notif[1].nodetype);
- assert_int_equal(LYS_STATUS_CURR, notif[1].flags);
- assert_string_equal("b2", notif[1].name);
- assert_null(notif[1].data);
- assert_int_equal(1, LY_ARRAY_COUNT(notif[1].musts));
+ notif = notif->next;
+ assert_int_equal(LYS_NOTIF, notif->nodetype);
+ assert_int_equal(LYS_STATUS_CURR, notif->flags);
+ assert_string_equal("b2", notif->name);
+ assert_null(notif->data);
+ assert_int_equal(1, LY_ARRAY_COUNT(notif->musts));
/* invalid */
assert_int_equal(LY_EVALID, lys_parse_mem(UTEST_LYCTX, "module aa {namespace urn:aa;prefix aa;container top {notification x;}}",
@@ -2088,20 +2092,22 @@
assert_non_null(mod->compiled->data);
cont = (const struct lysc_node_container *)mod->compiled->data;
assert_non_null(cont->actions);
- assert_int_equal(2, LY_ARRAY_COUNT(cont->actions));
- assert_string_equal("e", cont->actions[1].name);
- assert_string_equal("g", cont->actions[0].name);
- assert_string_equal("ultra g", cont->actions[0].dsc);
+ assert_non_null(cont->actions->next);
+ assert_null(cont->actions->next->next);
+ assert_string_equal("e", cont->actions->next->name);
+ assert_string_equal("g", cont->actions->name);
+ assert_string_equal("ultra g", cont->actions->dsc);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module f {yang-version 1.1;namespace urn:f;prefix f; grouping grp {notification g { description \"super g\";}}"
"container top {notification f; uses grp {refine g {description \"ultra g\";}}}}", LYS_IN_YANG, &mod));
assert_non_null(mod->compiled->data);
cont = (const struct lysc_node_container *)mod->compiled->data;
assert_non_null(cont->notifs);
- assert_int_equal(2, LY_ARRAY_COUNT(cont->notifs));
- assert_string_equal("f", cont->notifs[1].name);
- assert_string_equal("g", cont->notifs[0].name);
- assert_string_equal("ultra g", cont->notifs[0].dsc);
+ assert_non_null(cont->notifs->next);
+ assert_null(cont->notifs->next->next);
+ assert_string_equal("f", cont->notifs->next->name);
+ assert_string_equal("g", cont->notifs->name);
+ assert_string_equal("ultra g", cont->notifs->dsc);
/* empty grouping */
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module g {namespace urn:g;prefix g; grouping grp; uses grp;}", LYS_IN_YANG, &mod));
@@ -2348,8 +2354,7 @@
const struct lysc_node_choice *ch;
const struct lysc_node_case *c;
const struct lysc_node_container *cont;
- const struct lysc_action *rpc;
- const struct lysc_notif *notif;
+ const struct lysc_node_action *rpc;
ly_ctx_set_module_imp_clb(UTEST_LYCTX, test_imp_clb, "module a {namespace urn:a;prefix a; typedef atype {type string;}"
"container top {leaf a {type string;}}}");
@@ -2444,7 +2449,7 @@
"augment /hi:func/hi:output {leaf y {type string;}}}", LYS_IN_YANG, NULL));
assert_non_null(mod = ly_ctx_get_module_implemented(UTEST_LYCTX, "himp"));
assert_non_null(rpc = mod->compiled->rpcs);
- assert_int_equal(1, LY_ARRAY_COUNT(rpc));
+ assert_null(rpc->next);
assert_non_null(rpc->input.data);
assert_string_equal("x", rpc->input.data->name);
assert_null(rpc->input.data->next);
@@ -2457,8 +2462,8 @@
"augment /root {uses grp;}}", LYS_IN_YANG, &mod));
assert_non_null(cont = (const struct lysc_node_container *)mod->compiled->data);
assert_null(cont->child);
- assert_non_null(notif = cont->notifs);
- assert_int_equal(1, LY_ARRAY_COUNT(notif));
+ assert_non_null(cont->notifs);
+ assert_null(cont->notifs->next);
assert_int_equal(LY_EVALID, 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));
@@ -2538,9 +2543,10 @@
assert_non_null(((struct lysc_node_choice *)node)->dflt);
assert_non_null(((struct lysc_node_choice *)node)->cases);
assert_null(((struct lysc_node_choice *)node)->cases->next);
- assert_int_equal(1, LY_ARRAY_COUNT(mod->compiled->rpcs));
- assert_null(mod->compiled->rpcs[0].input.data);
- assert_null(mod->compiled->rpcs[0].output.data);
+ assert_non_null(mod->compiled->rpcs);
+ assert_null(mod->compiled->rpcs->next);
+ assert_null(mod->compiled->rpcs->input.data);
+ assert_null(mod->compiled->rpcs->output.data);
assert_int_equal(LY_SUCCESS, lys_parse_mem(UTEST_LYCTX, "module c {namespace urn:c;prefix c; typedef mytype {type string; units kilometers;}"
"leaf c1 {type mytype;} leaf c2 {type mytype; units meters;} leaf c3 {type mytype; units meters;}"
diff --git a/tests/utests/utests.h b/tests/utests/utests.h
index 873e224..b1637b5 100644
--- a/tests/utests/utests.h
+++ b/tests/utests/utests.h
@@ -220,7 +220,7 @@
assert_non_null(NODE); \
CHECK_POINTER((NODE)->data, DATA); \
CHECK_ARRAY((NODE)->exts, EXTS); \
- CHECK_ARRAY((NODE)->groupings, GROUPINGS); \
+ CHECK_POINTER((NODE)->groupings, GROUPINGS); \
CHECK_ARRAY((NODE)->musts, MUSTS); \
assert_int_equal((NODE)->nodetype, NODETYPE); \
CHECK_POINTER((NODE)->parent, PARENT); \
@@ -253,7 +253,7 @@
CHECK_STRING((NODE)->dsc, DSC); \
CHECK_ARRAY((NODE)->exts, EXTS); \
assert_int_equal((NODE)->flags, FLAGS); \
- CHECK_ARRAY((NODE)->groupings, GROUPINGS); \
+ CHECK_POINTER((NODE)->groupings, GROUPINGS); \
CHECK_ARRAY((NODE)->iffeatures, IFFEATURES); \
CHECK_LYSP_ACTION_INOUT(&((NODE)->input), INPUT_DATA, INPUT_EXTS, INPUT_GROUPINGS, \
INPUT_MUSTS, LYS_INPUT, INPUT_PARENT, INPUT_TYPEDEFS); \
@@ -515,12 +515,12 @@
CHECK_ARRAY((NODE)->exts, EXTS); \
assert_int_equal((NODE)->flags, FLAGS); \
CHECK_LYSC_ACTION_INOUT(&(NODE)->input, INPUT_DATA, INPUT_MUST, LYS_INPUT); \
- CHECK_ARRAY((NODE)->input_exts, INPUT_EXTS); \
+ CHECK_ARRAY((NODE)->input.exts, INPUT_EXTS); \
CHECK_POINTER((NODE)->module, MODULE); \
assert_string_equal((NODE)->name, NAME); \
assert_int_equal((NODE)->nodetype, NODETYPE); \
CHECK_LYSC_ACTION_INOUT(&(NODE)->output, OUTPUT_DATA, OUTPUT_MUST, LYS_OUTPUT); \
- CHECK_ARRAY((NODE)->output_exts, OUTPUT_EXTS); \
+ CHECK_ARRAY((NODE)->output.exts, OUTPUT_EXTS); \
CHECK_POINTER((NODE)->parent, PARENT); \
CHECK_POINTER((NODE)->priv, PRIV); \
CHECK_STRING((NODE)->ref, REF); \