Correct NETCONF error-tag when operation not supported

This commit is contained in:
Jan-Olof Carlson 2022-07-23 06:59:55 +00:00 committed by Olof hagsand
parent 0a20348b3b
commit 9647177165
2 changed files with 6 additions and 3 deletions

View file

@ -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;
}

View file

@ -176,7 +176,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \
"<rpc $DEFAULTNS><get><filter type=\"subtree\"><interfaces $EXAMPLENS/></filter>\
<with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">trim</with-defaults></get></rpc>" \
"" \
"<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag>\
"<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-not-supported</error-tag>\
<error-severity>error</error-severity>\
<error-message>with-defaults retrieval mode \"trim\" is not supported</error-message></rpc-error></rpc-reply>"
@ -197,7 +197,7 @@ expecteof_netconf "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO" \
"<rpc $DEFAULTNS><get><filter type=\"subtree\"><interfaces $EXAMPLENS/></filter>\
<with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">report-all-tagged</with-defaults></get></rpc>" \
"" \
"<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag>\
"<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-not-supported</error-tag>\
<error-severity>error</error-severity>\
<error-message>with-defaults retrieval mode \"report-all-tagged\" is not supported</error-message></rpc-error></rpc-reply>"