From af36838b4cfcaecf0761540aaa6959cef6b14e52 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 5 May 2024 09:46:25 +0200 Subject: [PATCH] Changed -f /usr/local/etc/example.xml -> /usr/local/etc/clixon/example.xml everywhere --- apps/restconf/README.md | 6 ++--- apps/restconf/restconf_main_fcgi.c | 2 +- apps/restconf/restconf_methods.c | 2 +- doc/DEVELOP.md | 2 +- doc/FAQ.md | 20 +++++++------- example/main/README.md | 26 +++++++++---------- example/main/systemd/example.service | 2 +- example/main/systemd/example_restconf.service | 2 +- yang/clixon/clixon-config@2024-04-01.yang | 12 ++++----- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/apps/restconf/README.md b/apps/restconf/README.md index fa8fbff0..462c6d24 100644 --- a/apps/restconf/README.md +++ b/apps/restconf/README.md @@ -68,7 +68,7 @@ Or on FreeBSD: Start clixon backend daemon (if not already started) ``` - sudo clixon_backend -s init -f /usr/local/etc/example.xml + sudo clixon_backend -s init -f /usr/local/etc/clixon/example.xml ``` Start clixon restconf daemon @@ -213,7 +213,7 @@ See (https://nchan.io/#eventsource) on more info on how to access an SSE sub end Start the restconf fastcgi program with debug flag: ``` -sudo clixon_restconf -D 1 -f /usr/local/etc/example.xml +sudo clixon_restconf -D 1 -f /usr/local/etc/clixon/example.xml ``` Look at syslog: ``` @@ -228,7 +228,7 @@ curl -G http://127.0.0.1/restconf/data/* You can also run restconf in a debugger. ``` sudo gdb clixon_restconf -(gdb) run -D 1 -f /usr/local/etc/example.xml +(gdb) run -D 1 -f /usr/local/etc/clixon/example.xml ``` but you need to ensure /www-data/fastcgi_restconf.sock has the following access (may need to be done after restconf has started) ``` diff --git a/apps/restconf/restconf_main_fcgi.c b/apps/restconf/restconf_main_fcgi.c index 7d05e114..5268b236 100644 --- a/apps/restconf/restconf_main_fcgi.c +++ b/apps/restconf/restconf_main_fcgi.c @@ -42,7 +42,7 @@ * sudo apt-get install libfcgi-dev * gcc -o fastcgi fastcgi.c -lfcgi - * sudo su -c "/www-data/clixon_restconf -D 1 -f /usr/local/etc/example.xml " -s /bin/sh www-data + * sudo su -c "/www-data/clixon_restconf -D 1 -f /usr/local/etc/clixon/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 eadde470..4f84ea7a 100644 --- a/apps/restconf/restconf_methods.c +++ b/apps/restconf/restconf_methods.c @@ -40,7 +40,7 @@ * sudo apt-get install libfcgi-dev * gcc -o fastcgi fastcgi.c -lfcgi - * sudo su -c "/www-data/clixon_restconf -D 1 f /usr/local/etc/example.xml " -s /bin/sh www-data + * sudo su -c "/www-data/clixon_restconf -D 1 f /usr/local/etc/clixon/example.xml " -s /bin/sh www-data * This is the interface: * api/data/profile=/metric= PUT data:enable= diff --git a/doc/DEVELOP.md b/doc/DEVELOP.md index 148d4c06..5c8ca3c1 100644 --- a/doc/DEVELOP.md +++ b/doc/DEVELOP.md @@ -205,7 +205,7 @@ Use MAXPATHLEN (not PATH_MAX) in sys/param.h ## Emulating a serial console -socat PTY,link=/tmp/clixon-tty,rawer EXEC:"/usr/local/bin/clixon_cli -f /usr/local/etc/example.xml",pty,stderr & +socat PTY,link=/tmp/clixon-tty,rawer EXEC:"/usr/local/bin/clixon_cli -f /usr/local/etc/clixon/example.xml",pty,stderr & screen /tmp/clixon-tty ## Coverage diff --git a/doc/FAQ.md b/doc/FAQ.md index 55b3f8be..dce00d13 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -93,10 +93,10 @@ The main example: ## How do I run Clixon example commands? -- Start a backend server: `sudo clixon_backend -s init -f /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` -- Start a restconf daemon: `sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data` +- Start a backend server: `sudo clixon_backend -s init -f /usr/local/etc/clixon/example.xml` +- Start a cli session: `clixon_cli -f /usr/local/etc/clixon/example.xml` +- Start a netconf session: `clixon_netconf -f /usr/local/etc/clixon/example.xml` +- Start a restconf daemon: `sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/clixon/example.xml " -s /bin/sh www-data` - Send a restconf command: `curl -X GET http://127.0.0.1/restconf/data` More info in the [example](../example) directory. @@ -131,7 +131,7 @@ clicon:x:1001:,www-data The easiest way to use Clixon is via the CLI. In the main example, once the backend is started you can start the auto-cli. Example: ``` -clixon_cli -f /usr/local/etc/example.xml +clixon_cli -f /usr/local/etc/clixon/example.xml cli> set interfaces interface eth9 ? description enabled ipv4 ipv6 link-up-down-trap-enable type @@ -154,7 +154,7 @@ cli> delete interfaces interface eth9 As an alternative to cli configuration, you can use netconf. Easiest is to just pipe netconf commands to the clixon_netconf application. Example: ``` -clixon_netconf -qf /usr/local/etc/example.xml +clixon_netconf -qf /usr/local/etc/clixon/example.xml ]]>]]> eth9ex:ethtrue]]>]]> ``` @@ -162,7 +162,7 @@ clixon_netconf -qf /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/example.xml + Subsystem netconf /usr/local/bin/clixon_netconf -f /usr/local/etc/clixon/example.xml ``` and then invoke it from a client using ``` @@ -193,7 +193,7 @@ sudo /etc/init.d/nginx start ``` Start the clixon restconf daemon ``` -sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data +sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/clixon/example.xml " -s /bin/sh www-data ``` Then access: @@ -271,7 +271,7 @@ Backend Plugin1 Plugin2 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/example.xml. The +configuration file is installed at /usr/local/etc/clixon/example.xml. The YANG specification for the configuration file is clixon-config.yang. See the [example config file](../example/main/example.xml). @@ -394,7 +394,7 @@ severity major; ``` or via NETCONF: ``` -clixon_netconf -qf /usr/local/etc/example.xml +clixon_netconf -qf /usr/local/etc/clixon/example.xml EXAMPLE]]>]]> ]]>]]> 2018-09-30T12:44:59.657276faultEthernet0major]]>]]> diff --git a/example/main/README.md b/example/main/README.md index 957ac7a4..89434f67 100644 --- a/example/main/README.md +++ b/example/main/README.md @@ -71,19 +71,19 @@ If elsewhere, use `./configure --with-yang-standard-dir=DIR`. Example to checkou Start backend: ``` - sudo clixon_backend -f /usr/local/etc/example.xml -s init + sudo clixon_backend -f /usr/local/etc/clixon/example.xml -s init ``` Start cli: ``` - clixon_cli -f /usr/local/etc/example.xml + clixon_cli -f /usr/local/etc/clixon/example.xml ``` Send netconf command: ``` - clixon_netconf -f /usr/local/etc/example.xml + clixon_netconf -f /usr/local/etc/clixon/example.xml ``` Start clixon restconf daemon (default config listens on http IPv4 0.0.0.0 on port 8080): ``` - sudo clixon_restconf -f /usr/local/etc/example.xml + sudo clixon_restconf -f /usr/local/etc/clixon/example.xml ``` Send restconf command ``` @@ -97,11 +97,11 @@ There are also many other commands available as examples. View the source file ( The following example shows how to add an interface in candidate, validate and commit it to running, then look at it (as xml) and finally delete it. ``` -clixon_cli -f /usr/local/etc/example.xml -cli> set table parameter a ? +clixon_cli -f /usr/local/etc/clixon/example.xml +cli> merge table parameter a ? value -cli> set table parameter a value 42 +cli> merge table parameter a value 42 cli> validate cli> commit cli> show configuration @@ -130,7 +130,7 @@ cli> commit The following example shows how to set data using netconf (Use `-0` for EOM framing that can be used in shell): ``` -sh> clixon_netconf -qf /usr/local/etc/example.xml +sh> clixon_netconf -qf /usr/local/etc/clixon/example.xml urn:ietf:params:netconf:base:1.0]]>]]> @@ -257,7 +257,7 @@ Start nginx daemon Start the clixon restconf daemon ``` - sudo /usr/local/sbin/clixon_restconf -f /usr/local/etc/example.xml + sudo /usr/local/sbin/clixon_restconf -f /usr/local/etc/clixon/example.xml ``` then access using curl or wget: ``` @@ -276,7 +276,7 @@ stream in the session using netconf, create a subscription: ``` This can also be triggered via the CLI: ``` -clixon_cli -f /usr/local/etc/example.xml +clixon_cli -f /usr/local/etc/clixon/example.xml cli> notify cli> event-class fault; reportingEntity { @@ -298,19 +298,19 @@ not recommended . The example includes an example: Example using CLI: ``` -clixon_cli -f /usr/local/etc/example.xml +clixon_cli -f /usr/local/etc/clixon/example.xml cli> rpc ipv4 ipv442 ``` Example using Netconf: ``` -clixon_netconf -qf /usr/local/etc/example.xml +clixon_netconf -qf /usr/local/etc/clixon/example.xml ipv4]]>]]> ipv442]]>]]> ``` Restconf (assuming nginx started): ``` -sudo /usr/local/sbin/clixon_restconf -f /usr/local/etc/example.xml +sudo /usr/local/sbin/clixon_restconf -f /usr/local/etc/clixon/example.xml curl -X POST http://localhost/restconf/operations/clixon-example:example -H "Content-Type: application/yang-data+json" -d '{"clixon-example:input":{"x":"ipv4"}}' { "clixon-example:output": { diff --git a/example/main/systemd/example.service b/example/main/systemd/example.service index 0bc4130d..da103df4 100644 --- a/example/main/systemd/example.service +++ b/example/main/systemd/example.service @@ -7,7 +7,7 @@ Type=forking User=root RestartSec=60 Restart=on-failure -ExecStart=/usr/local/sbin/clixon_backend -s running -f /usr/local/etc/example.xml +ExecStart=/usr/local/sbin/clixon_backend -s running -f /usr/local/etc/clixon/example.xml [Install] WantedBy=multi-user.target \ No newline at end of file diff --git a/example/main/systemd/example_restconf.service b/example/main/systemd/example_restconf.service index d47ff885..54139e22 100644 --- a/example/main/systemd/example_restconf.service +++ b/example/main/systemd/example_restconf.service @@ -8,7 +8,7 @@ Type=simple User=www-data WorkingDirectory=/www-data Restart=on-failure -ExecStart=/www-data/clixon_restconf -f /usr/local/etc/example.xml +ExecStart=/www-data/clixon_restconf -f /usr/local/etc/clixon/example.xml [Install] WantedBy=multi-user.target diff --git a/yang/clixon/clixon-config@2024-04-01.yang b/yang/clixon/clixon-config@2024-04-01.yang index efe65808..e0b48790 100644 --- a/yang/clixon/clixon-config@2024-04-01.yang +++ b/yang/clixon/clixon-config@2024-04-01.yang @@ -958,7 +958,8 @@ module clixon-config { description "Backend privileges mode. If CLICON_BACKEND_USER user is set, mode can be set to drop_perm or - drop_temp."; + drop_temp. + Drop privs may not be used together with CLICON_XMLDB_MULTI"; } leaf CLICON_BACKEND_PIDFILE { type string; @@ -1055,11 +1056,10 @@ module clixon-config { default false; description "Split configure datastore into multiple sub files - Keep track of which part of the XML tree are dirty, - Do not sync sub files if cache is not dirty. - Uses .d/ directory structure with digest.xml/.json - Splits are marked in YANG made on mountpoints only (may be generalized) - See CLICON_YANG_SCHEMA_MOUNT"; + Uses .d/ directory structure with .xml and 0.xml as root + Splits are marked in YANG using extension xl:xmldb-split, (typical usage is mount-points). + May not be used together with CLICON_BACKEND_PRIVILEGES=drop and root, since new files + need to be created in XMLDB_DIR"; } leaf CLICON_XML_CHANGELOG { type boolean;