From 860c0c042dc361b78627c6fdeae2fa9378678ccf Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Tue, 12 Feb 2019 12:58:27 +0100 Subject: [PATCH] Added RCLOG for redirecting restconf logs at tests; with-restconf error in example --- docker/system/Makefile.in | 2 +- docker/system/README.md | 24 ++++++++++++++++++------ example/Makefile.in | 1 + test/lib.sh | 4 ++++ test/test_choice.sh | 2 +- test/test_nacm.sh | 2 +- test/test_nacm_ext.sh | 2 +- test/test_nacm_module_read.sh | 2 +- test/test_nacm_module_write.sh | 2 +- test/test_nacm_protocol.sh | 2 +- test/test_perf.sh | 2 +- test/test_restconf.sh | 2 +- test/test_restconf2.sh | 2 +- test/test_rpc.sh | 2 +- test/test_stream.sh | 2 +- test/test_yang_namespace.sh | 2 +- 16 files changed, 36 insertions(+), 19 deletions(-) diff --git a/docker/system/Makefile.in b/docker/system/Makefile.in index f0a059d3..c18c47cc 100644 --- a/docker/system/Makefile.in +++ b/docker/system/Makefile.in @@ -63,7 +63,7 @@ docker: clixon Dockerfile # Start the clixon system container and run the test script test: docker - ./cleanup.sh ; ./start.sh # kill (ignore error) and the start it + ./cleanup.sh ; PORT=8080 ./start.sh # kill (ignore error) and the start it sudo docker exec -it clixon-system bash -c 'cd /clixon/clixon/test && ./all.sh' push: diff --git a/docker/system/README.md b/docker/system/README.md index 483b0905..7cf3aa6b 100644 --- a/docker/system/README.md +++ b/docker/system/README.md @@ -37,11 +37,23 @@ Example: $ DBG=1 PORT=8080 ./start.sh ``` -Once running you can access it as follows: -* CLI: `sudo docker exec -it clixon-system clixon_cli` -* Netconf: `sudo docker exec -it clixon-system clixon_netconf` -* Restconf: `curl -G http://localhost/restconf` -* Run tests: `sudo docker exec -it clixon-system bash -c 'cd /clixon/clixon/test; exec ./all.sh'` +Once running you can access it in different ways as follows: +As CLI: +``` + $ sudo docker exec -it clixon-system clixon_cli +``` +As netconf via stdin/stdout: +``` + $ sudo docker exec -it clixon-system clixon_netconf +``` +As restconf using curl on exposed port 80: +``` + $ curl -G http://localhost/restconf +``` +Or run tests: +``` + $ sudo docker exec -it clixon-system bash -c 'cd /clixon/clixon/test&& ./all.sh' +``` To check status and then kill it: ``` @@ -49,4 +61,4 @@ To check status and then kill it: $ ./cleanup.sh ``` -You can also trigger the test scripts inside the container using `make test`. \ No newline at end of file +You trigger the test scripts inside the container using `make test`. diff --git a/example/Makefile.in b/example/Makefile.in index 720afa9e..d0e502b5 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -51,6 +51,7 @@ CLIXON_DEFAULT_CONFIG = @CLIXON_DEFAULT_CONFIG@ CC = @CC@ CFLAGS = @CFLAGS@ -rdynamic -fPIC INSTALLFLAGS = @INSTALLFLAGS@ +with_restconf = @with_restconf@ INCLUDES = -I$(includedir) @INCLUDES@ CPPFLAGS = @CPPFLAGS@ -fPIC diff --git a/test/lib.sh b/test/lib.sh index 2135e05a..1689cc14 100755 --- a/test/lib.sh +++ b/test/lib.sh @@ -32,6 +32,10 @@ testname= # If set, enable debugging (of backend) : ${DBG:=0} +# Where to log restconf. Some systems may not have syslog, +# eg logging to a file: RCLOG="-l f/www-data/restconf.log" +: ${RCLOG:=} + # If reset, do NOT run tests with external yang models. # This involves downloading # https://github.com/openconfig/public and https://github.com/YangModels/yang diff --git a/test/test_choice.sh b/test/test_choice.sh index c127a502..ea4e2677 100755 --- a/test/test_choice.sh +++ b/test/test_choice.sh @@ -108,7 +108,7 @@ new "kill old restconf daemon" sudo pkill -u www-data clixon_restconf new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -y $fyang -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $RCLOG $cfg -y $fyang -D $DBG" -s /bin/sh www-data & # First vanilla (protocol) case new "netconf validate empty" diff --git a/test/test_nacm.sh b/test/test_nacm.sh index 62101a0a..7d384410 100755 --- a/test/test_nacm.sh +++ b/test/test_nacm.sh @@ -127,7 +127,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf" sleep 1 new "start restconf daemon (-a is enable basic authentication)" -sudo su -c "$clixon_restconf -f $cfg -D $DBG -- -a" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_nacm_ext.sh b/test/test_nacm_ext.sh index ff78484c..5acd989a 100755 --- a/test/test_nacm_ext.sh +++ b/test/test_nacm_ext.sh @@ -147,7 +147,7 @@ new "kill old restconf daemon" sudo pkill -u www-data -f "/www-data/clixon_restconf" new "start restconf daemon (-a is enable http basic auth)" -sudo su -c "$clixon_restconf -f $cfg -D $DBG -- -a" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_nacm_module_read.sh b/test/test_nacm_module_read.sh index 9883f66e..92292bbd 100755 --- a/test/test_nacm_module_read.sh +++ b/test/test_nacm_module_read.sh @@ -142,7 +142,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf" sleep 1 new "start restconf daemon (-a is enable basic authentication)" -sudo su -c "$clixon_restconf -f $cfg -D $DBG -- -a" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_nacm_module_write.sh b/test/test_nacm_module_write.sh index e427c7b5..9cdfe6bc 100755 --- a/test/test_nacm_module_write.sh +++ b/test/test_nacm_module_write.sh @@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf" sleep 1 new "start restconf daemon (-a is enable basic authentication)" -sudo su -c "$clixon_restconf -f $cfg -D $DBG -- -a" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_nacm_protocol.sh b/test/test_nacm_protocol.sh index 5d45f33f..c06e41ec 100755 --- a/test/test_nacm_protocol.sh +++ b/test/test_nacm_protocol.sh @@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf" sleep 1 new "start restconf daemon (-a is enable basic authentication)" -sudo su -c "$clixon_restconf -f $cfg -D $DBG -- -a" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG -- -a" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_perf.sh b/test/test_perf.sh index d43c1558..cd54eda8 100755 --- a/test/test_perf.sh +++ b/test/test_perf.sh @@ -79,7 +79,7 @@ new "kill old restconf daemon" sudo pkill -u www-data -f "/www-data/clixon_restconf" new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -y $fyang -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_restconf.sh b/test/test_restconf.sh index e607598b..e585d378 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -51,7 +51,7 @@ new "kill old restconf daemon" sudo pkill -u www-data clixon_restconf new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_restconf2.sh b/test/test_restconf2.sh index fb9396f0..a80c7eaa 100755 --- a/test/test_restconf2.sh +++ b/test/test_restconf2.sh @@ -83,7 +83,7 @@ new "kill old restconf daemon" sudo pkill -u www-data -f "/www-data/clixon_restconf" new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -y $fyang -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_rpc.sh b/test/test_rpc.sh index e1e24337..467e6992 100755 --- a/test/test_rpc.sh +++ b/test/test_rpc.sh @@ -49,7 +49,7 @@ new "kill old restconf daemon" sudo pkill -u www-data clixon_restconf new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_stream.sh b/test/test_stream.sh index 3f166fc5..5d84de13 100755 --- a/test/test_stream.sh +++ b/test/test_stream.sh @@ -122,7 +122,7 @@ new "kill old restconf daemon" sudo pkill -u www-data -f "/www-data/clixon_restconf" new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -y $fyang -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg -y $fyang $RCLOG -D $DBG" -s /bin/sh www-data & sleep $RCWAIT diff --git a/test/test_yang_namespace.sh b/test/test_yang_namespace.sh index 0a58d82a..6f83e94f 100755 --- a/test/test_yang_namespace.sh +++ b/test/test_yang_namespace.sh @@ -81,7 +81,7 @@ new "kill old restconf daemon" sudo pkill -u www-data clixon_restconf new "start restconf daemon" -sudo su -c "$clixon_restconf -f $cfg -D $DBG" -s /bin/sh www-data & +sudo su -c "$clixon_restconf -f $cfg $RCLOG -D $DBG" -s /bin/sh www-data & new "netconf set x in example1" expecteof "$clixon_netconf -qf $cfg" 0 '42]]>]]>' '^]]>]]>$'