From 4eee00101ce93d9e52d1f631c2a2181e20c775cc Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 15 Nov 2020 18:14:41 +0100 Subject: [PATCH] Disabling IPv6 per default due to failing docker tests --- lib/src/clixon_err.c | 4 ++-- lib/src/clixon_yang_parse_lib.c | 4 ++-- test/lib.sh | 4 ++++ test/site.sh | 6 ++++- test/test_restconf.sh | 39 +++++++++++++++++++++++---------- test/test_ssl_certs.sh | 11 ++++++++-- test/test_yang_models.sh | 1 + 7 files changed, 51 insertions(+), 18 deletions(-) diff --git a/lib/src/clixon_err.c b/lib/src/clixon_err.c index 85b8646d..73a0ab47 100644 --- a/lib/src/clixon_err.c +++ b/lib/src/clixon_err.c @@ -182,14 +182,14 @@ int clicon_err_fn(const char *fn, strncpy(clicon_err_reason, msg, ERR_STRLEN-1); /* Actually log it */ - if (errno){ + if (suberr){ /* Here we could take care of specific errno, like application-defined errors */ clicon_log(LOG_ERR, "%s: %d: %s: %s: %s", fn, line, clicon_strerror(category), msg, - errno==XMLPARSE_ERRNO?"XML parse error":strerror(errno)); + suberr==XMLPARSE_ERRNO?"XML parse error":strerror(suberr)); } else clicon_log(LOG_ERR, "%s: %d: %s: %s", diff --git a/lib/src/clixon_yang_parse_lib.c b/lib/src/clixon_yang_parse_lib.c index 11521858..c9b2f55f 100644 --- a/lib/src/clixon_yang_parse_lib.c +++ b/lib/src/clixon_yang_parse_lib.c @@ -927,10 +927,10 @@ yang_parse_module(clicon_handle h, goto done; if (nr == 0){ if (revision) - clicon_err(OE_YANG, errno, "No yang files found matching \"%s@%s\" in the list of CLICON_YANG_DIRs", + clicon_err(OE_YANG, ENOENT, "No1 yang files found matching \"%s@%s\" in the list of CLICON_YANG_DIRs", module, revision); else - clicon_err(OE_YANG, errno, "No yang files found matching \"%s\" in the list of CLICON_YANG_DIRs", module); + clicon_err(OE_YANG, ENOENT, "No2 yang files found matching \"%s\" in the list of CLICON_YANG_DIRs", module); goto done; } filename = cbuf_get(fbuf); diff --git a/test/lib.sh b/test/lib.sh index 26d3a496..c09aff63 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -133,6 +133,10 @@ fi # Standard IETF RFC yang files. : ${IETFRFC=../yang/standard} +# Some restconf tests can run IPv6, but its complicated because: +# - docker by default does not run IPv6 +: ${IPv6:=false} + # Backend user BUSER=clicon diff --git a/test/site.sh b/test/site.sh index 5ea335a7..72c3dce0 100644 --- a/test/site.sh +++ b/test/site.sh @@ -15,8 +15,12 @@ #OPENCONFIG=/usr/local/share/openconfig/public # # Parse yangmodels from https://github.com/YangModels/yang -#YANGMODELS=/usr/local/share/yangmodels +#YANGMODELS=/usr/local/share/yang # # Specify alternative directory for the standard IETF RFC yang files. #IETFRFC=$YANGMODELS/standard/ietf/RFC +# Some restconf tests can run IPv6, but its complicated because: +# - docker by default does not run IPv6 +# - for fcgi nginx needs to be configured properly (shouldnt be a problem) +#IPv6=false diff --git a/test/test_restconf.sh b/test/test_restconf.sh index 92e36435..d8edfa67 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -22,11 +22,6 @@ APPNAME=example cfg=$dir/conf.xml -# Must explicitly enable IPv6 testing -: ${IPv6:=false} - -# Use yang in example - cat < $cfg $cfg @@ -56,9 +51,15 @@ if [ "${WITH_RESTCONF}" = "evhtp" ]; then test -d $certdir || mkdir $certdir . ./certs.sh cat <> $cfg - $srvcert - $srvkey - $srvcert + $srvcert + $srvkey + $srvcert +EOF +fi + +if $IPv6; then + cat <> $cfg + :: EOF fi @@ -69,8 +70,9 @@ EOF # This is a fixed 'state' implemented in routing_backend. It is assumed to be always there state='{"clixon-example:state":{"op":\["41","42","43"\]}' -# For backend config, create 4 sockets, all combinations IPv4/IPv6 + http/https -RESTCONFCONFIG=$(cat < true password @@ -78,12 +80,27 @@ RESTCONFCONFIG=$(cat <$srvkey $cakey default
0.0.0.0
80false
- default
::
80false
default
0.0.0.0
443true
+ default
::
80false
default
::
443true
EOF ) +else + # For backend config, create 4 sockets, all combinations IPv4/IPv6 + http/https + RESTCONFCONFIG=$(cat < + true + password + $srvcert + $srvkey + $cakey + default
0.0.0.0
80false
+ default
0.0.0.0
443true
+ +EOF +) +fi # Restconf test routine with arguments: # 1. proto:http/https diff --git a/test/test_ssl_certs.sh b/test/test_ssl_certs.sh index 0e1b3451..5dcbc05f 100755 --- a/test/test_ssl_certs.sh +++ b/test/test_ssl_certs.sh @@ -57,8 +57,6 @@ cat < $cfg example_backend.so$ /usr/local/lib/$APPNAME/restconf false - 127.0.0.1 - ::1 /usr/local/lib/$APPNAME/cli $APPNAME /usr/local/var/$APPNAME/$APPNAME.sock @@ -69,6 +67,15 @@ cat < $cfg $srvcert $srvkey $cacert +EOF + +if $IPv6; then + cat <> $cfg + :: +EOF +fi + +cat <> $cfg
EOF diff --git a/test/test_yang_models.sh b/test/test_yang_models.sh index 2a94080b..654c0848 100755 --- a/test/test_yang_models.sh +++ b/test/test_yang_models.sh @@ -40,6 +40,7 @@ cat < $cfg $YANGMODELS/standard/ieee/draft/802 $YANGMODELS/standard/ieee/draft/802 $YANGMODELS/standard/ieee/published/802.1 + $YANGMODELS/standard/ieee/published/802 /usr/local/share/clixon false /usr/local/lib/$APPNAME/clispec