Fixed: input RPC validation of choice (non-case)
This commit is contained in:
parent
bdc09851f0
commit
b5ecd6d5fa
3 changed files with 58 additions and 2 deletions
|
|
@ -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='<u1 xmlns="urn:example:clixon"><uk>bar</uk><val>1</val></u1><u1 xmlns="urn
|
|||
new "netconf example rpc input list with non-unique keys (should fail)"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><example xmlns=\"urn:example:clixon\"><x>mandatory</x>$LIST</example></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-app-tag>data-not-unique</error-app-tag><error-severity>error</error-severity><error-info><non-unique><uk>bar</uk></non-unique></error-info></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf choice ok"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><example xmlns=\"urn:example:clixon\"><x>42</x><a1>x</a1><a21>x</a21><a22>x</a22></example></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><x xmlns=\"urn:example:clixon\">42</x><y xmlns=\"urn:example:clixon\">42</y><a1 xmlns=\"urn:example:clixon\">x</a1><a21 xmlns=\"urn:example:clixon\">x</a21><a22 xmlns=\"urn:example:clixon\">x</a22></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf choice not-case expect fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><example xmlns=\"urn:example:clixon\"><x>42</x><a1>x</a1><b1>x</b1></example></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>b1</bad-element></error-info><error-severity>error</error-severity><error-message>Element in choice statement already exists</error-message></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
new "netconf choice case expect fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><example xmlns=\"urn:example:clixon\"><x>42</x><a21>x</a21><b2>x</b2></example></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>bad-element</error-tag><error-info><bad-element>b2</bad-element></error-info><error-severity>error</error-severity><error-message>Element in choice statement already exists</error-message></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
if [ $RC -ne 0 ]; then
|
||||
new "Kill restconf daemon"
|
||||
stop_restconf
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue