restconf get working alpha
This commit is contained in:
parent
ef3c98518a
commit
9552aeebbb
6 changed files with 131 additions and 998 deletions
|
|
@ -381,7 +381,7 @@ main(int argc, char **argv)
|
|||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
/* Parse db spec file */
|
||||
/* Parse yang database spec file */
|
||||
if (yang_spec_main(h, stdout, 0) < 0)
|
||||
goto done;
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
</rpc>
|
||||
*/
|
||||
|
||||
/* get-config help function
|
||||
/*! get-config help function
|
||||
* xfilter is a filter expression starting with <filter>
|
||||
* only <filter type="xpath"/> supported
|
||||
* needs refactoring: move the lower part (after xfilter) up to get-config or
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
<rpc><get-config><source><candidate/></source><filter/></get-config></rpc>]]>]]>
|
||||
* filter xpath + select all:
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/"/></get-config></rpc>]]>]]>
|
||||
* filter subnet + config:
|
||||
* filter subtree + config:
|
||||
<rpc><get-config><source><candidate/></source><filter type="subtree"><configuration><interfaces><interface><ipv4/></interface></interfaces></configuration></filter></get-config></rpc>]]>]]>
|
||||
* filter xpath + select:
|
||||
<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface/ipv4"/></get-config></rpc>]]>]]>
|
||||
|
|
@ -158,7 +158,7 @@ netconf_filter_xmldb(clicon_handle h,
|
|||
"protocol",
|
||||
"error",
|
||||
NULL,
|
||||
"<bad-attribute>select</bad-attribute>");
|
||||
"<bad-attribute>select</bad-attribute>");
|
||||
goto done;
|
||||
}
|
||||
if (xmldb_get(h, source, selector, 0, &xdb, NULL, NULL) < 0){
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
Work-in-progress restconf server
|
||||
================================
|
||||
|
||||
See draft-ietf-netconf-restconf-13.txt
|
||||
|
||||
|
|
@ -26,7 +27,19 @@ server {
|
|||
# pass the REST API to FastCGI server
|
||||
location /restconf {
|
||||
root /usr/share/nginx/html/restconf;
|
||||
fastcgi_pass unix:/www-data/fastcgi_api.sock;
|
||||
fastcgi_pass unix:/www-data/clicon_restconf.sock;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
|
||||
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/foo
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -120,6 +120,6 @@ CLICON_XMLDB_DIR localstatedir/APPNAME
|
|||
|
||||
# FastCGI unix socket. Should be specified in webserver
|
||||
# Eg in nginx: fastcgi_pass unix:/www-data/clicon_restconf.sock;
|
||||
CLICON_RESTCONF_PATH "/www-data/clicon_restconf.sock"
|
||||
CLICON_RESTCONF_PATH /www-data/fastcgi_restconf.sock
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -957,7 +957,10 @@ xmldb_get_local(clicon_handle h,
|
|||
clicon_err(OE_XML, 0, "dbname NULL");
|
||||
goto done;
|
||||
}
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "No yang spec");
|
||||
goto done;
|
||||
}
|
||||
if (vector){
|
||||
if (xmldb_get_vec(dbname, xpath, yspec, xtop, xvec, xlen) < 0)
|
||||
goto done;
|
||||
|
|
@ -989,7 +992,7 @@ xmldb_get_local(clicon_handle h,
|
|||
* cxobj *xt;
|
||||
* cxobj **xvec;
|
||||
* size_t xlen;
|
||||
* yang_spec *yspec = clicon_dbspec_yang(h);
|
||||
*
|
||||
* if (xmldb_get("running", "/interfaces/interface[name="eth"]",
|
||||
* 1, &xt, &xvec, &xlen) < 0)
|
||||
* err;
|
||||
|
|
@ -1011,11 +1014,13 @@ xmldb_get(clicon_handle h,
|
|||
cxobj ***xvec,
|
||||
size_t *xlen)
|
||||
{
|
||||
assert(xpath);
|
||||
int retval = -1;
|
||||
|
||||
if (clicon_xmldb_rpc(h))
|
||||
return xmldb_get_rpc(h, db, xpath, vector, xtop, xvec, xlen);
|
||||
retval = xmldb_get_rpc(h, db, xpath, vector, xtop, xvec, xlen);
|
||||
else
|
||||
return xmldb_get_local(h, db, xpath, vector, xtop, xvec, xlen);
|
||||
retval = xmldb_get_local(h, db, xpath, vector, xtop, xvec, xlen);
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*! Get value of the "operation" attribute and change op if given
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue