clixon/apps/restconf
2017-10-21 19:15:24 +02:00
..
Makefile.in restconf post/put/head/patch, memtests 2017-03-26 15:14:37 +02:00
README.md xml config default; api_path_fmt2api_path cleanup 2017-10-03 22:41:12 +02:00
restconf_lib.c mem leak 2017-08-01 19:39:19 +02:00
restconf_lib.h Added new backend plugin callback: plugin_statedata() for getting state data; Added generic xml_merge() function. 2017-07-05 12:30:42 +02:00
restconf_main.c restconf dbg 2017-10-08 19:44:00 +02:00
restconf_methods.c Removed unused functions: cli_exec, cli_ptpush, cli_ptpop 2017-10-21 19:15:24 +02:00
restconf_methods.h restconf RPC 2017-07-30 16:16:10 +02:00

Clixon Restconf

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. and is based on draft-ietf-netconf-restconf-13. There is currently (2017) a RFC 8040: RESTCONF Protocol, many of those features are not implemented, including:

  • query parameters (section 4.9)
  • notifications (sec 6)
  • only rudimentary error reporting exists (sec 7)

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/*