CHANGE reflect API changes in libyang 0.14
diff --git a/src/session.c b/src/session.c
index 6ee961e..8e4d8c7 100644
--- a/src/session.c
+++ b/src/session.c
@@ -498,7 +498,7 @@
}
/* send closing info to the other side */
- ietfnc = ly_ctx_get_module(session->ctx, "ietf-netconf", NULL);
+ ietfnc = ly_ctx_get_module(session->ctx, "ietf-netconf", NULL, 1);
if (!ietfnc) {
WRN("Session %u: missing ietf-netconf schema in context, unable to send <close-session>.", session->id);
} else {
@@ -763,7 +763,7 @@
/* capabilities */
- mod = ly_ctx_get_module(ctx, "ietf-netconf", NULL);
+ mod = ly_ctx_get_module(ctx, "ietf-netconf", NULL, 1);
if (mod) {
if (lys_features_state(mod, "writable-running") == 1) {
add_cpblt(ctx, "urn:ietf:params:netconf:capability:writable-running:1.0", &cpblts, &size, &count);
@@ -791,7 +791,7 @@
}
}
- mod = ly_ctx_get_module(ctx, "ietf-netconf-with-defaults", NULL);
+ mod = ly_ctx_get_module(ctx, "ietf-netconf-with-defaults", NULL, 1);
if (mod) {
if (!server_opts.wd_basic_mode) {
VRB("with-defaults capability will not be advertised even though \"ietf-netconf-with-defaults\" model is present, unknown basic-mode.");
@@ -839,7 +839,7 @@
}
/* models */
- LY_TREE_FOR(yanglib->child, child) {
+ LY_TREE_FOR(yanglib->prev->child, child) {
if (!module_set_id) {
if (strcmp(child->prev->schema->name, "module-set-id")) {
ERRINT;
diff --git a/src/session_client.c b/src/session_client.c
index e6cdbb3..090feb5 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -193,7 +193,7 @@
{
/* assign context (dicionary needed for handshake) */
if (!ctx) {
- ctx = ly_ctx_new(NULL);
+ ctx = ly_ctx_new(NULL, 0);
if (!ctx) {
return EXIT_FAILURE;
}
@@ -270,7 +270,7 @@
int i;
const struct lys_module *ietfnc;
- ietfnc = ly_ctx_get_module(ctx, "ietf-netconf", NULL);
+ ietfnc = ly_ctx_get_module(ctx, "ietf-netconf", NULL, 1);
if (!ietfnc) {
ietfnc = ly_ctx_load_module(ctx, "ietf-netconf", NULL);
if (!ietfnc) {
@@ -465,7 +465,7 @@
revision = strndup(ptr, ptr2 - ptr);
}
- mod = ly_ctx_get_module(session->ctx, name, revision);
+ mod = ly_ctx_get_module(session->ctx, name, revision, 0);
if (mod) {
if (!mod->implemented) {
/* make the present module implemented */
@@ -659,7 +659,7 @@
}
}
- mod = ly_ctx_get_module(session->ctx, name, revision);
+ mod = ly_ctx_get_module(session->ctx, name, revision, 0);
if (mod) {
if (implemented && !mod->implemented) {
/* make the present module implemented */
@@ -776,7 +776,7 @@
}
/* get-schema is supported, load local ietf-netconf-monitoring so we can create <get-schema> RPCs */
- if (get_schema_support && !ly_ctx_get_module(session->ctx, "ietf-netconf-monitoring", NULL)) {
+ if (get_schema_support && !ly_ctx_get_module(session->ctx, "ietf-netconf-monitoring", NULL, 1)) {
if (!lys_parse_path(session->ctx, SCHEMAS_DIR"/ietf-netconf-monitoring.yin", LYS_IN_YIN)) {
WRN("Loading NETCONF monitoring schema failed, cannot use <get-schema>.");
get_schema_support = 0;
@@ -855,9 +855,9 @@
/* assign context (dicionary needed for handshake) */
if (!ctx) {
- ctx = ly_ctx_new(SCHEMAS_DIR);
+ ctx = ly_ctx_new(SCHEMAS_DIR, 0);
/* definitely should not happen, but be ready */
- if (!ctx && !(ctx = ly_ctx_new(NULL))) {
+ if (!ctx && !(ctx = ly_ctx_new(NULL, 0))) {
/* that's just it */
goto fail;
}
@@ -1328,7 +1328,7 @@
break;
case NC_RPC_GETSCHEMA:
- rpc_act = lyd_new(NULL, ly_ctx_get_module(ctx, "ietf-netconf-monitoring", NULL), "get-schema");
+ rpc_act = lyd_new(NULL, ly_ctx_get_module(ctx, "ietf-netconf-monitoring", NULL, 1), "get-schema");
if (!rpc_act) {
ERRINT;
return NULL;
@@ -1814,7 +1814,7 @@
}
if ((rpc->type != NC_RPC_GETSCHEMA) && (rpc->type != NC_RPC_ACT_GENERIC) && (rpc->type != NC_RPC_SUBSCRIBE)) {
- ietfnc = ly_ctx_get_module(session->ctx, "ietf-netconf", NULL);
+ ietfnc = ly_ctx_get_module(session->ctx, "ietf-netconf", NULL, 1);
if (!ietfnc) {
ERR("Session %u: missing \"ietf-netconf\" schema in the context.", session->id);
return NC_MSG_ERROR;
@@ -1860,7 +1860,7 @@
if (rpc_gc->wd_mode) {
if (!ietfncwd) {
- ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL);
+ ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL, 1);
if (!ietfncwd) {
ERR("Session %u: missing \"ietf-netconf-with-defaults\" schema in the context.", session->id);
return NC_MSG_ERROR;
@@ -1968,7 +1968,7 @@
if (rpc_cp->wd_mode) {
if (!ietfncwd) {
- ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL);
+ ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL, 1);
if (!ietfncwd) {
ERR("Session %u: missing \"ietf-netconf-with-defaults\" schema in the context.", session->id);
return NC_MSG_ERROR;
@@ -2059,7 +2059,7 @@
if (rpc_g->wd_mode) {
if (!ietfncwd) {
- ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL);
+ ietfncwd = ly_ctx_get_module(session->ctx, "ietf-netconf-with-defaults", NULL, 1);
if (!ietfncwd) {
ERR("Session %u: missing \"ietf-netconf-with-defaults\" schema in the context.", session->id);
lyd_free(data);
@@ -2166,7 +2166,7 @@
break;
case NC_RPC_GETSCHEMA:
- ietfncmon = ly_ctx_get_module(session->ctx, "ietf-netconf-monitoring", NULL);
+ ietfncmon = ly_ctx_get_module(session->ctx, "ietf-netconf-monitoring", NULL, 1);
if (!ietfncmon) {
ERR("Session %u: missing \"ietf-netconf-monitoring\" schema in the context.", session->id);
return NC_MSG_ERROR;
@@ -2197,7 +2197,7 @@
break;
case NC_RPC_SUBSCRIBE:
- notifs = ly_ctx_get_module(session->ctx, "notifications", NULL);
+ notifs = ly_ctx_get_module(session->ctx, "notifications", NULL, 1);
if (!notifs) {
ERR("Session %u: missing \"notifications\" schema in the context.", session->id);
return NC_MSG_ERROR;
diff --git a/src/session_server.c b/src/session_server.c
index c161085..bbd4c40 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -405,7 +405,7 @@
}
/* check and get module with the name identifier */
- module = ly_ctx_get_module(server_opts.ctx, identifier, version);
+ module = ly_ctx_get_module(server_opts.ctx, identifier, version, 0);
if (!module) {
module = (const struct lys_module *)ly_ctx_get_submodule(server_opts.ctx, NULL, NULL, identifier, version);
}