From 6ed769e082051345f61617dcb9452c4b3c5f7681 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Mon, 2 Apr 2018 13:18:47 +0200 Subject: [PATCH] The Clixon example has changed name from routing to example affecting all config files, plugins, tests, etc. --- CHANGELOG.md | 9 +++-- apps/restconf/README.md | 4 +- apps/restconf/restconf_main.c | 2 +- apps/restconf/restconf_methods.c | 2 +- datastore/datastore_client.c | 6 +-- develop.md | 8 ++-- doc/FAQ.md | 39 ++++++++++--------- example/Makefile.in | 18 ++++----- example/README.md | 33 +++++++++++++--- example/example.xml | 18 +++++++++ example/example.yang | 3 -- .../{routing_backend.c => example_backend.c} | 0 example/{routing_cli.c => example_cli.c} | 0 example/{routing_cli.cli => example_cli.cli} | 4 +- .../{routing_netconf.c => example_netconf.c} | 0 ...{routing_restconf.c => example_restconf.c} | 0 example/routing.conf.local | 17 -------- example/routing.xml | 18 --------- test/test_auth.sh | 21 +++++----- test/test_cli.sh | 17 ++++---- test/test_leafref.sh | 16 ++++---- test/test_netconf.sh | 22 +++++------ test/test_order.sh | 14 +++---- test/test_perf.sh | 8 ++-- test/test_restconf.sh | 20 +++++----- test/test_restconf2.sh | 6 +-- test/test_startup.sh | 26 ++++++------- test/test_type.sh | 16 ++++---- test/test_yang.sh | 22 +++++------ 29 files changed, 187 insertions(+), 182 deletions(-) create mode 100644 example/example.xml rename example/{routing_backend.c => example_backend.c} (100%) rename example/{routing_cli.c => example_cli.c} (100%) rename example/{routing_cli.cli => example_cli.cli} (98%) rename example/{routing_netconf.c => example_netconf.c} (100%) rename example/{routing_restconf.c => example_restconf.c} (100%) delete mode 100644 example/routing.conf.local delete mode 100644 example/routing.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 39e95e6f..487f9e5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ ### Minor changes: +* The Clixon example has changed name from "routing" to "example" affecting all config files, plugins, tests, etc. * Removed username to rpc calls (added below) * README.md extended with new yang, netconf, restconf, datastore, and auth sections. * The key-value datastore is no longer supported. Use the default text datastore. @@ -175,11 +176,11 @@ SUNET for support, requests, debugging, bugfixes and proposed solutions. * In backward compatible mode both .xml and .conf works * For migration from old to new, a utility is clixon_cli -x to print new format. Run the command and save in configuration file with .xml suffix instead. ``` - > clixon_cli -f /usr/local/etc/routing.conf -1x + > clixon_cli -f /usr/local/etc/example.conf -1x - /usr/local/etc/routing.xml - /usr/local/share/routing/yang - /usr/local/lib/routing/backend + /usr/local/etc/example.xml + /usr/local/share/example/yang + /usr/local/lib/example/backend ... ``` diff --git a/apps/restconf/README.md b/apps/restconf/README.md index 78104f3d..d6c69b89 100644 --- a/apps/restconf/README.md +++ b/apps/restconf/README.md @@ -20,7 +20,7 @@ sudo /etc/init.d nginx start Start clixon restconf daemon ``` -olof@vandal> sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/routing.xml " -s /bin/sh www-data +olof@vandal> sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data ``` Make restconf calls with curl @@ -56,7 +56,7 @@ curl -sX POST -d '{"interfaces":{"interface":{"name":"eth1","type":"eth","enable Start the restconf fastcgi program with debug flag: ``` -sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/routing.xml" -s /bin/sh www-data +sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/example.xml" -s /bin/sh www-data ``` Look at syslog: ``` diff --git a/apps/restconf/restconf_main.c b/apps/restconf/restconf_main.c index 62f8b6f1..234a23cc 100644 --- a/apps/restconf/restconf_main.c +++ b/apps/restconf/restconf_main.c @@ -39,7 +39,7 @@ * sudo apt-get install libfcgi-dev * gcc -o fastcgi fastcgi.c -lfcgi - * sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/routing.xml " -s /bin/sh www-data + * sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/example.xml " -s /bin/sh www-data * This is the interface: * api/data/profile=/metric= PUT data:enable= diff --git a/apps/restconf/restconf_methods.c b/apps/restconf/restconf_methods.c index 729d01c6..547aa3ec 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -39,7 +39,7 @@ * sudo apt-get install libfcgi-dev * gcc -o fastcgi fastcgi.c -lfcgi - * sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/routing.xml " -s /bin/sh www-data + * sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/example.xml " -s /bin/sh www-data * This is the interface: * api/data/profile=/metric= PUT data:enable= diff --git a/datastore/datastore_client.c b/datastore/datastore_client.c index 5a411420..bdcd4ac5 100644 --- a/datastore/datastore_client.c +++ b/datastore/datastore_client.c @@ -33,11 +33,11 @@ * Examples: -./datastore_client -d candidate -b /usr/local/var/routing -p /home/olof/src/clixon/datastore/keyvalue/keyvalue.so -y /usr/local/share/routing/yang -m ietf-ip get / +./datastore_client -d candidate -b /usr/local/var/example -p /home/olof/src/clixon/datastore/keyvalue/keyvalue.so -y /usr/local/share/example/yang -m ietf-ip get / -sudo ./datastore_client -d candidate -b /usr/local/var/routing -p /home/olof/src/clixon/datastore/keyvalue/keyvalue.so -y /usr/local/share/routing/yang -m ietf-ip put merge /interfaces/interface=eth66 'eth66' +sudo ./datastore_client -d candidate -b /usr/local/var/example -p /home/olof/src/clixon/datastore/keyvalue/keyvalue.so -y /usr/local/share/example/yang -m ietf-ip put merge /interfaces/interface=eth66 'eth66' -sudo ./datastore_client -d candidate -b /usr/local/var/routing -p /home/olof/src/clixon/datastore/keyvalue/keyvalue.so -y /usr/local/share/routing/yang -m ietf-ip put merge / 'eth0true' +sudo ./datastore_client -d candidate -b /usr/local/var/example -p /home/olof/src/clixon/datastore/keyvalue/keyvalue.so -y /usr/local/share/example/yang -m ietf-ip put merge / 'eth0true' */ diff --git a/develop.md b/develop.md index c23f5314..4ff98354 100644 --- a/develop.md +++ b/develop.md @@ -69,11 +69,11 @@ EOF cat < /tmp/myconf.xml /tmp/myconf.xml - /usr/local/share/routing/yang + /usr/local/share/example/yang example - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile - /usr/local/var/routing + /usr/local/var/example/example.sock + /usr/local/var/example/example.pidfile + /usr/local/var/example /usr/local/lib/xmldb/text.so EOF diff --git a/doc/FAQ.md b/doc/FAQ.md index 1b90a6a0..2b151e27 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -24,7 +24,7 @@ Clixon is written in C. The plugins are written in C. The CLI specification uses cligen (http://cligen.se) ## How to best understand Clixon? -Run the ietf yang routing example, in the example directory. +Run the Clixon example, in the example directory. ## How do you build and install Clixon (and the example)? Clixon: @@ -56,14 +56,14 @@ Build using 'make doc' and aim your browser at doc/html/index.html or use the web resource: http://clicon.org/ref/index.html ## How do you run the example? -- Start a backend server: 'clixon_backend -Ff /usr/local/etc/routing.xml' -- Start a cli session: clixon_cli -f /usr/local/etc/routing.xml -- Start a netconf session: clixon_netconf -f /usr/local/etc/routing.xml +- Start a backend server: 'clixon_backend -Ff /usr/local/etc/example.xml' +- Start a cli session: clixon_cli -f /usr/local/etc/example.xml +- Start a netconf session: clixon_netconf -f /usr/local/etc/example.xml ## How is configuration data stored? Configuration data is stored in an XML datastore. The default is a text-based datastore. In the example the datastore are regular files found in -/usr/local/var/routing/. +/usr/local/var/example/. ## What is validate and commit? Clixon follows netconf in its validate and commit semantics. @@ -79,7 +79,7 @@ is the core functionality of a clixon system. Clixon options are stored in an XML configuration file. The default configuration file is /usr/local/etc/clixon.xml. The example -configuration file is installed at /usr/local/etc/routing.xml. The +configuration file is installed at /usr/local/etc/example.xml. The YANG specification for the configuration file is clixon-config.yang. You can change where CLixon looks for the configuration FILE as follows: @@ -109,12 +109,12 @@ You may also push the containers with 'make push' but you may then consider chan As an alternative to cli configuration, you can use netconf. Easiest is to just pipe netconf commands to the clixon_netconf application. Example: - echo "]]>]]>" | clixon_netconf -f /usr/local/etc/routing.xml + echo "]]>]]>" | clixon_netconf -f /usr/local/etc/example.xml However, more useful is to run clixon_netconf as an SSH subsystem. Register the subsystem in /etc/sshd_config: ``` - Subsystem netconf /usr/local/bin/clixon_netconf -f /usr/local/etc/routing.xml + Subsystem netconf /usr/local/bin/clixon_netconf -f /usr/local/etc/example.xml ``` and then invoke it from a client using ``` @@ -149,7 +149,7 @@ cli> ``` or via netconf: ``` -clixon_netconf -qf /usr/local/etc/routing.xml +clixon_netconf -qf /usr/local/etc/example.xml ROUTING]]>]]> ]]>]]> Routing notification]]>]]> @@ -194,18 +194,19 @@ clixon_backend ... -c extra.xml ``` The second way is by programming the plugin_reset() in the backend -plugin. The example code contains an example on how to do this (see plugin_reset() in routing_backend.c). +plugin. The example code contains an example on how to do this (see plugin_reset() in example_backend.c). ## I want to program. How do I extend the example? -- routing.xml - Change the configuration file +- example.xml - Change the configuration file - The yang specifications - This is the central part. It changes the XML, database and the config cli. -- routing_cli.cli - Change the fixed part of the CLI commands -- routing_cli.c - Cli C-commands are placed here. -- routing_backend.c - Commit and validate functions. -- routing_netconf.c - Modify semantics of netconf commands. +- example_cli.cli - Change the fixed part of the CLI commands +- example_cli.c - Cli C-commands are placed here. +- example_backend.c - Commit and validate functions. +- example_netconf.c - Netconf plugin +- example_restconf.c - Add restconf authentication, etc. ## How do I write a commit function? -In the example, you write a commit function in routing_backend.c. +In the example, you write a commit function in example_backend.c. Every time a commit is made, transaction_commit() is called in the backend. It has a 'transaction_data td' argument which is used to fetch information on added, deleted and changed entries. You access this @@ -235,9 +236,9 @@ More are found in the doxygen reference. ## How do I write a CLI callback function? -1. You add an entry in routing_cli.cli +1. You add an entry in example_cli.cli > example("This is a comment") ("This is a variable"), mycallback("myarg"); -2. Then define a function in routing_cli.c +2. Then define a function in example_cli.c > mycallback(clicon_handle h, cvec *cvv, cvec *arv) where 'cvv' contains the value of the variable 'var' and 'argv' contains the string "myarg". @@ -320,5 +321,5 @@ If a plugin is provided, it needs to supply a username. If not, the request is unauthorized. the function mallocs a username and returns it. -See (../apps/example/routing_restconf.c) plugin_credentials() for +See (../apps/example/example_restconf.c) plugin_credentials() for an example of HTTP basic auth. diff --git a/example/Makefile.in b/example/Makefile.in index 12570d86..65df832f 100644 --- a/example/Makefile.in +++ b/example/Makefile.in @@ -38,7 +38,7 @@ bindir = @bindir@ includedir = @includedir@ datarootdir = @datarootdir@ -APPNAME = routing +APPNAME = example CC = @CC@ CFLAGS = @CFLAGS@ -rdynamic -fPIC @@ -53,13 +53,12 @@ PLUGINS = $(BE_PLUGIN) $(CLI_PLUGIN) $(NETCONF_PLUGIN) $(RESTCONF_PLUGIN) all: $(PLUGINS) -# Note: clixon.mk has a rule for: -# $(APPNAME.conf) +# Note: clixon.mk has rules for clixon_DBSPECDIR, clixon_SYSCONFDIR, etc used below -include $(DESTDIR)$(datarootdir)/clixon/clixon.mk -CLISPECS = routing_cli.cli +CLISPECS = $(APPNAME)_cli.cli -#YANGSPECS = $(APPNAME).yang +YANGSPECS = $(APPNAME).yang YANGSPECS += ietf-yang-types@2013-07-15.yang YANGSPECS += ietf-inet-types@2013-07-15.yang YANGSPECS += ietf-interfaces@2014-05-08.yang @@ -68,28 +67,27 @@ YANGSPECS += ietf-routing@2014-10-26.yang YANGSPECS += ietf-ipv4-unicast-routing@2014-10-26.yang YANGSPECS += ietf-ipv6-unicast-routing@2014-10-26.yang YANGSPECS += ietf-ipsec@2016-03-09.yang -YANGSPECS += example.yang # Backend plugin -BE_SRC = routing_backend.c +BE_SRC = $(APPNAME)_backend.c BE_OBJ = $(BE_SRC:%.c=%.o) $(BE_PLUGIN): $(BE_OBJ) $(CC) -Wall -shared -o $@ -lc $< # CLI frontend plugin -CLI_SRC = routing_cli.c +CLI_SRC = $(APPNAME)_cli.c CLI_OBJ = $(CLI_SRC:%.c=%.o) $(CLI_PLUGIN): $(CLI_OBJ) $(CC) -Wall -shared -o $@ -lc $^ # NETCONF frontend plugin -NETCONF_SRC = routing_netconf.c +NETCONF_SRC = $(APPNAME)_netconf.c NETCONF_OBJ = $(NETCONF_SRC:%.c=%.o) $(NETCONF_PLUGIN): $(NETCONF_OBJ) $(CC) -Wall -shared -o $@ -lc $^ # RESTCONF frontend plugin -RESTCONF_SRC = routing_restconf.c +RESTCONF_SRC = $(APPNAME)_restconf.c RESTCONF_OBJ = $(RESTCONF_SRC:%.c=%.o) $(RESTCONF_PLUGIN): $(RESTCONF_OBJ) $(CC) -Wall -shared -o $@ -lc $^ diff --git a/example/README.md b/example/README.md index e2cf9fe6..27fd33d6 100644 --- a/example/README.md +++ b/example/README.md @@ -1,4 +1,19 @@ -# Clixon yang routing example +# Clixon example + +This directory contains a Clixon example which includes a simple +routing example. It contains the following files: +* example.xml The configuration file. See yang/clixon-config@.yang for all available fields. +* example.yang The yang spec of the example. It mainly includes ietf routing and IP modules. +* example_cli.cli CLIgen specification. +* example_cli.c CLI callback plugin containing functions called in the cli file above: a generic callback (`mycallback`) and an RPC (`fib_route_rpc`). +* example_backend.c Backend callback plugin including example of: + * transaction callbacks (validate/commit), + * notification, + * rpc handler + * state-data handler, ie non-config data +* example_restconf.c Restconf callback plugin containing an HTTP basic authentication callback +* example_netconf.c Netconf callback plugin +* Makefile.in Example makefile where plugins are built and installed ## Compile and run ``` @@ -7,15 +22,23 @@ ``` Start backend: ``` - clixon_backend -f /usr/local/etc/routing.xml -I + clixon_backend -f /usr/local/etc/example.xml -I ``` Edit cli: ``` - clixon_cli -f /usr/local/etc/routing.xml + clixon_cli -f /usr/local/etc/example.xml ``` Send netconf command: ``` - clixon_netconf -f /usr/local/etc/routing.xml + clixon_netconf -f /usr/local/etc/example.xml +``` +Start clixon restconf daemon +``` +> sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data +``` +Send restconf command +``` + curl -G http://127.0.0.1/restconf/data ``` ## Setting data example using netconf @@ -114,7 +137,7 @@ plugin_init(clicon_handle h) Netconf and restconf GET also returns state data, in contrast to config data. - +p In YANG state data is specified with "config false;". In the example, interface-state is state data. To return state data, you need to write a backend state data callback diff --git a/example/example.xml b/example/example.xml new file mode 100644 index 00000000..e93b840a --- /dev/null +++ b/example/example.xml @@ -0,0 +1,18 @@ + + /usr/local/etc/example.xml + /usr/local/share/example/yang + example + example + /usr/local/lib/example/backend + /usr/local/lib/example/netconf + /usr/local/lib/example/restconf + /usr/local/lib/example/cli + /usr/local/lib/example/clispec + /usr/local/var/example/example.sock + /usr/local/var/example/example.pidfile + 1 + /usr/local/var/example + /usr/local/lib/xmldb/text.so + 0 + init + diff --git a/example/example.yang b/example/example.yang index 831f30b3..eb4dbfdd 100644 --- a/example/example.yang +++ b/example/example.yang @@ -6,9 +6,6 @@ module example { import ietf-routing { prefix rt; } - import ietf-netconf-acm { - prefix nacm; /* See RFC 6536 */ - } description "Example code that includes ietf-ip and ietf-routing"; leaf basic_auth{ diff --git a/example/routing_backend.c b/example/example_backend.c similarity index 100% rename from example/routing_backend.c rename to example/example_backend.c diff --git a/example/routing_cli.c b/example/example_cli.c similarity index 100% rename from example/routing_cli.c rename to example/example_cli.c diff --git a/example/routing_cli.cli b/example/example_cli.cli similarity index 98% rename from example/routing_cli.cli rename to example/example_cli.cli index 63a285eb..6f8fdcfd 100644 --- a/example/routing_cli.cli +++ b/example/example_cli.cli @@ -1,7 +1,7 @@ # Common CLI syntax for both server and PMNode operatio mode -CLICON_MODE="routing"; +CLICON_MODE="example"; CLICON_PROMPT="%U@%H> "; -CLICON_PLUGIN="routing_cli"; +CLICON_PLUGIN="example_cli"; # Note, when switching to PT, change datamodel to only @datamodel set @datamodel:example, cli_set(); diff --git a/example/routing_netconf.c b/example/example_netconf.c similarity index 100% rename from example/routing_netconf.c rename to example/example_netconf.c diff --git a/example/routing_restconf.c b/example/example_restconf.c similarity index 100% rename from example/routing_restconf.c rename to example/example_restconf.c diff --git a/example/routing.conf.local b/example/routing.conf.local deleted file mode 100644 index a6caa01a..00000000 --- a/example/routing.conf.local +++ /dev/null @@ -1,17 +0,0 @@ -# Main YANG module first parsed by parser (in CLICON_YANG_DIR). eg clicon.yang. - -# Startup CLI mode. This should match the CLICON_MODE in your startup clispec file -CLICON_CLI_MODE routing - -# Option used to construct initial yang file: -# [@] -#CLICON_YANG_MODULE_MAIN ietf-ip -CLICON_YANG_MODULE_MAIN example - -# Option used to construct initial yang file: -# [@] -#CLICON_YANG_MODULE_REVISION 2014-06-16 - -# Set to 0 if you want CLI to wrap to next line. -# Set to 1 if you want CLI to scroll sideways when approaching right margin -CLICON_CLI_LINESCROLLING 0 diff --git a/example/routing.xml b/example/routing.xml deleted file mode 100644 index 6ed38f96..00000000 --- a/example/routing.xml +++ /dev/null @@ -1,18 +0,0 @@ - - /usr/local/etc/routing.xml - /usr/local/share/routing/yang - example - routing - /usr/local/lib/routing/backend - /usr/local/lib/routing/netconf - /usr/local/lib/routing/restconf - /usr/local/lib/routing/cli - /usr/local/lib/routing/clispec - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile - 1 - /usr/local/var/routing - /usr/local/lib/xmldb/text.so - 0 - init - diff --git a/test/test_auth.sh b/test/test_auth.sh index 92325864..6ccf1d3c 100755 --- a/test/test_auth.sh +++ b/test/test_auth.sh @@ -1,6 +1,7 @@ #!/bin/bash # Authentication and authorization +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh @@ -11,23 +12,23 @@ fyangerr=$dir/err.yang cat < $cfg $cfg - /usr/local/share/routing/yang - example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/restconf - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/share/$APPNAME/yang + $APPNAME + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/restconf + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so false EOF cat < $fyang -module example{ +module $APPNAME{ prefix ex; leaf basic_auth{ description "Basic user / password authentication as in HTTP basic auth"; diff --git a/test/test_cli.sh b/test/test_cli.sh index 496b9d95..338ba060 100755 --- a/test/test_cli.sh +++ b/test/test_cli.sh @@ -8,6 +8,7 @@ # Set the mandatory type # Commit +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf_yang.xml @@ -15,15 +16,15 @@ cfg=$dir/conf_yang.xml cat < $cfg $cfg - /usr/local/share/routing/yang - example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/share/$APPNAME/yang + $APPNAME + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_leafref.sh b/test/test_leafref.sh index 789ca4f8..1b7c2990 100755 --- a/test/test_leafref.sh +++ b/test/test_leafref.sh @@ -1,6 +1,6 @@ #!/bin/bash # Test7: Yang specifics: leafref - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf_yang.xml @@ -9,15 +9,15 @@ fyang=$dir/leafref.yang cat < $cfg $cfg - /usr/local/share/routing/yang + /usr/local/share/$APPNAME/yang example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_netconf.sh b/test/test_netconf.sh index 71578145..f94b7226 100755 --- a/test/test_netconf.sh +++ b/test/test_netconf.sh @@ -1,6 +1,6 @@ #!/bin/bash # Test2: backend and netconf basic functionality - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh @@ -9,18 +9,18 @@ cfg=$dir/conf_yang.xml cat < $cfg $cfg - /usr/local/share/routing/yang + /usr/local/share/$APPNAME/yang example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/backend - /usr/local/lib/routing/netconf - /usr/local/lib/routing/restconf - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/backend + /usr/local/lib/$APPNAME/netconf + /usr/local/lib/$APPNAME/restconf + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_order.sh b/test/test_order.sh index d29ad4f2..a046d5c6 100755 --- a/test/test_order.sh +++ b/test/test_order.sh @@ -5,7 +5,7 @@ # The ordered-by user MUST be the order it is entered. # No test of ordered-by system is done yet # (we may want to sort them alphabetically for better performance). - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf_yang.xml @@ -25,13 +25,13 @@ fi cat < $cfg /tmp/conf_yang.xml - /usr/local/share/routing/yang + /usr/local/share/$APPNAME/yang example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 $dbdir /usr/local/lib/xmldb/text.so diff --git a/test/test_perf.sh b/test/test_perf.sh index dcbaa95f..8ad933e1 100755 --- a/test/test_perf.sh +++ b/test/test_perf.sh @@ -14,7 +14,7 @@ else echo "Usage: $0 [ []]" exit 1 fi - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh @@ -46,10 +46,10 @@ cat < $cfg $cfg $fyang ietf-ip - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile false - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_restconf.sh b/test/test_restconf.sh index 818388fb..13586009 100755 --- a/test/test_restconf.sh +++ b/test/test_restconf.sh @@ -1,7 +1,7 @@ #!/bin/bash # Restconf basic functionality # Assume http server setup, such as nginx described in apps/restconf/README.md - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf.xml @@ -11,18 +11,18 @@ fyang=$dir/restconf.yang cat < $cfg $cfg - /usr/local/share/routing/yang + /usr/local/share/$APPNAME/yang $fyang - /usr/local/lib/routing/clispec - /usr/local/lib/routing/backend - /usr/local/lib/routing/restconf + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/backend + /usr/local/lib/$APPNAME/restconf false - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_restconf2.sh b/test/test_restconf2.sh index b31f662b..928defa4 100755 --- a/test/test_restconf2.sh +++ b/test/test_restconf2.sh @@ -1,7 +1,7 @@ #!/bin/bash # Restconf basic functionality # Assume http server setup, such as nginx described in apps/restconf/README.md - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf.xml @@ -14,9 +14,9 @@ cat < $cfg /usr/local/var $fyang false - /usr/local/var/routing/routing.sock + /usr/local/var/$APPNAME/$APPNAME.sock $dir/restconf.pidfile - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_startup.sh b/test/test_startup.sh index c81f88b9..d7b5d6a8 100755 --- a/test/test_startup.sh +++ b/test/test_startup.sh @@ -5,7 +5,7 @@ # - An extra xml configuration file starts with an "extra" interface # - running db starts with a "run" interface # - startup db starts with a "start" interface - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh cfg=$dir/conf_startup.xml @@ -13,18 +13,18 @@ cfg=$dir/conf_startup.xml cat < $cfg $cfg - /usr/local/share/routing/yang + /usr/local/share/$APPNAME/yang example - routing - /usr/local/lib/routing/backend - /usr/local/lib/routing/netconf - /usr/local/lib/routing/restconf - /usr/local/lib/routing/cli - /usr/local/lib/routing/clispec - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + $APPNAME + /usr/local/lib/$APPNAME/backend + /usr/local/lib/$APPNAME/netconf + /usr/local/lib/$APPNAME/restconf + /usr/local/lib/$APPNAME/cli + /usr/local/lib/$APPNAME/clispec + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so 0 init @@ -48,7 +48,7 @@ run(){ EOF - sudo mv $dbdir /usr/local/var/routing/running_db + sudo mv $dbdir /usr/local/var/$APPNAME/running_db cat < $dbdir @@ -60,7 +60,7 @@ EOF EOF - sudo mv $dbdir /usr/local/var/routing/startup_db + sudo mv $dbdir /usr/local/var/$APPNAME/startup_db cat < $dir/config diff --git a/test/test_type.sh b/test/test_type.sh index e63bd05a..8eaaba92 100755 --- a/test/test_type.sh +++ b/test/test_type.sh @@ -1,7 +1,7 @@ #!/bin/bash # Advanced union types and generated code # and enum w values - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh @@ -12,15 +12,15 @@ fyang=$dir/type.yang cat < $cfg $cfg - /usr/local/share/routing/yang + /usr/local/share/$APPNAME/yang example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF diff --git a/test/test_yang.sh b/test/test_yang.sh index 4d5af03d..52d4a70f 100755 --- a/test/test_yang.sh +++ b/test/test_yang.sh @@ -1,6 +1,6 @@ #!/bin/bash # Test4: Yang specifics: multi-keys and empty type - +APPNAME=example # include err() and new() functions and creates $dir . ./lib.sh @@ -11,21 +11,21 @@ fyangerr=$dir/err.yang cat < $cfg $cfg - /usr/local/share/routing/yang - example - /usr/local/lib/routing/clispec - /usr/local/lib/routing/cli - routing - /usr/local/var/routing/routing.sock - /usr/local/var/routing/routing.pidfile + /usr/local/share/$APPNAME/yang + $APPNAME + /usr/local/lib/$APPNAME/clispec + /usr/local/lib/$APPNAME/cli + $APPNAME + /usr/local/var/$APPNAME/$APPNAME.sock + /usr/local/var/$APPNAME/$APPNAME.pidfile 1 - /usr/local/var/routing + /usr/local/var/$APPNAME /usr/local/lib/xmldb/text.so EOF cat < $fyang -module example{ +module $APPNAME{ prefix ex; extension c-define { description "Example from RFC 6020"; @@ -87,7 +87,7 @@ EOF # This yang definition uses an extension which is not defined. Error when loading cat < $fyangerr -module example{ +module $APPNAME{ prefix ex; extension c-define { description "Example from RFC 6020";