Skip to content

Commit a0b8b70

Browse files
committed
session client BUGFIX proper NMDA supp detection
1 parent c80b3a6 commit a0b8b70

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/session_client.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,14 +1261,12 @@ nc_ctx_check_and_fill(struct nc_session *session)
12611261
yanglib_support = 1 + i;
12621262
} else if (!strncmp(session->opts.client.cpblts[i], "urn:ietf:params:netconf:capability:xpath:1.0", 44)) {
12631263
xpath_support = 1 + i;
1264-
} else if (!strncmp(session->opts.client.cpblts[i], "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda", 45)) {
1265-
nmda_support = 1 + i;
12661264
}
1265+
/* NMDA is YANG 1.1 module, which is not present in the capabilities */
12671266
}
12681267
VRB(session, "Capability for <get-schema> support%s found.", get_schema_support ? "" : " not");
12691268
VRB(session, "Capability for yang-library support%s found.", yanglib_support ? "" : " not");
12701269
VRB(session, "Capability for XPath filter support%s found.", xpath_support ? "" : " not");
1271-
VRB(session, "Capability for NMDA RPCs support%s found.", nmda_support ? "" : " not");
12721270

12731271
/* get information about server's modules from capabilities list until we will have yang-library */
12741272
if (build_module_info_cpblts(session->opts.client.cpblts, &server_modules) || !server_modules) {
@@ -1316,13 +1314,6 @@ nc_ctx_check_and_fill(struct nc_session *session)
13161314
}
13171315
}
13181316

1319-
/* ietf-netconf-nmda is needed to issue get-data */
1320-
if (nmda_support && nc_ctx_load_module(session, "ietf-netconf-nmda", NULL, NULL, server_modules, old_clb, old_data,
1321-
get_schema_support, &mod)) {
1322-
WRN(session, "Loading NMDA module failed, unable to use <get-data>.");
1323-
nmda_support = 0;
1324-
}
1325-
13261317
/* prepare structured information about server's modules */
13271318
if (yanglib_support) {
13281319
if (build_module_info_yl(session, nmda_support, xpath_support, &sm)) {
@@ -1334,6 +1325,21 @@ nc_ctx_check_and_fill(struct nc_session *session)
13341325
* yang-library module */
13351326
free_module_info(server_modules);
13361327
server_modules = sm;
1328+
1329+
/* check for NMDA support */
1330+
for (i = 0; server_modules[i].name; ++i) {
1331+
if (!strcmp(server_modules[i].name, "ietf-netconf-nmda") && server_modules[i].implemented) {
1332+
nmda_support = 1;
1333+
break;
1334+
}
1335+
}
1336+
1337+
/* ietf-netconf-nmda is needed to issue get-data */
1338+
if (nmda_support && nc_ctx_load_module(session, "ietf-netconf-nmda", NULL, NULL, server_modules, old_clb,
1339+
old_data, get_schema_support, &mod)) {
1340+
WRN(session, "Loading NMDA module failed, unable to use <get-data>.");
1341+
nmda_support = 0;
1342+
}
13371343
}
13381344
}
13391345

0 commit comments

Comments
 (0)