From ebd53a34eec349238a8f306881b5fad2f1d7acc4 Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Sun, 21 Aug 2016 19:23:06 +0200 Subject: [PATCH] doc --- apps/restconf/README | 86 +++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 32 deletions(-) diff --git a/apps/restconf/README b/apps/restconf/README index 10c4b1c2..b850b53e 100644 --- a/apps/restconf/README +++ b/apps/restconf/README @@ -1,36 +1,58 @@ -Work-in-progress restconf server -================================ -See draft-ietf-netconf-restconf-13.txt - -Example nginx-default file: -server { - listen 80 default_server; - listen [::]:80 default_server ipv6only=on; - - index index.html index.htm; - - # Make site accessible from http://localhost/ - server_name localhost; - - location / { - root /usr/share/nginx/html; - - # First attempt to serve request as file, then - # as directory, then fall back to displaying a 404. - try_files $uri $uri/ =404; - # Uncomment to enable naxsi on this location - # include /etc/nginx/naxsi.rules - - } - - # pass the REST API to FastCGI server - location /restconf { - root /usr/share/nginx/html/restconf; - fastcgi_pass unix:/www-data/clicon_restconf.sock; - include fastcgi_params; - } +# Existing clixon installation. Using CLI: +olof@vandal> clixon_cli -f /usr/local/etc/routing.conf +olof@vandal> show configuration +interfaces { + interface { + name eth0; + type eth; + enabled true; + } + interface { + name eth9; + type eth; + enabled true; + } } +# 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.conf " -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" + } +] Debugging --------- @@ -41,5 +63,5 @@ Look at syslog: tail -f /var/log/syslog | grep clixon_restconf Send command: -curl -G http://127.0.0.1/restconf/data/foo +curl -G http://127.0.0.1/restconf/data/*