clixon/apps/restconf
2016-09-22 16:57:26 +02:00
..
Makefile.in experimental restconf 2016-05-20 18:33:48 +02:00
README doc 2016-08-21 19:23:06 +02:00
restconf_lib.c restconf; xmlput extended with api_path; xmldb_put_tree 2016-09-20 21:51:08 +02:00
restconf_lib.h restconf; xmlput extended with api_path; xmldb_put_tree 2016-09-20 21:51:08 +02:00
restconf_main.c better json printing 2016-09-22 16:57:26 +02:00

# 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
---------
Start the fastcgi programs with debug flag:
sudo su -c "/www-data/clixon_restconf -D" -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/*