* RESTCONF "depth" query parameter supported
* C API change: Added `depth` parameter to function `clicon_xml2cbuf`, default is -1.
This commit is contained in:
parent
10a2dbe8ec
commit
ee329ee382
31 changed files with 289 additions and 117 deletions
|
|
@ -176,6 +176,8 @@ client_get_capabilities(clicon_handle h,
|
|||
goto done;
|
||||
if (xml_parse_va(&xcap, yspec, "<capability>urn:ietf:params:restconf:capability:defaults:1.0?basic-mode=explicit</capability>") < 0)
|
||||
goto done;
|
||||
if (xml_parse_va(&xcap, yspec, "<capability>urn:ietf:params:restconf:capability:depth:1.0</capability>") < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
return retval;
|
||||
|
|
@ -428,7 +430,7 @@ from_client_get_config(clicon_handle h,
|
|||
else{
|
||||
if (xml_name_set(xret, "data") < 0)
|
||||
goto done;
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
}
|
||||
cprintf(cbret, "</rpc-reply>");
|
||||
|
|
@ -541,7 +543,7 @@ from_client_edit_config(clicon_handle h,
|
|||
if ((ret = xml_yang_validate_list_key_only(h, xc, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -877,6 +879,7 @@ from_client_get(clicon_handle h,
|
|||
cvec *nsc = NULL; /* Create a netconf namespace context from filter */
|
||||
char *attr;
|
||||
netconf_content content = CONTENT_ALL;
|
||||
int32_t depth = -1; /* Nr of levels to print, -1 is all, 0 is none */
|
||||
|
||||
username = clicon_username_get(h);
|
||||
if ((xfilter = xml_find(xe, "filter")) != NULL){
|
||||
|
|
@ -890,9 +893,24 @@ from_client_get(clicon_handle h,
|
|||
if (xml_nsctx_node(xfilter, &nsc) < 0)
|
||||
goto done;
|
||||
}
|
||||
/* Clixon extensions: depth and content */
|
||||
if ((attr = xml_find_value(xe, "content")) != NULL)
|
||||
content = netconf_content_str2int(attr);
|
||||
|
||||
if ((attr = xml_find_value(xe, "depth")) != NULL){
|
||||
char *reason = NULL;
|
||||
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
|
||||
clicon_err(OE_XML, errno, "parse_int32");
|
||||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
if (netconf_bad_attribute(cbret, "application",
|
||||
"<bad-attribute>depth</bad-attribute>", "Unrecognized value of depth attribute") < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
}
|
||||
|
||||
if (content != CONTENT_NONCONFIG){
|
||||
/* Get config
|
||||
* Note xret can be pruned by nacm below and change name and
|
||||
|
|
@ -911,7 +929,7 @@ from_client_get(clicon_handle h,
|
|||
if ((ret = client_statedata(h, xpath, nsc, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){ /* Error from callback (error in xret) */
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -932,7 +950,8 @@ from_client_get(clicon_handle h,
|
|||
else{
|
||||
if (xml_name_set(xret, "data") < 0)
|
||||
goto done;
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
/* Top level is data, so add 1 to depth if significant */
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, depth>0?depth+1:depth) < 0)
|
||||
goto done;
|
||||
}
|
||||
cprintf(cbret, "</rpc-reply>");
|
||||
|
|
@ -1250,7 +1269,7 @@ from_client_msg(clicon_handle h,
|
|||
if ((ret = xml_yang_validate_rpc(h, x, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
goto reply;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ startup_common(clicon_handle h,
|
|||
if ((ret = generic_validate(h, yspec, td, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
goto fail; /* STARTUP_INVALID */
|
||||
}
|
||||
|
|
@ -522,7 +522,7 @@ candidate_commit(clicon_handle h,
|
|||
if ((ret = from_validate_common(h, candidate, td, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -755,7 +755,7 @@ from_client_validate(clicon_handle h,
|
|||
/* A little complex due to several sources of validation fails or errors.
|
||||
* (1) xerr is set -> translate to cbret; (2) cbret set use that; otherwise
|
||||
* use clicon_err. */
|
||||
if (xret && clicon_xml2cbuf(cbret, xret, 0, 0) < 0)
|
||||
if (xret && clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
plugin_transaction_abort(h, td);
|
||||
if (!cbuf_len(cbret) &&
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ transaction_log(clicon_handle h,
|
|||
}
|
||||
for (i=0; i<td->td_dlen; i++){
|
||||
xn = td->td_dvec[i];
|
||||
clicon_xml2cbuf(cb, xn, 0, 0);
|
||||
clicon_xml2cbuf(cb, xn, 0, 0, -1);
|
||||
}
|
||||
if (i)
|
||||
clicon_log(level, "%s %" PRIu64 " %s del: %s",
|
||||
|
|
@ -248,7 +248,7 @@ transaction_log(clicon_handle h,
|
|||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_alen; i++){
|
||||
xn = td->td_avec[i];
|
||||
clicon_xml2cbuf(cb, xn, 0, 0);
|
||||
clicon_xml2cbuf(cb, xn, 0, 0, -1);
|
||||
}
|
||||
if (i)
|
||||
clicon_log(level, "%s %" PRIu64 " %s add: %s", __FUNCTION__, td->td_id, op, cbuf_get(cb));
|
||||
|
|
@ -256,10 +256,10 @@ transaction_log(clicon_handle h,
|
|||
for (i=0; i<td->td_clen; i++){
|
||||
if (td->td_scvec){
|
||||
xn = td->td_scvec[i];
|
||||
clicon_xml2cbuf(cb, xn, 0, 0);
|
||||
clicon_xml2cbuf(cb, xn, 0, 0, -1);
|
||||
}
|
||||
xn = td->td_tcvec[i];
|
||||
clicon_xml2cbuf(cb, xn, 0, 0);
|
||||
clicon_xml2cbuf(cb, xn, 0, 0, -1);
|
||||
}
|
||||
if (i)
|
||||
clicon_log(level, "%s %" PRIu64 " %s change: %s", __FUNCTION__, td->td_id, op, cbuf_get(cb));
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ cli_dbxml(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clicon_xml2cbuf(cb, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cb, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_edit_config(h, "candidate", OP_NONE, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
|
|
@ -792,7 +792,7 @@ load_config_file(clicon_handle h,
|
|||
while ((x = xml_child_each(xt, x, -1)) != NULL) {
|
||||
/* Ensure top-level is "config", maybe this is too rough? */
|
||||
xml_name_set(x, "config");
|
||||
if (clicon_xml2cbuf(cbxml, x, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbxml, x, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (clicon_rpc_edit_config(h, "candidate",
|
||||
|
|
@ -1235,7 +1235,7 @@ cli_copy_config(clicon_handle h,
|
|||
/* resuse cb */
|
||||
cbuf_reset(cb);
|
||||
/* create xml copy tree and merge it with database configuration */
|
||||
clicon_xml2cbuf(cb, x2, 0, 0);
|
||||
clicon_xml2cbuf(cb, x2, 0, 0, -1);
|
||||
if (clicon_rpc_edit_config(h, db, OP_MERGE, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ cli_show_config1(clicon_handle h,
|
|||
clicon_err(OE_FATAL, 0, "Show state only for running database, not %s", db);
|
||||
goto done;
|
||||
}
|
||||
if (clicon_rpc_get(h, cbuf_get(cbxpath), namespace, CONTENT_ALL, &xt) < 0)
|
||||
if (clicon_rpc_get(h, cbuf_get(cbxpath), namespace, CONTENT_ALL, -1, &xt) < 0)
|
||||
goto done;
|
||||
}
|
||||
if ((xerr = xpath_first(xt, "/rpc-error")) != NULL){
|
||||
|
|
@ -723,7 +723,7 @@ cli_show_auto1(clicon_handle h,
|
|||
clicon_err(OE_FATAL, 0, "Show state only for running database, not %s", db);
|
||||
goto done;
|
||||
}
|
||||
if (clicon_rpc_get(h, xpath, namespace, CONTENT_ALL, &xt) < 0)
|
||||
if (clicon_rpc_get(h, xpath, namespace, CONTENT_ALL, -1, &xt) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ netconf_input_packet(clicon_handle h,
|
|||
if ((ret = xml_yang_validate_rpc(h, xrpc, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clicon_xml2cbuf(cbret, xret, 0, 0);
|
||||
clicon_xml2cbuf(cbret, xret, 0, 0, -1);
|
||||
netconf_output_encap(1, cbret, "rpc-error");
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ netconf_input_packet(clicon_handle h,
|
|||
if (xml_addsub(xc, xa2) < 0)
|
||||
goto done;
|
||||
}
|
||||
clicon_xml2cbuf(cbret, xml_child_i(xret,0), 0, 0);
|
||||
clicon_xml2cbuf(cbret, xml_child_i(xret,0), 0, 0, -1);
|
||||
if (netconf_output_encap(1, cbret, "rpc-reply") < 0){
|
||||
cbuf_free(cbret);
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@ netconf_notification_cb(int s,
|
|||
clicon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clicon_xml2cbuf(cb, xn, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cb, xn, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
/* Send it to listening client on stdout */
|
||||
if (netconf_output_encap(1, cb, "notification") < 0){
|
||||
|
|
@ -599,7 +599,7 @@ netconf_application_rpc(clicon_handle h,
|
|||
if (ret > 0 && (ret = xml_yang_validate_add(h, xn, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_xml2cbuf(cbret, xerr, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xerr, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
netconf_output_encap(1, cbret, "rpc-error");
|
||||
goto ok;
|
||||
|
|
@ -632,7 +632,7 @@ netconf_application_rpc(clicon_handle h,
|
|||
if (ret > 0 && (ret = xml_yang_validate_add(h, xoutput, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_xml2cbuf(cbret, xerr, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xerr, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_log(LOG_WARNING, "Errors in output netconf %s", cbuf_get(cbret));
|
||||
goto ok;
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ api_return_err(clicon_handle h,
|
|||
FCGX_FPrintF(r->out, "Content-Type: %s\r\n\r\n", restconf_media_int2str(media));
|
||||
switch (media){
|
||||
case YANG_DATA_XML:
|
||||
if (clicon_xml2cbuf(cb, xerr, 2, pretty) < 0)
|
||||
if (clicon_xml2cbuf(cb, xerr, 2, pretty, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s code:%d err:%s", __FUNCTION__, code, cbuf_get(cb));
|
||||
if (pretty){
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ api_root(clicon_handle h,
|
|||
goto done;
|
||||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
if (clicon_xml2cbuf(cb, xt, 0, pretty) < 0)
|
||||
if (clicon_xml2cbuf(cb, xt, 0, pretty, -1) < 0)
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
@ -292,7 +292,7 @@ api_yang_library_version(clicon_handle h,
|
|||
}
|
||||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
if (clicon_xml2cbuf(cb, xt, 0, pretty) < 0)
|
||||
if (clicon_xml2cbuf(cb, xt, 0, pretty, -1) < 0)
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ api_data_write(clicon_handle h,
|
|||
#if 0
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s XRET: %s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -457,7 +457,7 @@ api_data_write(clicon_handle h,
|
|||
#if 0
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xdata, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xdata, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s DATA:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -620,7 +620,7 @@ api_data_write(clicon_handle h,
|
|||
NETCONF_BASE_NAMESPACE); /* bind nc to netconf namespace */
|
||||
cprintf(cbx, "<edit-config><target><candidate /></target>");
|
||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||
if (clicon_xml2cbuf(cbx, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbx, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
clicon_debug(1, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
|
||||
|
|
@ -891,7 +891,7 @@ api_data_delete(clicon_handle h,
|
|||
NETCONF_BASE_NAMESPACE); /* bind nc to netconf namespace */
|
||||
cprintf(cbx, "<edit-config><target><candidate /></target>");
|
||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||
if (clicon_xml2cbuf(cbx, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbx, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
if (clicon_rpc_netconf(h, cbuf_get(cbx), &xret, NULL) < 0)
|
||||
|
|
|
|||
|
|
@ -114,8 +114,9 @@ api_data_get2(clicon_handle h,
|
|||
int ret;
|
||||
char *namespace = NULL;
|
||||
cvec *nsc = NULL;
|
||||
char *str;
|
||||
char *attr; /* attribute value string */
|
||||
netconf_content content = CONTENT_ALL;
|
||||
int32_t depth = -1; /* Nr of levels to print, -1 is all, 0 is none */
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
|
|
@ -123,9 +124,9 @@ api_data_get2(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
/* Check for content attribute */
|
||||
if ((str = cvec_find_str(qvec, "content")) != NULL){
|
||||
clicon_debug(1, "%s content=%s", __FUNCTION__, str);
|
||||
if ((content = netconf_content_str2int(str)) == -1){
|
||||
if ((attr = cvec_find_str(qvec, "content")) != NULL){
|
||||
clicon_debug(1, "%s content=%s", __FUNCTION__, attr);
|
||||
if ((content = netconf_content_str2int(attr)) == -1){
|
||||
if (netconf_bad_attribute_xml(&xerr, "application",
|
||||
"<bad-attribute>content</bad-attribute>", "Unrecognized value of content attribute") < 0)
|
||||
goto done;
|
||||
|
|
@ -138,7 +139,29 @@ api_data_get2(clicon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check for depth attribute */
|
||||
if ((attr = cvec_find_str(qvec, "depth")) != NULL){
|
||||
clicon_debug(1, "%s depth=%s", __FUNCTION__, attr);
|
||||
if (strcmp(attr, "unbounded") != 0){
|
||||
char *reason = NULL;
|
||||
if ((ret = parse_int32(attr, &depth, &reason)) < 0){
|
||||
clicon_err(OE_XML, errno, "parse_int32");
|
||||
goto done;
|
||||
}
|
||||
if (ret==0){
|
||||
if (netconf_bad_attribute_xml(&xerr, "application",
|
||||
"<bad-attribute>depth</bad-attribute>", "Unrecognized value of depth attribute") < 0)
|
||||
goto done;
|
||||
if ((xe = xpath_first(xerr, "rpc-error")) == NULL){
|
||||
clicon_err(OE_XML, EINVAL, "rpc-error not found (internal error)");
|
||||
goto done;
|
||||
}
|
||||
if (api_return_err(h, r, xe, pretty, media_out, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((cbpath = cbuf_new()) == NULL)
|
||||
goto done;
|
||||
cprintf(cbpath, "/");
|
||||
|
|
@ -165,13 +188,13 @@ api_data_get2(clicon_handle h,
|
|||
goto done;
|
||||
switch (content){
|
||||
case CONTENT_CONFIG:
|
||||
ret = clicon_rpc_get_config(h, "running", xpath, namespace, &xret);
|
||||
ret = clicon_rpc_get(h, xpath, namespace, CONTENT_CONFIG, depth, &xret);
|
||||
break;
|
||||
case CONTENT_NONCONFIG:
|
||||
ret = clicon_rpc_get(h, xpath, namespace, CONTENT_NONCONFIG, &xret);
|
||||
ret = clicon_rpc_get(h, xpath, namespace, CONTENT_NONCONFIG, depth, &xret);
|
||||
break;
|
||||
case CONTENT_ALL:
|
||||
ret = clicon_rpc_get(h, xpath, namespace, CONTENT_ALL, &xret);
|
||||
ret = clicon_rpc_get(h, xpath, namespace, CONTENT_ALL, depth, &xret);
|
||||
break;
|
||||
default:
|
||||
clicon_err(OE_XML, EINVAL, "Invalid content attribute %d", content);
|
||||
|
|
@ -196,7 +219,7 @@ api_data_get2(clicon_handle h,
|
|||
#if 0 /* DEBUG */
|
||||
if (debug){
|
||||
cbuf *cb = cbuf_new();
|
||||
clicon_xml2cbuf(cb, xret, 0, 0);
|
||||
clicon_xml2cbuf(cb, xret, 0, 0, -1);
|
||||
clicon_debug(1, "%s xret:%s", __FUNCTION__, cbuf_get(cb));
|
||||
cbuf_free(cb);
|
||||
}
|
||||
|
|
@ -219,7 +242,7 @@ api_data_get2(clicon_handle h,
|
|||
if (xpath==NULL || strcmp(xpath,"/")==0){ /* Special case: data root */
|
||||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
if (clicon_xml2cbuf(cbx, xret, 0, pretty) < 0) /* Dont print top object? */
|
||||
if (clicon_xml2cbuf(cbx, xret, 0, pretty, -1) < 0) /* Dont print top object? */
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
@ -268,7 +291,7 @@ api_data_get2(clicon_handle h,
|
|||
if (namespace2 && xmlns_set(x, prefix, namespace2) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (clicon_xml2cbuf(cbx, x, 0, pretty) < 0) /* Dont print top object? */
|
||||
if (clicon_xml2cbuf(cbx, x, 0, pretty, -1) < 0) /* Dont print top object? */
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ api_data_post(clicon_handle h,
|
|||
#if 1
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s XURI:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -309,7 +309,7 @@ api_data_post(clicon_handle h,
|
|||
#if 1
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xdata, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xdata, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s XDATA:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -330,7 +330,7 @@ api_data_post(clicon_handle h,
|
|||
NETCONF_BASE_NAMESPACE); /* bind nc to netconf namespace */
|
||||
cprintf(cbx, "<edit-config><target><candidate /></target>");
|
||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||
if (clicon_xml2cbuf(cbx, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(cbx, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
clicon_debug(1, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
|
||||
|
|
@ -507,7 +507,7 @@ api_operations_post_input(clicon_handle h,
|
|||
#if 1
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xdata, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xdata, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s DATA:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -614,7 +614,7 @@ api_operations_post_output(clicon_handle h,
|
|||
#if 1
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xoutput, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xoutput, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s XOUTPUT:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -855,7 +855,7 @@ api_operations_post(clicon_handle h,
|
|||
#if 1
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s 5. Translate input args: %s",
|
||||
__FUNCTION__, cbuf_get(ccc));
|
||||
|
|
@ -882,7 +882,7 @@ api_operations_post(clicon_handle h,
|
|||
#if 0
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xtop, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xtop, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s 6. Validate and defaults:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -922,7 +922,7 @@ api_operations_post(clicon_handle h,
|
|||
#if 1
|
||||
if (debug){
|
||||
cbuf *ccc=cbuf_new();
|
||||
if (clicon_xml2cbuf(ccc, xret, 0, 0) < 0)
|
||||
if (clicon_xml2cbuf(ccc, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s 8. Receive reply:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
cbuf_free(ccc);
|
||||
|
|
@ -942,7 +942,7 @@ api_operations_post(clicon_handle h,
|
|||
cbuf_reset(cbret);
|
||||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
if (clicon_xml2cbuf(cbret, xoutput, 0, pretty) < 0)
|
||||
if (clicon_xml2cbuf(cbret, xoutput, 0, pretty, -1) < 0)
|
||||
goto done;
|
||||
/* xoutput should now look: <output xmlns="uri"><x>0</x></output> */
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ restconf_stream_cb(int s,
|
|||
FCGX_FPrintF(r->out, "M#id: %02d:0\r\n", tv.tv_sec);
|
||||
}
|
||||
#endif
|
||||
if (clicon_xml2cbuf(cb, xn, 0, pretty) < 0)
|
||||
if (clicon_xml2cbuf(cb, xn, 0, pretty, -1) < 0)
|
||||
goto done;
|
||||
FCGX_FPrintF(r->out, "data: %s\r\n", cbuf_get(cb));
|
||||
FCGX_FPrintF(r->out, "\r\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue