Changed -f /usr/local/etc/example.xml -> /usr/local/etc/clixon/example.xml everywhere

This commit is contained in:
Olof hagsand 2024-05-05 09:46:25 +02:00
parent 60fdb65ee0
commit af36838b4c
9 changed files with 37 additions and 37 deletions

View file

@ -68,7 +68,7 @@ Or on FreeBSD:
Start clixon backend daemon (if not already started) 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 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: 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: Look at syslog:
``` ```
@ -228,7 +228,7 @@ curl -G http://127.0.0.1/restconf/data/*
You can also run restconf in a debugger. You can also run restconf in a debugger.
``` ```
sudo gdb clixon_restconf 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) but you need to ensure /www-data/fastcgi_restconf.sock has the following access (may need to be done after restconf has started)
``` ```

View file

@ -42,7 +42,7 @@
* sudo apt-get install libfcgi-dev * sudo apt-get install libfcgi-dev
* gcc -o fastcgi fastcgi.c -lfcgi * 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: * This is the interface:
* api/data/profile=<name>/metric=<name> PUT data:enable=<flag> * api/data/profile=<name>/metric=<name> PUT data:enable=<flag>

View file

@ -40,7 +40,7 @@
* sudo apt-get install libfcgi-dev * sudo apt-get install libfcgi-dev
* gcc -o fastcgi fastcgi.c -lfcgi * 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: * This is the interface:
* api/data/profile=<name>/metric=<name> PUT data:enable=<flag> * api/data/profile=<name>/metric=<name> PUT data:enable=<flag>

View file

@ -205,7 +205,7 @@ Use MAXPATHLEN (not PATH_MAX) in sys/param.h
## Emulating a serial console ## 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 screen /tmp/clixon-tty
## Coverage ## Coverage

View file

@ -93,10 +93,10 @@ The main example:
## How do I run Clixon example commands? ## How do I run Clixon example commands?
- Start a backend server: `sudo clixon_backend -s init -f /usr/local/etc/example.xml` - 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/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/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/example.xml " -s /bin/sh www-data` - 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` - Send a restconf command: `curl -X GET http://127.0.0.1/restconf/data`
More info in the [example](../example) directory. More info in the [example](../example) directory.
@ -131,7 +131,7 @@ clicon:x:1001:<user>,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: 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 ? cli> set interfaces interface eth9 ?
description enabled ipv4 description enabled ipv4
ipv6 link-up-down-trap-enable type 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. As an alternative to cli configuration, you can use netconf. Easiest is to just pipe netconf commands to the clixon_netconf application.
Example: Example:
``` ```
clixon_netconf -qf /usr/local/etc/example.xml clixon_netconf -qf /usr/local/etc/clixon/example.xml
<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]> <rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>
<rpc-reply><data><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>eth9</name><type>ex:eth</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>]]>]]> <rpc-reply><data><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>eth9</name><type>ex:eth</type><enabled>true</enabled></interface></interfaces></data></rpc-reply>]]>]]>
``` ```
@ -162,7 +162,7 @@ clixon_netconf -qf /usr/local/etc/example.xml
However, more useful is to run clixon_netconf as an SSH However, more useful is to run clixon_netconf as an SSH
subsystem. Register the subsystem in /etc/sshd_config: 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 and then invoke it from a client using
``` ```
@ -193,7 +193,7 @@ sudo /etc/init.d/nginx start
``` ```
Start the clixon restconf daemon 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: Then access:
@ -271,7 +271,7 @@ Backend Plugin1 Plugin2
Clixon options are stored in an XML configuration file. The default Clixon options are stored in an XML configuration file. The default
configuration file is /usr/local/etc/clixon.xml. The example 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. YANG specification for the configuration file is clixon-config.yang.
See the [example config file](../example/main/example.xml). See the [example config file](../example/main/example.xml).
@ -394,7 +394,7 @@ severity major;
``` ```
or via NETCONF: or via NETCONF:
``` ```
clixon_netconf -qf /usr/local/etc/example.xml clixon_netconf -qf /usr/local/etc/clixon/example.xml
<rpc><create-subscription xmlns="urn:ietf:params:xml:ns:netmod:notification"><stream>EXAMPLE</stream></create-subscription></rpc>]]>]]> <rpc><create-subscription xmlns="urn:ietf:params:xml:ns:netmod:notification"><stream>EXAMPLE</stream></create-subscription></rpc>]]>]]>
<rpc-reply><ok/></rpc-reply>]]>]]> <rpc-reply><ok/></rpc-reply>]]>]]>
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>2018-09-30T12:44:59.657276</eventTime><event xmlns="http://example.com/event/1.0"><event-class>fault</event-class><reportingEntity><card>Ethernet0</card></reportingEntity><severity>major</severity></event></notification>]]>]]> <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"><eventTime>2018-09-30T12:44:59.657276</eventTime><event xmlns="http://example.com/event/1.0"><event-class>fault</event-class><reportingEntity><card>Ethernet0</card></reportingEntity><severity>major</severity></event></notification>]]>]]>

View file

@ -71,19 +71,19 @@ If elsewhere, use `./configure --with-yang-standard-dir=DIR`. Example to checkou
Start backend: 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: Start cli:
``` ```
clixon_cli -f /usr/local/etc/example.xml clixon_cli -f /usr/local/etc/clixon/example.xml
``` ```
Send netconf command: 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): 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 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. 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 clixon_cli -f /usr/local/etc/clixon/example.xml
cli> set table parameter a ? cli> merge table parameter a ?
<cr> <cr>
value value
cli> set table parameter a value 42 cli> merge table parameter a value 42
cli> validate cli> validate
cli> commit cli> commit
cli> show configuration 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): 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
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><capabilities><capability>urn:ietf:params:netconf:base:1.0</capability></capabilities></hello>]]>]]> <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><capabilities><capability>urn:ietf:params:netconf:base:1.0</capability></capabilities></hello>]]>]]>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="0"> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="0">
@ -257,7 +257,7 @@ Start nginx daemon
Start the clixon restconf 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: 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: 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> notify
cli> event-class fault; cli> event-class fault;
reportingEntity { reportingEntity {
@ -298,19 +298,19 @@ not recommended . The example includes an example:
Example using CLI: Example using CLI:
``` ```
clixon_cli -f /usr/local/etc/example.xml clixon_cli -f /usr/local/etc/clixon/example.xml
cli> rpc ipv4 cli> rpc ipv4
<rpc-reply><x xmlns="urn:example:clixon">ipv4</x><y xmlns="urn:example:clixon">42</y></rpc-reply> <rpc-reply><x xmlns="urn:example:clixon">ipv4</x><y xmlns="urn:example:clixon">42</y></rpc-reply>
``` ```
Example using Netconf: Example using Netconf:
``` ```
clixon_netconf -qf /usr/local/etc/example.xml clixon_netconf -qf /usr/local/etc/clixon/example.xml
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><example xmlns="urn:example:clixon"><x>ipv4</x></example></rpc>]]>]]> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><example xmlns="urn:example:clixon"><x>ipv4</x></example></rpc>]]>]]>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><x xmlns="urn:example:clixon">ipv4</x><y xmlns="urn:example:clixon">42</y></rpc-reply>]]>]]> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><x xmlns="urn:example:clixon">ipv4</x><y xmlns="urn:example:clixon">42</y></rpc-reply>]]>]]>
``` ```
Restconf (assuming nginx started): 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"}}' 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": { "clixon-example:output": {

View file

@ -7,7 +7,7 @@ Type=forking
User=root User=root
RestartSec=60 RestartSec=60
Restart=on-failure 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] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -8,7 +8,7 @@ Type=simple
User=www-data User=www-data
WorkingDirectory=/www-data WorkingDirectory=/www-data
Restart=on-failure 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] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -958,7 +958,8 @@ module clixon-config {
description description
"Backend privileges mode. "Backend privileges mode.
If CLICON_BACKEND_USER user is set, mode can be set to drop_perm or 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 { leaf CLICON_BACKEND_PIDFILE {
type string; type string;
@ -1055,11 +1056,10 @@ module clixon-config {
default false; default false;
description description
"Split configure datastore into multiple sub files "Split configure datastore into multiple sub files
Keep track of which part of the XML tree are dirty, Uses .d/ directory structure with <digest>.xml and 0.xml as root
Do not sync sub files if cache is not dirty. Splits are marked in YANG using extension xl:xmldb-split, (typical usage is mount-points).
Uses .d/ directory structure with digest.xml/.json May not be used together with CLICON_BACKEND_PRIVILEGES=drop and root, since new files
Splits are marked in YANG made on mountpoints only (may be generalized) need to be created in XMLDB_DIR";
See CLICON_YANG_SCHEMA_MOUNT";
} }
leaf CLICON_XML_CHANGELOG { leaf CLICON_XML_CHANGELOG {
type boolean; type boolean;