clixon/apps/restconf
Olof hagsand bfce20c760 * Added Clixon Restconf library
* Builds and installs a new restconf library: libclixon_restconf.so and clixon_restconf.h
  * The restconf library can be included by a restconf plugin.
  * Example code in example/Makefile.in and example/restconf_lib.c
* Authorization
  * Example extended with authorization
  * Test added with http basic authorization (test/test_auth.sh)
  * Documentation in FAQ.md
* README.md extended with new yang, netconf, restconf, datastore, and auth sections.
2018-03-25 15:47:27 +02:00
..
clixon_restconf.h * Added Clixon Restconf library 2018-03-25 15:47:27 +02:00
Makefile.in * Added Clixon Restconf library 2018-03-25 15:47:27 +02:00
README.md * Added Clixon Restconf library 2018-03-25 15:47:27 +02:00
restconf_lib.c * Added Clixon Restconf library 2018-03-25 15:47:27 +02:00
restconf_lib.h restconf credentials plugin 2018-02-09 12:18:39 +07:00
restconf_main.c \r\n in restconf code and tests 2018-03-22 21:33:41 +01:00
restconf_methods.c \r\n in restconf code and tests 2018-03-22 21:33:41 +01:00
restconf_methods.h Restconf error handling 2018-03-11 22:49:10 +01:00

Clixon Restconf

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