Add restconf get list extra =restval test
This commit is contained in:
parent
4c1249fd9b
commit
05009aed67
4 changed files with 19 additions and 2 deletions
|
|
@ -399,7 +399,7 @@ ret2status(int ret,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /* DEBUG */
|
||||||
/* Debug timer */
|
/* Debug timer */
|
||||||
int
|
int
|
||||||
backend_timer_setup(int fd,
|
backend_timer_setup(int fd,
|
||||||
|
|
@ -429,6 +429,7 @@ backend_timer_setup(int fd,
|
||||||
done:
|
done:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
#endif /* DEBUG */
|
||||||
|
|
||||||
/*! usage
|
/*! usage
|
||||||
*/
|
*/
|
||||||
|
|
@ -1024,10 +1025,12 @@ main(int argc,
|
||||||
|
|
||||||
/* Start session-id for clients */
|
/* Start session-id for clients */
|
||||||
clicon_session_id_set(h, 0);
|
clicon_session_id_set(h, 0);
|
||||||
|
#if 0 /* debug */
|
||||||
/* Enable this to get prints of datastore and session status */
|
/* Enable this to get prints of datastore and session status */
|
||||||
if (0 && clicon_debug_get() &&
|
if (0 && clicon_debug_get() &&
|
||||||
backend_timer_setup(0, h) < 0)
|
backend_timer_setup(0, h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
#endif
|
||||||
if (stream_timer_setup(0, h) < 0)
|
if (stream_timer_setup(0, h) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (clixon_event_loop(h) < 0)
|
if (clixon_event_loop(h) < 0)
|
||||||
|
|
|
||||||
|
|
@ -1705,7 +1705,7 @@ restconf_sig_term(int arg)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
exit(-1);
|
exit(-1);
|
||||||
clicon_exit_set(); /* XXX should rather signal event_base_loop */
|
clicon_exit_set();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! Usage help routine
|
/*! Usage help routine
|
||||||
|
|
|
||||||
|
|
@ -1074,6 +1074,15 @@ api_path2xml_vec(char **vec,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: /* eg Y_CONTAINER, Y_LEAF */
|
default: /* eg Y_CONTAINER, Y_LEAF */
|
||||||
|
if (restval != NULL){
|
||||||
|
if (strict){
|
||||||
|
cprintf(cberr, "malformed api-path, =%s not expected", restval);
|
||||||
|
if (xerr &&
|
||||||
|
netconf_malformed_message_xml(xerr, cbuf_get(cberr)) < 0)
|
||||||
|
goto done;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (x0 &&
|
if (x0 &&
|
||||||
(x = xml_find_type(x0, NULL, name, CX_ELMNT)) == NULL){ /* eg key of list */
|
(x = xml_find_type(x0, NULL, name, CX_ELMNT)) == NULL){ /* eg key of list */
|
||||||
if ((x = xml_new(name, x0, CX_ELMNT)) == NULL)
|
if ((x = xml_new(name, x0, CX_ELMNT)) == NULL)
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,8 @@ expectpart "$(curl $CURLOPTS -X GET -H 'Accept: application/yang-data+xml' $RCPR
|
||||||
|
|
||||||
# XXX cannot get this to work for all combinations of nc/netcat fcgi/native
|
# XXX cannot get this to work for all combinations of nc/netcat fcgi/native
|
||||||
# But leave it here for debugging where netcat works properly
|
# But leave it here for debugging where netcat works properly
|
||||||
|
# Alt try something like:
|
||||||
|
# printf "Hello World!" | (exec 3<>/dev/tcp/127.0.0.1/80; cat >&3; cat <&3; exec 3<&-)
|
||||||
if false; then
|
if false; then
|
||||||
# Look for netcat or nc for direct socket http calls
|
# Look for netcat or nc for direct socket http calls
|
||||||
if [ -n "$(type netcat 2> /dev/null)" ]; then
|
if [ -n "$(type netcat 2> /dev/null)" ]; then
|
||||||
|
|
@ -245,6 +247,9 @@ fi
|
||||||
new "restconf GET non-qualified list"
|
new "restconf GET non-qualified list"
|
||||||
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:a)" 0 'HTTP/1.1 400 Bad Request' "{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed key =example:a, expected '=restval'\"}}}"
|
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:a)" 0 'HTTP/1.1 400 Bad Request' "{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed key =example:a, expected '=restval'\"}}}"
|
||||||
|
|
||||||
|
new "restconf GET container with rest-api"
|
||||||
|
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:table=x)" 0 'HTTP/1.1 400 Bad Request' "{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed api-path, =x not expected\"}}}"
|
||||||
|
|
||||||
new "restconf GET non-qualified list subelements"
|
new "restconf GET non-qualified list subelements"
|
||||||
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:a/k)" 0 'HTTP/1.1 400 Bad Request' "^{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed key =example:a, expected '=restval'\"}}}"
|
expectpart "$(curl $CURLOPTS -X GET $RCPROTO://localhost/restconf/data/example:a/k)" 0 'HTTP/1.1 400 Bad Request' "^{\"ietf-restconf:errors\":{\"error\":{\"error-type\":\"rpc\",\"error-tag\":\"malformed-message\",\"error-severity\":\"error\",\"error-message\":\"malformed key =example:a, expected '=restval'\"}}}"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue