rfc6243 with-defaults Capability for NETCONF
This commit is contained in:
parent
70ed85f413
commit
0a20348b3b
7 changed files with 411 additions and 6 deletions
|
|
@ -1529,6 +1529,9 @@ netconf_module_load(clicon_handle h)
|
|||
/* Load ietf list pagination netconf */
|
||||
if (yang_spec_parse_module(h, "ietf-list-pagination-nc", NULL, yspec)< 0)
|
||||
goto done;
|
||||
/* Load rfc6243 with-defaults module explicit (imported by ietf-list-pagination-nc) */
|
||||
if (yang_spec_parse_module(h, "ietf-netconf-with-defaults", NULL, yspec)< 0)
|
||||
goto done;
|
||||
/* Framing: If hello protocol skipped, set framing direct, ie fix chunked framing if NETCONF-1.1
|
||||
* But start with default: RFC 4741 EOM ]]>]]>
|
||||
* For now this only applies to external protocol
|
||||
|
|
@ -1721,6 +1724,8 @@ netconf_hello_server(clicon_handle h,
|
|||
cprintf(cb, "<capability>urn:ietf:params:netconf:capability:startup:1.0</capability>");
|
||||
cprintf(cb, "<capability>urn:ietf:params:netconf:capability:xpath:1.0</capability>");
|
||||
cprintf(cb, "<capability>urn:ietf:params:netconf:capability:notification:1.0</capability>");
|
||||
/* rfc6243 with-defaults capability modes */
|
||||
cprintf(cb, "<capability>urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit</capability>");
|
||||
cprintf(cb, "</capabilities>");
|
||||
if (session_id)
|
||||
cprintf(cb, "<session-id>%lu</session-id>", (long unsigned int)session_id);
|
||||
|
|
|
|||
|
|
@ -561,6 +561,42 @@ xml_tree_prune_flagged(cxobj *xt,
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*! Prune everything that passes test
|
||||
* @param[in] xt XML tree with some node marked
|
||||
* @param[in] flags Flags set
|
||||
* @param[in] mask Which flags to test for
|
||||
* The function removes all branches that does pass test
|
||||
* @code
|
||||
* xml_tree_prune_flaggs(xt, XML_FLAG_MARK, XML_FLAG_MARK|XML_FLAG_DEFAULT);
|
||||
* @endcode
|
||||
*/
|
||||
int
|
||||
xml_tree_prune_flags(cxobj *xt,
|
||||
int flags,
|
||||
int mask)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *x;
|
||||
cxobj *xprev;
|
||||
|
||||
x = NULL;
|
||||
xprev = NULL;
|
||||
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
|
||||
if (xml_flag(x, mask) == flags){ /* Pass test means purge */
|
||||
if (xml_purge(x) < 0)
|
||||
goto done;
|
||||
x = xprev;
|
||||
continue;
|
||||
}
|
||||
if (xml_tree_prune_flags(x, flags, mask) < 0)
|
||||
goto done;
|
||||
xprev = x;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Add prefix:namespace pair to xml node, set cache, etc
|
||||
* @param[in] x XML node whose namespace should change
|
||||
* @param[in] xp XML node where namespace attribute should be declared (can be same)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue