clixon/apps/restconf
Olof hagsand 7f0b9909b3 Library functions in clixon_cli_api.h (e.g cli_commit) is rewritten in new
for (eg cli_commitv). See clixon_cli_api.h for new names.
Use restconf format for internal xmldb keys. Eg /a/b=3,4
Changed example to use multiple cli callbacks
2017-01-31 22:36:14 +01:00
..
Makefile.in dual license 2016-12-30 16:14:48 +01:00
README restconf plugins and figthing with xml->json translation 2016-09-26 21:44:17 +02:00
restconf_lib.c xpath multiple match, int main, etc 2016-11-17 21:25:49 +01:00
restconf_lib.h restconf plugins and figthing with xml->json translation 2016-09-26 21:44:17 +02:00
restconf_main.c Library functions in clixon_cli_api.h (e.g cli_commit) is rewritten in new 2017-01-31 22:36:14 +01: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 restconf 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/*