Remove default sets in init cache

This commit is contained in:
Olof hagsand 2020-08-28 09:51:14 +02:00
parent 558abb1f9b
commit 043acb6a54
2 changed files with 8 additions and 2 deletions

View file

@ -776,7 +776,6 @@ xmldb_get_cache(clicon_handle h,
if ((x1t = xml_new(xml_name(x0t), NULL, CX_ELMNT)) == NULL) if ((x1t = xml_new(xml_name(x0t), NULL, CX_ELMNT)) == NULL)
goto done; goto done;
xml_spec_set(x1t, xml_spec(x0t)); xml_spec_set(x1t, xml_spec(x0t));
if (xlen < 1000){ if (xlen < 1000){
/* This is optimized for the case when the tree is large and xlen is small /* This is optimized for the case when the tree is large and xlen is small
@ -806,6 +805,13 @@ xmldb_get_cache(clicon_handle h,
if (xml_apply(x1t, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset, (void*)(XML_FLAG_MARK|XML_FLAG_CHANGE)) < 0) if (xml_apply(x1t, CX_ELMNT, (xml_applyfn_t*)xml_flag_reset, (void*)(XML_FLAG_MARK|XML_FLAG_CHANGE)) < 0)
goto done; goto done;
} }
/* Remove global defaults from cache
* Mark non-presence containers as XML_FLAG_DEFAULT */
if (xml_apply(x0t, CX_ELMNT, xml_nopresence_default_mark, (void*)XML_FLAG_DEFAULT) < 0)
goto done;
/* Clear XML tree of defaults */
if (xml_tree_prune_flagged(x0t, XML_FLAG_DEFAULT, 1) < 0)
goto done;
/* x1t is wrong here should be <config><system>.. but is <system>.. */ /* x1t is wrong here should be <config><system>.. but is <system>.. */
/* XXX where should we apply default values once? */ /* XXX where should we apply default values once? */
if (xml_default_recurse(x1t) < 0) if (xml_default_recurse(x1t) < 0)

View file

@ -210,7 +210,7 @@ new "commit it"
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$" expecteof "$clixon_netconf -qf $cfg" 0 "<rpc><commit/></rpc>]]>]]>" "^<rpc-reply><ok/></rpc-reply>]]>]]>$"
new "enable nacm" new "enable nacm"
expectpart "$(curl -u andy:bar $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/1.1 201 Created" expectpart "$(curl -u andy:bar $CURLOPTS -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/1.1 204 No Content"
# Rule 3: permit-edit-config # Rule 3: permit-edit-config
new "permit-edit-config: limited ok restconf" new "permit-edit-config: limited ok restconf"