* Fixed: [The config false leaf shouldn't be configed in startup stage #189](https://github.com/clicon/clixon/issues/189)

This commit is contained in:
Olof hagsand 2021-03-11 09:11:14 +01:00
parent f01efaf02a
commit dea3962cc0
6 changed files with 38 additions and 6 deletions

View file

@ -2,6 +2,7 @@
* [5.1.0](#510) Expected: April * [5.1.0](#510) Expected: April
* [5.0.0](#500) 27 February 2021 * [5.0.0](#500) 27 February 2021
* [5.0.1](#501) 10 March 2021
* [4.9.0](#490) 18 December 2020 * [4.9.0](#490) 18 December 2020
* [4.8.0](#480) 18 October 2020 * [4.8.0](#480) 18 October 2020
* [4.7.0](#470) 14 September 2020 * [4.7.0](#470) 14 September 2020
@ -61,11 +62,25 @@ Developers may need to change their code
### Corrected Bugs ### Corrected Bugs
* Fixed: [The config false leaf shouldn't be configed in startup stage #189](https://github.com/clicon/clixon/issues/189)
* Fixed: [CLIXON is not waiting for the hello message #184](https://github.com/clicon/clixon/issues/184) * Fixed: [CLIXON is not waiting for the hello message #184](https://github.com/clicon/clixon/issues/184)
* See also API changes * See also API changes
* Fixed: [comma in yang list name will lead to cli setting error #186](https://github.com/clicon/clixon/issues/186) * Fixed: [comma in yang list name will lead to cli setting error #186](https://github.com/clicon/clixon/issues/186)
* Reverted blocked signal behavior introduced in 5.0. * Reverted blocked signal behavior introduced in 5.0.
## 5.0.1
10 March 2021
### Minor features
* Introduced a delay before making process start/stop/restart processes for race conditions when configuring eg restconf
* For restconf `CLICON_BACKEND_RESTCONF_PROCESS`, restart restconf if restconf is edited.
### Corrected Bugs
* Reverted blocked signal behavior introduced in 5.0.
## 5.0.0 ## 5.0.0
27 February 2021 27 February 2021
@ -77,6 +92,10 @@ Other changes since 4.9 include NETCONF call home, a new client API, and a modif
Thanks Netgate and input from the Clixon community for making this possible! Thanks Netgate and input from the Clixon community for making this possible!
### Known Issues
* Changed behavior in signal handlers and some race conditions, use 5.0.1 instead
### New features ### New features
* RESTCONF configuration is extended and changed for both fcgi and evhtp * RESTCONF configuration is extended and changed for both fcgi and evhtp

View file

@ -261,6 +261,14 @@ startup_common(clicon_handle h,
goto done; goto done;
goto fail; goto fail;
} }
/* After upgrade check no state data */
if ((ret = xml_non_config_data(xt, &xret)) < 0)
goto done;
if (ret == 0){
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
goto done;
goto fail;
}
/* Sort xml */ /* Sort xml */
if (xml_sort_recurse(xt) < 0) if (xml_sort_recurse(xt) < 0)
goto done; goto done;

View file

@ -1478,9 +1478,8 @@ xml_non_config_data(cxobj *xt,
clicon_err(OE_UNIX, errno, "cbuf_new"); clicon_err(OE_UNIX, errno, "cbuf_new");
goto done; goto done;
} }
cprintf(cb, "%s in module %s: state data node unexpected", cprintf(cb, "module %s: state data node unexpected", yang_argument_get(ys_module(y)));
yang_argument_get(y), yang_argument_get(ys_module(y))); if (netconf_bad_element_xml(xerr, "application", yang_argument_get(y), cbuf_get(cb)) < 0)
if (netconf_invalid_value_xml(xerr, "application", cbuf_get(cb)) < 0)
goto done; goto done;
retval = 0; retval = 0;
goto done; goto done;

View file

@ -200,7 +200,7 @@ new "netconf discard-changes"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$" expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
new "netconf edit state operation should fail" new "netconf edit state operation should fail"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>e0</name><oper-status>up</oper-status></interface></interfaces></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>invalid-value</error-tag><error-severity>error</error-severity><error-message>oper-status in module ietf-interfaces: state data node unexpected</error-message></rpc-error></rpc-reply>]]>]]>" expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>e0</name><oper-status>up</oper-status></interface></interfaces></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>oper-status</bad-element></error-info><error-severity>error</error-severity><error-message>module ietf-interfaces: state data node unexpected</error-message></rpc-error></rpc-reply>]]>]]>"
new "netconf get state operation" new "netconf get state operation"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"/if:interfaces\" xmlns:if=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\" /></get></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>eth1</name><type>ex:eth</type><enabled>true</enabled><oper-status>up</oper-status><ex:my-status xmlns:ex=\"urn:example:clixon\"><ex:int>42</ex:int><ex:str>foo</ex:str></ex:my-status></interface></interfaces></data></rpc-reply>]]>]]>$" expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"/if:interfaces\" xmlns:if=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\" /></get></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>eth1</name><type>ex:eth</type><enabled>true</enabled><oper-status>up</oper-status><ex:my-status xmlns:ex=\"urn:example:clixon\"><ex:int>42</ex:int><ex:str>foo</ex:str></ex:my-status></interface></interfaces></data></rpc-reply>]]>]]>$"

View file

@ -6,7 +6,7 @@
# - An extra xml configuration file starts with an "extra" interface # - An extra xml configuration file starts with an "extra" interface
# - running db starts with a "run" interface # - running db starts with a "run" interface
# - startup db starts with a "start" interface # - startup db starts with a "start" interface
# There is also an "invalid" XML and a "broken" XML # There is also an "invalid" XML and a "broken" XML and a "state" XML
# There are two steps, first run through everything OK # There are two steps, first run through everything OK
# Then try with invalid and broken XML and ensure the backend quits and all is untouched # Then try with invalid and broken XML and ensure the backend quits and all is untouched
@ -57,6 +57,9 @@ invalidvar='<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><int
# Broken XML (contains </nmae>) # Broken XML (contains </nmae>)
brokenvar='<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>broken</nmae><type>ex:eth</type><enabled>true</enabled></interface></interfaces>' brokenvar='<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>broken</nmae><type>ex:eth</type><enabled>true</enabled></interface></interfaces>'
# Startup XML with state
statevar='<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>startup</name><oper-status>up</oper-status><type>ex:eth</type><enabled>true</enabled></interface></interfaces>'
# Create a pre-set running, startup and (extra) config. # Create a pre-set running, startup and (extra) config.
# The configs are identified by an interface called run, startup, extra. # The configs are identified by an interface called run, startup, extra.
# Depending on startup mode (init, none, running, or startup) # Depending on startup mode (init, none, running, or startup)
@ -184,6 +187,9 @@ if [ $valgrindtest -ne 2 ]; then
new "Run broken startup in startup mode" new "Run broken startup in startup mode"
testfail startup "$runvar" "$brokenvar" "$extravar" testfail startup "$runvar" "$brokenvar" "$extravar"
new "Run broken startup with state data in startup mode"
testfail startup "$runvar" "$statevar" "$extravar"
fi fi
rm -rf $dir rm -rf $dir

View file

@ -212,7 +212,7 @@ new "cli show leaf-list"
expectpart "$($clixon_cli -1f $cfg show xpath /x/f/e urn:example:clixon)" 0 "<e>foo</e>" expectpart "$($clixon_cli -1f $cfg show xpath /x/f/e urn:example:clixon)" 0 "<e>foo</e>"
new "netconf set state data (not allowed)" new "netconf set state data (not allowed)"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><state xmlns=\"urn:example:clixon\"><op>42</op></state></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>invalid-value</error-tag><error-severity>error</error-severity><error-message>state in module example: state data node unexpected</error-message></rpc-error></rpc-reply>]]>]]>$" expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><state xmlns=\"urn:example:clixon\"><op>42</op></state></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>state</bad-element></error-info><error-severity>error</error-severity><error-message>module example: state data node unexpected</error-message></rpc-error></rpc-reply>]]>]]>$"
new "netconf set presence and not present" new "netconf set presence and not present"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><nopresence/><presence/></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$" expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><nopresence/><presence/></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"