Fixed: [with-defaults=trim does not work due to dodgy handling of state data marked as default](https://github.com/clicon/clixon/issues/348)

This commit is contained in:
Olof hagsand 2022-08-10 15:17:37 +02:00
parent 71fe10a057
commit f3ab3006e8
3 changed files with 19 additions and 8 deletions

View file

@ -36,6 +36,17 @@
* [3.3.2](#332) Aug 27 2017
* [3.3.1](#331) June 7 2017
## with-defaults branch
### New features
* With-defaults RFC6243
* see [Netconf With-defaults Capability](https://github.com/clicon/clixon/issues/262)
### Corrected Bugs
* Fixed: [with-defaults=trim does not work due to dodgy handling of state data marked as default](https://github.com/clicon/clixon/issues/348)
## 5.9.0
Expected: September 2022

View file

@ -206,12 +206,6 @@ get_client_statedata(clicon_handle h,
clicon_err(OE_UNIX, errno, "cbuf_new");
goto done;
}
/* Add default state to config if present */
if (xml_default_recurse(*xret, 1) < 0)
goto done;
/* Add default global state */
if (xml_global_defaults(h, *xret, nsc, xpath, yspec, 1) < 0)
goto done;
if (clicon_option_bool(h, "CLICON_STREAM_DISCOVERY_RFC5277")){
if ((ymod = yang_find_module_by_name(yspec, "clixon-rfc5277")) == NULL){
clicon_err(OE_YANG, ENOENT, "yang module clixon-rfc5277 not found");
@ -261,6 +255,12 @@ get_client_statedata(clicon_handle h,
goto done;
if (ret == 0)
goto fail;
/* Add default state to config if present */
if (xml_default_recurse(*xret, 1) < 0)
goto done;
/* Add default global state */
if (xml_global_defaults(h, *xret, nsc, xpath, yspec, 1) < 0)
goto done;
retval = 1; /* OK */
done:
clicon_debug(1, "%s %d", __FUNCTION__, retval);

View file

@ -31,6 +31,7 @@ cat <<EOF > $cfg
<CLICON_CLI_MODE>$APPNAME</CLICON_CLI_MODE>
<CLICON_SOCK>$dir/$APPNAME.sock</CLICON_SOCK>
<CLICON_BACKEND_PIDFILE>/usr/local/var/$APPNAME/$APPNAME.pidfile</CLICON_BACKEND_PIDFILE>
<CLICON_YANG_LIBRARY>false</CLICON_YANG_LIBRARY>
<CLICON_XMLDB_DIR>$dir</CLICON_XMLDB_DIR>
<CLICON_XMLDB_PRETTY>false</CLICON_XMLDB_PRETTY>
<CLICON_YANG_DIR>$IETFRFC</CLICON_YANG_DIR>
@ -128,7 +129,7 @@ if [ $BE -ne 0 ]; then # Bring your own backend
if [ $? -ne 0 ]; then
err
fi
new "start backend -s $db -f $cfg"
new "start backend -s $db -f $cfg -- -sS $fstate"
start_backend -s $db -f $cfg -- -sS $fstate
fi
@ -169,7 +170,6 @@ fi
new "wait restconf"
wait_restconf
new "rfc4243 4.3. Capability Identifier"
expecteof "$clixon_netconf -ef $cfg" 0 "$DEFAULTHELLO" \
"<capability>urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit</capability>"