First working prototype

This commit is contained in:
Olof hagsand 2020-10-27 09:20:30 +01:00
parent 6b357dc038
commit 2e857bb417
16 changed files with 968 additions and 28 deletions

View file

@ -275,6 +275,7 @@ api_return_err(clicon_handle h,
switch (media){
case YANG_DATA_XML:
case YANG_PATCH_XML:
case YANG_COLLECTION_XML:
clicon_debug(1, "%s code:%d", __FUNCTION__, code);
if (pretty){
cprintf(cb, " <errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">\n");
@ -291,6 +292,7 @@ api_return_err(clicon_handle h,
break;
case YANG_DATA_JSON:
case YANG_PATCH_JSON:
case YANG_COLLECTION_JSON:
clicon_debug(1, "%s code:%d", __FUNCTION__, code);
if (pretty){
cprintf(cb, "{\n\"ietf-restconf:errors\" : ");
@ -306,9 +308,7 @@ api_return_err(clicon_handle h,
cprintf(cb, "}\r\n");
}
break;
default:
clicon_err(OE_YANG, EINVAL, "Invalid media type %d", media);
goto done;
default: /* Just ignore the body so that there is a reply */
break;
} /* switch media */
assert(cbuf_len(cb));