C-API: clixon_xml2file and clixon_xml2cbuf added prefix argument
Added in-mem xml diff function: `xml_tree_diff_print`
This commit is contained in:
parent
819a0b5a9e
commit
6335f810d3
43 changed files with 309 additions and 149 deletions
|
|
@ -491,7 +491,7 @@ from_client_edit_config(clicon_handle h,
|
|||
if ((ret = xml_bind_yang(h, xc, YB_MODULE, yspec, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -499,7 +499,7 @@ from_client_edit_config(clicon_handle h,
|
|||
if ((ret = xml_non_config_data(xc, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -516,7 +516,7 @@ from_client_edit_config(clicon_handle h,
|
|||
if (ret==1 && (ret = xml_yang_validate_list_key_only(xc, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -1529,7 +1529,7 @@ from_client_msg(clicon_handle h,
|
|||
goto reply;
|
||||
}
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto reply;
|
||||
}
|
||||
|
|
@ -1609,7 +1609,7 @@ from_client_msg(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
ce->ce_in_bad_rpcs++;
|
||||
netconf_monitoring_counter_inc(h, "in-bad-rpcs");
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ startup_common(clicon_handle h,
|
|||
* See similar clause below
|
||||
*/
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -262,7 +262,7 @@ startup_common(clicon_handle h,
|
|||
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ startup_common(clicon_handle h,
|
|||
if ((ret = xml_non_config_data(xt, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ startup_common(clicon_handle h,
|
|||
if ((ret = generic_validate(h, yspec, td, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail; /* STARTUP_INVALID */
|
||||
}
|
||||
|
|
@ -612,7 +612,7 @@ candidate_validate(clicon_handle h,
|
|||
clicon_err(OE_CFG, EINVAL, "xret is NULL");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (!cbuf_len(cbret) &&
|
||||
netconf_operation_failed(cbret, "application", clicon_err_reason)< 0)
|
||||
|
|
@ -702,7 +702,7 @@ candidate_commit(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -969,7 +969,7 @@ from_client_restart_one(clicon_handle h,
|
|||
if ((ret = xml_yang_validate_all_top(h, td->td_target, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
@ -1018,7 +1018,7 @@ from_client_restart_one(clicon_handle h,
|
|||
if ((ret = generic_validate(h, yspec, td, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ get_nacm_and_reply(clicon_handle h,
|
|||
if (xml_name_set(xret, NETCONF_OUTPUT_DATA) < 0)
|
||||
goto done;
|
||||
/* Top level is data, so add 1 to depth if significant */
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, depth>0?depth+1:depth, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, depth>0?depth+1:depth, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
cprintf(cbret, "</rpc-reply>");
|
||||
|
|
@ -755,7 +755,7 @@ get_list_pagination(clicon_handle h,
|
|||
clicon_err_reason);
|
||||
if (netconf_operation_failed_xml(&xerr, "application", cbuf_get(cberr)) < 0)
|
||||
goto done;
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -769,7 +769,7 @@ get_list_pagination(clicon_handle h,
|
|||
". Internal error, state callback returned invalid XML",
|
||||
NULL) < 0)
|
||||
goto done;
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -1001,7 +1001,7 @@ get_common(clicon_handle h,
|
|||
if ((ret = get_statedata(h, xpath?xpath:"/", nsc, wdef, &xret)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){ /* Error from callback (error in xret) */
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
@ -1024,7 +1024,7 @@ get_common(clicon_handle h,
|
|||
". Internal error, state callback returned invalid XML",
|
||||
NULL) < 0)
|
||||
goto done;
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ restconf_pseudo_set_inline(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, xrestconf, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xrestconf, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if ((str = strdup(cbuf_get(cb))) == NULL){
|
||||
clicon_err(OE_XML, errno, "stdup");
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ transaction_dbg(clicon_handle h,
|
|||
}
|
||||
for (i=0; i<td->td_dlen; i++){
|
||||
xn = td->td_dvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
|
|
@ -272,7 +272,7 @@ transaction_dbg(clicon_handle h,
|
|||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_alen; i++){
|
||||
xn = td->td_avec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
|
|
@ -282,11 +282,11 @@ transaction_dbg(clicon_handle h,
|
|||
for (i=0; i<td->td_clen; i++){
|
||||
if (td->td_scvec){
|
||||
xn = td->td_scvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
xn = td->td_tcvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
|
|
@ -319,7 +319,7 @@ transaction_log(clicon_handle h,
|
|||
}
|
||||
for (i=0; i<td->td_dlen; i++){
|
||||
xn = td->td_dvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
|
|
@ -328,7 +328,7 @@ transaction_log(clicon_handle h,
|
|||
cbuf_reset(cb);
|
||||
for (i=0; i<td->td_alen; i++){
|
||||
xn = td->td_avec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
|
|
@ -337,11 +337,11 @@ transaction_log(clicon_handle h,
|
|||
for (i=0; i<td->td_clen; i++){
|
||||
if (td->td_scvec){
|
||||
xn = td->td_scvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
xn = td->td_tcvec[i];
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (i)
|
||||
|
|
|
|||
|
|
@ -472,7 +472,7 @@ cli_dbxml(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, xtop, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_edit_config(h, "candidate", OP_NONE, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
|
|
@ -865,7 +865,7 @@ compare_db_names(clicon_handle h,
|
|||
clixon_netconf_error(xerr, "Get configuration", NULL);
|
||||
goto done;
|
||||
}
|
||||
if (clixon_compare_xmls(xc1, xc2, format, cligen_output) < 0) /* astext? */
|
||||
if (clixon_compare_xmls(xc1, xc2, format) < 0) /* astext? */
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
@ -1055,7 +1055,7 @@ load_config_file(clicon_handle h,
|
|||
/* Read as datastore-top but transformed into an edit-config "config" */
|
||||
xml_name_set(x, NETCONF_INPUT_CONFIG);
|
||||
}
|
||||
if (clixon_xml2cbuf(cbxml, xt, 0, 0, -1, 1) < 0)
|
||||
if (clixon_xml2cbuf(cbxml, xt, 0, 0, NULL, -1, 1) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_edit_config(h, "candidate",
|
||||
replace?OP_REPLACE:OP_MERGE,
|
||||
|
|
@ -1158,7 +1158,7 @@ save_config_file(clicon_handle h,
|
|||
}
|
||||
switch (format){
|
||||
case FORMAT_XML:
|
||||
if (clixon_xml2file(f, xt, 0, pretty, fprintf, 0, 1) < 0)
|
||||
if (clixon_xml2file(f, xt, 0, pretty, NULL, fprintf, 0, 1) < 0)
|
||||
goto done;
|
||||
break;
|
||||
case FORMAT_JSON:
|
||||
|
|
@ -1177,7 +1177,7 @@ save_config_file(clicon_handle h,
|
|||
fprintf(f, "<rpc xmlns=\"%s\" %s><edit-config><target><candidate/></target>",
|
||||
NETCONF_BASE_NAMESPACE, NETCONF_MESSAGE_ID_ATTR);
|
||||
fprintf(f, "\n");
|
||||
if (clixon_xml2file(f, xt, 0, pretty, fprintf, 0, 1) < 0)
|
||||
if (clixon_xml2file(f, xt, 0, pretty, NULL, fprintf, 0, 1) < 0)
|
||||
goto done;
|
||||
fprintf(f, "</edit-config></rpc>]]>]]>\n");
|
||||
break;
|
||||
|
|
@ -1288,7 +1288,7 @@ cli_notification_cb(int s,
|
|||
goto done;
|
||||
break;
|
||||
case FORMAT_XML:
|
||||
if (clixon_xml2file(stdout, xt, 0, 1, cligen_output, 1, 1) < 0)
|
||||
if (clixon_xml2file(stdout, xt, 0, 1, NULL, cligen_output, 1, 1) < 0)
|
||||
goto done;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -1535,7 +1535,7 @@ cli_copy_config(clicon_handle h,
|
|||
/* resuse cb */
|
||||
cbuf_reset(cb);
|
||||
/* create xml copy tree and merge it with database configuration */
|
||||
if (clixon_xml2cbuf(cb, x2, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, x2, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_edit_config(h, db, OP_MERGE, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ cli_show_common(clicon_handle h,
|
|||
/* Print configuration according to format */
|
||||
switch (format){
|
||||
case FORMAT_XML:
|
||||
if (clixon_xml2file(stdout, xp, 0, pretty, cligen_output, skiptop, 1) < 0)
|
||||
if (clixon_xml2file(stdout, xp, 0, pretty, NULL, cligen_output, skiptop, 1) < 0)
|
||||
goto done;
|
||||
if (!pretty && i == veclen-1)
|
||||
cligen_output(stdout, "\n");
|
||||
|
|
@ -531,7 +531,7 @@ cli_show_common(clicon_handle h,
|
|||
if (pretty)
|
||||
cligen_output(stdout, "\n");
|
||||
}
|
||||
if (clixon_xml2file(stdout, xp, 2, pretty, cligen_output, skiptop, 1) < 0)
|
||||
if (clixon_xml2file(stdout, xp, 2, pretty, NULL, cligen_output, skiptop, 1) < 0)
|
||||
goto done;
|
||||
if (i == veclen-1)
|
||||
cligen_output(stdout, "</config></edit-config></rpc>]]>]]>\n");
|
||||
|
|
@ -1219,7 +1219,7 @@ cli_pagination(clicon_handle h,
|
|||
xc = xvec[j];
|
||||
switch (format){
|
||||
case FORMAT_XML:
|
||||
if (clixon_xml2file(stdout, xc, 0, 1, cligen_output, 0, 1) < 0)
|
||||
if (clixon_xml2file(stdout, xc, 0, 1, NULL, cligen_output, 0, 1) < 0)
|
||||
goto done;
|
||||
break;
|
||||
case FORMAT_JSON:
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ netconf_rpc_message(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (netconf_output_encap(framing, cbret) < 0)
|
||||
goto done;
|
||||
|
|
@ -241,7 +241,7 @@ netconf_rpc_message(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (netconf_output_encap(framing, cbret) < 0)
|
||||
goto done;
|
||||
|
|
@ -262,7 +262,7 @@ netconf_rpc_message(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (netconf_output_encap(framing, cbret) < 0)
|
||||
goto done;
|
||||
|
|
@ -278,7 +278,7 @@ netconf_rpc_message(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xml_child_i(xret,0), 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xml_child_i(xret,0), 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (netconf_output_encap(framing, cbret) < 0)
|
||||
goto done;
|
||||
|
|
@ -335,7 +335,7 @@ netconf_input_packet(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (netconf_output_encap(framing, cbret) < 0)
|
||||
goto done;
|
||||
|
|
@ -451,7 +451,7 @@ netconf_input_frame(clicon_handle h,
|
|||
clicon_err(OE_XML, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (netconf_output_encap(framing, cbret) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ netconf_notification_cb(int s,
|
|||
clicon_err(OE_PLUGIN, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
/* Send it to listening client on stdout */
|
||||
if (netconf_output_encap(clicon_option_int(h, "netconf-framing"), cb) < 0){
|
||||
|
|
@ -657,7 +657,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 (clixon_xml2cbuf(cbret, xerr, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xerr, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
clicon_log(LOG_WARNING, "Errors in output netconf %s", cbuf_get(cbret));
|
||||
goto ok;
|
||||
|
|
|
|||
|
|
@ -278,13 +278,13 @@ api_return_err(clicon_handle h,
|
|||
clicon_debug(1, "%s code:%d", __FUNCTION__, code);
|
||||
if (pretty){
|
||||
cprintf(cb, " <errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">\n");
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, " </errors>\r\n");
|
||||
}
|
||||
else {
|
||||
cprintf(cb, "<errors xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\">");
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xerr, 2, pretty, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cb, "</errors>\r\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ api_data_write(clicon_handle h,
|
|||
CLIXON_LIB_PREFIX, CLIXON_LIB_PREFIX, CLIXON_LIB_NS);
|
||||
cprintf(cbx, "><target><candidate /></target>");
|
||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
clicon_debug(1, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
|
||||
|
|
@ -782,7 +782,7 @@ api_data_delete(clicon_handle h,
|
|||
CLIXON_LIB_PREFIX, CLIXON_LIB_PREFIX, CLIXON_LIB_NS);
|
||||
cprintf(cbx, "><target><candidate /></target>");
|
||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
if (clicon_rpc_netconf(h, cbuf_get(cbx), &xret, NULL) < 0)
|
||||
|
|
|
|||
|
|
@ -231,7 +231,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 (clixon_xml2cbuf(cbx, xret, 0, pretty, -1, 0) < 0) /* Dont print top object? */
|
||||
if (clixon_xml2cbuf(cbx, xret, 0, pretty, NULL, -1, 0) < 0) /* Dont print top object? */
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
@ -275,7 +275,7 @@ api_data_get2(clicon_handle h,
|
|||
cvec_free(nscd);
|
||||
nscd = NULL;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbx, x, 0, pretty, -1, 0) < 0) /* Dont print top object? */
|
||||
if (clixon_xml2cbuf(cbx, x, 0, pretty, NULL, -1, 0) < 0) /* Dont print top object? */
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
|
@ -541,7 +541,7 @@ api_data_pagination(clicon_handle h,
|
|||
if (xml_insert(xpr, xp, INS_LAST, NULL, NULL) < 0)
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cbx, xpr, 0, pretty, -1, 0) < 0) /* Dont print top object? */
|
||||
if (clixon_xml2cbuf(cbx, xpr, 0, pretty, NULL, -1, 0) < 0) /* Dont print top object? */
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
|
|||
|
|
@ -362,7 +362,7 @@ api_data_post(clicon_handle h,
|
|||
CLIXON_LIB_PREFIX, CLIXON_LIB_PREFIX, CLIXON_LIB_NS);
|
||||
cprintf(cbx, "><target><candidate /></target>");
|
||||
cprintf(cbx, "<default-operation>none</default-operation>");
|
||||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbx, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
cprintf(cbx, "</edit-config></rpc>");
|
||||
clicon_debug(1, "%s xml: %s api_path:%s",__FUNCTION__, cbuf_get(cbx), api_path);
|
||||
|
|
@ -871,7 +871,7 @@ api_operations_post(clicon_handle h,
|
|||
cbuf_reset(cbret);
|
||||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
if (clixon_xml2cbuf(cbret, xoutput, 0, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cbret, xoutput, 0, pretty, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
/* xoutput should now look: <output xmlns="uri"><x>0</x></output> */
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ api_root_restconf_exact(clicon_handle h,
|
|||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
case YANG_PATCH_XML:
|
||||
if (clixon_xml2cbuf(cb, xt, 0, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xt, 0, pretty, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
@ -288,7 +288,7 @@ api_yang_library_version(clicon_handle h,
|
|||
switch (media_out){
|
||||
case YANG_DATA_XML:
|
||||
case YANG_PATCH_XML:
|
||||
if (clixon_xml2cbuf(cb, xt, 0, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xt, 0, pretty, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
break;
|
||||
case YANG_DATA_JSON:
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@ restconf_stream_cb(int s,
|
|||
FCGX_FPrintF(r->out, "M#id: %02d:0\r\n", tv.tv_sec);
|
||||
}
|
||||
#endif
|
||||
if (clixon_xml2cbuf(cb, xn, 0, pretty, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xn, 0, pretty, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
FCGX_FPrintF(r->out, "data: %s\r\n", cbuf_get(cb));
|
||||
FCGX_FPrintF(r->out, "\r\n");
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@ snmp_scalar_set(clicon_handle h,
|
|||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, xtop, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_edit_config(h, "candidate", op, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
|
|
@ -500,7 +500,7 @@ snmp_cache_row_op(clicon_handle h,
|
|||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||
goto done;
|
||||
}
|
||||
if (clixon_xml2cbuf(cb, xtop, 0, 0, -1, 0) < 0)
|
||||
if (clixon_xml2cbuf(cb, xtop, 0, 0, NULL, -1, 0) < 0)
|
||||
goto done;
|
||||
if (clicon_rpc_edit_config(h, "candidate", OP_NONE, cbuf_get(cb)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue