revise testing: change expectfn -> extectpart etc
This commit is contained in:
parent
96ab7292b9
commit
41e23865a1
23 changed files with 186 additions and 241 deletions
|
|
@ -55,3 +55,6 @@ wwwuser=@wwwuser@
|
|||
|
||||
# Home dir for web user, by default /www-data
|
||||
WWWDIR=@wwwdir@
|
||||
|
||||
# Top src dir
|
||||
TOP_SRCDIR=@top_srcdir@
|
||||
|
|
|
|||
60
test/lib.sh
60
test/lib.sh
|
|
@ -6,11 +6,10 @@
|
|||
#
|
||||
# Create working dir as variable "dir"
|
||||
# The functions are somewhat wildgrown, a little too many:
|
||||
# - expectfn
|
||||
# - expectpart
|
||||
# - expecteof
|
||||
# - expecteofeq
|
||||
# - expecteofx
|
||||
# - expecteofeq
|
||||
# - expecteof_file
|
||||
# - expectwait
|
||||
# - expectmatch
|
||||
|
|
@ -371,63 +370,6 @@ new(){
|
|||
>&2 echo "Test $testi($testnr) [$1]"
|
||||
}
|
||||
|
||||
# clixon command tester.
|
||||
# Arguments:
|
||||
# - command,
|
||||
# - expected command return value (0 if OK)
|
||||
# - expected* stdout outcome, (can be many)
|
||||
# Example: expectfn "$clixon_cli -1 -f $cfg show conf cli" 0 "line1" "line2"
|
||||
# XXX: for some reason some curl commands dont work here, eg
|
||||
# curl -H 'Accept: application/xrd+xml'
|
||||
# NOTE: Please us expectpart instead!!
|
||||
expectfn(){
|
||||
cmd=$1
|
||||
retval=$2
|
||||
expect="$3"
|
||||
|
||||
if [ $# = 4 ]; then
|
||||
expect2=$4
|
||||
else
|
||||
expect2=
|
||||
fi
|
||||
ret=$($cmd)
|
||||
r=$?
|
||||
# echo "cmd:\"$cmd\""
|
||||
# echo "retval:\"$retval\""
|
||||
# echo "expect:\"$expect\""
|
||||
# echo "ret:\"$ret\""
|
||||
# echo "r:\"$r\""
|
||||
if [ $r != $retval ]; then
|
||||
echo -e "\e[31m\nError ($r != $retval) in Test$testnr [$testname]:"
|
||||
echo -e "\e[0m:"
|
||||
exit -1
|
||||
fi
|
||||
# if [ $ret -ne $retval ]; then
|
||||
# echo -e "\e[31m\nError in Test$testnr [$testname]:"
|
||||
# echo -e "\e[0m:"
|
||||
# exit -1
|
||||
# fi
|
||||
# Match if both are empty string (special case)
|
||||
if [ -z "$ret" -a -z "$expect" ]; then
|
||||
return
|
||||
fi
|
||||
if [ -z "$ret" -a "$expect" = "^$" ]; then
|
||||
return
|
||||
fi
|
||||
# Loop over all variable args expect strings
|
||||
let i=0;
|
||||
for exp in "$@"; do
|
||||
if [ $i -gt 1 ]; then
|
||||
match=`echo $ret | grep --null -Eo "$exp"`
|
||||
if [ -z "$match" ]; then
|
||||
err "$exp" "$ret"
|
||||
fi
|
||||
fi
|
||||
let i++;
|
||||
|
||||
done
|
||||
}
|
||||
|
||||
# Evaluate and return
|
||||
# Example: expectpart $(fn arg) 0 "my return" -- "foo"
|
||||
# - evaluated expression
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ expectpart "$($clixon_cli -1 -f $cfg show conf cli)" 0 "^set interfaces interfac
|
|||
|
||||
new "cli configure using encoded chars data <&"
|
||||
# problems in changing to expectpart with escapes
|
||||
expectfn "$clixon_cli -1 -f $cfg set interfaces interface eth/0/0 description \"foo<&bar\"" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set interfaces interface eth/0/0 description "\"foo<&bar\"")" 0 ""
|
||||
|
||||
new "cli configure using encoded chars name <&"
|
||||
expectfn "$clixon_cli -1 -f $cfg set interfaces interface fddi&< type ianaift:ethernetCsmacd" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set interfaces interface "fddi&<" type ianaift:ethernetCsmacd)" 0 ""
|
||||
|
||||
new "cli failed validate"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application missing-element Mandatory variable of interface in module ietf-interfaces <bad-element>type</bad-element>"
|
||||
|
|
@ -120,7 +120,7 @@ expectpart "$($clixon_cli -1 -f $cfg -l o debug level 1)" 0 "^$"
|
|||
|
||||
# How to test this?
|
||||
new "cli debug reset"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o debug level 0" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o debug level 0)" 0 "^$"
|
||||
|
||||
new "cli rpc"
|
||||
# We dont know which message-id the cli app uses
|
||||
|
|
|
|||
|
|
@ -94,23 +94,23 @@ fi
|
|||
|
||||
# Positive tests
|
||||
new "set x"
|
||||
expectfn "$clixon_cli -1 -f $cfg set x" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set x)" 0 ""
|
||||
|
||||
new "set x a b"
|
||||
expectfn "$clixon_cli -1 -f $cfg set x a 99 b 22" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set x a 99 b 22)" 0 ""
|
||||
|
||||
new "set x a b c"
|
||||
expectfn "$clixon_cli -1 -f $cfg set x a 22 b 33 c 55" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set x a 22 b 33 c 55)" 0 ""
|
||||
|
||||
new "show conf x"
|
||||
expectfn "$clixon_cli -1 -f $cfg show conf x" 0 "x m1 a 22 b 33"
|
||||
expectpart "$($clixon_cli -1 -f $cfg show conf x)" 0 "x m1 a 22 b 33"
|
||||
|
||||
# Negative tests
|
||||
new "err x"
|
||||
expectfn "$clixon_cli -1 -f $cfg err x" 255 "Config error: api-path syntax error \"/example2:x\": application unknown-element No such yang module prefix <bad-element>example2</bad-element>: Invalid argument"
|
||||
expectpart "$($clixon_cli -1 -f $cfg err x)" 255 "Config error: api-path syntax error \"/example2:x\": application unknown-element No such yang module prefix <bad-element>example2</bad-element>: Invalid argument"
|
||||
|
||||
new "err x a"
|
||||
expectfn "$clixon_cli -1 -f $cfg err x a 99" 255 "Config error: api-path syntax error \"/example:x/m1=%s\": rpc malformed-message List key m1 length mismatch : Invalid argument"
|
||||
expectpart "$($clixon_cli -1 -f $cfg err x a 99)" 255 "Config error: api-path syntax error \"/example:x/m1=%s\": rpc malformed-message List key m1 length mismatch : Invalid argument"
|
||||
|
||||
endtest
|
||||
|
||||
|
|
|
|||
|
|
@ -83,44 +83,44 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
new "set 1 v1"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v1" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 1 b v1)" 0 ""
|
||||
|
||||
new "set 1 v2"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v2" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 1 b v2)" 0 ""
|
||||
|
||||
new "set 1 v3"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v3" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 1 b v3)" 0 ""
|
||||
|
||||
new "set 2 v1"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 2 b v1" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 2 b v1)" 0 ""
|
||||
|
||||
new "set 2 v2"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 2 b v2" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 2 b v2)" 0 ""
|
||||
|
||||
new "set 2 v3"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 2 b v3" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 2 b v3)" 0 ""
|
||||
|
||||
new "set 1 v2 again"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex x a 1 b v2" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex x a 1 b v2)" 0 ""
|
||||
|
||||
new "show conf"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><ex xmlns=\"urn:example:clixon\"><x><a>1</a><b>v1</b></x><x><a>1</a><b>v2</b></x><x><a>1</a><b>v3</b></x><x><a>2</a><b>v1</b></x><x><a>2</a><b>v2</b></x><x><a>2</a><b>v3</b></x></ex></data></rpc-reply>]]>]]>$"
|
||||
|
||||
# ordered-by user
|
||||
new "set 1 v1"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex y a 1 b v1" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex y a 1 b v1)" 0 ""
|
||||
|
||||
new "set 2 v1"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex y a 2 b v1" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex y a 2 b v1)" 0 ""
|
||||
|
||||
new "set 1 v2"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex y a 1 b v2" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex y a 1 b v2)" 0 ""
|
||||
|
||||
new "set 1 v3"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex y a 1 b v3" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex y a 1 b v3)" 0 ""
|
||||
|
||||
new "set 2 v2"
|
||||
expectfn "$clixon_cli -1 -f $cfg set ex y a 2 b v2" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg set ex y a 2 b v2)" 0 ""
|
||||
|
||||
new "show conf"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><ex xmlns=\"urn:example:clixon\"><x><a>1</a><b>v1</b></x><x><a>1</a><b>v2</b></x><x><a>1</a><b>v3</b></x><x><a>2</a><b>v1</b></x><x><a>2</a><b>v2</b></x><x><a>2</a><b>v3</b></x><y><a>1</a><b>v1</b></y><y><a>2</a><b>v1</b></y><y><a>1</a><b>v2</b></y><y><a>1</a><b>v3</b></y><y><a>2</a><b>v2</b></y></ex></data></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
|
|
@ -89,24 +89,24 @@ m=AAA
|
|||
# Tests using mode AAA that should pass
|
||||
for c in 1 2 5; do
|
||||
new "cli mode $m 1 cmd$c OK"
|
||||
expectfn "$clixon_cli -1 -m $m -f $cfg cmd$c" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 0 "^$"
|
||||
done
|
||||
# Tests using mode AAA that should fail
|
||||
for c in 3 4 6; do
|
||||
new "cli mode $m 1 cmd$c Not OK"
|
||||
expectfn "$clixon_cli -1 -m $m -f $cfg cmd$c" 255 "^$"
|
||||
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 255 "^$"
|
||||
done
|
||||
|
||||
m=BBB
|
||||
# Tests using mode BBB that should pass
|
||||
for c in 1 3 5 6; do
|
||||
new "cli mode $m 1 cmd$c OK"
|
||||
expectfn "$clixon_cli -1 -m $m -f $cfg cmd$c" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 0 "^$"
|
||||
done
|
||||
# Tests using mode BBB that should fail
|
||||
for c in 2 4; do
|
||||
new "cli mode $m 1 cmd$c Not OK"
|
||||
expectfn "$clixon_cli -1 -m $m -f $cfg cmd$c" 255 "^$"
|
||||
expectpart "$($clixon_cli -1 -m $m -f $cfg cmd$c)" 255 "^$"
|
||||
done
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
|
|
|
|||
|
|
@ -62,12 +62,12 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
new "translate abc -> table/parameter=translate/value = bcd"
|
||||
expectfn "$clixon_cli -1 -f $cfg translate abc" 0 ""
|
||||
expectpart "$($clixon_cli -1 -f $cfg translate abc)" 0 ""
|
||||
|
||||
new "show config"
|
||||
expectpart "$($clixon_cli -1 -f $cfg show config)" 0 "<table xmlns=\"urn:example:clixon\"><parameter><name>translate</name><value>bcd</value></parameter></table>"
|
||||
|
||||
if [ $BE -new 0 ]; then
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
# Check if premature kill
|
||||
pid=$(pgrep -u root -f clixon_backend)
|
||||
|
|
|
|||
|
|
@ -61,103 +61,103 @@ rm -rf $mydir/*
|
|||
conf="-d candidate -b $mydir -y $dir/ietf-ip.yang"
|
||||
|
||||
new "datastore init"
|
||||
expectfn "$clixon_util_datastore $conf init" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf init)" 0 ""
|
||||
|
||||
new "datastore put all replace"
|
||||
ret=$($clixon_util_datastore $conf put replace "$xml")
|
||||
expectmatch "$ret" $? "0" ""
|
||||
|
||||
new "datastore get"
|
||||
expectfn "$clixon_util_datastore $conf get /" 0 "^$xml$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml$"
|
||||
|
||||
new "datastore put all remove"
|
||||
expectfn "$clixon_util_datastore $conf put remove <config/>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove "<config/>")" 0 ""
|
||||
|
||||
new "datastore get"
|
||||
expectfn "$clixon_util_datastore $conf get /" 0 "^<config/>$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^<config/>$"
|
||||
|
||||
new "datastore put all merge"
|
||||
ret=$($clixon_util_datastore $conf put merge "$xml")
|
||||
expectmatch "$ret" $? "0" ""
|
||||
|
||||
# expectfn "$clixon_util_datastore $conf put merge $xml" 0 ""
|
||||
# expectpart "$($clixon_util_datastore $conf put merge $xml)" 0 ""
|
||||
|
||||
new "datastore get"
|
||||
expectfn "$clixon_util_datastore $conf get /" 0 "^$xml$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml$"
|
||||
|
||||
new "datastore put all delete"
|
||||
expectfn "$clixon_util_datastore $conf put remove <config/>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove "<config/>")" 0 ""
|
||||
|
||||
new "datastore get"
|
||||
expectfn "$clixon_util_datastore $conf get /" 0 "^<config/>$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^<config/>$"
|
||||
|
||||
new "datastore put all create"
|
||||
ret=$($clixon_util_datastore $conf put create "$xml")
|
||||
expectmatch "$ret" $? "0" ""
|
||||
|
||||
new "datastore get"
|
||||
expectfn "$clixon_util_datastore $conf get /" 0 "^$xml$"
|
||||
expectpart "$($clixon_util_datastore $conf get /)" 0 "^$xml$"
|
||||
|
||||
new "datastore put top create"
|
||||
expectfn "$clixon_util_datastore $conf put create <config><x/></config>" 0 "" # error
|
||||
expectpart "$($clixon_util_datastore $conf put create "<config><x/></config>")" 0 "" # error
|
||||
|
||||
# Single key operations
|
||||
# leaf
|
||||
new "datastore put all delete"
|
||||
expectfn "$clixon_util_datastore $conf delete" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf delete)" 0 ""
|
||||
|
||||
new "datastore init"
|
||||
expectfn "$clixon_util_datastore $conf init" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf init)" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectfn "$clixon_util_datastore $conf put create <config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create "<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>")" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectfn "$clixon_util_datastore $conf put create <config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore delete leaf"
|
||||
expectfn "$clixon_util_datastore $conf put delete <config><x><y><a>1</a><b>3</b></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put delete '<config><x><y><a>1</a><b>3</b></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore replace leaf"
|
||||
expectfn "$clixon_util_datastore $conf put create <config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore remove leaf"
|
||||
expectfn "$clixon_util_datastore $conf put remove <config><x><g/></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove '<config><x><g/></x></config>')" 0 ""
|
||||
|
||||
new "datastore remove leaf"
|
||||
expectfn "$clixon_util_datastore $conf put remove <config><x><y><a>1</a><b>3</b><c/></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put remove '<config><x><y><a>1</a><b>3</b><c/></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore delete leaf"
|
||||
expectfn "$clixon_util_datastore $conf put delete <config><x><g/></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put delete '<config><x><g/></x></config>')" 0 ""
|
||||
|
||||
new "datastore merge leaf"
|
||||
expectfn "$clixon_util_datastore $conf put merge <config><x><g>nalle</g></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put merge '<config><x><g>nalle</g></x></config>')" 0 ""
|
||||
|
||||
new "datastore replace leaf"
|
||||
expectfn "$clixon_util_datastore $conf put replace <config><x><g>nalle</g></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put replace '<config><x><g>nalle</g></x></config>')" 0 ""
|
||||
|
||||
new "datastore merge leaf"
|
||||
expectfn "$clixon_util_datastore $conf put merge <config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put merge '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore replace leaf"
|
||||
expectfn "$clixon_util_datastore $conf put replace <config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put replace '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectfn "$clixon_util_datastore $conf put create <config><x><h><j>aaa</j></h></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><h><j>aaa</j></h></x></config>')" 0 ""
|
||||
|
||||
new "datastore create leaf"
|
||||
expectfn "$clixon_util_datastore $conf put create <config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf put create '<config><x><y><a>1</a><b>3</b><c>newentry</c></y></x></config>')" 0 ""
|
||||
|
||||
new "datastore other db init"
|
||||
expectfn "$clixon_util_datastore -d kalle -b $mydir -y $dir/ietf-ip.yang init" 0 ""
|
||||
expectpart "$($clixon_util_datastore -d kalle -b $mydir -y $dir/ietf-ip.yang init)" 0 ""
|
||||
|
||||
new "datastore other db copy"
|
||||
expectfn "$clixon_util_datastore $conf copy kalle" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf copy kalle)" 0 ""
|
||||
|
||||
diff $mydir/kalle_db $mydir/candidate_db
|
||||
|
||||
new "datastore lock"
|
||||
expectfn "$clixon_util_datastore $conf lock 756" 0 ""
|
||||
expectpart "$($clixon_util_datastore $conf lock 756)" 0 ""
|
||||
|
||||
# unset conditional parameters
|
||||
unset clixon_util_datastore
|
||||
|
|
|
|||
|
|
@ -159,16 +159,16 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
new "cli enabled feature"
|
||||
expectfn "$clixon_cli -1f $cfg set x foo" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set x foo)" 0 ""
|
||||
|
||||
new "cli disabled feature"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set y foo" 255 "CLI syntax error: \"set y foo\": Unknown command"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set y foo)" 255 "CLI syntax error: \"set y foo\": Unknown command"
|
||||
|
||||
new "cli enabled feature in other module"
|
||||
expectfn "$clixon_cli -1f $cfg set routing router-id 1.2.3.4" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set routing router-id 1.2.3.4)" 0 ""
|
||||
|
||||
new "cli disabled feature in other module"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set routing ribs rib default-rib false" 255 "CLI syntax error: \"set routing ribs rib default-rib false\": Unknown command"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set routing ribs rib default-rib false)" 255 "CLI syntax error: \"set routing ribs rib default-rib false\": Unknown command"
|
||||
|
||||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
|
|
@ -212,22 +212,22 @@ new "netconf validate (expect fail)"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message>Identityref validation failed, foo:bar not derived from crypto-alg</error-message></rpc-error></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli set crypto to mc:aes"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set crypto mc:aes" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set crypto mc:aes)" 0 "^$"
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o validate" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$"
|
||||
|
||||
new "cli set crypto to aes"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set crypto aes" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set crypto aes)" 0 "^$"
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o validate" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$"
|
||||
|
||||
new "cli set crypto to des:des3"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set crypto des:des3" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set crypto des:des3)" 0 "^$"
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o validate" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$"
|
||||
|
||||
new "Netconf set acl-type"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><acls xmlns=\"urn:example:my-crypto\"><acl><name>x</name><type>mc:ipv4-acl-type</type></acl></acls></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -245,20 +245,20 @@ new "netconf discard-changes"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "CLI set acl-type"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set acls acl x type mc:ipv4-acl-type" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set acls acl x type mc:ipv4-acl-type)" 0 "^$"
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o validate" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$"
|
||||
|
||||
new "CLI set wrong acl-type"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set acls acl x type undefined" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set acls acl x type undefined)" 0 "^$"
|
||||
|
||||
new "cli validate acl-type"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
|
||||
|
||||
# test empty identityref list
|
||||
new "cli set empty"
|
||||
expectfn "$clixon_cli -1 -f $cfg -l o set e undefined" 0 "^$"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o set e undefined)" 0 "^$"
|
||||
|
||||
new "cli validate empty"
|
||||
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 255 "Validate failed. Edit and try again or discard changes: application operation-failed Identityref validation failed, undefined not derived from acl-base"
|
||||
|
|
|
|||
|
|
@ -176,16 +176,16 @@ new "leafref discard-changes"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli leafref lo"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set default-address absname lo" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set default-address absname lo)" 0 "^$"
|
||||
|
||||
new "cli leafref validate"
|
||||
expectfn "$clixon_cli -1f $cfg -l o validate" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o validate)" 0 "^$"
|
||||
|
||||
new "cli sender"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set sender a" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set sender a)" 0 "^$"
|
||||
|
||||
new "cli sender template"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set sender b template a" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set sender b template a)" 0 "^$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -201,13 +201,13 @@ new "cli show conf as guest"
|
|||
expectpart "$($clixon_cli -1 -U guest -l o -f $cfg show conf)" 255 "application access-denied"
|
||||
|
||||
new "cli rpc as admin"
|
||||
expectfn "$clixon_cli -1 -U andy -l o -f $cfg rpc ipv4" 0 '<x xmlns="urn:example:clixon">ipv4</x><y xmlns="urn:example:clixon">42</y>'
|
||||
expectpart "$($clixon_cli -1 -U andy -l o -f $cfg rpc ipv4)" 0 '<x xmlns="urn:example:clixon">ipv4</x><y xmlns="urn:example:clixon">42</y>'
|
||||
|
||||
new "cli rpc as limited"
|
||||
expectfn "$clixon_cli -1 -U wilma -l o -f $cfg rpc ipv4" 255 "access-denied default deny"
|
||||
expectpart "$($clixon_cli -1 -U wilma -l o -f $cfg rpc ipv4)" 255 "access-denied default deny"
|
||||
|
||||
new "cli rpc as guest"
|
||||
expectfn "$clixon_cli -1 -U guest -l o -f $cfg rpc ipv4" 255 "access-denied access denied"
|
||||
expectpart "$($clixon_cli -1 -U guest -l o -f $cfg rpc ipv4)" 255 "access-denied access denied"
|
||||
|
||||
if [ $RC -ne 0 ]; then
|
||||
new "Kill restconf daemon"
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ new "netconf get replaced config"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\"><interface><name>eth&</name><type>t<></type><enabled>true</enabled></interface><interface><name>eth1</name><type>ex:eth</type><enabled>true</enabled></interface><interface><name>eth2</name><type>ex:eth</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli show configuration eth& - encoding tests"
|
||||
expectfn "$clixon_cli -1 -f $cfg show conf cli" 0 "interfaces interface eth& type t<>
|
||||
expectpart "$($clixon_cli -1 -f $cfg show conf cli)" 0 "interfaces interface eth& type t<>
|
||||
interfaces interface eth& enabled true"
|
||||
|
||||
new "netconf edit CDATA"
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ new "Openconfig test: $clixon_cli -1f $cfg -y $f show version ($m modules)"
|
|||
for f in $files; do
|
||||
if [ -n "$(head -1 $f|grep '^module')" ]; then
|
||||
new "$clixon_cli -D $DBG -1f $cfg -y $f show version"
|
||||
expectfn "$clixon_cli -D $DBG -1f $cfg -y $f show version" 0 "$version."
|
||||
expectpart "$($clixon_cli -D $DBG -1f $cfg -y $f show version)" 0 "$version."
|
||||
fi
|
||||
|
||||
done
|
||||
|
|
|
|||
|
|
@ -743,68 +743,68 @@ testrun "p$pnr" false '248:197.7.89/8'
|
|||
|
||||
# CLI tests
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 2 AB"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc2 AB" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc2 AB)" 0 '^$'
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 2 9A00"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc2 9A00" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc2 9A00)" 0 '^$'
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 2 00ABAB (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc2 00ABAB" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc2 00ABAB)" 255 '^CLI syntax error:'
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 2 xx00 (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc2 xx00" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc2 xx00)" 255 '^CLI syntax error:'
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 3 enabled"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc3 enabled" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc3 enabled)" 0 '^$'
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 3 10-mbit (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc3 10-mbit" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc3 10-mbit)" 255 '^CLI syntax error:'
|
||||
|
||||
new "CLI tests for RFC7950 Sec 9.4.7 ex 3 xml-element (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c rfc3 xml-element" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c rfc3 xml-element)" 255 '^CLI syntax error:'
|
||||
|
||||
new "CLI tests for two patterns gksdhfsakjhdks"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c twomatch gksdhfsakjhdks" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c twomatch gksdhfsakjhdks)" 0 '^$'
|
||||
|
||||
new "CLI tests for two patterns xabcde (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c twomatch xabcde" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c twomatch xabcde)" 255 '^CLI syntax error:'
|
||||
|
||||
new "CLI tests for two patterns gabcdefg (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c twomatch gabcdefg" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c twomatch gabcdefg)" 255 '^CLI syntax error:'
|
||||
|
||||
# NOTE if the following two are swapped, it fails, the reason being:
|
||||
# valid "gks" is selected as a valid (expand) match although gk is not.
|
||||
# this may be a CLIgen error but ignored for now
|
||||
new "CLI tests for three patterns gk (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c threematch gk" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c threematch gk)" 255 '^CLI syntax error:'
|
||||
|
||||
new "CLI tests for three patterns gks"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c threematch gks" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c threematch gks)" 0 '^$'
|
||||
|
||||
new "CLI tests for three patterns abcg (should fail)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c threematch abcg" 255 '^CLI syntax error:'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c threematch abcg)" 255 '^CLI syntax error:'
|
||||
|
||||
# Need to have failures first so there are no matches with existing entries
|
||||
new "CLI tests for CDATA, should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 <![CDATA[foo" 255 'CLI syntax error'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "<![CDATA[foo")" 255 'CLI syntax error'
|
||||
|
||||
new "CLI tests for CDATA, should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 <!CDATA[foo]]" 255 'CLI syntax error'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "<!CDATA[foo]]")" 255 'CLI syntax error'
|
||||
|
||||
new "CLI tests for CDATA, should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 <!CDATA[foo]>" 255 'CLI syntax error'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "<!CDATA[foo]>")" 255 'CLI syntax error'
|
||||
|
||||
new "CLI tests for CDATA, should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 <![CDATA[]]>" 255 'CLI syntax error'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "<![CDATA[]]>")" 255 'CLI syntax error'
|
||||
|
||||
new "CLI tests for CDATA, should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 ![CDATA[foo]]>" 255 'CLI syntax error'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "![CDATA[foo]]>")" 255 'CLI syntax error'
|
||||
|
||||
new "CLI tests for CDATA, should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 <![CDATA[foo]]" 255 'CLI syntax error'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "<![CDATA[foo]]")" 255 'CLI syntax error'
|
||||
|
||||
new "CLI tests for CDATA OK"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c p45 <![CDATA[foobar]]>" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c p45 "<![CDATA[foobar]]>")" 0 '^$'
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ done } 2>&1 | awk '/real/ {print $2}'
|
|||
if false; then
|
||||
# CLI get
|
||||
new "cli get test single req"
|
||||
expectfn "$clixon_cli -1 -1f $cfg -l o show state xml interfaces a foo b interface e1" 0 '^<interface>
|
||||
expectpart "$($clixon_cli -1 -1f $cfg -l o show state xml interfaces a foo b interface e1)" 0 '^<interface>
|
||||
<name>e1</name>
|
||||
<type>eth</type>
|
||||
<status>up</status>
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ APPNAME=example
|
|||
|
||||
cfg=$dir/conf.xml
|
||||
|
||||
# clixon-example and clixon-restconf is used, copy here
|
||||
cp /usr/local/share/clixon/clixon-example@2020-12-01.yang $dir/
|
||||
cp /usr/local/share/clixon/clixon-restconf@2020-10-30.yang $dir/
|
||||
# clixon-example and clixon-restconf is used in the test, need local copy
|
||||
cp ${TOP_SRCDIR}/example/main/clixon-example@2020-12-01.yang $dir/
|
||||
cp ${TOP_SRCDIR}/yang/clixon/clixon-restconf@2020-10-30.yang $dir/
|
||||
|
||||
cat <<EOF > $cfg
|
||||
<clixon-config xmlns="http://clicon.org/config">
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ EOF
|
|||
fi
|
||||
|
||||
new "$clixon_cli -1f $cfg show version"
|
||||
expectfn "$clixon_cli -1f $cfg show version" 0 "$version."
|
||||
expectpart "$($clixon_cli -1f $cfg show version)" 0 "$version."
|
||||
|
||||
new "hello session-id 2"
|
||||
expecteof "$clixon_util_socket -a $family -s $sock -D $DBG" 0 "<hello $DEFAULTNS/>" "<hello $DEFAULTNS><session-id>3</session-id></hello>"
|
||||
|
|
|
|||
|
|
@ -177,28 +177,28 @@ new "netconfig edit main module"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><main xmlns=\"urn:example:clixon\"><x>foo</x><ext>foo</ext></main></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli edit main"
|
||||
expectfn "$clixon_cli -1f $cfg set main x bar" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set main x bar)" 0 ""
|
||||
|
||||
new "cli edit main ext"
|
||||
expectfn "$clixon_cli -1f $cfg set main ext bar" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set main ext bar)" 0 ""
|
||||
|
||||
new "netconfig edit sub1"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><sub1 xmlns=\"urn:example:clixon\"><x>foo</x><ext1>foo</ext1></sub1></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli edit sub1"
|
||||
expectfn "$clixon_cli -1f $cfg set sub1 x bar" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set sub1 x bar)" 0 ""
|
||||
|
||||
new "cli edit sub1 ext"
|
||||
expectfn "$clixon_cli -1f $cfg set sub1 ext1 bar" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set sub1 ext1 bar)" 0 ""
|
||||
|
||||
new "netconfig edit sub2 module"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><sub2 xmlns=\"urn:example:clixon\"><x>foo</x><ext2>foo</ext2></sub2></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli edit sub2"
|
||||
expectfn "$clixon_cli -1f $cfg set sub2 x fum" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set sub2 x fum)" 0 ""
|
||||
|
||||
new "cli edit sub2 ext"
|
||||
expectfn "$clixon_cli -1f $cfg set sub2 ext2 fum" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set sub2 ext2 fum)" 0 ""
|
||||
|
||||
new "netconf submodule validate"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
|
|
@ -246,10 +246,10 @@ EOF
|
|||
fi
|
||||
|
||||
new "cli set transitive string. type is alpha followed by number and is defined in three levels of modules"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c talle x99" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c talle x99)" 0 '^$'
|
||||
|
||||
new "cli set transitive string error. Wrong type"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c talle 9xx" 255 '^CLI syntax error: "set c talle 9xx": regexp match fail: 9xx does not match \[a-z\]\[0-9\]\*$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c talle 9xx)" 255 '^CLI syntax error: "set c talle 9xx": regexp match fail: 9xx does not match \[a-z\]\[0-9\]\*$'
|
||||
|
||||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -264,22 +264,22 @@ EOF
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli set transitive union int (ulle should accept 4.44|bounded|unbounded)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c ulle 33" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle 33)" 0 '^$'
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1f $cfg -l o -l o validate" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o -l o validate)" 0 '^$'
|
||||
|
||||
new "cli set transitive union string (and space)"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c ulle un\ bounded" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle "un\ bounded")" 0 '^$'
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1f $cfg -l o -l o validate" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o -l o validate)" 0 '^$'
|
||||
|
||||
new "cli set transitive union error. should fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c ulle kalle" 255 "^CLI syntax error: \"set c ulle kalle\": 'kalle' is not a number$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle kalle)" 255 "^CLI syntax error: \"set c ulle kalle\": 'kalle' is not a number$"
|
||||
|
||||
new "cli set transitive union error int"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c ulle 55" 255 '^CLI syntax error: "set c ulle 55": Number 55 out of range: 4 - 44$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle 55)" 255 '^CLI syntax error: "set c ulle 55": Number 55 out of range: 4 - 44$'
|
||||
|
||||
new "netconf set transitive union error int"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><c xmlns=\"urn:example:clixon\"><ulle>55</ulle></c></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>"
|
||||
|
|
@ -293,25 +293,25 @@ EOF
|
|||
#-----------
|
||||
|
||||
new "cli set ab"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set list a.b.a.b" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set list a.b.a.b)" 0 '^$'
|
||||
|
||||
new "cli set cd"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set list c.d.c.d" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set list c.d.c.d)" 0 '^$'
|
||||
|
||||
new "cli set ef"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set list e.f.e.f" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set list e.f.e.f)" 0 '^$'
|
||||
|
||||
new "cli set ab fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set list a&b&a&b" 255 "^CLI syntax error"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set list "a&b&a&b")" 255 "^CLI syntax error"
|
||||
|
||||
new "cli set ad fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set list a.b.c.d" 255 "^CLI syntax error"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set list a.b.c.d)" 255 "^CLI syntax error"
|
||||
|
||||
new "cli validate"
|
||||
expectfn "$clixon_cli -1f $cfg -l o -l o validate" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o -l o validate)" 0 '^$'
|
||||
|
||||
new "cli commit"
|
||||
expectfn "$clixon_cli -1f $cfg -l o -l o commit" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o -l o commit)" 0 '^$'
|
||||
|
||||
new "netconf validate ok"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -329,20 +329,20 @@ EOF
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><commit/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli enum value"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set status down" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set status down)" 0 '^$'
|
||||
|
||||
new "cli bits value"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set mbits create" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set mbits create)" 0 '^$'
|
||||
|
||||
#XXX No, cli cant assign two bit values
|
||||
#new "cli bits two values"
|
||||
#expectfn "$clixon_cli -1f $cfg -l o set mbits \"create read\"" 0 '^$'
|
||||
#expectpart "$($clixon_cli -1f $cfg -l o set mbits \)"create read\"" 0 '^$'
|
||||
|
||||
new "netconf bits two values"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><mbits xmlns=\"urn:example:clixon\">create read</mbits></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
new "cli bits validate"
|
||||
expectfn "$clixon_cli -1f $cfg -l o validate" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o validate)" 0 '^$'
|
||||
|
||||
#-------- num0 empty value
|
||||
|
||||
|
|
@ -358,13 +358,13 @@ EOF
|
|||
#-------- num1 single range (1)
|
||||
|
||||
new "cli range test num1 1 OK"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num1 1" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num1 1)" 0 '^$'
|
||||
|
||||
#new "cli range test num1 -100 ok" # XXX -/minus cant be given as argv
|
||||
#expectfn "$clixon_cli -1f $cfg -l o set num1 \-100" 0 '^$'
|
||||
#expectpart "$($clixon_cli -1f $cfg -l o set num1 \-100)" 0 '^$'
|
||||
|
||||
new "cli range test num1 2 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num1 2" 255 '^CLI syntax error: "set num1 2": Number 2 out of range: 1 - 1$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num1 2)" 255 '^CLI syntax error: "set num1 2": Number 2 out of range: 1 - 1$'
|
||||
|
||||
new "netconf range set num1 -1"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><num1 xmlns=\"urn:example:clixon\">-1</num1></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -378,13 +378,13 @@ EOF
|
|||
#-------- num2 range and blanks
|
||||
|
||||
new "cli range test num2 3 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num2 3" 255 '^CLI syntax error: "set num2 3": Number 3 out of range: 4 - 4000$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num2 3)" 255 '^CLI syntax error: "set num2 3": Number 3 out of range: 4 - 4000$'
|
||||
|
||||
new "cli range test num2 1000 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num2 1000" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num2 1000)" 0 '^$'
|
||||
|
||||
new "cli range test num2 5000 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num2 5000" 255 '^CLI syntax error: "set num2 5000": Number 5000 out of range: 4 - 4000$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num2 5000)" 255 '^CLI syntax error: "set num2 5000": Number 5000 out of range: 4 - 4000$'
|
||||
|
||||
new "netconf range set num2 3 fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><num2 xmlns=\"urn:example:clixon\">3</num2></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -410,13 +410,13 @@ EOF
|
|||
#-------- num3 min max range
|
||||
|
||||
new "cli range test num3 42 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num3 42" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num3 42)" 0 '^$'
|
||||
|
||||
new "cli range test num3 260 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num3 260" 255 '^CLI syntax error: "set num3 260": Number 260 out of range: 0 - 255$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num3 260)" 255 '^CLI syntax error: "set num3 260": Number 260 out of range: 0 - 255$'
|
||||
|
||||
new "cli range test num3 -1 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num3 -1" 255 "CLI syntax error:"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num3 -1)" 255 "CLI syntax error:"
|
||||
|
||||
new "netconf range set num3 260 fail"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><num3 xmlns=\"urn:example:clixon\">260</num3></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -430,19 +430,19 @@ EOF
|
|||
#-------- num4 multiple ranges 1..2 | 42..50
|
||||
|
||||
new "cli range test num4 multiple 0 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num4 0" 255 '^CLI syntax error: "set num4 0": Number 0 out of range: 1 - 2, 42 - 50$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num4 0)" 255 '^CLI syntax error: "set num4 0": Number 0 out of range: 1 - 2, 42 - 50$'
|
||||
|
||||
new "cli range test num4 multiple 2 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l e set num4 2" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l e set num4 2)" 0 '^$'
|
||||
|
||||
new "cli range test num4 multiple 20 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num4 20" 255 '^CLI syntax error: "set num4 20": Number 20 out of range: 1 - 2, 42 - 50$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num4 20)" 255 '^CLI syntax error: "set num4 20": Number 20 out of range: 1 - 2, 42 - 50$'
|
||||
|
||||
new "cli range test num4 multiple 42 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num4 42" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num4 42)" 0 '^$'
|
||||
|
||||
new "cli range test num4 multiple 99 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num4 99" 255 '^CLI syntax error: "set num4 99": Number 99 out of range: 1 - 2, 42 - 50$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num4 99)" 255 '^CLI syntax error: "set num4 99": Number 99 out of range: 1 - 2, 42 - 50$'
|
||||
|
||||
new "netconf range set num4 multiple 2"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><num4 xmlns=\"urn:example:clixon\">42</num4></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -468,16 +468,16 @@ EOF
|
|||
#-------- dec64 multiple ranges -3.5..-2.5 | 0.0 | 10.0..20.0
|
||||
# XXX how to enter negative numbers in bash string and cli -1?
|
||||
new "cli range dec64 multiple 0 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set dec 0" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set dec 0)" 0 '^$'
|
||||
|
||||
new "cli range dec64 multiple 0.1 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set num4 0.1" 255 '^CLI syntax error: "set num4 0.1": '"'"'0.1'"'"' is not a number$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set num4 0.1)" 255 '^CLI syntax error: "set num4 0.1": '"'"'0.1'"'"' is not a number$'
|
||||
|
||||
new "cli range dec64 multiple 15.0 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set dec 15.0" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set dec 15.0)" 0 '^$'
|
||||
|
||||
new "cli range dec64 multiple 30.0 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set dec 30.0" 255 '^CLI syntax error: "set dec 30.0": Number 30.000 out of range: -3.500 - -2.500, 0.000 - 0.000, 10.000 - 20.000$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set dec 30.0)" 255 '^CLI syntax error: "set dec 30.0": Number 30.000 out of range: -3.500 - -2.500, 0.000 - 0.000, 10.000 - 20.000$'
|
||||
|
||||
new "dec64 discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -522,13 +522,13 @@ EOF
|
|||
#----------------string ranges---------------------
|
||||
#-------- len1 single range (2)
|
||||
new "cli length test len1 1 fail"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len1 x" 255 '^CLI syntax error: "set len1 x": String length 1 out of range: 2 - 2$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len1 x)" 255 '^CLI syntax error: "set len1 x": String length 1 out of range: 2 - 2$'
|
||||
|
||||
new "cli length test len1 2 OK"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len1 xy" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len1 xy)" 0 '^$'
|
||||
|
||||
new "cli length test len1 3 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len1 hej" 255 '^CLI syntax error: "set len1 hej": String length 3 out of range: 2 - 2$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len1 hej)" 255 '^CLI syntax error: "set len1 hej": String length 3 out of range: 2 - 2$'
|
||||
|
||||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -542,10 +542,10 @@ EOF
|
|||
#-------- len2 range and blanks
|
||||
|
||||
new "cli length test len2 3 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len2 ab" 255 '^CLI syntax error: "set len2 ab": String length 2 out of range: 4 - 4000$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len2 ab)" 255 '^CLI syntax error: "set len2 ab": String length 2 out of range: 4 - 4000$'
|
||||
|
||||
new "cli length test len2 42 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len2 hejhophdsakjhkjsadhkjsahdkjsad" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len2 hejhophdsakjhkjsadhkjsahdkjsad)" 0 '^$'
|
||||
|
||||
new "netconf discard-changes"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -553,36 +553,36 @@ EOF
|
|||
#-------- len3 min max range
|
||||
|
||||
new "cli range ptest len3 42 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len3 hsakjdhkjsahdkjsahdksahdksajdhsakjhd" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len3 hsakjdhkjsahdkjsahdksahdksajdhsakjhd)" 0 '^$'
|
||||
|
||||
#-------- len4 multiple ranges 2..3 | 20-29
|
||||
new "cli length test len4 1 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len4 a" 255 '^CLI syntax error: "set len4 a": String length 1 out of range: 2 - 3, 20 - 29$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len4 a)" 255 '^CLI syntax error: "set len4 a": String length 1 out of range: 2 - 3, 20 - 29$'
|
||||
|
||||
new "cli length test len4 2 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len4 ab" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len4 ab)" 0 '^$'
|
||||
|
||||
new "cli length test len4 10 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len4 abcdefghij" 255 '^CLI syntax error: "set len4 abcdefghij": String length 10 out of range: 2 - 3, 20 - 29$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len4 abcdefghij)" 255 '^CLI syntax error: "set len4 abcdefghij": String length 10 out of range: 2 - 3, 20 - 29$'
|
||||
|
||||
new "cli length test len4 20 ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len4 abcdefghijabcdefghija" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len4 abcdefghijabcdefghija)" 0 '^$'
|
||||
|
||||
new "cli length test len4 30 error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set len4 abcdefghijabcdefghijabcdefghij" 255 '^CLI syntax error: "set len4 abcdefghijabcdefghijabcdefghij": String length 30 out of range: 2 - 3, 20 - 29$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set len4 abcdefghijabcdefghijabcdefghij)" 255 '^CLI syntax error: "set len4 abcdefghijabcdefghijabcdefghij": String length 30 out of range: 2 - 3, 20 - 29$'
|
||||
|
||||
# XSD schema -> POSIX ECE translation
|
||||
new "cli yang pattern \d ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set digit4 0123" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set digit4 0123)" 0 '^$'
|
||||
|
||||
new "cli yang pattern \d error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set digit4 01b2" 255 '^CLI syntax error: "set digit4 01b2": regexp match fail: 01b2 does not match'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set digit4 01b2)" 255 '^CLI syntax error: "set digit4 01b2": regexp match fail: 01b2 does not match'
|
||||
|
||||
new "cli yang pattern \w ok"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set word4 abc9" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set word4 abc9)" 0 '^$'
|
||||
|
||||
new "cli yang pattern \w error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set word4 ab%3" 255 '^CLI syntax error: "set word4 ab%3": regexp match fail: ab%3 does not match'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set word4 ab%3)" 255 '^CLI syntax error: "set word4 ab%3": regexp match fail: ab%3 does not match'
|
||||
|
||||
new "netconf pattern \w"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><word4 xmlns=\"urn:example:clixon\">aXG9</word4></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -634,28 +634,28 @@ EOF
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><validate><source><candidate/></source></validate></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
||||
#new "cli type with minus"
|
||||
#expectfn "$clixon_cli -1f $cfg -l o set name my-name" 0 "^$"
|
||||
#expectpart "$($clixon_cli -1f $cfg -l o set name my-name)" 0 "^$"
|
||||
|
||||
#------ cli truth-values: true/on/enable false/off/disable
|
||||
|
||||
new "cli truth: true"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool true" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool true)" 0 "^$"
|
||||
new "cli truth: false"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool false" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool false)" 0 "^$"
|
||||
new "cli truth: on"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool on" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool on)" 0 "^$"
|
||||
new "cli verify on translates to true"
|
||||
expectfn "$clixon_cli -1f $cfg -l o show conf" 0 "bool true;"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o show conf)" 0 "bool true;"
|
||||
new "cli truth: off"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool off" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool off)" 0 "^$"
|
||||
new "cli verify off translates to false"
|
||||
expectfn "$clixon_cli -1f $cfg -l o show conf" 0 "bool false;"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o show conf)" 0 "bool false;"
|
||||
new "cli truth: enable"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool enable" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool enable)" 0 "^$"
|
||||
new "cli truth: disable"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool disable" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool disable)" 0 "^$"
|
||||
new "cli truth: wrong"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set bool wrong" 255 "'wrong' is not a boolean value"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set bool wrong)" 255 "'wrong' is not a boolean value"
|
||||
|
||||
if [ $BE -ne 0 ]; then
|
||||
new "Kill backend"
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ testrange(){
|
|||
expectpart "$($clixon_cli -1f $cfg -l o set l$t $eval)" 255 "$errmsg"
|
||||
|
||||
new "generated cli set $t leaf OK"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set l$t $val" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set l$t $val)" 0 '^$'
|
||||
|
||||
# XXX Error in cligen order: Unknown command vs Number out of range
|
||||
# olof@vandal> set luint8 0
|
||||
|
|
@ -245,14 +245,14 @@ testrange(){
|
|||
# CLI syntax error: "set luint8 0": Unknown command
|
||||
# (SAME AS FIRST ^)
|
||||
new "generated cli set $t leaf invalid"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set l$t $eval" 255 "$errmsg"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set l$t $eval)" 255 "$errmsg"
|
||||
|
||||
new "manual cli set $t leaf OK"
|
||||
expectfn "$clixon_cli -1f $cfg -l o man h$t $val" 0 '^$'
|
||||
expectpart "$($clixon_cli -1f $cfg -l o man h$t $val)" 0 '^$'
|
||||
|
||||
new "manual cli set $t leaf invalid"
|
||||
echo "$clixon_cli -1f $cfg -l o set h$t $eval"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set l$t $eval" 255 "$errmsg"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set l$t $eval)" 255 "$errmsg"
|
||||
|
||||
new "discard"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
|
|||
|
|
@ -92,13 +92,13 @@ if [ $BE -ne 0 ]; then
|
|||
fi
|
||||
|
||||
new "cli set transitive string"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c talle x" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c talle x)" 0 "^$"
|
||||
|
||||
new "cli set transitive union"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c ulle 33" 0 "^$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle 33)" 0 "^$"
|
||||
|
||||
new "cli set transitive union error"
|
||||
expectfn "$clixon_cli -1f $cfg -l o set c ulle kalle" 255 "^CLI syntax error: \"set c ulle kalle\": 'kalle' is not a number$"
|
||||
expectpart "$($clixon_cli -1f $cfg -l o set c ulle kalle)" 255 "^CLI syntax error: \"set c ulle kalle\": 'kalle' is not a number$"
|
||||
|
||||
if [ $BE -eq 0 ]; then
|
||||
exit # BE
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@ if [ "$BE" -ne 0 ]; then
|
|||
fi
|
||||
|
||||
new "cli defined extension"
|
||||
expectfn "$clixon_cli -1f $cfg show version" 0 "$version."
|
||||
expectpart "$($clixon_cli -1f $cfg show version)" 0 "$version."
|
||||
|
||||
new "empty values in leaf-list"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon\"><f><e>a</e></f></x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
|
||||
|
|
@ -175,7 +175,7 @@ expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><discard-changes/></rpc>
|
|||
#new "netconf not defined extension"
|
||||
#expecteof "$clixon_netconf -qf $cfg -l o" 0 "$YANG" "Extension ex:not-defined not found"
|
||||
# This text yields an error, but the test cannot detect the error message yet
|
||||
#expectfn "$clixon_cli -1f $cfg -y $fyangerr show version" 0 "Yang error: Extension ex:not-defined not found"
|
||||
#expectpart "$($clixon_cli -1f $cfg -y $fyangerr show version)" 0 "Yang error: Extension ex:not-defined not found"
|
||||
|
||||
new "netconf schema resource, RFC 7895"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"yanglib:modules-state/yanglib:module\" xmlns:yanglib=\"urn:ietf:params:xml:ns:yang:ietf-yang-library\"/></get></rpc>]]>]]>" "<module><name>ietf-yang-types</name><revision>2013-07-15</revision><namespace>urn:ietf:params:xml:ns:yang:ietf-yang-types</namespace><conformance-type>implement</conformance-type></module>"
|
||||
|
|
@ -206,10 +206,10 @@ new "netconf get (should be some)"
|
|||
expecteof "$clixon_netconf -qf $cfg" 0 "<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"/\"/></get></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data><x xmlns=\"urn:example:clixon\"><y><a>1</a><b>2</b><c>5</c><val>one</val></y><d/></x>"
|
||||
|
||||
new "cli set leaf-list"
|
||||
expectfn "$clixon_cli -1f $cfg set x f e foo" 0 ""
|
||||
expectpart "$($clixon_cli -1f $cfg set x f e foo)" 0 ""
|
||||
|
||||
new "cli show leaf-list"
|
||||
expectfn "$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)"
|
||||
expecteof "$clixon_netconf -qf $cfg" 0 "<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>]]>]]>$"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue