restconf dbg

This commit is contained in:
Olof Hagsand 2017-10-08 19:44:00 +02:00
parent 089b2da71c
commit 2d9e4666eb
4 changed files with 9 additions and 11 deletions

View file

@ -205,9 +205,8 @@ request_process(clicon_handle h,
if (strcmp(method, "data") == 0) /* restconf, skip /api/data */ if (strcmp(method, "data") == 0) /* restconf, skip /api/data */
retval = api_data(h, r, path, pcvec, 2, qvec, data); retval = api_data(h, r, path, pcvec, 2, qvec, data);
else else if (strcmp(method, "operations") == 0) /* rpc */
if (strcmp(method, "operations") == 0) /* rpc */ retval = api_operations(h, r, path, pcvec, 2, qvec, data);
retval = api_operations(h, r, path, pcvec, 2, qvec, data);
else if (strcmp(method, "test") == 0) else if (strcmp(method, "test") == 0)
retval = test(r, 0); retval = test(r, 0);
else else

View file

@ -691,13 +691,12 @@ api_operation_post(clicon_handle h,
char *media_accept; char *media_accept;
int use_xml = 0; /* By default return JSON */ int use_xml = 0; /* By default return JSON */
clicon_debug(1, "%s json:\"%s\"", __FUNCTION__, data); clicon_debug(1, "%s json:\"%s\" path:\"%s\"", __FUNCTION__, data, path);
media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp); if ((media_accept = FCGX_GetParam("HTTP_ACCEPT", r->envp)) &&
if (strcmp(media_accept, "application/yang-data+xml")==0) strcmp(media_accept, "application/yang-data+xml")==0)
use_xml++; use_xml++;
if ((media_content_type = FCGX_GetParam("HTTP_CONTENT_TYPE", r->envp)) &&
media_content_type = FCGX_GetParam("HTTP_CONTENT_TYPE", r->envp); strcmp(media_content_type, "application/yang-data+xml")==0)
if (strcmp(media_content_type, "application/yang-data+xml")==0)
parse_xml++; parse_xml++;
clicon_debug(1, "%s accept:\"%s\" content-type:\"%s\"", clicon_debug(1, "%s accept:\"%s\" content-type:\"%s\"",
__FUNCTION__, media_accept, media_content_type); __FUNCTION__, media_accept, media_content_type);

View file

@ -1779,7 +1779,7 @@ schema_nodeid_vec(yang_node *yn,
} }
} }
if (!match){ if (!match){
clicon_debug(1, "%s not found", nodeid); clicon_debug(1, "%s: %s not found", __FUNCTION__, nodeid);
goto ok; goto ok;
} }
ynext = (yang_node*)ys; ynext = (yang_node*)ys;

View file

@ -83,7 +83,7 @@ new "restconf get subtree"
expectfn "curl -sS -G http://localhost/restconf/data" '{"interfaces": {"interface": {"name": "eth/0/0","type": "eth","enabled": "true"}}} expectfn "curl -sS -G http://localhost/restconf/data" '{"interfaces": {"interface": {"name": "eth/0/0","type": "eth","enabled": "true"}}}
$' $'
new "restconf rpc using POST json" new "restconf operation rpc using POST json"
expectfn 'curl -sS -X POST -d {"input":{"routing-instance-name":"ipv4"}} http://localhost/restconf/operations/rt:fib-route' '{ "output": { "route": { "address-family": "ipv4", "next-hop": { "next-hop-list": "2.3.4.5" } } } } ' expectfn 'curl -sS -X POST -d {"input":{"routing-instance-name":"ipv4"}} http://localhost/restconf/operations/rt:fib-route' '{ "output": { "route": { "address-family": "ipv4", "next-hop": { "next-hop-list": "2.3.4.5" } } } } '
new "restconf rpc using POST xml" new "restconf rpc using POST xml"