* New XML parsing API:
* `clixon_xml_parse_string()` * `clixon_xml_parse_file()` * New JSON parsing API, with same signature as XML parsing: * `clixon_json_parse_string()` * `clixon_xml_parse_file()` * XML YANG binding API have been rearranged as follows: * `xml_bind_yang_rpc()` * `xml_bind_yang_rpc_reply()` * `xml_bind_yang()` * `xml_bind_yang0()`
This commit is contained in:
parent
c4b0491754
commit
09a2e09848
54 changed files with 590 additions and 711 deletions
|
|
@ -186,7 +186,7 @@ client_get_capabilities(clicon_handle h,
|
|||
cprintf(cb, "<capability>urn:ietf:params:restconf:capability:defaults:1.0?basic-mode=explicit</capability>");
|
||||
cprintf(cb, "<capability>urn:ietf:params:restconf:capability:depth:1.0</capability>");
|
||||
cprintf(cb, "</capabilities>");
|
||||
if (xml_parse_string2(cbuf_get(cb), YB_PARENT, NULL, &xrstate, NULL) < 0)
|
||||
if (clixon_xml_parse_string(cbuf_get(cb), YB_PARENT, NULL, &xrstate, NULL) < 0)
|
||||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
|
|
@ -236,7 +236,7 @@ client_get_streams(clicon_handle h,
|
|||
goto done;
|
||||
cprintf(cb,"</%s>", top);
|
||||
|
||||
if (xml_parse_string(cbuf_get(cb), yspec, &x) < 0){
|
||||
if (clixon_xml_parse_string(cbuf_get(cb), YB_MODULE, yspec, &x, NULL) < 0){
|
||||
if (netconf_operation_failed_xml(xret, "protocol", clicon_err_reason)< 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
|
|
@ -320,7 +320,7 @@ clixon_stats_get(clicon_handle h,
|
|||
clixon_stats_get_db(h, "candidate", cb);
|
||||
clixon_stats_get_db(h, "startup", cb);
|
||||
cprintf(cb, "</clixon-stats>");
|
||||
if ((ret = xml_parse_string2(cbuf_get(cb), YB_TOP, yspec, xret, NULL)) < 0)
|
||||
if ((ret = clixon_xml_parse_string(cbuf_get(cb), YB_MODULE, yspec, xret, NULL)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clicon_err(OE_XML, EINVAL, "Internal error");
|
||||
|
|
@ -376,7 +376,7 @@ client_statedata(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
cprintf(cb, "<netconf xmlns=\"%s\"/>", namespace);
|
||||
if (xml_parse_string2(cbuf_get(cb), YB_TOP, yspec, xret, NULL) < 0)
|
||||
if (clixon_xml_parse_string(cbuf_get(cb), YB_MODULE, yspec, xret, NULL) < 0)
|
||||
goto done;
|
||||
if ((ret = client_get_streams(h, yspec, xpath, ymod, "netconf", xret)) < 0)
|
||||
goto done;
|
||||
|
|
@ -394,7 +394,7 @@ client_statedata(clicon_handle h,
|
|||
}
|
||||
cbuf_reset(cb);
|
||||
cprintf(cb, "<restconf-state xmlns=\"%s\"/>", namespace);
|
||||
if (xml_parse_string2(cbuf_get(cb), YB_TOP, yspec, xret, NULL) < 0)
|
||||
if (clixon_xml_parse_string(cbuf_get(cb), YB_MODULE, yspec, xret, NULL) < 0)
|
||||
goto done;
|
||||
if ((ret = client_get_streams(h, yspec, xpath, ymod, "restconf-state", xret)) < 0)
|
||||
goto done;
|
||||
|
|
@ -670,7 +670,7 @@ from_client_edit_config(clicon_handle h,
|
|||
xml_spec_set(xc, NULL);
|
||||
/* Populate XML with Yang spec (why not do this in parser?)
|
||||
*/
|
||||
if (xml_bind_yang(xc, yspec, NULL) < 0)
|
||||
if (xml_bind_yang(xc, YB_MODULE, yspec, NULL) < 0)
|
||||
goto done;
|
||||
/* Maybe validate xml here as in text_modify_top? */
|
||||
if (xml_apply(xc, CX_ELMNT, xml_non_config_data, &non_config) < 0)
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ startup_common(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
/* After upgrading, XML tree needs to be sorted and yang spec populated */
|
||||
if (xml_bind_yang(xt, yspec, NULL) < 0)
|
||||
if (xml_bind_yang(xt, YB_MODULE, yspec, NULL) < 0)
|
||||
goto done;
|
||||
if (xml_apply0(xt, CX_ELMNT, xml_sort, h) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ nacm_load_external(clicon_handle h)
|
|||
goto done;
|
||||
fd = fileno(f);
|
||||
/* Read configfile */
|
||||
if (xml_parse_file(fd, yspec, &xt) < 0)
|
||||
if (clixon_xml_parse_file(fd, YB_MODULE, yspec, NULL, &xt, NULL) < 0)
|
||||
goto done;
|
||||
if (xt == NULL){
|
||||
clicon_err(OE_XML, 0, "No xml tree in %s", filename);
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ clixon_plugin_statedata(clicon_handle h,
|
|||
if (debug)
|
||||
clicon_log_xml(LOG_DEBUG, x, "%s STATE:", __FUNCTION__);
|
||||
#endif
|
||||
if (xml_bind_yang(x, yspec, NULL) < 0)
|
||||
if (xml_bind_yang(x, YB_MODULE, yspec, NULL) < 0)
|
||||
goto done;
|
||||
if ((ret = netconf_trymerge(x, yspec, xret)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ load_extraxml(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if (xml_parse_file(fd, yspec, &xt) < 0)
|
||||
if (clixon_xml_parse_file(fd, YB_MODULE, yspec, NULL, &xt, NULL) < 0)
|
||||
goto done;
|
||||
/* Replace parent w first child */
|
||||
if (xml_rootchild(xt, 0, &xt) < 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue