Test: restconf-callhome fixes for http/1+2 and valgrind

This commit is contained in:
Olof hagsand 2022-09-06 11:34:06 +02:00
parent f6a964eab6
commit 44501c097d
4 changed files with 15 additions and 21 deletions

View file

@ -190,7 +190,7 @@ EOF
new "wait restconf" new "wait restconf"
wait_restconf $proto wait_restconf $proto
echo "curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/index.html" # echo "curl $CURLOPTS -X GET -H 'Accept: text/html' $proto://localhost/data/index.html"
if ! $enable; then if ! $enable; then
# XXX or bad request? # XXX or bad request?

View file

@ -221,7 +221,7 @@ function testrun()
HVER=2 HVER=2
new "wait restconf" new "wait restconf"
wait_restconf https wait_restconf
new "restconf root discovery. RFC 8040 3.1 (xml+xrd)" new "restconf root discovery. RFC 8040 3.1 (xml+xrd)"
echo "curl $CURLOPTS -X GET $proto://$addr/.well-known/host-meta" echo "curl $CURLOPTS -X GET $proto://$addr/.well-known/host-meta"

View file

@ -26,16 +26,9 @@ if ! ${HAVE_HTTP1}; then
rm -rf $dir rm -rf $dir
if [ "$s" = $0 ]; then exit 0; else return 0; fi if [ "$s" = $0 ]; then exit 0; else return 0; fi
fi fi
# Callhome stream is HTTP/1.1, other communication is HTTP/2
# Callhome stream pin to HTTP/1.1, other communication is HTTP/2 if present
HVERCH=1.1 HVERCH=1.1
if [ ${HAVE_LIBNGHTTP2} = true ]; then
# Pin to http/1
HAVE_LIBNGHTTP2=false
CURLOPTS="${CURLOPTS} --http1.1"
HVER=2
else
HVER=1.1
fi
: ${clixon_restconf_callhome_client:=clixon_restconf_callhome_client} : ${clixon_restconf_callhome_client:=clixon_restconf_callhome_client}
@ -305,7 +298,6 @@ fi
new "wait restconf" new "wait restconf"
wait_restconf wait_restconf
new "restconf Add init data" new "restconf Add init data"
expectpart "$(curl $CURLOPTS --key $certdir/andy.key --cert $certdir/andy.crt -X POST -H "Accept: application/yang-data+json" -H "Content-Type: application/yang-data+json" -d '{"clixon-example:table":{"parameter":{"name":"x","value":"foo"}}}' $RCPROTO://127.0.0.1/restconf/data)" 0 "HTTP/$HVER 201" expectpart "$(curl $CURLOPTS --key $certdir/andy.key --cert $certdir/andy.crt -X POST -H "Accept: application/yang-data+json" -H "Content-Type: application/yang-data+json" -d '{"clixon-example:table":{"parameter":{"name":"x","value":"foo"}}}' $RCPROTO://127.0.0.1/restconf/data)" 0 "HTTP/$HVER 201"
@ -316,7 +308,7 @@ t1=$(date +"%s")
let t=t1-t0 let t=t1-t0
new "Check persistent interval ($t) is in interval [2,4]" new "Check persistent interval ($t) is in interval [2,4]"
if [ $t -lt 2 -o $t -ge 4 ]; then if [ $t -lt 2 -o $t -gt 4 ]; then
err1 "timer in interval [2,4] but is: $t" err1 "timer in interval [2,4] but is: $t"
fi fi
@ -327,7 +319,7 @@ t1=$(date +"%s")
let t=t1-t0 let t=t1-t0
new "Check periodic interval ($t) is in interval [10-21]" new "Check periodic interval ($t) is in interval [10-21]"
if [ $t -lt 10 -o $t -ge 21 ]; then if [ $t -lt 10 -o $t -gt 21 ]; then
err1 "timer in interval [10-21] but is: $t" err1 "timer in interval [10-21] but is: $t"
fi fi
@ -338,7 +330,7 @@ t1=$(date +"%s")
let t=t1-t0 let t=t1-t0
new "Check persistent interval ($t) is in interval [2,4]" new "Check persistent interval ($t) is in interval [2,4]"
if [ $t -lt 2 -o $t -ge 4 ]; then if [ $t -lt 2 -o $t -gt 4 ]; then
err1 "timer in interval [2,4] but is: $t" err1 "timer in interval [2,4] but is: $t"
fi fi
@ -349,7 +341,7 @@ t1=$(date +"%s")
let t=t1-t0 let t=t1-t0
new "Check periodic interval ($t) is in interval [5-15]" new "Check periodic interval ($t) is in interval [5-15]"
if [ $t -lt 5 -o $t -ge 15 ]; then if [ $t -lt 5 -o $t -gt 15 ]; then
err1 "timer in interval [5-15] but is: $t" err1 "timer in interval [5-15] but is: $t"
fi fi

View file

@ -44,9 +44,6 @@ x3users="mymd5" # Too weak ca
# Whether to generate new keys or not (only if $dir is not removed) # Whether to generate new keys or not (only if $dir is not removed)
# Here dont generate keys if restconf started stand-alone (RC=0) # Here dont generate keys if restconf started stand-alone (RC=0)
: ${genkeys:=true} : ${genkeys:=true}
#if [ $RC -eq 0 ]; then
# genkeys=false
#fi
test -d $certdir || mkdir $certdir test -d $certdir || mkdir $certdir
@ -254,8 +251,13 @@ EOF
start_restconf -f $cfg start_restconf -f $cfg
fi fi
# Note, the root resource is accessed by wait_restconf to detect liveness.
# The root resource is not a protected resource in clixon (see RFC8040 sec 2.5)
# therefore the client cert is not necessary
# wait_restconf # --key $certdir/andy.key --cert $certdir/andy.crt
# (should it be?)
new "wait for restconf" new "wait for restconf"
wait_restconf --key $certdir/andy.key --cert $certdir/andy.crt wait_restconf
new "enable nacm" new "enable nacm"
expectpart "$(curl $CURLOPTS --key $certdir/andy.key --cert $certdir/andy.crt -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/$HVER 204" expectpart "$(curl $CURLOPTS --key $certdir/andy.key --cert $certdir/andy.crt -X PUT -H "Content-Type: application/yang-data+json" -d '{"ietf-netconf-acm:enable-nacm": true}' $RCPROTO://localhost/restconf/data/ietf-netconf-acm:nacm/enable-nacm)" 0 "HTTP/$HVER 204"