* 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:
Olof hagsand 2020-03-19 21:32:27 +01:00
parent c4b0491754
commit 09a2e09848
54 changed files with 590 additions and 711 deletions

View file

@ -98,10 +98,12 @@ example_client_rpc(clicon_handle h,
/* User supplied variable in CLI command */
cva = cvec_find(cvv, "a"); /* get a cligen variable from vector */
/* Create XML for example netconf RPC */
if (xml_parse_va(&xtop, NULL, "<rpc message-id=\"101\" xmlns=\"%s\" username=\"%s\"><example xmlns=\"urn:example:clixon\"><x>%s</x></example></rpc>",
NETCONF_BASE_NAMESPACE,
clicon_username_get(h),
cv_string_get(cva)) < 0)
if (clixon_xml_parse_va(YB_NONE, NULL, &xtop, NULL,
"<rpc message-id=\"101\" xmlns=\"%s\" username=\"%s\">"
"<example xmlns=\"urn:example:clixon\"><x>%s</x></example></rpc>",
NETCONF_BASE_NAMESPACE,
clicon_username_get(h),
cv_string_get(cva)) < 0)
goto done;
/* Skip top-level */
xrpc = xml_child_i(xtop, 0);
@ -109,7 +111,7 @@ example_client_rpc(clicon_handle h,
if (clicon_rpc_netconf_xml(h, xrpc, &xret, NULL) < 0)
goto done;
if ((xerr = xpath_first(xret, NULL, "//rpc-error")) != NULL){
clicon_rpc_generate_error(xerr, "Get configuration", NULL);
clixon_netconf_error(OE_NETCONF, xerr, "Get configuration", NULL);
goto done;
}
/* Print result */