* Pushed tag to 4.0.1.PRE

* Restconf RFC 8040 increased feature compliance
  * Cache-Control: no-cache added in HTTP responses (RFC Section 5.5)
  * Restconf monitoring capabilities (RFC Section 9.1)
* Added support for Yang extensions
  * New plugin callback: ca_extension
  * Main backend example includes example code on how to implement a Yang extension in a plugin.
* JSON changes
  * Non-pretty-print output removed all extra spaces.
    * Example: `{"nacm-example:x": 42}` --> {"nacm-example:x":42}`
  * Empty JSON container changed from `null` to `{}`.
    * Empty list and leafs remain as `null`
* Removed unnecessary configure dependencies
  * libnsl, libcrypt, libm, if_vlan,...
* pseudo-plugin added, to enable callbacks also for main programs. Useful for extensions
* Yang Unique statements with multiple schema identifiers did not work on some platforms due to memory error.
This commit is contained in:
Olof hagsand 2019-07-23 22:11:14 +02:00
parent fe46a0e093
commit e7b60619da
60 changed files with 1619 additions and 568 deletions

View file

@ -34,7 +34,7 @@ if [ -f ./site.sh ]; then
# test skiplist.
for f in $SKIPLIST; do
if [ "$testfile" = "$f" ]; then
echo ...skipped
echo "...skipped (see site.sh)"
return -1 # skip
fi
done
@ -233,9 +233,11 @@ new(){
# Arguments:
# - command,
# - expected command return value (0 if OK)
# - expected stdout outcome,
# - expected2 stdout outcome,
# Example: expectfn "$clixon_cli -1 -f $cfg show conf cli" 0 "^$"
# - 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'
# instead use expectpart
expectfn(){
cmd=$1
retval=$2
@ -258,32 +260,30 @@ expectfn(){
echo -e "\e[0m:"
exit -1
fi
# if [ $r != 0 ]; then
# return
# 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
# 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
# grep extended grep
match=`echo $ret | grep -EZo "$expect"`
if [ -z "$match" ]; then
err "$expect" "$ret"
fi
if [ -n "$expect2" ]; then
match=`echo "$ret" | grep -EZo "$expect2"`
if [ -z "$match" ]; then
err $expect "$ret"
# Loop over all variable args expect strings
let i=0;
for exp in "$@"; do
if [ $i -gt 1 ]; then
match=`echo $ret | grep -EZo "$exp"`
if [ -z "$match" ]; then
err "$exp" "$ret"
fi
fi
fi
let i++;
done
}
# Evaluate and return
@ -313,6 +313,48 @@ expecteq(){
fi
}
# Evaluate and return
# like expecteq but partial match is OK
# Example: expecteq $(fn arg) 0 "my return"
# - evaluated expression
# - expected command return value (0 if OK)
# - expected stdout outcome
expectpart(){
r=$?
ret=$1
retval=$2
expect=$3
# echo "r:$r"
# echo "ret:\"$ret\""
# echo "retval:$retval"
# echo "expect:$expect"
if [ $r != $retval ]; then
echo -e "\e[31m\nError ($r != $retval) in Test$testnr [$testname]:"
echo -e "\e[0m:"
exit -1
fi
if [ -z "$ret" -a -z "$expect" ]; then
return
fi
# Loop over all variable args expect strings
let i=0;
for exp in "$@"; do
if [ $i -gt 1 ]; then
# echo "exp:$exp"
match=`echo $ret | grep -Zo "$exp"` # XXX -EZo: -E cant handle {}
if [ -z "$match" ]; then
err "$exp" "$ret"
fi
fi
let i++;
done
# if [[ "$ret" != "$expect" ]]; then
# err "$expect" "$ret"
# fi
}
# Pipe stdin to command
# Arguments:
# - Command
@ -401,6 +443,43 @@ EOF
fi
}
# Like expecteof/expecteofx but with test == instead of grep.
# No wildcards
# Use this for multi-lines
expecteofeq(){
cmd=$1
retval=$2
input=$3
expect=$4
# Do while read stuff
ret=$($cmd<<EOF
$input
EOF
)
r=$?
if [ $r != $retval ]; then
echo -e "\e[31m\nError ($r != $retval) in Test$testnr [$testname]:"
echo -e "\e[0m:"
exit -1
fi
# If error dont match output strings (why not?)
# if [ $r != 0 ]; then
# return
# fi
# Match if both are empty string
if [ -z "$ret" -a -z "$expect" ]; then
return
fi
# echo "ret:\"$ret\""
# echo "expect:\"$expect\""
# echo "match:\"$match\""
if [ "$ret" != "$expect" ]; then
err "$expect" "$ret"
fi
}
# clixon tester read from file for large tests
expecteof_file(){
cmd=$1