From 96471771656d65e2a7cbb77340c1e88ab29c4a69 Mon Sep 17 00:00:00 2001 From: Jan-Olof Carlson Date: Sat, 23 Jul 2022 06:59:55 +0000 Subject: [PATCH] Correct NETCONF error-tag when operation not supported --- apps/backend/backend_get.c | 5 ++++- test/test_yang_with_defaults.sh | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/backend/backend_get.c b/apps/backend/backend_get.c index 55c74162..179ebf56 100644 --- a/apps/backend/backend_get.c +++ b/apps/backend/backend_get.c @@ -853,6 +853,9 @@ get_common(clicon_handle h, /* Remove default configuration nodes from XML */ if (xml_tree_prune_flags(xret, XML_FLAG_DEFAULT, XML_FLAG_MARK|XML_FLAG_DEFAULT) < 0) goto done; + /* Restore marked nodes */ + if (xml_apply(xret, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset, (void*)XML_FLAG_MARK) < 0) + goto done; } else if (strcmp(with_defaults, "report-all") == 0) { /* Accept mode, do nothing */ @@ -864,7 +867,7 @@ get_common(clicon_handle h, goto done; } cprintf(cbmsg, "with-defaults retrieval mode \"%s\" is not supported", with_defaults); - if (netconf_operation_failed(cbret, "application", cbuf_get(cbmsg)) < 0) + if (netconf_operation_not_supported(cbret, "application", cbuf_get(cbmsg)) < 0) goto done; goto ok; } diff --git a/test/test_yang_with_defaults.sh b/test/test_yang_with_defaults.sh index 4896f21a..fbb94bef 100755 --- a/test/test_yang_with_defaults.sh +++ b/test/test_yang_with_defaults.sh @@ -176,7 +176,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ "\ trim" \ "" \ -"applicationoperation-failed\ +"applicationoperation-not-supported\ error\ with-defaults retrieval mode \"trim\" is not supported" @@ -197,7 +197,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \ "\ report-all-tagged" \ "" \ -"applicationoperation-failed\ +"applicationoperation-not-supported\ error\ with-defaults retrieval mode \"report-all-tagged\" is not supported"