diff --git a/CHANGELOG.md b/CHANGELOG.md index f8b395b6..e0950916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ Users may have to change how they access the system * Command field of clixon-lib:process-control RPC reply used CDATA encoding but now uses regular XML encoding ### Corrected Bugs + +* Fixed: input RPC validation of choice (non-case) * Fixed: More than one unknown/extension in combination with augment of extension resulted in extension being skipped. ## 5.5.0 diff --git a/lib/src/clixon_validate.c b/lib/src/clixon_validate.c index 5d1e4170..27279337 100644 --- a/lib/src/clixon_validate.c +++ b/lib/src/clixon_validate.c @@ -538,7 +538,7 @@ check_choice(cxobj *xt, continue; break; case Y_CHOICE: - if (yp != ytcase) /* Not same choice (not relevant) */ + if (yp != ytchoice) /* Not same choice (not relevant) */ continue; break; default: @@ -549,7 +549,6 @@ check_choice(cxobj *xt, goto done; goto fail; } /* while */ - ok: retval = 1; done: diff --git a/test/test_rpc.sh b/test/test_rpc.sh index aa31317b..86bfe988 100755 --- a/test/test_rpc.sh +++ b/test/test_rpc.sh @@ -105,6 +105,29 @@ module clixon-example{ type string; } } + choice par1 { + leaf a1{ + type string; + } + leaf b1{ + type string; + } + } + choice par2 { + case nr1 { + leaf a21{ + type string; + } + leaf a22{ + type string; + } + } + case nr2 { + leaf b2{ + type string; + } + } + } } output { leaf x { @@ -134,6 +157,29 @@ module clixon-example{ type string; } } + choice par1 { + leaf a1{ + type string; + } + leaf b1{ + type string; + } + } + choice par2 { + case nr1 { + leaf a21{ + type string; + } + leaf a22{ + type string; + } + } + case nr2 { + leaf b2{ + type string; + } + } + } } } } @@ -305,6 +351,15 @@ LIST='bar1mandatory$LIST]]>]]>" "^applicationoperation-faileddata-not-uniqueerrorbar]]>]]>$" +new "netconf choice ok" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42xxx]]>]]>" "^4242xxx]]>]]>$" + +new "netconf choice not-case expect fail" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42xx]]>]]>" "^applicationbad-elementb1errorElement in choice statement already exists]]>]]>$" + +new "netconf choice case expect fail" +expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO42xx]]>]]>" "^applicationbad-elementb2errorElement in choice statement already exists]]>]]>$" + if [ $RC -ne 0 ]; then new "Kill restconf daemon" stop_restconf