clixon/docker/test
2024-05-14 10:13:36 +02:00
..
cleanup.sh Renamed clixon-system container to clixon-test 2023-01-15 22:44:00 +01:00
Dockerfile Test: add coreutils to test container 2024-05-14 10:13:36 +02:00
Dockerfile.fcgi Test: add coreutils to test container 2024-05-14 10:13:36 +02:00
Dockerfile.native Test: add coreutils to test container 2024-05-14 10:13:36 +02:00
getopenconfig.sh use local yangmodels/openconfig (if present) instead of github 2023-09-29 22:06:18 +02:00
getyang.sh use local yangmodels/openconfig (if present) instead of github 2023-09-29 22:06:18 +02:00
Makefile.in more clixon-util rm effects 2023-12-02 17:46:43 +01:00
README.md Renamed clixon-system container to clixon-test 2023-01-15 22:44:00 +01:00
start.sh New clixon-config@2024-04-01.yang revision 2024-04-03 17:40:32 +02:00
startsystem.sh Docker: enable ssh tests 2023-11-20 09:55:37 +01:00
startsystem_fcgi.sh Docker: enable ssh tests 2023-11-20 09:55:37 +01:00
startsystem_native.sh Docker: enable ssh tests 2023-11-20 09:55:37 +01:00

Clixon example test container

This directory show how to build a "monolithic" clixon docker container exporting port 80 and contains the example application with both restconf, netconf, cli and backend. It also includes packages to be able to run the Clixon tests.

Note that restconf capability depends on how clixon was configured using the --with-restconf option.

The directory contains the following files:

  • cleanup.sh Kill containers
  • Dockerfile Docker build instructions without restconf
  • Dockerfile.fcgi Docker build instructions with nginx/fcgi restconf (this is default)
  • Dockerfile.native Docker build instructions with native restconf
  • Makefile.in "make docker" builds the container
  • README.md This file
  • start.sh Start containers
  • startsystem.sh Internal start script copied to inside the container (dont run from shell).
  • startsystem_fcgi.sh Variant for nginx/fcgi (default)
  • startsystem_native.sh Variant for native restconf

How to run the tests:

  $ make test

How to build and start the container (called clixon-test):

  $ make docker
  $ ./start.sh 

The start.sh has a number of environment variables to alter the default behaviour:

  • PORT - Nginx exposes port 80 per default. Set PORT=8080 for example to access restconf using 8080.
  • DBG - Set debug. The clixon_backend will be shown on docker logs.
  • CONFIG - Set XML configuration file other than the default example.
  • STORE - Set running datastore content to other than default.

Example:

  $ DBG=1 PORT=8080 ./start.sh

Once running you can access it in different ways as follows: As CLI:

  $ sudo docker exec -it clixon-test clixon_cli

As netconf via stdin/stdout:

  $ sudo docker exec -it clixon-test clixon_netconf -f /usr/local/etc/example.xml

As restconf using curl on exposed port 80:

  $ curl -X GET http://localhost/restconf
  {
    "ietf-restconf:restconf": {
      "data": {},
      "operations": {},
      "yang-library-version": "2019-01-04"
    }
  }

Or run tests:

  $ sudo docker exec -it clixon-test bash -c 'cd /usr/local/bin/test && ./all.sh'

To check status and then kill it:

  $ sudo docker ps --all
  $ ./cleanup.sh 

You trigger the test scripts inside the container using make test.

Changing code

If you want to edit clixon code so it runs in the container? You either:

  1. "persistent": make your changes in the actual clixon code and commit; make clean to remove the local clone; make test again
  2. "volatile" edit the local clone, (in the subdir); make test.