Added RCLOG for redirecting restconf logs at tests; with-restconf error in example

This commit is contained in:
Olof Hagsand 2019-02-12 12:58:27 +01:00
parent f02310dcef
commit 860c0c042d
16 changed files with 36 additions and 19 deletions

View file

@ -63,7 +63,7 @@ docker: clixon Dockerfile
# Start the clixon system container and run the test script # Start the clixon system container and run the test script
test: docker 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' sudo docker exec -it clixon-system bash -c 'cd /clixon/clixon/test && ./all.sh'
push: push:

View file

@ -37,11 +37,23 @@ Example:
$ DBG=1 PORT=8080 ./start.sh $ DBG=1 PORT=8080 ./start.sh
``` ```
Once running you can access it as follows: Once running you can access it in different ways as follows:
* CLI: `sudo docker exec -it clixon-system clixon_cli` As CLI:
* Netconf: `sudo docker exec -it clixon-system clixon_netconf` ```
* Restconf: `curl -G http://localhost/restconf` $ sudo docker exec -it clixon-system clixon_cli
* Run tests: `sudo docker exec -it clixon-system bash -c 'cd /clixon/clixon/test; exec ./all.sh'` ```
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: To check status and then kill it:
``` ```
@ -49,4 +61,4 @@ To check status and then kill it:
$ ./cleanup.sh $ ./cleanup.sh
``` ```
You can also trigger the test scripts inside the container using `make test`. You trigger the test scripts inside the container using `make test`.

View file

@ -51,6 +51,7 @@ CLIXON_DEFAULT_CONFIG = @CLIXON_DEFAULT_CONFIG@
CC = @CC@ CC = @CC@
CFLAGS = @CFLAGS@ -rdynamic -fPIC CFLAGS = @CFLAGS@ -rdynamic -fPIC
INSTALLFLAGS = @INSTALLFLAGS@ INSTALLFLAGS = @INSTALLFLAGS@
with_restconf = @with_restconf@
INCLUDES = -I$(includedir) @INCLUDES@ INCLUDES = -I$(includedir) @INCLUDES@
CPPFLAGS = @CPPFLAGS@ -fPIC CPPFLAGS = @CPPFLAGS@ -fPIC

View file

@ -32,6 +32,10 @@ testname=
# If set, enable debugging (of backend) # If set, enable debugging (of backend)
: ${DBG:=0} : ${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. # If reset, do NOT run tests with external yang models.
# This involves downloading # This involves downloading
# https://github.com/openconfig/public and https://github.com/YangModels/yang # https://github.com/openconfig/public and https://github.com/YangModels/yang

View file

@ -108,7 +108,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u www-data clixon_restconf
new "start restconf daemon" 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 # First vanilla (protocol) case
new "netconf validate empty" new "netconf validate empty"

View file

@ -127,7 +127,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1 sleep 1
new "start restconf daemon (-a is enable basic authentication)" 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 sleep $RCWAIT

View file

@ -147,7 +147,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon (-a is enable http basic auth)" 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 sleep $RCWAIT

View file

@ -142,7 +142,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1 sleep 1
new "start restconf daemon (-a is enable basic authentication)" 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 sleep $RCWAIT

View file

@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1 sleep 1
new "start restconf daemon (-a is enable basic authentication)" 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 sleep $RCWAIT

View file

@ -150,7 +150,7 @@ sudo pkill -u www-data -f "/www-data/clixon_restconf"
sleep 1 sleep 1
new "start restconf daemon (-a is enable basic authentication)" 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 sleep $RCWAIT

View file

@ -79,7 +79,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon" 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 sleep $RCWAIT

View file

@ -51,7 +51,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u www-data clixon_restconf
new "start restconf daemon" 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 sleep $RCWAIT

View file

@ -83,7 +83,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon" 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 sleep $RCWAIT

View file

@ -49,7 +49,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u www-data clixon_restconf
new "start restconf daemon" 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 sleep $RCWAIT

View file

@ -122,7 +122,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data -f "/www-data/clixon_restconf" sudo pkill -u www-data -f "/www-data/clixon_restconf"
new "start restconf daemon" 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 sleep $RCWAIT

View file

@ -81,7 +81,7 @@ new "kill old restconf daemon"
sudo pkill -u www-data clixon_restconf sudo pkill -u www-data clixon_restconf
new "start restconf daemon" 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" new "netconf set x in example1"
expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$' expecteof "$clixon_netconf -qf $cfg" 0 '<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><edit-config><target><candidate/></target><config><x xmlns="urn:example:clixon1">42</x></config></edit-config></rpc>]]>]]>' '^<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>]]>]]>$'