Merge branch 'develop' of https://github.com/clicon/clixon into develop

This commit is contained in:
Olof Hagsand 2017-05-07 16:15:11 +02:00
commit 9c4ac8678d
14 changed files with 368 additions and 66 deletions

View file

@ -632,7 +632,7 @@ from_client_delete_config(clicon_handle h,
"</rpc-error></rpc-reply>", clicon_err_reason);
goto ok;
}
if (xmldb_init(h, target) < 0){
if (xmldb_create(h, target) < 0){
cprintf(cbret, "<rpc-reply><rpc-error>"
"<error-tag>operation-failed</error-tag>"
"<error-type>protocol</error-type>"

View file

@ -159,7 +159,7 @@ db_reset(clicon_handle h,
{
if (xmldb_delete(h, db) != 0 && errno != ENOENT)
return -1;
if (xmldb_init(h, db) < 0)
if (xmldb_create(h, db) < 0)
return -1;
return 0;
}
@ -181,7 +181,7 @@ rundb_main(clicon_handle h,
cxobj *xt = NULL;
cxobj *xn;
if (xmldb_init(h, "tmp") < 0)
if (xmldb_create(h, "tmp") < 0)
goto done;
if (xmldb_copy(h, "running", "tmp") < 0){
clicon_err(OE_UNIX, errno, "file copy");
@ -538,7 +538,7 @@ main(int argc, char **argv)
else
if (db_reset(h, "running") < 0)
goto done;
if (xmldb_init(h, "candidate") < 0)
if (xmldb_create(h, "candidate") < 0)
goto done;
if (xmldb_copy(h, "running", "candidate") < 0)
goto done;
@ -562,7 +562,7 @@ main(int argc, char **argv)
}
/* If candidate does not exist, create it from running */
if (xmldb_exists(h, "candidate") != 1){
if (xmldb_init(h, "candidate") < 0)
if (xmldb_create(h, "candidate") < 0)
goto done;
if (xmldb_copy(h, "running", "candidate") < 0)
goto done;

17
apps/netconf/README.md Normal file
View file

@ -0,0 +1,17 @@
# Clixon Netconf
Clixon netconf implements the following standards:
- RFC 4741 (NETCONF Configuration Protocol),
- RFC 4742 (Using the NETCONF Configuration Protocol over Secure SHell (SSH)) and
- RFC 5277 (NETCONF Event Notifications).
It needs to be updated to RFC6241 and RFC 6242. It also does not implement the following features:
- :url capability
- copy-config source config
- edit-config testopts
- edit-config erropts
- edit-config config-text

View file

@ -1,13 +1,12 @@
Clixon Restconf
===============
# Clixon Restconf
Contents:
1. Features
2. Installation using NGINX
3. Debugging
1. FEATURES
+++++++++++
## 1. FEATURES
Clixon restconf is a daemon based on FASTCGI. Instructions are available to
run with NGINX.
The implementatation supports plain OPTIONS, HEAD, GET, POST, PUT, PATCH, DELETE.
@ -18,10 +17,10 @@ including:
- notifications (sec 6)
- only rudimentary error reporting exists (sec 7)
2. INSTALLATION using NGINX
+++++++++++++++++++++++++++
## 2. INSTALLATION using NGINX
# Define nginx config file/etc/nginx/sites-available/default
Define nginx config file/etc/nginx/sites-available/default
```
server {
...
location /restconf {
@ -30,13 +29,19 @@ server {
include fastcgi_params;
}
}
# Start nginx daemon
```
Start nginx daemon
```
sudo /etc/init.d nginx start
```
# Start clixon restconf daemon
Start clixon restconf daemon
```
olof@vandal> sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/routing.conf " -s /bin/sh www-data
```
# Make restconf calls with curl
Make restconf calls with curl
```
olof@vandal> curl -G http://127.0.0.1/restconf/data/interfaces
[
{
@ -62,16 +67,21 @@ olof@vandal> curl -G http://127.0.0.1/restconf/data/interfaces/interface/name=et
]
curl -sX POST -d '{"clicon":{"interfaces":{"interface":{"name":"eth1","type":"eth","enabled":"true"}}}}' http://localhost/restconf/data
```
## DEBUGGING
3. DEBUGGING
++++++++++++
Start the restconf fastcgi program with debug flag:
sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/routing.conf" -s /bin/sh www-data
```
sudo su -c "/www-data/clixon_restconf -Df /usr/local/etc/routing.conf" -s /bin/sh www-
data
```
Look at syslog:
```
tail -f /var/log/syslog | grep clixon_restconf
```
Send command:
```
curl -G http://127.0.0.1/restconf/data/*
```