cicd tests
This commit is contained in:
parent
1db969d3a7
commit
afe64cbd5e
4 changed files with 27 additions and 35 deletions
|
|
@ -18,28 +18,3 @@ You may also do `make push` if you want to push the image, but you may then cons
|
||||||
|
|
||||||
(You may have to login for push with sudo docker login -u <username>)
|
(You may have to login for push with sudo docker login -u <username>)
|
||||||
|
|
||||||
## Example run
|
|
||||||
|
|
||||||
The base container is a minimal and primitive example. Look at the [clixon-system](../main) for a more stream-lined application.
|
|
||||||
|
|
||||||
The following shows a simple example of how to run the example
|
|
||||||
application. First, the container is started with the backend running:
|
|
||||||
```
|
|
||||||
$ sudo docker run --rm --name cli -d clixon/clixon clixon_backend -Fs init
|
|
||||||
```
|
|
||||||
Then a CLI is started, and finally the container is removed:
|
|
||||||
```
|
|
||||||
$ sudo docker exec -it hello clixon_cli
|
|
||||||
cli> set ?
|
|
||||||
hello
|
|
||||||
cli> set hello world
|
|
||||||
cli> show configuration
|
|
||||||
hello world;
|
|
||||||
> q
|
|
||||||
$ sudo docker kill hello
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that the clixon example application is a special case since the example is
|
|
||||||
already a part of the installation. If you want to add your own
|
|
||||||
application, such as plugins, cli syntax files, yang models, etc, you
|
|
||||||
need to extend the base container with your own additions.
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ SHELL = /bin/sh
|
||||||
# eg :
|
# eg :
|
||||||
# HOSTS += vandal.hagsand.com # i86_32 ubuntu
|
# HOSTS += vandal.hagsand.com # i86_32 ubuntu
|
||||||
# ...
|
# ...
|
||||||
|
# You can also set RESTCONF to fcgi or evhtp
|
||||||
|
RESTCONF=fcgi
|
||||||
HOSTS=
|
HOSTS=
|
||||||
-include site.mk
|
-include site.mk
|
||||||
|
|
||||||
|
|
@ -56,9 +58,9 @@ all: $(HOSTS)
|
||||||
# Real hosts reachable by ssh
|
# Real hosts reachable by ssh
|
||||||
$(HOSTS):
|
$(HOSTS):
|
||||||
ifdef LOGDIR
|
ifdef LOGDIR
|
||||||
./cicd.sh $@ 2>&1 > $(LOGDIR)/$@.log
|
./cicd.sh $@ $(RESTCONF) 2>&1 > $(LOGDIR)/$@-$(RESTCONF).log
|
||||||
else
|
else
|
||||||
./cicd.sh $@ 2>&1 | tee /$@.log
|
./cicd.sh $@ $(RESTCONF) 2>&1 | tee /$@-$(RESTCONF).log
|
||||||
endif
|
endif
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,14 @@
|
||||||
|
|
||||||
set -eux # x
|
set -eux # x
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "usage: $0 <host>"
|
echo "usage: $0 <host> <restconf>"
|
||||||
|
echo " where <restconf> is fcgi or evhtp"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
h=$1
|
h=$1 # Host
|
||||||
|
restconf=$2
|
||||||
|
|
||||||
SCRIPTS="cligen-mk.sh clixon-mk.sh clixon-config.sh"
|
SCRIPTS="cligen-mk.sh clixon-mk.sh clixon-config.sh"
|
||||||
|
|
||||||
|
|
@ -43,8 +45,13 @@ ssh -t $h "(cd src/cligen; /tmp/cligen-mk.sh)"
|
||||||
# pull git changes and build clixon
|
# pull git changes and build clixon
|
||||||
ssh -t $h "test -d src/clixon || (cd src;git clone https://github.com/clicon/clixon.git)"
|
ssh -t $h "test -d src/clixon || (cd src;git clone https://github.com/clicon/clixon.git)"
|
||||||
ssh -t $h "(cd src/clixon;git pull)"
|
ssh -t $h "(cd src/clixon;git pull)"
|
||||||
ssh -t $h "(cd src/clixon; /tmp/clixon-config.sh)"
|
ssh -t $h "(cd src/clixon; /tmp/clixon-config.sh $evhtp)"
|
||||||
ssh -t $h "(cd src/clixon; /tmp/clixon-mk.sh)"
|
ssh -t $h "(cd src/clixon; /tmp/clixon-mk.sh)"
|
||||||
ssh -t $h sudo ldconfig
|
ssh -t $h sudo ldconfig
|
||||||
# Run clixon test suite
|
# Run clixon test suite
|
||||||
|
if [ "$restconf" = "fcgi" ]; then
|
||||||
|
ssh -t $h sudo systemctl start nginx
|
||||||
|
else
|
||||||
|
ssh -t $h sudo systemctl stop nginx
|
||||||
|
fi
|
||||||
ssh -t $h "(cd src/clixon/test; ./sum.sh)"
|
ssh -t $h "(cd src/clixon/test; ./sum.sh)"
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,16 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# A top-level configurer for clixon
|
# A top-level configurer for clixon
|
||||||
set -eux
|
set -eux
|
||||||
if [ $(uname) = "FreeBSD" ]; then
|
|
||||||
./configure --with-cligen=/usr/local --with-wwwuser=www --enable-optyangs
|
if [ $# -ne 1 ]; then
|
||||||
else
|
echo "usage: $0 <restconf>"
|
||||||
./configure --enable-optyangs
|
echo " where <restconf> is fcgi or evhtp"
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
restconf=$1
|
||||||
|
|
||||||
|
if [ $(uname) = "FreeBSD" ]; then
|
||||||
|
./configure --with-cligen=/usr/local --with-wwwuser=www --enable-optyangs --with-restconf=$restconf
|
||||||
|
else
|
||||||
|
./configure --enable-optyangs --with-restconf=$restconf
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue