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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue