@@ -1230,7 +1230,7 @@ nc_ctx_schema_mount(struct nc_session *session, int get_data_sup, int xpath_sup)
12301230int
12311231nc_ctx_check_and_fill (struct nc_session * session )
12321232{
1233- int i , get_schema_support = 0 , yanglib_support = 0 , get_data_support = 0 , xpath_support = 0 , ret = -1 ;
1233+ int i , get_schema_support = 0 , yanglib_support = 0 , xpath_support = 0 , nmda_support = 0 , ret = -1 ;
12341234 ly_module_imp_clb old_clb = NULL ;
12351235 void * old_data = NULL ;
12361236 struct lys_module * mod = NULL ;
@@ -1257,18 +1257,14 @@ nc_ctx_check_and_fill(struct nc_session *session)
12571257 yanglib_support = 1 + i ;
12581258 } else if (!strncmp (session -> opts .client .cpblts [i ], "urn:ietf:params:netconf:capability:xpath:1.0" , 44 )) {
12591259 xpath_support = 1 + i ;
1260+ } else if (!strncmp (session -> opts .client .cpblts [i ], "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda" , 45 )) {
1261+ nmda_support = 1 + i ;
12601262 }
12611263 }
1262- if (get_schema_support ) {
1263- VRB (session , "Capability for <get-schema> support found." );
1264- } else {
1265- VRB (session , "Capability for <get-schema> support not found." );
1266- }
1267- if (yanglib_support ) {
1268- VRB (session , "Capability for yang-library support found." );
1269- } else {
1270- VRB (session , "Capability for yang-library support not found." );
1271- }
1264+ VRB (session , "Capability for <get-schema> support%s found." , get_schema_support ? "" : " not" );
1265+ VRB (session , "Capability for yang-library support%s found." , yanglib_support ? "" : " not" );
1266+ VRB (session , "Capability for XPath filter support%s found." , xpath_support ? "" : " not" );
1267+ VRB (session , "Capability for NMDA RPCs support%s found." , nmda_support ? "" : " not" );
12721268
12731269 /* get information about server's modules from capabilities list until we will have yang-library */
12741270 if (build_module_info_cpblts (session -> opts .client .cpblts , & server_modules ) || !server_modules ) {
@@ -1313,21 +1309,19 @@ nc_ctx_check_and_fill(struct nc_session *session)
13131309 }
13141310 }
13151311 free (revision );
1316-
1317- /* ietf-netconf-nmda is needed to issue get-data */
1318- if (!nc_ctx_load_module (session , "ietf-netconf-nmda" , NULL , NULL , server_modules , old_clb , old_data ,
1319- get_schema_support , & mod )) {
1320- VRB (session , "Support for <get-data> from ietf-netconf-nmda found." );
1321- get_data_support = 1 ;
1322- } else {
1323- VRB (session , "Support for <get-data> from ietf-netconf-nmda not found." );
1324- }
13251312 }
13261313 }
13271314
1315+ /* ietf-netconf-nmda is needed to issue get-data */
1316+ if (nmda_support && nc_ctx_load_module (session , "ietf-netconf-nmda" , NULL , NULL , server_modules , old_clb , old_data ,
1317+ get_schema_support , & mod )) {
1318+ WRN (session , "Loading NMDA module failed, unable to use <get-data>." );
1319+ nmda_support = 0 ;
1320+ }
1321+
13281322 /* prepare structured information about server's modules */
13291323 if (yanglib_support ) {
1330- if (build_module_info_yl (session , get_data_support , xpath_support , & sm )) {
1324+ if (build_module_info_yl (session , nmda_support , xpath_support , & sm )) {
13311325 goto cleanup ;
13321326 } else if (!sm ) {
13331327 VRB (session , "Trying to use capabilities instead of ietf-yang-library data." );
@@ -1353,7 +1347,7 @@ nc_ctx_check_and_fill(struct nc_session *session)
13531347 }
13541348
13551349 /* set support for schema-mount, if possible */
1356- if (nc_ctx_schema_mount (session , get_data_support , xpath_support )) {
1350+ if (nc_ctx_schema_mount (session , nmda_support , xpath_support )) {
13571351 goto cleanup ;
13581352 }
13591353
0 commit comments