clixon/apps/restconf
2018-02-13 09:17:32 +07:00
..
Makefile.in 2017->2018 2018-01-01 12:25:33 +01:00
README.md Restconf: get well-known, top-level resource, yang library version, put whole datastore, 2018-01-21 14:31:53 +01:00
restconf_lib.c restconf credentials plugin 2018-02-09 12:18:39 +07:00
restconf_lib.h restconf credentials plugin 2018-02-09 12:18:39 +07:00
restconf_main.c Adding username to all restconf backend calls 2018-02-13 09:17:32 +07:00
restconf_methods.c Adding username to all restconf backend calls 2018-02-13 09:17:32 +07:00
restconf_methods.h Adding username to all restconf backend calls 2018-02-13 09:17:32 +07:00

Clixon Restconf

Features

Clixon restconf is a daemon based on FASTCGI. Instructions are available to run with NGINX. The implementatation is based on RFC 8040: RESTCONF Protocol. The following featires are supported:

  • OPTIONS, HEAD, GET, POST, PUT, DELETE The following are not implemented
  • PATCH
  • query parameters (section 4.9)
  • notifications (sec 6)
  • schema resource

Installation using Nginx

Define nginx config file/etc/nginx/sites-available/default

server {
  ...
  location /restconf {
    root /usr/share/nginx/html/restconf;
    fastcgi_pass unix:/www-data/fastcgi_restconf.sock;
    include fastcgi_params;
  }
}

Start nginx daemon

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

Make restconf calls with curl

olof@vandal> curl -G http://127.0.0.1/restconf/data/interfaces
[
  {
    "interfaces": {
      "interface":[
        {
          "name": "eth0",
          "type": "eth",
          "enabled": "true",
          "name": "eth9",
          "type": "eth",
          "enabled": "true"
         }
      ]
    }
  }
]
olof@vandal> curl -G http://127.0.0.1/restconf/data/interfaces/interface/name=eth9/type
[
  {
    "type": "eth" 
  }
]

curl -sX POST -d '{"interfaces":{"interface":{"name":"eth1","type":"eth","enabled":"true"}}}' http://localhost/restconf/data

Debugging

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

Look at syslog:

tail -f /var/log/syslog | grep clixon_restconf

Send command:

curl -G http://127.0.0.1/restconf/data/*