* Fixed: Netconf diff callback did not work with choice and same value replace
* Eg if YANG is `choice c { leaf x; leaf y }` and XML changed from `<x>42</x>` to `<y>42</y>` the datastrore changed, but was not detected by diff algorithms and provided to validate callbacks.
* Thanks: Alexander Skorichenko, Netgate
This commit is contained in:
parent
8352e25860
commit
c35ca82083
3 changed files with 47 additions and 1 deletions
|
|
@ -72,6 +72,9 @@ Users may have to change how they access the system
|
|||
|
||||
### Corrected Bugs
|
||||
|
||||
* Fixed: Netconf diff callback did not work with choice and same value replace
|
||||
* Eg if YANG is `choice c { leaf x; leaf y }` and XML changed from `<x>42</x>` to `<y>42</y>` the datastrore changed, but was not detected by diff algorithms and provided to validate callbacks.
|
||||
* Thanks: Alexander Skorichenko, Netgate
|
||||
* Fixed: [Autocli does not offer completions for leafref to identityref #254](https://github.com/clicon/clixon/issues/254)
|
||||
* This is a part of YANG Leafref feature update
|
||||
* Fixed: [clixon_netconf errors on client XML Declaration with valid encoding spec](https://github.com/clicon/clixon/issues/250)
|
||||
|
|
|
|||
|
|
@ -608,7 +608,10 @@ xml_diff1(cxobj *x0,
|
|||
b2 = xml_body(x1c);
|
||||
if (b1 == NULL && b2 == NULL)
|
||||
;
|
||||
else if (b1 == NULL || b2 == NULL || strcmp(b1, b2) != 0){
|
||||
else if (b1 == NULL || b2 == NULL
|
||||
|| strcmp(b1, b2) != 0
|
||||
|| strcmp(xml_name(x0c), xml_name(x1c)) != 0 /* Ex: choice { a:bool; b:bool } */
|
||||
){
|
||||
if (cxvec_append(x0c, changed_x0, changedlen) < 0)
|
||||
goto done;
|
||||
(*changedlen)--; /* append two vectors */
|
||||
|
|
|
|||
|
|
@ -57,6 +57,14 @@ module trans{
|
|||
type int32;
|
||||
}
|
||||
}
|
||||
choice csame {
|
||||
leaf first {
|
||||
type boolean;
|
||||
}
|
||||
leaf second {
|
||||
type boolean;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
|
@ -305,6 +313,38 @@ for op in begin validate complete commit commit_done end; do
|
|||
let line++
|
||||
done
|
||||
|
||||
# Variant check that only b,c
|
||||
|
||||
new "8. Set first choice"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns='urn:example:clixon'><first>true</first></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf commit same"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "Set second choice"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns='urn:example:clixon'><second>true</second></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
# choice chanmge with same value did not show up in log
|
||||
new "netconf commit second"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
let nr++
|
||||
let nr++
|
||||
|
||||
let line+=12
|
||||
# check complete
|
||||
for op in begin validate complete commit commit_done; do
|
||||
checklog "$nr main_$op change: <first>true</first><second>true</second>" $line
|
||||
let line++
|
||||
checklog "$nr nacm_$op change: <first>true</first><second>true</second>" $line
|
||||
let line++
|
||||
done
|
||||
|
||||
# End is special because change does not have old element
|
||||
checklog "$nr main_end change: <second>true</second>" $line
|
||||
let line++
|
||||
# This check does not work if MOVE_TRANS_END is set
|
||||
checklog "$nr nacm_end change: <second>true</second>" $line
|
||||
let line++
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue