* Restconf top-level operations GET root resource modified to comply with

RFC 8040 Sec 3.1
  * non-pretty print remove all spaces, eg `{"operations":{"clixon-example:client-rpc":[null]`
  * Replaced JSON `null` with `[null]` as proper empty JSON leaf/leaf-list encoding.
* [Cannot write to config using restconf example #91](https://github.com/clicon/clixon/issues/91)
  * Updated restconf documentation (the example was wrong)
* [clixon-lib yang revision file name update #92](https://github.com/clicon/clixon/issues/92)
  * Clixon-lib yang file had conflicting filename and internal yang revision.
  * This was only detected in the use-case when a whole dir was loaded.
  * Inserted sanity check in all yang parse routines.
  * Committed updated clixon-lib yang file that triggered the error
This commit is contained in:
Olof hagsand 2019-08-24 15:30:43 +02:00
parent a8906fd0bd
commit 6df434093e
12 changed files with 230 additions and 192 deletions

View file

@ -23,57 +23,62 @@ Download and start nginx. For example on ubuntu:
Define nginx config file: /etc/nginx/sites-available/default
```
server {
...
location /restconf {
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
include fastcgi_params;
server {
...
location /restconf {
fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
include fastcgi_params;
}
}
}
```
Start nginx daemon
```
sudo /etc/init.d nginx start
sudo /etc/init.d nginx start
```
Alternatively, start it via systemd:
```
sudo /etc/init.d/nginx start
sudo systemctl start start.service
sudo systemctl start nginx.service
```
Start clixon backend daemon (if not already started)
```
sudo clixon_backend -s init -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
sudo su -c "/www-data/clixon_restconf -f /usr/local/etc/example.xml " -s /bin/sh www-data
```
Make restconf calls with curl
Make restconf calls with curl (or other http client). Example of writing a new interface specification:
```
> curl -G http://127.0.0.1/restconf/data/ietf-interfaces:interfaces
[
curl -sX PUT http://localhost/restconf/data/ietf-interfaces:interfaces -H 'Content-Type: application/yang-data+json' -d '{"ietf-interfaces:interfaces":{"interface":{"name":"eth1","type":"clixon-example:eth","enabled":true}}}'
```
Get the data
```
curl -X GET http://127.0.0.1/restconf/data/ietf-interfaces:interfaces
{
"ietf-interfaces:interfaces": {
"interface":[
"interface": [
{
"name": "eth9",
"type": "ex:eth",
"enabled": true,
}
"name": "eth1",
"type": "clixon-example:eth",
"enabled": true
}
]
}
}
]
```
Get the type of a specific interface:
```
> curl -G http://127.0.0.1/restconf/data/interfaces/interface=eth9/type
{
"ietf-interfaces:type": "eth"
}
```
Example of writing a new interfaces specification:
```
curl -sX PUT http://localhost/restconf/data -d '{"ietf-interfaces:interfaces":{"interface":{"name":"eth1","type":"ex:eth","enabled":true}}}'
curl -X GET http://127.0.0.1/restconf/data/ietf-interfacesinterfaces/interface=eth1/type
{
"ietf-interfaces:type": "clixon-example:eth"
}
```
## Streams
@ -83,7 +88,7 @@ RFC8040 Section 6 using SSE. One native and one using Nginx
nchan. The Nchan alternaitve is described in the
next section.
The (example)[../../example/README.md] creates an EXAMPLE stream.
The [example](../../example/main/README.md) creates an EXAMPLE stream.
Set the Clixon configuration options:
```