* C-API: Added clicon_handle parameter to all xml_bind_* calls
This commit is contained in:
parent
da9bfcbb53
commit
51ebbdf12f
21 changed files with 102 additions and 62 deletions
|
|
@ -82,6 +82,7 @@ Developers may need to change their code
|
||||||
* Added netconf ssh subsystem
|
* Added netconf ssh subsystem
|
||||||
* Renamed from `clixon` built in `docker/base`
|
* Renamed from `clixon` built in `docker/base`
|
||||||
* C-API
|
* C-API
|
||||||
|
* Added `clicon_handle` parameter to all `xml_bind_*` calls
|
||||||
* All calls to `clicon_log_xml()` changed to new function `clicon_debug_xml()`
|
* All calls to `clicon_log_xml()` changed to new function `clicon_debug_xml()`
|
||||||
* Changed type of `veclen` parameter to `size_t` in `xpath_vec_flag()`
|
* Changed type of `veclen` parameter to `size_t` in `xpath_vec_flag()`
|
||||||
* Added `with-defaults` parameter (default 0) to `xmldb_get0()`
|
* Added `with-defaults` parameter (default 0) to `xmldb_get0()`
|
||||||
|
|
|
||||||
|
|
@ -487,7 +487,7 @@ from_client_edit_config(clicon_handle h,
|
||||||
xml_spec_set(xc, NULL);
|
xml_spec_set(xc, NULL);
|
||||||
/* Populate XML with Yang spec (why not do this in parser?)
|
/* Populate XML with Yang spec (why not do this in parser?)
|
||||||
*/
|
*/
|
||||||
if ((ret = xml_bind_yang(xc, YB_MODULE, yspec, &xret)) < 0)
|
if ((ret = xml_bind_yang(h, xc, YB_MODULE, yspec, &xret)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ startup_common(clicon_handle h,
|
||||||
/* Print upgraded db: -q backend switch for debugging/ showing upgraded config only */
|
/* Print upgraded db: -q backend switch for debugging/ showing upgraded config only */
|
||||||
if (clicon_quit_upgrade_get(h) == 1){
|
if (clicon_quit_upgrade_get(h) == 1){
|
||||||
/* bind yang */
|
/* bind yang */
|
||||||
if ((ret = xml_bind_yang(xt, YB_MODULE, yspec, &xret)) < 1){
|
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xret)) < 1){
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
/* invalid */
|
/* invalid */
|
||||||
clicon_err(OE_XML, EFAULT, "invalid configuration");
|
clicon_err(OE_XML, EFAULT, "invalid configuration");
|
||||||
|
|
@ -257,7 +257,7 @@ startup_common(clicon_handle h,
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
/* After upgrading, XML tree needs to be sorted and yang spec populated */
|
/* After upgrading, XML tree needs to be sorted and yang spec populated */
|
||||||
if ((ret = xml_bind_yang(xt, YB_MODULE, yspec, &xret)) < 0)
|
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xret)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
if (clixon_xml2cbuf(cbret, xret, 0, 0, -1, 0) < 0)
|
||||||
|
|
|
||||||
|
|
@ -761,7 +761,7 @@ get_list_pagination(clicon_handle h,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* System makes the binding */
|
/* System makes the binding */
|
||||||
if ((ret = xml_bind_yang(xret, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xret, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
clicon_debug_xml(1, xret, "Yang bind pagination state");
|
clicon_debug_xml(1, xret, "Yang bind pagination state");
|
||||||
|
|
|
||||||
|
|
@ -370,7 +370,7 @@ clixon_plugin_statedata_all(clicon_handle h,
|
||||||
}
|
}
|
||||||
clicon_debug_xml(CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
|
clicon_debug_xml(CLIXON_DBG_DETAIL, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
|
||||||
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
|
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
|
||||||
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, x, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (clixon_netconf_internal_error(xerr,
|
if (clixon_netconf_internal_error(xerr,
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ load_extraxml(clicon_handle h,
|
||||||
if (xt)
|
if (xt)
|
||||||
xml_name_set(xt, NETCONF_INPUT_CONFIG);
|
xml_name_set(xt, NETCONF_INPUT_CONFIG);
|
||||||
/* Now we can yang bind */
|
/* Now we can yang bind */
|
||||||
if ((ret = xml_bind_yang(xt, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xt, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (netconf_err2cb(xerr, cbret) < 0)
|
if (netconf_err2cb(xerr, cbret) < 0)
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ netconf_rpc_message(clicon_handle h,
|
||||||
*eof = 1;
|
*eof = 1;
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
if ((ret = xml_bind_yang_rpc(xrpc, yspec, &xret)) < 0)
|
if ((ret = xml_bind_yang_rpc(h, xrpc, yspec, &xret)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret > 0 &&
|
if (ret > 0 &&
|
||||||
(ret = xml_yang_validate_rpc(h, xrpc, 0, &xret)) < 0)
|
(ret = xml_yang_validate_rpc(h, xrpc, 0, &xret)) < 0)
|
||||||
|
|
|
||||||
|
|
@ -650,7 +650,7 @@ netconf_application_rpc(clicon_handle h,
|
||||||
if ((youtput = yang_find(yrpc, Y_OUTPUT, NULL)) != NULL){
|
if ((youtput = yang_find(yrpc, Y_OUTPUT, NULL)) != NULL){
|
||||||
xoutput=xpath_first(*xret, NULL, "/");
|
xoutput=xpath_first(*xret, NULL, "/");
|
||||||
xml_spec_set(xoutput, youtput); /* needed for xml_bind_yang */
|
xml_spec_set(xoutput, youtput); /* needed for xml_bind_yang */
|
||||||
if ((ret = xml_bind_yang(xoutput, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xoutput, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret > 0 && (ret = xml_yang_validate_all_top(h, xoutput, &xerr)) < 0)
|
if (ret > 0 && (ret = xml_yang_validate_all_top(h, xoutput, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,7 @@ api_operations_post_output(clicon_handle h,
|
||||||
if (youtput != NULL){
|
if (youtput != NULL){
|
||||||
xml_spec_set(xoutput, youtput); /* needed for xml_bind_yang */
|
xml_spec_set(xoutput, youtput); /* needed for xml_bind_yang */
|
||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
if ((ret = xml_bind_yang(xoutput, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xoutput, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret > 0 && (ret = xml_yang_validate_all(xoutput, &xerr)) < 0)
|
if (ret > 0 && (ret = xml_yang_validate_all(xoutput, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -798,7 +798,7 @@ api_operations_post(clicon_handle h,
|
||||||
clicon_debug_xml(1, xtop, "%s 5. Translate input args:", __FUNCTION__);
|
clicon_debug_xml(1, xtop, "%s 5. Translate input args:", __FUNCTION__);
|
||||||
#endif
|
#endif
|
||||||
/* 6. Validate outgoing RPC and fill in defaults */
|
/* 6. Validate outgoing RPC and fill in defaults */
|
||||||
if ((ret = xml_bind_yang_rpc(xtop, yspec, &xerr)) < 0) /* */
|
if ((ret = xml_bind_yang_rpc(h, xtop, yspec, &xerr)) < 0) /* */
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (api_return_err0(h, req, xerr, pretty, media_out, 0) < 0)
|
if (api_return_err0(h, req, xerr, pretty, media_out, 0) < 0)
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@
|
||||||
*/
|
*/
|
||||||
int xml_bind_yang_unknown_anydata(int val);
|
int xml_bind_yang_unknown_anydata(int val);
|
||||||
int xml_bind_netconf_message_id_optional(int val);
|
int xml_bind_netconf_message_id_optional(int val);
|
||||||
int xml_bind_yang_rpc(cxobj *xrpc, yang_stmt *yspec, cxobj **xerr);
|
int xml_bind_yang_rpc(clicon_handle h, cxobj *xrpc, yang_stmt *yspec, cxobj **xerr);
|
||||||
int xml_bind_yang_rpc_reply(cxobj *xrpc, char *name, yang_stmt *yspec, cxobj **xerr);
|
int xml_bind_yang_rpc_reply(clicon_handle h, cxobj *xrpc, char *name, yang_stmt *yspec, cxobj **xerr);
|
||||||
int xml_bind_yang0(cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
int xml_bind_yang0(clicon_handle h, cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
||||||
int xml_bind_yang(cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
int xml_bind_yang(clicon_handle h, cxobj *xt, yang_bind yb, yang_stmt *yspec, cxobj **xerr);
|
||||||
int xml_bind_special(cxobj *xd, yang_stmt *yspec, char *schema_nodeid);
|
int xml_bind_special(cxobj *xd, yang_stmt *yspec, char *schema_nodeid);
|
||||||
|
|
||||||
#endif /* _CLIXON_XML_BIND_H_ */
|
#endif /* _CLIXON_XML_BIND_H_ */
|
||||||
|
|
|
||||||
|
|
@ -537,6 +537,7 @@ xmldb_readfile(clicon_handle h,
|
||||||
xml_flag_set(x0, XML_FLAG_TOP);
|
xml_flag_set(x0, XML_FLAG_TOP);
|
||||||
if (xml_child_nr(x0) == 0 && de)
|
if (xml_child_nr(x0) == 0 && de)
|
||||||
de->de_empty = 1;
|
de->de_empty = 1;
|
||||||
|
|
||||||
/* Check if we support modstate */
|
/* Check if we support modstate */
|
||||||
if (clicon_option_bool(h, "CLICON_XMLDB_MODSTATE"))
|
if (clicon_option_bool(h, "CLICON_XMLDB_MODSTATE"))
|
||||||
if ((msdiff = modstate_diff_new()) == NULL)
|
if ((msdiff = modstate_diff_new()) == NULL)
|
||||||
|
|
@ -618,7 +619,7 @@ xmldb_readfile(clicon_handle h,
|
||||||
} /* if msdiff */
|
} /* if msdiff */
|
||||||
/* xml looks like: <top><config><x>... actually YB_MODULE_NEXT
|
/* xml looks like: <top><config><x>... actually YB_MODULE_NEXT
|
||||||
*/
|
*/
|
||||||
if ((ret = xml_bind_yang(x0, YB_MODULE, yspec1?yspec1:yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang(h, x0, YB_MODULE, yspec1?yspec1:yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -883,7 +884,7 @@ xmldb_get_cache(clicon_handle h,
|
||||||
x0t = de->de_xml;
|
x0t = de->de_xml;
|
||||||
|
|
||||||
if (yb == YB_MODULE && !xml_spec(x0t)){
|
if (yb == YB_MODULE && !xml_spec(x0t)){
|
||||||
if ((ret = xml_bind_yang(x0t, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang(h, x0t, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
; /* XXX */
|
; /* XXX */
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ clicon_files_recursive(const char *dir,
|
||||||
int res = 0;
|
int res = 0;
|
||||||
char errbuf[128];
|
char errbuf[128];
|
||||||
|
|
||||||
clicon_debug(2, "%s dir:%s", __FUNCTION__, dir);
|
clicon_debug(CLIXON_DBG_DETAIL, "%s dir:%s", __FUNCTION__, dir);
|
||||||
if (regexp && (res = regcomp(&re, regexp, REG_EXTENDED)) != 0) {
|
if (regexp && (res = regcomp(&re, regexp, REG_EXTENDED)) != 0) {
|
||||||
regerror(res, &re, errbuf, sizeof(errbuf));
|
regerror(res, &re, errbuf, sizeof(errbuf));
|
||||||
clicon_err(OE_DB, 0, "regcomp: %s", errbuf);
|
clicon_err(OE_DB, 0, "regcomp: %s", errbuf);
|
||||||
|
|
@ -238,7 +238,7 @@ clicon_file_dirent(const char *dir,
|
||||||
clicon_err(OE_UNIX, errno, "realloc");
|
clicon_err(OE_UNIX, errno, "realloc");
|
||||||
goto quit;
|
goto quit;
|
||||||
} /* realloc */
|
} /* realloc */
|
||||||
clicon_debug(2, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize);
|
clicon_debug(CLIXON_DBG_DETAIL, "%s memcpy(%p %p %u", __FUNCTION__, &new[nent], dent, direntStructSize);
|
||||||
/* man (3) readdir:
|
/* man (3) readdir:
|
||||||
* By implication, the use sizeof(struct dirent) to capture the size of the record including
|
* By implication, the use sizeof(struct dirent) to capture the size of the record including
|
||||||
* the size of d_name is also incorrect. */
|
* the size of d_name is also incorrect. */
|
||||||
|
|
|
||||||
|
|
@ -1462,19 +1462,19 @@ _json_parse(char *str,
|
||||||
*/
|
*/
|
||||||
switch (yb){
|
switch (yb){
|
||||||
case YB_PARENT:
|
case YB_PARENT:
|
||||||
if ((ret = xml_bind_yang0(x, yb, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang0(NULL, x, yb, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
break;
|
break;
|
||||||
case YB_MODULE_NEXT:
|
case YB_MODULE_NEXT:
|
||||||
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang(NULL, x, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
break;
|
break;
|
||||||
case YB_MODULE:
|
case YB_MODULE:
|
||||||
if ((ret = xml_bind_yang0(x, yb, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang0(NULL, x, yb, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
|
|
@ -1482,7 +1482,7 @@ _json_parse(char *str,
|
||||||
case YB_NONE:
|
case YB_NONE:
|
||||||
break;
|
break;
|
||||||
case YB_RPC:
|
case YB_RPC:
|
||||||
if ((ret = xml_bind_yang_rpc(x, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang_rpc(NULL, x, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
|
|
|
||||||
|
|
@ -449,7 +449,7 @@ clicon_rpc_netconf_xml(clicon_handle h,
|
||||||
xml_find_type(xreply, NULL, "rpc-error", CX_ELMNT) == NULL){
|
xml_find_type(xreply, NULL, "rpc-error", CX_ELMNT) == NULL){
|
||||||
yspec = clicon_dbspec_yang(h);
|
yspec = clicon_dbspec_yang(h);
|
||||||
/* Here use rpc name to bind to yang */
|
/* Here use rpc name to bind to yang */
|
||||||
if ((ret = xml_bind_yang_rpc_reply(xreply, rpcname, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang_rpc_reply(h, xreply, rpcname, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
/* Replace reply with error */
|
/* Replace reply with error */
|
||||||
|
|
@ -573,7 +573,7 @@ clicon_rpc_get_config(clicon_handle h,
|
||||||
else{
|
else{
|
||||||
if (xml_bind_special(xd, yspec, "/nc:get-config/output/data") < 0)
|
if (xml_bind_special(xd, yspec, "/nc:get-config/output/data") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((ret = xml_bind_yang(xd, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xd, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (clixon_netconf_internal_error(xerr,
|
if (clixon_netconf_internal_error(xerr,
|
||||||
|
|
@ -1020,7 +1020,7 @@ clicon_rpc_get(clicon_handle h,
|
||||||
else{
|
else{
|
||||||
if (xml_bind_special(xd, yspec, "/nc:get/output/data") < 0)
|
if (xml_bind_special(xd, yspec, "/nc:get/output/data") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((ret = xml_bind_yang(xd, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xd, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (clixon_netconf_internal_error(xerr,
|
if (clixon_netconf_internal_error(xerr,
|
||||||
|
|
@ -1184,7 +1184,7 @@ clicon_rpc_get_pageable_list(clicon_handle h,
|
||||||
else{
|
else{
|
||||||
if (xml_bind_special(xd, yspec, "/nc:get/output/data") < 0)
|
if (xml_bind_special(xd, yspec, "/nc:get/output/data") < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((ret = xml_bind_yang(xd, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xd, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if (clixon_netconf_internal_error(xerr,
|
if (clixon_netconf_internal_error(xerr,
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,7 @@ _text_syntax_parse(char *str,
|
||||||
*/
|
*/
|
||||||
switch (yb){
|
switch (yb){
|
||||||
case YB_MODULE_NEXT:
|
case YB_MODULE_NEXT:
|
||||||
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang(NULL, x, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
|
|
@ -428,7 +428,7 @@ _text_syntax_parse(char *str,
|
||||||
/* xt:<top> nospec
|
/* xt:<top> nospec
|
||||||
* x: <a> <-- populate from modules
|
* x: <a> <-- populate from modules
|
||||||
*/
|
*/
|
||||||
if ((ret = xml_bind_yang0(x, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang0(NULL, x, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
|
|
|
||||||
|
|
@ -1416,7 +1416,7 @@ rpc_reply_check(clicon_handle h,
|
||||||
}
|
}
|
||||||
if (xml_rootchild(x, 0, &x) < 0)
|
if (xml_rootchild(x, 0, &x) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if ((ret = xml_bind_yang_rpc_reply(x, rpcname, yspec, &xret)) < 0)
|
if ((ret = xml_bind_yang_rpc_reply(h, x, rpcname, yspec, &xret)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
clicon_debug(1, "%s failure when validating:%s", __FUNCTION__, cbuf_get(cbret));
|
clicon_debug(1, "%s failure when validating:%s", __FUNCTION__, cbuf_get(cbret));
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@
|
||||||
***** END LICENSE BLOCK *****
|
***** END LICENSE BLOCK *****
|
||||||
|
|
||||||
*
|
*
|
||||||
* Translation / mapping code between formats
|
* Given an existing XML tree, bind YANG specs to XML nodes according to different
|
||||||
|
* algorithms
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "clixon_config.h" /* generated by config & autoconf */
|
#include "clixon_config.h" /* generated by config & autoconf */
|
||||||
|
|
@ -68,13 +69,13 @@
|
||||||
#include "clixon_options.h"
|
#include "clixon_options.h"
|
||||||
#include "clixon_data.h"
|
#include "clixon_data.h"
|
||||||
#include "clixon_yang_module.h"
|
#include "clixon_yang_module.h"
|
||||||
#include "clixon_plugin.h"
|
|
||||||
#include "clixon_xml_nsctx.h"
|
#include "clixon_xml_nsctx.h"
|
||||||
#include "clixon_xpath_ctx.h"
|
#include "clixon_xpath_ctx.h"
|
||||||
#include "clixon_xpath.h"
|
#include "clixon_xpath.h"
|
||||||
#include "clixon_log.h"
|
#include "clixon_log.h"
|
||||||
#include "clixon_err.h"
|
#include "clixon_err.h"
|
||||||
#include "clixon_netconf_lib.h"
|
#include "clixon_netconf_lib.h"
|
||||||
|
#include "clixon_plugin.h"
|
||||||
#include "clixon_xml_sort.h"
|
#include "clixon_xml_sort.h"
|
||||||
#include "clixon_yang_type.h"
|
#include "clixon_yang_type.h"
|
||||||
#include "clixon_xml_map.h"
|
#include "clixon_xml_map.h"
|
||||||
|
|
@ -136,6 +137,8 @@ strip_body_objects(cxobj *xt)
|
||||||
/*! Associate XML node x with x:s parents yang:s matching child
|
/*! Associate XML node x with x:s parents yang:s matching child
|
||||||
*
|
*
|
||||||
* @param[in] xt XML tree node
|
* @param[in] xt XML tree node
|
||||||
|
* @param[in] xsibling
|
||||||
|
* @param[in] yspec Top-level YANG spec / mount-point
|
||||||
* @param[out] xerr Reason for failure, or NULL
|
* @param[out] xerr Reason for failure, or NULL
|
||||||
* @retval 2 OK Yang assignment not made because yang parent is anyxml or anydata
|
* @retval 2 OK Yang assignment not made because yang parent is anyxml or anydata
|
||||||
* @retval 1 OK Yang assignment made
|
* @retval 1 OK Yang assignment made
|
||||||
|
|
@ -145,9 +148,10 @@ strip_body_objects(cxobj *xt)
|
||||||
* @see populate_self_top
|
* @see populate_self_top
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
populate_self_parent(cxobj *xt,
|
populate_self_parent(cxobj *xt,
|
||||||
cxobj *xsibling,
|
cxobj *xsibling,
|
||||||
cxobj **xerr)
|
yang_stmt *yspec,
|
||||||
|
cxobj **xerr)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
yang_stmt *y = NULL; /* yang node */
|
yang_stmt *y = NULL; /* yang node */
|
||||||
|
|
@ -349,6 +353,7 @@ populate_self_top(cxobj *xt,
|
||||||
*
|
*
|
||||||
* Populate xt:s children as top-level symbols
|
* Populate xt:s children as top-level symbols
|
||||||
* This may be unnecessary if yspec is set on manual creation: x=xml_new(); xml_spec_set(x,y)
|
* This may be unnecessary if yspec is set on manual creation: x=xml_new(); xml_spec_set(x,y)
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
* @param[in] xt XML tree node
|
* @param[in] xt XML tree node
|
||||||
* @param[in] yb How to bind yang to XML top-level when parsing
|
* @param[in] yb How to bind yang to XML top-level when parsing
|
||||||
* @param[in] yspec Yang spec
|
* @param[in] yspec Yang spec
|
||||||
|
|
@ -358,16 +363,17 @@ populate_self_top(cxobj *xt,
|
||||||
* @retval -1 Error
|
* @retval -1 Error
|
||||||
* @code
|
* @code
|
||||||
* cxobj *xerr = NULL;
|
* cxobj *xerr = NULL;
|
||||||
* if (xml_bind_yang(x, YB_MODULE, yspec, &xerr) < 0)
|
* if (xml_bind_yang(h, x, YB_MODULE, yspec, &xerr) < 0)
|
||||||
* err;
|
* err;
|
||||||
* @endcode
|
* @endcode
|
||||||
* @note For subs to anyxml nodes will not have spec set
|
|
||||||
* There are several functions in the API family
|
* There are several functions in the API family
|
||||||
* @see xml_bind_yang_rpc for incoming rpc
|
* @see xml_bind_yang_rpc for incoming rpc
|
||||||
* @see xml_bind_yang0 If the calling xml object should also be populated
|
* @see xml_bind_yang0 If the calling xml object should also be populated
|
||||||
|
* @note For subs to anyxml nodes will not have spec set
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_bind_yang(cxobj *xt,
|
xml_bind_yang(clicon_handle h,
|
||||||
|
cxobj *xt,
|
||||||
yang_bind yb,
|
yang_bind yb,
|
||||||
yang_stmt *yspec,
|
yang_stmt *yspec,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
|
|
@ -379,7 +385,7 @@ xml_bind_yang(cxobj *xt,
|
||||||
strip_body_objects(xt);
|
strip_body_objects(xt);
|
||||||
xc = NULL; /* Apply on children */
|
xc = NULL; /* Apply on children */
|
||||||
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
|
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
|
||||||
if ((ret = xml_bind_yang0(xc, yb, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang0(h, xc, yb, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -392,9 +398,23 @@ xml_bind_yang(cxobj *xt,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
*
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
|
* @param[in] xt XML tree node
|
||||||
|
* @param[in] yb How to bind yang to XML top-level when parsing
|
||||||
|
* @param[in] yspec Yang spec
|
||||||
|
* @param[in] xsibling
|
||||||
|
* @param[out] xerr Reason for failure, or NULL
|
||||||
|
* @retval 1 OK yang assignment made
|
||||||
|
* @retval 0 Partial or no yang assigment made (at least one failed) and xerr set
|
||||||
|
* @retval -1 Error
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
xml_bind_yang0_opt(cxobj *xt,
|
xml_bind_yang0_opt(clicon_handle h,
|
||||||
|
cxobj *xt,
|
||||||
yang_bind yb,
|
yang_bind yb,
|
||||||
|
yang_stmt *yspec,
|
||||||
cxobj *xsibling,
|
cxobj *xsibling,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
{
|
{
|
||||||
|
|
@ -407,11 +427,17 @@ xml_bind_yang0_opt(cxobj *xt,
|
||||||
char *name0 = NULL;
|
char *name0 = NULL;
|
||||||
char *prefix0 = NULL;
|
char *prefix0 = NULL;
|
||||||
char *name;
|
char *name;
|
||||||
|
yang_bind ybc;
|
||||||
char *prefix;
|
char *prefix;
|
||||||
|
yang_stmt *yspec1 = NULL;
|
||||||
|
|
||||||
switch (yb){
|
switch (yb){
|
||||||
|
case YB_MODULE:
|
||||||
|
if ((ret = populate_self_top(xt, yspec, xerr)) < 0)
|
||||||
|
goto done;
|
||||||
|
break;
|
||||||
case YB_PARENT:
|
case YB_PARENT:
|
||||||
if ((ret = populate_self_parent(xt, xsibling, xerr)) < 0)
|
if ((ret = populate_self_parent(xt, xsibling, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -424,6 +450,8 @@ xml_bind_yang0_opt(cxobj *xt,
|
||||||
else if (ret == 2) /* ret=2 for anyxml from parent^ */
|
else if (ret == 2) /* ret=2 for anyxml from parent^ */
|
||||||
goto ok;
|
goto ok;
|
||||||
strip_body_objects(xt);
|
strip_body_objects(xt);
|
||||||
|
ybc = YB_PARENT;
|
||||||
|
yspec1 = yspec;
|
||||||
xc = NULL; /* Apply on children */
|
xc = NULL; /* Apply on children */
|
||||||
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
|
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
|
||||||
/* It is xml2ns in populate_self_parent that needs improvement */
|
/* It is xml2ns in populate_self_parent that needs improvement */
|
||||||
|
|
@ -433,15 +461,15 @@ xml_bind_yang0_opt(cxobj *xt,
|
||||||
if (yc0 != NULL &&
|
if (yc0 != NULL &&
|
||||||
clicon_strcmp(name0, name) == 0 &&
|
clicon_strcmp(name0, name) == 0 &&
|
||||||
clicon_strcmp(prefix0, prefix) == 0){
|
clicon_strcmp(prefix0, prefix) == 0){
|
||||||
if ((ret = xml_bind_yang0_opt(xc, YB_PARENT, xc0, xerr)) < 0)
|
if ((ret = xml_bind_yang0_opt(h, xc, ybc, yspec1, xc0, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if (xsibling &&
|
else if (xsibling &&
|
||||||
(xs = xml_find_type(xsibling, prefix, name, CX_ELMNT)) != NULL){
|
(xs = xml_find_type(xsibling, prefix, name, CX_ELMNT)) != NULL){
|
||||||
if ((ret = xml_bind_yang0_opt(xc, YB_PARENT, xs, xerr)) < 0)
|
if ((ret = xml_bind_yang0_opt(h, xc, ybc, yspec1, xs, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
else if ((ret = xml_bind_yang0_opt(xc, YB_PARENT, NULL, xerr)) < 0)
|
else if ((ret = xml_bind_yang0_opt(h, xc, ybc, yspec1, NULL, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -461,6 +489,7 @@ xml_bind_yang0_opt(cxobj *xt,
|
||||||
|
|
||||||
/*! Find yang spec association of tree of XML nodes
|
/*! Find yang spec association of tree of XML nodes
|
||||||
*
|
*
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
* @param[in] xt XML tree node
|
* @param[in] xt XML tree node
|
||||||
* @param[in] yb How to bind yang to XML top-level when parsing
|
* @param[in] yb How to bind yang to XML top-level when parsing
|
||||||
* @param[in] yspec Yang spec
|
* @param[in] yspec Yang spec
|
||||||
|
|
@ -472,7 +501,8 @@ xml_bind_yang0_opt(cxobj *xt,
|
||||||
* @see xml_bind_yang If only children of xt should be populated, not xt itself
|
* @see xml_bind_yang If only children of xt should be populated, not xt itself
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_bind_yang0(cxobj *xt,
|
xml_bind_yang0(clicon_handle h,
|
||||||
|
cxobj *xt,
|
||||||
yang_bind yb,
|
yang_bind yb,
|
||||||
yang_stmt *yspec,
|
yang_stmt *yspec,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
|
|
@ -487,7 +517,7 @@ xml_bind_yang0(cxobj *xt,
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
case YB_PARENT:
|
case YB_PARENT:
|
||||||
if ((ret = populate_self_parent(xt, NULL, xerr)) < 0)
|
if ((ret = populate_self_parent(xt, NULL, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
break;
|
break;
|
||||||
case YB_NONE:
|
case YB_NONE:
|
||||||
|
|
@ -505,7 +535,7 @@ xml_bind_yang0(cxobj *xt,
|
||||||
strip_body_objects(xt);
|
strip_body_objects(xt);
|
||||||
xc = NULL; /* Apply on children */
|
xc = NULL; /* Apply on children */
|
||||||
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
|
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL) {
|
||||||
if ((ret = xml_bind_yang0_opt(xc, YB_PARENT, NULL, xerr)) < 0)
|
if ((ret = xml_bind_yang0_opt(h, xc, YB_PARENT, yspec, NULL, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -520,9 +550,11 @@ xml_bind_yang0(cxobj *xt,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! RPC-specific
|
/*! RPC-specific
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xml_bind_yang_rpc_rpc(cxobj *x,
|
xml_bind_yang_rpc_rpc(clicon_handle h,
|
||||||
|
cxobj *x,
|
||||||
yang_stmt *yrpc,
|
yang_stmt *yrpc,
|
||||||
char *rpcname,
|
char *rpcname,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
|
|
@ -556,7 +588,7 @@ xml_bind_yang_rpc_rpc(cxobj *x,
|
||||||
* recursive population to work. Therefore, assign input yang
|
* recursive population to work. Therefore, assign input yang
|
||||||
* to rpc level although not 100% intuitive */
|
* to rpc level although not 100% intuitive */
|
||||||
xml_spec_set(x, yi);
|
xml_spec_set(x, yi);
|
||||||
if ((ret = xml_bind_yang(x, YB_PARENT, NULL, xerr)) < 0)
|
if ((ret = xml_bind_yang(h, x, YB_PARENT, NULL, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -576,10 +608,12 @@ xml_bind_yang_rpc_rpc(cxobj *x,
|
||||||
* Find the innermost container or list containing an XML element that carries the name of the
|
* Find the innermost container or list containing an XML element that carries the name of the
|
||||||
* defined action.
|
* defined action.
|
||||||
* Only one action can be invoked in one rpc
|
* Only one action can be invoked in one rpc
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
* XXX if not more action, consider folding into calling function
|
* XXX if not more action, consider folding into calling function
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
xml_bind_yang_rpc_action(cxobj *xn,
|
xml_bind_yang_rpc_action(clicon_handle h,
|
||||||
|
cxobj *xn,
|
||||||
yang_stmt *yspec,
|
yang_stmt *yspec,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
{
|
{
|
||||||
|
|
@ -588,7 +622,7 @@ xml_bind_yang_rpc_action(cxobj *xn,
|
||||||
cxobj *xi;
|
cxobj *xi;
|
||||||
yang_stmt *yi;;
|
yang_stmt *yi;;
|
||||||
|
|
||||||
if ((ret = xml_bind_yang(xn, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang(h, xn, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -608,6 +642,7 @@ xml_bind_yang_rpc_action(cxobj *xn,
|
||||||
/*! Find yang spec association of XML node for incoming RPC starting with <rpc>
|
/*! Find yang spec association of XML node for incoming RPC starting with <rpc>
|
||||||
*
|
*
|
||||||
* Incoming RPC has an "input" structure that is not taken care of by xml_bind_yang
|
* Incoming RPC has an "input" structure that is not taken care of by xml_bind_yang
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
* @param[in] xrpc XML rpc node
|
* @param[in] xrpc XML rpc node
|
||||||
* @param[in] yspec Yang spec
|
* @param[in] yspec Yang spec
|
||||||
* @param[out] xerr Reason for failure, or NULL
|
* @param[out] xerr Reason for failure, or NULL
|
||||||
|
|
@ -623,7 +658,8 @@ xml_bind_yang_rpc_action(cxobj *xn,
|
||||||
* @see xml_bind_yang_rpc_reply
|
* @see xml_bind_yang_rpc_reply
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_bind_yang_rpc(cxobj *xrpc,
|
xml_bind_yang_rpc(clicon_handle h,
|
||||||
|
cxobj *xrpc,
|
||||||
yang_stmt *yspec,
|
yang_stmt *yspec,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
{
|
{
|
||||||
|
|
@ -699,7 +735,7 @@ xml_bind_yang_rpc(cxobj *xrpc,
|
||||||
if ((ret = xml_rpc_isaction(x)) < 0)
|
if ((ret = xml_rpc_isaction(x)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 1){
|
if (ret == 1){
|
||||||
if ((ret = xml_bind_yang_rpc_action(x, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang_rpc_action(h, x, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -719,7 +755,7 @@ xml_bind_yang_rpc(cxobj *xrpc,
|
||||||
goto done;
|
goto done;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if ((ret = xml_bind_yang_rpc_rpc(x, yrpc, rpcname, xerr)) < 0)
|
if ((ret = xml_bind_yang_rpc_rpc(h, x, yrpc, rpcname, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
@ -736,6 +772,7 @@ xml_bind_yang_rpc(cxobj *xrpc,
|
||||||
/*! Find yang spec association of XML node for outgoing RPC starting with <rpc-reply>
|
/*! Find yang spec association of XML node for outgoing RPC starting with <rpc-reply>
|
||||||
*
|
*
|
||||||
* Outgoing RPC has an "output" structure that is not taken care of by xml_bind_yang
|
* Outgoing RPC has an "output" structure that is not taken care of by xml_bind_yang
|
||||||
|
* @param[in] h Clixon handle (sometimes NULL)
|
||||||
* @param[in] xrpc XML rpc node
|
* @param[in] xrpc XML rpc node
|
||||||
* @param[in] name Name of RPC (not seen in output/reply)
|
* @param[in] name Name of RPC (not seen in output/reply)
|
||||||
* @param[in] yspec Yang spec
|
* @param[in] yspec Yang spec
|
||||||
|
|
@ -751,7 +788,8 @@ xml_bind_yang_rpc(cxobj *xrpc,
|
||||||
* @see xml_bind_yang For other generic cases
|
* @see xml_bind_yang For other generic cases
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xml_bind_yang_rpc_reply(cxobj *xrpc,
|
xml_bind_yang_rpc_reply(clicon_handle h,
|
||||||
|
cxobj *xrpc,
|
||||||
char *name,
|
char *name,
|
||||||
yang_stmt *yspec,
|
yang_stmt *yspec,
|
||||||
cxobj **xerr)
|
cxobj **xerr)
|
||||||
|
|
@ -804,7 +842,7 @@ xml_bind_yang_rpc_reply(cxobj *xrpc,
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
/* Use a temporary xml error tree since it is stringified in the original error on error */
|
/* Use a temporary xml error tree since it is stringified in the original error on error */
|
||||||
if ((ret = xml_bind_yang(xrpc, YB_PARENT, NULL, &xerr1)) < 0)
|
if ((ret = xml_bind_yang(h, xrpc, YB_PARENT, NULL, &xerr1)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if ((cberr = cbuf_new()) == NULL){
|
if ((cberr = cbuf_new()) == NULL){
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ xml_default_choice(yang_stmt *yc,
|
||||||
yang_stmt *yca = NULL;
|
yang_stmt *yca = NULL;
|
||||||
yang_stmt *ydef;
|
yang_stmt *ydef;
|
||||||
|
|
||||||
clicon_debug(2, "%s", __FUNCTION__);
|
clicon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||||
/* 1. Is there a default case and no child under this choice?
|
/* 1. Is there a default case and no child under this choice?
|
||||||
*/
|
*/
|
||||||
x = NULL;
|
x = NULL;
|
||||||
|
|
|
||||||
|
|
@ -579,14 +579,14 @@ _xml_parse(const char *str,
|
||||||
/* xt:n Has spec
|
/* xt:n Has spec
|
||||||
* x: <a> <-- populate from parent
|
* x: <a> <-- populate from parent
|
||||||
*/
|
*/
|
||||||
if ((ret = xml_bind_yang0(x, YB_PARENT, NULL, xerr)) < 0)
|
if ((ret = xml_bind_yang0(NULL, x, YB_PARENT, NULL, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case YB_MODULE_NEXT:
|
case YB_MODULE_NEXT:
|
||||||
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang(NULL, x, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
|
|
@ -595,13 +595,13 @@ _xml_parse(const char *str,
|
||||||
/* xt:<top> nospec
|
/* xt:<top> nospec
|
||||||
* x: <a> <-- populate from modules
|
* x: <a> <-- populate from modules
|
||||||
*/
|
*/
|
||||||
if ((ret = xml_bind_yang0(x, YB_MODULE, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang0(NULL, x, YB_MODULE, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
failed++;
|
failed++;
|
||||||
break;
|
break;
|
||||||
case YB_RPC:
|
case YB_RPC:
|
||||||
if ((ret = xml_bind_yang_rpc(x, yspec, xerr)) < 0)
|
if ((ret = xml_bind_yang_rpc(NULL, x, yspec, xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){ /* Add message-id */
|
if (ret == 0){ /* Add message-id */
|
||||||
if (*xerr && clixon_xml_attr_copy(x, *xerr, "message-id") < 0)
|
if (*xerr && clixon_xml_attr_copy(x, *xerr, "message-id") < 0)
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ main(int argc,
|
||||||
/* Validate XML as well */
|
/* Validate XML as well */
|
||||||
if (yang_file_dir){
|
if (yang_file_dir){
|
||||||
/* Populate */
|
/* Populate */
|
||||||
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, x, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if ((cb = cbuf_new()) ==NULL){
|
if ((cb = cbuf_new()) ==NULL){
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,7 @@ main(int argc,
|
||||||
/* Validate XML as well */
|
/* Validate XML as well */
|
||||||
if (yang_file_dir){
|
if (yang_file_dir){
|
||||||
/* Populate */
|
/* Populate */
|
||||||
if ((ret = xml_bind_yang(x0, YB_MODULE, yspec, &xerr)) < 0)
|
if ((ret = xml_bind_yang(h, x0, YB_MODULE, yspec, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
if ((cbret = cbuf_new()) ==NULL){
|
if ((cbret = cbuf_new()) ==NULL){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue