- Link utils statically if LINKAGE=static

- Fix event exit bug (set to new counter, dont increment)
- Changed default CI to be restconf=native instead of fcgi1~
- Tests:
  - Change to same wait backend and restconf commands
  - Change default restconf protocol from http to https
This commit is contained in:
Olof hagsand 2021-06-18 12:18:33 +02:00
parent 4b83f4198c
commit 9edf380f6a
70 changed files with 264 additions and 238 deletions

View file

@ -858,7 +858,7 @@ restconf_connection(int s,
* frames instead of just postponing nrof events?
*/
if (clixon_exit_get() == 1){
clixon_exit_set(4);
clixon_exit_set(3);
}
}
#endif
@ -868,7 +868,9 @@ restconf_connection(int s,
case HTTP_2:
if (http2_recv(rc, (unsigned char *)buf, n) < 0)
goto done;
// notused sd = restconf_stream_find(rc, 0); /* default stream */
//notused sd = restconf_stream_find(rc, 0); /* default stream */
/* There may be more data frames */
readmore++;
break;
#endif /* HAVE_LIBNGHTTP2 */
default:

View file

@ -543,6 +543,11 @@ on_invalid_frame_recv_callback(nghttp2_session *session,
}
/*! A chunk of data in DATA frame is received
*
* ``(flags & NGHTTP2_FLAG_END_STREAM) != 0`` does not
* necessarily mean this chunk of data is the last one in the stream.
* You should use :type:`nghttp2_on_frame_recv_callback` to know all
* data frames are received.
*/
static int
on_data_chunk_recv_callback(nghttp2_session *session,

6
configure vendored
View file

@ -1371,8 +1371,8 @@ Optional Features:
curl
--disable-evhtp Disable evhtp for native restconf http/1, default:
yes
--enable-nghttp2 Enable nghttp2 for native restconf http/2, default:
no
--disable-nghttp2 Disable nghttp2 for native restconf http/2, default:
yes
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -5300,7 +5300,7 @@ if test "${enable_nghttp2+set}" = set; then :
fi
else
ac_enable_nghttp2=no
ac_enable_nghttp2=yes
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: checking nghttp2 is enabled: $ac_enable_nghttp2" >&5

View file

@ -244,14 +244,14 @@ elif test "x${with_restconf}" == xnative; then
fi
# Check if nghttp2 is enabled for http/2
AC_ARG_ENABLE(nghttp2, AS_HELP_STRING([--enable-nghttp2],[Enable nghttp2 for native restconf http/2, default: no]),[
AC_ARG_ENABLE(nghttp2, AS_HELP_STRING([--disable-nghttp2],[Disable nghttp2 for native restconf http/2, default: yes]),[
if test "$enableval" = no; then
ac_enable_nghttp2=no
else
ac_enable_nghttp2=yes
fi
],
[ ac_enable_nghttp2=no])
[ ac_enable_nghttp2=yes])
AC_MSG_RESULT(checking nghttp2 is enabled: $ac_enable_nghttp2)
if test "$ac_enable_nghttp2" = "yes"; then
AC_CHECK_HEADERS(nghttp2/nghttp2.h,[], AC_MSG_ERROR([nghttp2 missing]))

View file

@ -77,7 +77,7 @@ COPY clixon .
RUN adduser -D -H -G www-data www-data
# Configure, build and install clixon
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --enable-optyangs --with-restconf=native --disable-nghttp2 --enable-evhtp
RUN ./configure --prefix=/clixon/build --with-cligen=/clixon/build --enable-optyangs --with-restconf=native --enable-nghttp2 --enable-evhtp
RUN make
RUN make install

View file

@ -59,7 +59,6 @@ echo "$STORE" > /usr/local/var/example/running_db
cat <<EOF > /usr/local/bin/test/site.sh
# Add your local site specific env variables (or tests) here.
SKIPLIST="test_api.sh test_client.sh test_c++.sh test_install.sh test_privileges.sh"
RCPROTO=https
#IETFRFC=
EOF

View file

@ -112,7 +112,7 @@ static int _clicon_sig_ignore = 0;
int
clixon_exit_set(int nr)
{
_clicon_exit++;
_clicon_exit = nr;
return 0;
}

View file

@ -127,7 +127,7 @@ DEMSLEEP=.2
let DEMLOOP=5*DEMWAIT
# RESTCONF protocol, eg http or https
: ${RCPROTO:=http}
: ${RCPROTO:=https}
# www user (on linux typically www-data, freebsd www)
# Start restconf user, can be root which is dropped to wwwuser
@ -381,9 +381,16 @@ function stop_restconf(){
# @see start_restconf
# Reasons for not working: if you run native is nginx running?
# @note assumes port=80 if RCPROTO=http and port=443 if RCPROTO=https
# Args:
# 1: (optional) override RCPROTO with http or https
function wait_restconf(){
# echo "curl $CURLOPTS $* $RCPROTO://localhost/restconf"
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf 2> /dev/null)
if [ $# = 1 ]; then
myproto=$1
else
myproto=${RCPROTO}
fi
# echo "curl $CURLOPTS $* $myproto://localhost/restconf"
hdr=$(curl $CURLOPTS $* $myproto://localhost/restconf 2> /dev/null)
# echo "hdr:\"$hdr\""
let i=0;
while [[ $hdr != *"200"* ]]; do
@ -392,7 +399,7 @@ function wait_restconf(){
err1 "restconf timeout $DEMWAIT seconds"
fi
sleep $DEMSLEEP
hdr=$(curl $CURLOPTS $* $RCPROTO://localhost/restconf 2> /dev/null)
hdr=$(curl $CURLOPTS $* $myproto://localhost/restconf 2> /dev/null)
# echo "hdr:\"$hdr\""
let i++;
done

View file

@ -238,11 +238,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
XML='<c xmlns="urn:example:api"><y3><k>2</k></y3><y3><k>3</k></y3><y3><k>5</k><val>zorro</val></y3><y3><k>7</k></y3></c>'
# Add a set of entries using restconf

View file

@ -87,11 +87,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Positive tests
new "set x"
expectpart "$($clixon_cli -1 -f $cfg set x)" 0 ""

View file

@ -93,11 +93,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s startup -f $cfg -- -sS $fstate"
start_backend -s startup -f $cfg -- -sS $fstate
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# First go down in structure and show config
new "show top tree"
expectpart "$(echo "show config xml" | $clixon_cli -f $cfg 2>&1)" 0 '<table xmlns="urn:example:clixon"><parameter><name>a</name><value>42</value></parameter></table>$'

View file

@ -129,11 +129,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
function testparam()
{

View file

@ -109,11 +109,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -- -sS $fstate"
start_backend -s init -f $cfg -- -sS $fstate
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Simple run trying setting a config,
# then deleting it, and reloading it
# 1. mode - either VARS Keywords on non-key variables: a <x> y <y> or

View file

@ -123,11 +123,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s startup -f $cfg"
start_backend -s startup -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
cat <<EOF > $fin
enter0 p1 # table/parameter=p1
show config xml

View file

@ -46,11 +46,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "cli read and add entry to existing history"
expecteof "$clixon_cli -f $cfg" 0 "example 42" "data"

View file

@ -77,11 +77,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "set 1 v1"
expectpart "$($clixon_cli -1 -f $cfg set ex x a 1 b v1)" 0 ""

View file

@ -79,11 +79,10 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
m=AAA
# Tests using mode AAA that should pass

View file

@ -56,11 +56,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "translate abc -> table/parameter=translate/value = bcd"
expectpart "$($clixon_cli -1 -f $cfg translate abc)" 0 ""

View file

@ -137,11 +137,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
XML='<table xmlns="urn:example:clixon-client"><parameter><name>a</name><value>42</value></parameter></table>'
# Add a set of entries using restconf

View file

@ -76,22 +76,22 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "wait backend"
wait_backend
fi
new "wait backend"
wait_backend
if [ $RC -ne 0 ]; then
new "kill old restconf daemon"
stop_restconf_pre
new "start restconf daemon"
start_restconf -f $cfg
new "wait restconf"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "Add config to candidate"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><interfaces xmlns=\"urn:ietf:params:xml:ns:yang:ietf-interfaces\" xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><interface nc:operation=\"create\"><name>eth/0/0</name><type>ex:eth</type></interface></interfaces></config><default-operation>none</default-operation> </edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -93,11 +93,11 @@ function testrun(){
fi
new "start backend -s startup -f $cfg -- -U"
start_backend -s startup -f $cfg -- -U
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "netconf get config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$AFTER</data></rpc-reply>]]>]]>$"

View file

@ -153,11 +153,11 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "cli enabled feature"
expectpart "$($clixon_cli -1f $cfg set x foo)" 0 ""

View file

@ -164,11 +164,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "Set crypto to aes"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><crypto xmlns=\"urn:example:my-crypto\">aes</crypto></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -118,11 +118,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "get config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>]]>]]>$"
@ -172,11 +172,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s startup -f $cfg"
start_backend -s startup -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "get startup config"
# Should have all defaults, except r1 that is set to 99
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>]]>]]>$"
@ -231,11 +231,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s startup -f $cfg"
start_backend -s startup -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "get startup config with presence"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$XML</data></rpc-reply>]]>]]>$"
@ -261,11 +261,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s startup -f $cfg"
start_backend -s startup -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "get startup config with list default"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get-config><source><candidate/></source></get-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><data>$XML<xs-config xmlns=\"urn:example:clixon\"><x><name>a</name><y><inside>false</inside></y><outside>false</outside></x></xs-config></data></rpc-reply>]]>]]>$"

View file

@ -122,11 +122,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "leafref base config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$BASEXML</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -139,11 +139,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Test top-level, default prefix, correct leafref and typedef path
XML=$(cat <<EOF
<sender xmlns="urn:example:example">

View file

@ -82,10 +82,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -- -sS $fstate"
start_backend -s init -f $cfg -- -sS $fstate
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Test top-level, default prefix, wrong leafref prefix and typedef path
XML=$(cat <<EOF
<sender-config xmlns="urn:example:example">

View file

@ -112,11 +112,11 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
# start new backend
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "minmax: minimal: 1x a1,b1 (should be [1:2]"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><c xmlns=\"urn:example:clixon\">
<a1><k>0</k></a1>

View file

@ -136,11 +136,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth get"
expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/nacm-example:x)" 0 "HTTP/$HVER 404" '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"invalid-value","error-severity":"error","error-message":"Instance does not exist"}}}'

View file

@ -236,11 +236,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -110,11 +110,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "admin read OK"
expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/nacm-example:table/parameters/parameter=a)" 0 "HTTP/$HVER 200" '{"nacm-example:parameter":\[{"name":"a","value":"72"}\]}'

View file

@ -241,11 +241,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -237,11 +237,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -103,10 +103,8 @@ EOF
fi
new "start backend -s $db -f $cfg"
start_backend -s $db -f $cfg
new "wait backend"
wait_backend
fi
new "wait backend"
wait_backend
@ -117,6 +115,7 @@ EOF
new "start restconf daemon"
start_restconf -f $cfg
fi
new "wait restconf"
wait_restconf

View file

@ -155,11 +155,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth get"
expectpart "$(curl -u andy:bar $CURLOPTS -X GET $RCPROTO://localhost/restconf/data)" 0 "HTTP/$HVER 200" '{"data":{"clixon-example:state":{"op":\["41","42","43"\]}'

View file

@ -138,11 +138,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -134,7 +134,7 @@ RULES=$(cat <<EOF
</nacm>
EOF
)
)
new "test params: -f $cfg"

View file

@ -159,11 +159,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "auth set authentication config"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config>$RULES</config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -97,21 +97,22 @@ EOF
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
if [ $RC -ne 0 ]; then
new "kill old restconf daemon"
stop_restconf_pre
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
if $getp; then
# default is read allowed so this should always succeed.
new "get startup default ok"

View file

@ -47,11 +47,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -- -s"
start_backend -s init -f $cfg -- -s
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Framing. with -q to inhibit rcv hello
new "Empty frame"
expecteof "$clixon_netconf -qf $cfg" 0 ']]>]]>' '<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><rpc-error><error-type>rpc</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message>Empty XML</error-message></rpc-error></rpc-reply>]]>]]>'

View file

@ -49,11 +49,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -- -s"
start_backend -s init -f $cfg -- -s
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Hello
new "Netconf snd hello with xmldecl"
expecteof "$clixon_netconf -qf $cfg" 0 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello $DEFAULTNS><capabilities><capability>urn:ietf:params:netconf:base:1.1</capability></capabilities></hello>]]>]]>" '^$' '^$'

View file

@ -99,11 +99,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# Start callhome server-side in background thread
callhomefn &

View file

@ -161,11 +161,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend"
start_backend -s running -f $cfg -- -s
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# STATE (should not be ordered)
#new "state data (should be unordered: 42,41,43)"
# Eeh I changed that to sortered unless STATE_ORDERED_BY_SYSTEM

View file

@ -415,11 +415,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Test for RFC7950 Sec 9.4.7 pattern example 2 (length + pattern)"
testrun rfc2 true 'AB'
testrun rfc2 true '9A00'

View file

@ -144,7 +144,7 @@ sed -i '/Connection:/d' $foutput
# Create a file to compare with
if ${HAVE_LIBNGHTTP2}; then
if ${HAVE_LIBEVHTP}; then
if [ ${HAVE_LIBEVHTP} -a ${RCPROTO} = http ]; then
# Add 101 switch protocols for http 1->2 upgrade
echo "HTTP/1.1 101 Switching Protocols " > $ftest
echo "Upgrade: h2c " >> $ftest

View file

@ -107,11 +107,11 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg -- -sS $fstate"
start_backend -s init -f $cfg -- -sS $fstate
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
if [ $RC -ne 0 ]; then
new "kill old restconf daemon"
@ -119,11 +119,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "cli get large config"
# baseline on thinkpad i5-3320M CPU @ 2.60GHz and 500K entries: 39.71s
$TIMEFN $clixon_cli -1f $cfg show xpath /interfaces urn:example:clixon 2>&1 > /dev/null | awk '/real/ {print $2}'

View file

@ -327,11 +327,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s none -f $cfg"
start_backend -s none -f $cfg
new "wait backend"
wait_backend
fi
new "wait backend"
wait_backend
new "wait restconf"
wait_restconf

View file

@ -54,7 +54,6 @@ test -d $certdir || mkdir $certdir
cacerts $cakey $cacert
servercerts $cakey $cacert $srvkey $srvcert
# XXX Note default port need to be 80 for wait_restconf to work
RESTCONFIG=$(cat <<EOF
<restconf>
<enable>true</enable>
@ -66,7 +65,7 @@ RESTCONFIG=$(cat <<EOF
<debug>$RESTCONFDBG</debug>
<socket> <!-- reference and to get wait-restconf to work -->
<namespace>default</namespace>
<address>0.0.0.0</address>
<address>127.0.0.1</address>
<port>80</port>
<ssl>false</ssl>
</socket>
@ -165,7 +164,7 @@ if [ $RC -ne 0 ]; then
fi
new "wait restconf"
wait_restconf
wait_restconf http # force to http on host ns
new "add sample config w netconf"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><table xmlns=\"urn:example:clixon\"><parameter><name>a</name><value>42</value></parameter></table></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -216,7 +215,7 @@ RESTCONFIG=$(cat <<EOF
<debug>$RESTCONFDBG</debug>
<auth-type>none</auth-type>
<pretty>false</pretty>
<socket>
<socket> <!-- reference and to get wait-restconf to work -->
<namespace>default</namespace>
<address>127.0.0.1</address>
<port>80</port>
@ -289,8 +288,7 @@ if [ $RC -ne 0 ]; then
fi
new "wait restconf"
wait_restconf
wait_restconf http # force to http on host ns
sleep $DEMSLEEP
new "Check zombies"

View file

@ -136,11 +136,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "netconf event stream discovery RFC8040 Sec 6.2"
expecteof "$clixon_netconf -D $DBG -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><get><filter type=\"xpath\" select=\"r:restconf-state/r:streams\" xmlns:r=\"urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring\"/></get></rpc>]]>]]>" "<rpc-reply $DEFAULTNS><data><restconf-state xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf-monitoring\"><streams><stream><name>EXAMPLE</name><description>Example event stream</description><replay-support>true</replay-support><access><encoding>xml</encoding><location>https://localhost/streams/EXAMPLE</location></access></stream></streams></restconf-state></data></rpc-reply>]]>]]>"

View file

@ -94,11 +94,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "restconf POST tree without key"
expectpart "$(curl $CURLOPTS -X POST -H "Content-Type: application/yang-data+json" -d '{"example:cont1":{"interface":{"type":"regular"}}}' $RCPROTO://localhost/restconf/data)" 0 "HTTP/$HVER 400" '{"ietf-restconf:errors":{"error":{"error-type":"application","error-tag":"missing-element","error-info":{"bad-element":"name"},"error-severity":"error","error-message":"Mandatory key"}}}'

View file

@ -55,11 +55,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "rpc tests"
# 1.First some positive tests vary media types

View file

@ -55,10 +55,10 @@ EOF
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
fi
new "wait backend"
wait_backend
fi
new "$clixon_cli -1f $cfg show version"
expectpart "$($clixon_cli -1f $cfg show version)" 0 "${CLIXON_VERSION}"

View file

@ -198,11 +198,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "wait restconf"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "netconfig edit main module"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<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>]]>]]>$"

View file

@ -119,11 +119,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -l f$flog -- -t -v /x/y[a=$errnr]"
start_backend -s init -f $cfg -l f$flog -- -t -v /x/y[a=$errnr] # -t means transaction logging
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
let nr=0
new "Basic transaction to add top-level x"

View file

@ -97,11 +97,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg -l f$flog -- -t /foo"
start_backend -s init -f $cfg -l f$flog -- -t /foo # -t means transaction logging (foo is dummy)
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
let nr=0
new "Basic transaction to add top-level x"

View file

@ -240,11 +240,11 @@ EOF
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "cli set transitive string. type is alpha followed by number and is defined in three levels of modules"
expectpart "$($clixon_cli -1f $cfg -l o set c talle x99)" 0 '^$'

View file

@ -276,11 +276,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "test params: -f $cfg"
# Test all int types

View file

@ -86,11 +86,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "cli set transitive string"
expectpart "$($clixon_cli -1f $cfg -l o set c talle x)" 0 "^$"

View file

@ -89,11 +89,11 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
# start new backend
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# RFC test two-field caes
new "Add not valid example"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><default-operation>replace</default-operation><config><c xmlns=\"urn:example:clixon\"><server>

View file

@ -220,11 +220,11 @@ function testrun(){
fi
new "start backend -s startup -f $cfg -l f$log -- -u"
start_backend -s startup -f $cfg -l f$log -- -u
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
if $flag; then
checklog "$match" $line
else

View file

@ -59,11 +59,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "wait backend"
wait_backend
fi
new "wait backend"
wait_backend
new "add hello world (with modstate)"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><hello xmlns=\"urn:example:simple\"><world/></hello></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -99,11 +99,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "when: add static route"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><whenex xmlns=\"urn:example:clixon\"><type>static</type><name>r1</name><static-routes/></whenex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -74,11 +74,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# This is the base XML with three values in the server: notset, default, other
XML='<c xmlns="urn:example:default"><x><k>default</k><y>42</y></x><x><k>notset</k></x><x><k>other</k><y>99</y></x></c>'

View file

@ -108,11 +108,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# contains
new "contains: Set site to foo that validates site OK"
expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><top xmlns=\"urn:example:clixon\"><class>foo</class><mylist><id>12</id><site>42</site></mylist></top></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>"

View file

@ -151,11 +151,11 @@ if [ "$BE" -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f "$cfg"
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "cli defined extension"
expectpart "$($clixon_cli -1f $cfg show version)" 0 "${CLIXON_VERSION}"

View file

@ -112,11 +112,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
# The main example implements ex:e4
new "Add extension foo (not implemented)"
expecteof "$clixon_netconf -qf $cfg -D $DBG" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><foo xmlns=\"urn:example:clixon\">a string</foo></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><rpc-error><error-type>application</error-type><error-tag>unknown-element</error-tag><error-info><bad-element>foo</bad-element></error-info><error-severity>error</error-severity>"

View file

@ -82,11 +82,11 @@ if [ $BE -ne 0 ]; then
fi
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "1. Set newex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><newex xmlns=\"urn:example:clixon\">str</newex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -130,11 +130,11 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
# start new backend
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set oldex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><oldex xmlns=\"urn:example:clixon\">str</oldex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -174,11 +174,11 @@ EOF
if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set newex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><newex xmlns=\"urn:example:clixon\">str</newex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -218,11 +218,11 @@ EOF
if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set oldex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><oldex xmlns=\"urn:example:clixon\">str</oldex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -262,11 +262,11 @@ EOF
if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set newex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><newex xmlns=\"urn:example:clixon\">str</newex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -308,10 +308,11 @@ EOF
if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set oldex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><oldex xmlns=\"urn:example:clixon\">str</oldex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -353,11 +354,11 @@ EOF
if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set oldex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><oldex xmlns=\"urn:example:clixon\">str</oldex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"
@ -399,11 +400,11 @@ EOF
if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
new "Set oldex"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><oldex xmlns=\"urn:example:clixon\">str</oldex></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -72,11 +72,11 @@ if [ $BE -ne 0 ]; then
new "start backend -s init -f $cfg"
start_backend -s init -f $cfg
new "waiting"
wait_backend
fi
new "wait backend"
wait_backend
if [ $RC -ne 0 ]; then
new "kill old restconf daemon"
stop_restconf_pre
@ -84,10 +84,11 @@ if [ $RC -ne 0 ]; then
new "start restconf daemon"
start_restconf -f $cfg
new "waiting"
wait_restconf
fi
new "wait restconf"
wait_restconf
new "netconf set x in example1"
expecteof "$clixon_netconf -qf $cfg" 0 "$DEFAULTHELLO<rpc $DEFAULTNS><edit-config><target><candidate/></target><config><x xmlns=\"urn:example:clixon1\">42</x></config></edit-config></rpc>]]>]]>" "^<rpc-reply $DEFAULTNS><ok/></rpc-reply>]]>]]>$"

View file

@ -69,13 +69,17 @@ INCLUDES = -I. @INCLUDES@ -I$(top_srcdir)/lib -I$(top_srcdir)/include
ifeq ($(LINKAGE),static)
CLIXON_LIB = libclixon.a
CLIXON_BACKEND_LIB = libclixon_backend.a # for util_validate
else
CLIXON_LIB = libclixon$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR)
CLIXON_BACKEND_LIB = libclixon_backend$(SH_SUFFIX).$(CLIXON_MAJOR).$(CLIXON_MINOR)
endif
# For dependency. A little strange that we rely on it being built in the src dir
# even though it may exist in $(libdir). But the new version may not have been installed yet.
LIBDEPS = $(top_srcdir)/lib/src/$(CLIXON_LIB)
LIBDEPS = $(top_srcdir)/apps/backend/$(CLIXON_BACKEND_LIB)
LIBDEPS += $(top_srcdir)/lib/src/$(CLIXON_LIB)
# Utilities, unit testings. Not installed.
APPSRC = clixon_util_xml.c
@ -107,6 +111,9 @@ all: $(APPS)
$(top_srcdir)/lib/src/$(CLIXON_LIB):
(cd $(top_srcdir)/lib/src && $(MAKE) $(MFLAGS) $(CLIXON_LIB))
$(top_srcdir)/lib/src/$(CLIXON_BACKEND_LIB):
(cd $(top_srcdir)/apps/backend && $(MAKE) $(MFLAGS) $(CLIXON_BACKEND_LIB))
clean:
rm -f $(APPS) clixon_util_stream *.core
rm -f *.gcda *.gcno *.gcov # coverage
@ -139,9 +146,13 @@ clixon_util_regexp: clixon_util_regexp.c $(LIBDEPS)
clixon_util_socket: clixon_util_socket.c $(LIBDEPS)
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -o $@
ifeq ($(LINKAGE),static)
clixon_util_validate: clixon_util_validate.c $(LIBDEPS)
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) clixon_util_validate.c $(LIBS) $(LIBDEPS) -o $@
else
clixon_util_validate: clixon_util_validate.c $(LIBDEPS)
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -l clixon_backend -o $@
endif
ifdef with_restconf
clixon_util_stream: clixon_util_stream.c $(LIBDEPS)
$(CC) $(INCLUDES) $(CPPFLAGS) @CFLAGS@ $(LDFLAGS) $^ $(LIBS) -lcurl -o $@

View file

@ -4,4 +4,6 @@ This directory contains Clixon utility programs, ie, programs that are
good to have for testing, analysis, etc, but not an actual part of
delivered code.
Look inside C-code for documentation
Note, streams utility may need: libcurl4-openssl-dev or corresponding.