session CHANGE updated to reflect libyang API changes
diff --git a/src/io.c b/src/io.c
index 87af293..c2996af 100644
--- a/src/io.c
+++ b/src/io.c
@@ -889,7 +889,7 @@
NC_NS_BASE, session->msgid + 1, attrs ? attrs : "");
nc_write_clb((void *)&arg, buf, count);
free(buf);
- lyd_print_clb(nc_write_clb, (void *)&arg, content, LYD_XML);
+ lyd_print_clb(nc_write_clb, (void *)&arg, content, LYD_XML, 0);
nc_write_clb((void *)&arg, "</rpc>", 6);
session->msgid++;
@@ -911,7 +911,7 @@
break;
case NC_RPL_DATA:
nc_write_clb((void *)&arg, "<data>", 6);
- lyd_print_clb(nc_write_clb, (void *)&arg, ((struct nc_reply_data *)reply)->data, LYD_XML);
+ lyd_print_clb(nc_write_clb, (void *)&arg, ((struct nc_reply_data *)reply)->data, LYD_XML, 0);
nc_write_clb((void *)&arg, "<data/>", 7);
break;
case NC_RPL_ERROR:
diff --git a/src/session_client.c b/src/session_client.c
index 12e4dc9..4818ee3 100644
--- a/src/session_client.c
+++ b/src/session_client.c
@@ -692,7 +692,8 @@
parse_reply(struct ly_ctx *ctx, struct lyxml_elem *xml, struct nc_rpc *rpc)
{
struct lyxml_elem *iter;
- const struct lys_node *schema;
+ const struct lys_node *schema = NULL;
+ const struct lys_module *mod;
struct lyd_node *data = NULL;
struct nc_client_reply_error *error_rpl;
struct nc_reply_data *data_rpl;
@@ -781,7 +782,10 @@
break;
case NC_RPC_GETSCHEMA:
- schema = ly_ctx_get_node(ctx, "/ietf-netconf-monitoring:get-schema");
+ mod = ly_ctx_get_module(ctx, "ietf-netconf-monitoring", NULL);
+ if (mod) {
+ schema = lys_get_node(mod, "/get-schema");
+ }
if (!schema) {
ERRINT;
return NULL;
diff --git a/src/session_server.c b/src/session_server.c
index 5744a41..2f86c1f 100644
--- a/src/session_server.c
+++ b/src/session_server.c
@@ -258,8 +258,11 @@
return nc_server_reply_err(err);
}
- sdata = ly_ctx_get_node(server_opts.ctx, "/ietf-netconf-monitoring:get-schema/output/data");
- if (model_data) {
+ module = ly_ctx_get_module(server_opts.ctx, "ietf-netconf-monitoring", NULL);
+ if (module) {
+ sdata = lys_get_node(module, "/get-schema/output/data");
+ }
+ if (model_data && sdata) {
data = lyd_output_new_anyxml(sdata, model_data);
}
free(model_data);
@@ -282,6 +285,7 @@
nc_server_init(struct ly_ctx *ctx)
{
const struct lys_node *rpc;
+ const struct lys_module *mod;
if (!ctx) {
ERRARG;
@@ -289,13 +293,21 @@
}
/* set default <get-schema> callback if not specified */
- rpc = ly_ctx_get_node(ctx, "/ietf-netconf-monitoring:get-schema");
+ rpc = NULL;
+ mod = ly_ctx_get_module(ctx, "ietf-netconf-monitoring", NULL);
+ if (mod) {
+ rpc = lys_get_node(mod, "/get-schema");
+ }
if (rpc && !rpc->private) {
lys_set_private(rpc, nc_clb_default_get_schema);
}
/* set default <close-session> callback if not specififed */
- rpc = ly_ctx_get_node(ctx, "/ietf-netconf:close-session");
+ rpc = NULL;
+ mod = ly_ctx_get_module(ctx, "ietf-netconf", NULL);
+ if (mod) {
+ rpc = lys_get_node(mod, "/close-session");
+ }
if (rpc && !rpc->private) {
lys_set_private(rpc, nc_clb_default_close_session);
}