* Fixed: YANG when was not properly implemented for LEAF default values

This commit is contained in:
Olof hagsand 2021-08-03 13:38:31 +02:00
parent 00645ee52b
commit 603f9724ce
4 changed files with 35 additions and 17 deletions

View file

@ -67,6 +67,19 @@ module example{
default 31; /* should be set on startup */
}
}
/* Extra rules to check when condition */
leaf npleaf{
when "../s3 = '99'";
type uint32;
default 98;
}
container npcont{
when "../s3 = '99'";
leaf npext{
type uint32;
default 99;
}
}
}
container p4{
presence "A presence container";
@ -144,6 +157,13 @@ expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-confi
new "get config (should contain y/inside+outside)"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$XML<xs-config xmlns=\"urn:example:clixon\"><x><name>a</name><y><inside>false</inside></y><outside>false</outside></x></xs-config></data></rpc-reply>]]>]]>$"
# Set s3 leaf to 99 triggering when condition for default values
new "Set s3 to 99"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><np3 xmlns=\"urn:example:clixon\"><s3>99</s3></np3></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
new "get config np3 with npleaf and npext"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source><filter type=\"xpath\" select=\"/ex:np3\" xmlns:ex=\"urn:example:clixon\" /></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><np3 xmlns=\"urn:example:clixon\"><s3>99</s3><np31><s31>31</s31></np31><npleaf>98</npleaf><npcont><npext>99</npext></npcont></np3></data></rpc-reply>]]>]]>$"
if [ $BE -ne 0 ]; then
new "Kill backend"
# Check if premature kill