* Proper RFC 6241 Netconf error handling
* New functions added in clixon_netconf_lib.[ch] * Datastore code modified for RFC 6241 * Remaining: validate, generic restconf and netconf code
This commit is contained in:
parent
52e510cfdf
commit
efa72e9e6f
26 changed files with 1196 additions and 475 deletions
41
test/lib.sh
41
test/lib.sh
|
|
@ -56,9 +56,9 @@ expectfn(){
|
|||
expect2=
|
||||
fi
|
||||
ret=`$cmd`
|
||||
if [ $? -ne 0 ]; then
|
||||
err "wrong args"
|
||||
fi
|
||||
# if [ $? -ne 0 ]; then
|
||||
# err "wrong args"
|
||||
# fi
|
||||
# Match if both are empty string
|
||||
if [ -z "$ret" -a -z "$expect" ]; then
|
||||
return
|
||||
|
|
@ -68,9 +68,7 @@ expectfn(){
|
|||
fi
|
||||
# grep extended grep
|
||||
match=`echo $ret | grep -EZo "$expect"`
|
||||
# echo "ret:\"$ret\""
|
||||
# echo "expect:\"$expect\""
|
||||
# echo "match:\"$match\""
|
||||
|
||||
if [ -z "$match" ]; then
|
||||
err "$expect" "$ret"
|
||||
fi
|
||||
|
|
@ -82,6 +80,37 @@ expectfn(){
|
|||
fi
|
||||
}
|
||||
|
||||
# Similar to expectfn, but checks for equality and not only match
|
||||
expecteq2(){
|
||||
ret=$1
|
||||
expect=$2
|
||||
# Match if both are empty string
|
||||
if [ -z "$ret" -a -z "$expect" ]; then
|
||||
return
|
||||
fi
|
||||
if [ "$ret" != "$expect" ]; then
|
||||
err "$expect" "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
# Similar to expectfn, but checks for equality and not only match
|
||||
expecteq(){
|
||||
cmd=$1
|
||||
expect=$2
|
||||
ret=$($cmd)
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
err "wrong args"
|
||||
fi
|
||||
# Match if both are empty string
|
||||
if [ -z "$ret" -a -z "$expect" ]; then
|
||||
return
|
||||
fi
|
||||
if [ "$ret" != "$expect" ]; then
|
||||
err "$expect" "$ret"
|
||||
fi
|
||||
}
|
||||
|
||||
# clixon tester. First arg is command second is stdin and
|
||||
# third is expected outcome
|
||||
expecteof(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue