* xml_merge() changed to use 3-value return: 1:OK, 0:Yang failed, -1: Error

* `clixon_netconf_error(category, xerr, msg, arg)` removed first argument -> `clixon_netconf_error(xerr, msg, arg)`
* Renamed utility function `clixon_util_insert()` to `clixon_util_xml_mod()` and added merge functionality.
* Fixed: Insertion of subtree leaf nodes were not made in the crrect place, always ended up last regardless of yang spec (if ordered-by system).
This commit is contained in:
Olof hagsand 2020-04-17 15:47:37 +02:00
parent f401c07c4b
commit 0d4263e324
16 changed files with 376 additions and 274 deletions

View file

@ -714,13 +714,13 @@ compare_dbs(clicon_handle h,
if (clicon_rpc_get_config(h, NULL, "running", "/", NULL, &xc1) < 0)
goto done;
if ((xerr = xpath_first(xc1, NULL, "/rpc-error")) != NULL){
clixon_netconf_error(OE_NETCONF, xerr, "Get configuration", NULL);
clixon_netconf_error(xerr, "Get configuration", NULL);
goto done;
}
if (clicon_rpc_get_config(h, NULL, "candidate", "/", NULL, &xc2) < 0)
goto done;
if ((xerr = xpath_first(xc2, NULL, "/rpc-error")) != NULL){
clixon_netconf_error(OE_NETCONF, xerr, "Get configuration", NULL);
clixon_netconf_error(xerr, "Get configuration", NULL);
goto done;
}
if (compare_xmls(xc1, xc2, astext) < 0) /* astext? */
@ -884,7 +884,7 @@ save_config_file(clicon_handle h,
goto done;
}
if ((xerr = xpath_first(xt, NULL, "/rpc-error")) != NULL){
clixon_netconf_error(OE_NETCONF, xerr, "Get configuration", NULL);
clixon_netconf_error(xerr, "Get configuration", NULL);
goto done;
}
/* get-config returns a <data> tree. Save as <config> tree so it can be used
@ -1230,7 +1230,7 @@ cli_copy_config(clicon_handle h,
if (clicon_rpc_get_config(h, NULL, db, cbuf_get(cb), nsc, &x1) < 0)
goto done;
if ((xerr = xpath_first(x1, NULL, "/rpc-error")) != NULL){
clixon_netconf_error(OE_NETCONF, xerr, "Get configuration", NULL);
clixon_netconf_error(xerr, "Get configuration", NULL);
goto done;
}