- Rewrote process control to simpler state model: stopped/running/exiting

- Stricter CLICON_BACKEND_RESTCONF_PROCESS :
 - if set, restconf daemon queries backend for its config
 - if not set, restconf daemon reads its config from main config file
This commit is contained in:
Olof hagsand 2021-04-11 17:36:22 +02:00
parent 9f5176adf5
commit 953326d39f
11 changed files with 517 additions and 310 deletions

View file

@ -72,8 +72,12 @@ testname=
# eg logging to a file: RCLOG="-l f/www-data/restconf.log"
: ${RCLOG:=}
# Namespace: netconf base
BASENS='urn:ietf:params:xml:ns:netconf:base:1.0'
# Namespace: Clixon lib
LIBNS='xmlns="http://clicon.org/lib"'
# Default netconf namespace statement, typically as placed on top-level <rpc xmlns=""
DEFAULTONLY="xmlns=\"$BASENS\""
@ -230,6 +234,7 @@ fi
# error and exit,
# arg1: expected
# arg2: errmsg[optional]
# Assumes: $dir and $expect are set
function err(){
echo -e "\e[31m\nError in Test$testnr [$testname]:"
if [ $# -gt 0 ]; then
@ -248,6 +253,20 @@ function err(){
exit -1 #$testnr
}
# Dont print diffs
function err1(){
echo -e "\e[31m\nError in Test$testnr [$testname]:"
if [ $# -gt 0 ]; then
echo "Expected: $1"
echo
fi
if [ $# -gt 1 ]; then
echo "Received: $2"
fi
echo -e "\e[0m"
exit -1 #$testnr
}
# Test is previous test had valgrind errors if so quit
function checkvalgrind(){
if [ -f $valgrindfile ]; then
@ -318,7 +337,7 @@ function start_restconf(){
echo "sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $*"
sudo -u $wwwstartuser -s $clixon_restconf $RCLOG -D $DBG $* &
if [ $? -ne 0 ]; then
err
err1 "expected 0" "$?"
fi
}
@ -352,7 +371,7 @@ function wait_restconf(){
while [[ $hdr != *"200 OK"* ]]; do
# echo "wait_restconf $i"
if [ $i -ge $DEMLOOP ]; then
err "restconf timeout $DEMWAIT seconds"
err1 "restconf timeout $DEMWAIT seconds"
fi
sleep $DEMSLEEP
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf 2> /dev/null)