|
|
||
|---|---|---|
| .. | ||
| cicd | ||
| fuzz | ||
| jenkins | ||
| mibs | ||
| vagrant | ||
| virtualbox | ||
| all.sh | ||
| clixon.png | ||
| config.sh.in | ||
| example_social.sh | ||
| jukebox.sh | ||
| lib.sh | ||
| long.sh | ||
| Makefile.in | ||
| mem.sh | ||
| nacm.sh | ||
| plot_perf.sh | ||
| README.md | ||
| site.sh | ||
| sum.sh | ||
| test_api.sh | ||
| test_api_path.sh | ||
| test_augment.sh | ||
| test_augment_state.sh | ||
| test_augment_trans.sh | ||
| test_autocli_editmode.sh | ||
| test_autocli_extension.sh | ||
| test_autocli_listkey_compress.sh | ||
| test_autocli_spec.sh | ||
| test_autocli_strict_expand.sh | ||
| test_autocli_sub.sh | ||
| test_autocli_treeref.sh | ||
| test_c++.sh | ||
| test_choice.sh | ||
| test_cli.sh | ||
| test_cli_apipath.sh | ||
| test_cli_duplicates.sh | ||
| test_cli_expand.sh | ||
| test_cli_history.sh | ||
| test_cli_leafref.sh | ||
| test_cli_multikey.sh | ||
| test_cli_rest.sh | ||
| test_cli_submodes.sh | ||
| test_cli_translate.sh | ||
| test_cli_union.sh | ||
| test_cli_varonly.sh | ||
| test_client.sh | ||
| test_configdir.sh | ||
| test_copy_config.sh | ||
| test_datastore.sh | ||
| test_datastore_format.sh | ||
| test_datastore_repair.sh | ||
| test_db.sh | ||
| test_debug.sh | ||
| test_dispatcher.sh | ||
| test_feature.sh | ||
| test_feature_startup.sh | ||
| test_helloworld.sh | ||
| test_http_data.sh | ||
| test_identity.sh | ||
| test_insert.sh | ||
| test_install.sh | ||
| test_instance_id.sh | ||
| test_instance_id_multi.sh | ||
| test_json.sh | ||
| test_json_list.sh | ||
| test_json_null.sh | ||
| test_leaf_default.sh | ||
| test_leafref.sh | ||
| test_leafref_augment.sh | ||
| test_leafref_state.sh | ||
| test_leafref_union.sh | ||
| test_leafref_uses_augment.sh | ||
| test_minmax.sh | ||
| test_nacm.sh | ||
| test_nacm_credentials.sh | ||
| test_nacm_datanode.sh | ||
| test_nacm_datanode_paths.sh | ||
| test_nacm_datanode_read.sh | ||
| test_nacm_datanode_write.sh | ||
| test_nacm_default.sh | ||
| test_nacm_ext.sh | ||
| test_nacm_module_read.sh | ||
| test_nacm_module_write.sh | ||
| test_nacm_protocol.sh | ||
| test_nacm_recovery.sh | ||
| test_netconf.sh | ||
| test_netconf_filter.sh | ||
| test_netconf_framing.sh | ||
| test_netconf_hello.sh | ||
| test_netconf_notifications.sh | ||
| test_netconf_ssh_callhome.sh | ||
| test_netconf_whitespace.sh | ||
| test_openconfig.sh | ||
| test_openconfig_interfaces.sh | ||
| test_openconfig_network_instance.sh | ||
| test_openconfig_system.sh | ||
| test_order.sh | ||
| test_pagination_config.sh | ||
| test_pagination_draft.sh | ||
| test_pagination_expect.exp | ||
| test_pagination_state.sh | ||
| test_pattern.sh | ||
| test_perf_cli.sh | ||
| test_perf_json.sh | ||
| test_perf_mem.sh | ||
| test_perf_netconf.sh | ||
| test_perf_restconf.sh | ||
| test_perf_restconf_ssl.sh | ||
| test_perf_startup.sh | ||
| test_perf_state.sh | ||
| test_perf_state_only.sh | ||
| test_perf_xml.sh | ||
| test_privileges.sh | ||
| test_restconf.sh | ||
| test_restconf_basic_auth.sh | ||
| test_restconf_continue.sh | ||
| test_restconf_err.sh | ||
| test_restconf_http_upgrade.sh | ||
| test_restconf_internal.sh | ||
| test_restconf_internal_usecases.sh | ||
| test_restconf_jukebox.sh | ||
| test_restconf_listkey.sh | ||
| test_restconf_netns.sh | ||
| test_restconf_nmap.sh | ||
| test_restconf_notifications.sh | ||
| test_restconf_op.sh | ||
| test_restconf_plain_patch.sh | ||
| test_restconf_ssl_certs.sh | ||
| test_restconf_startup.sh | ||
| test_restconf_yang_patch_json.sh | ||
| test_restconf_yang_patch_xml.sh | ||
| test_rpc.sh | ||
| test_search_index.sh | ||
| test_snmp_entity.sh | ||
| test_snmp_ifmib.sh | ||
| test_snmp_set.sh | ||
| test_snmp_system.sh | ||
| test_snmp_table.sh | ||
| test_snmp_types.sh | ||
| test_sock.sh | ||
| test_startup.sh | ||
| test_submodule.sh | ||
| test_transaction.sh | ||
| test_transaction_restart.sh | ||
| test_type.sh | ||
| test_type_range.sh | ||
| test_union.sh | ||
| test_unique.sh | ||
| test_unique_descendant.sh | ||
| test_upgrade_auto.sh | ||
| test_upgrade_checkold.sh | ||
| test_upgrade_failsafe.sh | ||
| test_upgrade_interfaces.sh | ||
| test_upgrade_interfaces_rfc7895.sh | ||
| test_upgrade_module.sh | ||
| test_upgrade_quit.sh | ||
| test_upgrade_repair.sh | ||
| test_upgrade_simple.sh | ||
| test_when_must.sh | ||
| test_with_default.sh | ||
| test_xml.sh | ||
| test_xml_trees.sh | ||
| test_xml_validate.sh | ||
| test_xpath.sh | ||
| test_xpath_canonical.sh | ||
| test_xpath_functions.sh | ||
| test_xpath_inverse.sh | ||
| test_yang.sh | ||
| test_yang_action.sh | ||
| test_yang_anydata.sh | ||
| test_yang_bind.sh | ||
| test_yang_default.sh | ||
| test_yang_deviation.sh | ||
| test_yang_extension.sh | ||
| test_yang_load.sh | ||
| test_yang_models_ieee.sh | ||
| test_yang_models_ietf.sh | ||
| test_yang_namespace.sh | ||
| test_yang_when.sh | ||
| valgrind-clixon.supp | ||
Clixon Test and CI
Overview
This directory contains Clixon test suites. Files directly under this
directory called test_*.sh are part of the regression CI tests.
There are also sub-directories for various other tests:
- cicd - Test scripts for running on remote hosts
- fuzz - Fuzzing with american fuzzy lop
- vagrant - Scripts for booting local vagrant hosts, installing clixon and running clixon tests
automatically run as part of the all.sh, sum.sh tests etc. The scripts need to follow some rules to work properly, please look at one or two to get the idea.
Most scripts are bash scripts using standard awk/sed etc. There is also (at least one) expect script.
Note that some IETF yangs need to be available, by default these are in /usr/local//share/yang/standard. You can change this location with configure option --with-yang-standard-dir=DIR
See also the site.sh for example for skipping tests or setting some site-specific variables.
Openconfig and Yang
To download the openconfig and yang models required for the tests:
cd /usr/local/share/openconfig
git clone https://github.com/openconfig/public
cd /usr/local/share/yang
git init
git remote add -f origin https://github.com/YangModels/yang
git config core.sparseCheckout true
echo "standard/" >> .git/info/sparse-checkout
echo "experimental/" >> .git/info/sparse-checkout
git pull origin main
Continuous Integration
CI is done via github actions.
In the CI process, the system is built and configured and then the clixon test container is built and the tests in this directory is executed.
There are also manual cicd scripts here
Getting started
You need to build and install the clixon utility programs before running the tests as some of the tests rely on them:
cd util
make
sudo make install
You need to configure and start nginx for the restconf tests:
- The example has instructions on how to edit your nginx config files
- If you run systemd:
sudo systemctl start nginx.service
You may need to install the time utility (/usr/bin/time).
Prefix variable
You can prefix a test with BE=0 if you want to run your own backend.
You can prefix a test with RC=0 if you want to run your own restconf process.
To run with debug flags, use the DBG=<number> environment variable.
Other variables include:
- DEMWAIT Number of seconds to sleep after daemons have started
Run all tests
You can run an individual test by itself, or run through all tests matching 'test_*.sh' in the directory. Prints test output and stops on first error:
all.sh
Run all tests but continue after errors and only print a summary test output identifying which tests succeeded and which failed:
sum.sh
Memory leak test
The mem.sh runs memory checks using valgrind. Start it with no arguments to test all components (backend, restconf, cli, netconf), or specify which components to run:
mem.sh 2>&1 | tee mylog # All components
mem.sh restconf backend # Only backend and cli
Run pattern of tests
The above scripts work with the pattern variable to limit the scope of which tests run, eg:
pattern="test_c*.sh" mem.sh
TLS and http/2
With default configure options, most tests run http/2 and TLS by
default. To pin tests to override this use the HVER and RCPROTO variables. Example:
HVER=1.1 RCPROTO=http ./test_restconf_plain_patch.sh
Some tests are pinned to certain settings and overriding will not will not work.
Performance plots
The script plot_perf.sh produces gnuplots for some testcases.
Site.sh
You may add your site-specific modifications in a site.sh file. Example:
# Add your local site specific env variables (or tests) here.
# Add test to this list that you dont want run
SKIPLIST="test_openconfig.sh test_yangmodels.sh"
# Parse yang openconfig models from https://github.com/openconfig/public
OPENCONFIG=/usr/local/share/openconfig/public
For example, in FreeBSD, add:
wwwuser=www
make=gmake
https
For fcgi/nginx you need to setup https in the nginx config file, independently of clixon.
If you use native with configure --with-restconf=http1, you can prepend the tests with RCPROTO=https which will run all restconf tests with SSL https and server certs.
Ensure the server keys are in order, as follows.
If you already have server certs, ensure the RESTCONF variable in lib.sh points to them, by default the config is
<server-cert-path>/etc/ssl/certs/clixon-server-crt.pem</server-cert-path>
<server-key-path>/etc/ssl/private/clixon-server-key.pem</server-key-path>
<server-ca-cert-path>/etc/ssl/certs/clixon-ca-crt.pem</server-ca-cert-path>
If you do not have them, generate self-signed certs, eg as follows:
openssl req -x509 -nodes -newkey rsa:4096 -keyout /etc/ssl/private/clixon-server-key.pem -out /etc/ssl/certs/clixon-server-crt.pem -days 365
There are also client-cert tests, eg test_ssl_certs.sh
SNMP
Clixon snmp frontend tests require a running netsnmpd and converted YANG files from MIB.
Netsnmpd is 5.9 or later and can be started via systemd. For the tests
to run, the systems IFMIB should be disabled: -I -ifTable,ifNumber,ifXTable
Converted YANG files are available at https://github.com/clicon/mib-yangs or alternatively use smidump version 0.5 or later.
Known issues
Workaround: Unicode double-quote in iana-if-type@2022-03-07.yang