Structural C-code change: Merged yang_spec and yang_node types into yang_stmt
This commit is contained in:
parent
4f9e942103
commit
b5f1f7346e
52 changed files with 492 additions and 496 deletions
|
|
@ -163,7 +163,7 @@ backend_client_rm(clicon_handle h,
|
|||
*/
|
||||
static int
|
||||
client_get_streams(clicon_handle h,
|
||||
yang_spec *yspec,
|
||||
yang_stmt *yspec,
|
||||
char *xpath,
|
||||
char *module,
|
||||
char *top,
|
||||
|
|
@ -175,11 +175,11 @@ client_get_streams(clicon_handle h,
|
|||
cxobj *x = NULL;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
if ((ystream = yang_find((yang_node*)yspec, Y_MODULE, module)) == NULL){
|
||||
if ((ystream = yang_find(yspec, Y_MODULE, module)) == NULL){
|
||||
clicon_err(OE_YANG, 0, "%s yang module not found", module);
|
||||
goto done;
|
||||
}
|
||||
if ((yns = yang_find((yang_node*)ystream, Y_NAMESPACE, NULL)) == NULL){
|
||||
if ((yns = yang_find(ystream, Y_NAMESPACE, NULL)) == NULL){
|
||||
clicon_err(OE_YANG, 0, "%s yang namespace not found", module);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -224,7 +224,7 @@ client_statedata(clicon_handle h,
|
|||
cxobj **xvec = NULL;
|
||||
size_t xlen;
|
||||
int i;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "No yang spec");
|
||||
|
|
@ -379,7 +379,7 @@ from_client_edit_config(clicon_handle h,
|
|||
enum operation_type operation = OP_MERGE;
|
||||
int piddb;
|
||||
int non_config = 0;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cbuf *cbx = NULL; /* Assist cbuf */
|
||||
int ret;
|
||||
char *username;
|
||||
|
|
@ -1061,7 +1061,7 @@ from_client_msg(clicon_handle h,
|
|||
cbuf *cbret = NULL; /* return message */
|
||||
int ret;
|
||||
char *username;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
yang_stmt *ye;
|
||||
yang_stmt *ymod;
|
||||
cxobj *xnacm = NULL;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@
|
|||
* @retval 1 Validation OK
|
||||
*/
|
||||
static int
|
||||
generic_validate(yang_spec *yspec,
|
||||
generic_validate(yang_stmt *yspec,
|
||||
transaction_data_t *td,
|
||||
cbuf *cbret)
|
||||
{
|
||||
|
|
@ -168,7 +168,7 @@ startup_common(clicon_handle h,
|
|||
cbuf *cbret)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
int ret;
|
||||
modstate_diff_t *msd = NULL;
|
||||
cxobj *xt = NULL;
|
||||
|
|
@ -341,7 +341,7 @@ from_validate_common(clicon_handle h,
|
|||
cbuf *cbret)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
int i;
|
||||
cxobj *xn;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
static int
|
||||
backend_terminate(clicon_handle h)
|
||||
{
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
char *pidfile = clicon_backend_pidfile(h);
|
||||
int sockfamily = clicon_sock_family(h);
|
||||
char *sockpath = clicon_sock(h);
|
||||
|
|
@ -174,7 +174,7 @@ nacm_load_external(clicon_handle h)
|
|||
{
|
||||
int retval = -1;
|
||||
char *filename; /* NACM config file */
|
||||
yang_spec *yspec = NULL;
|
||||
yang_stmt *yspec = NULL;
|
||||
cxobj *xt = NULL;
|
||||
struct stat st;
|
||||
FILE *f = NULL;
|
||||
|
|
@ -325,8 +325,8 @@ main(int argc,
|
|||
int sockfamily;
|
||||
char *nacm_mode;
|
||||
int logdst = CLICON_LOG_SYSLOG|CLICON_LOG_STDERR;
|
||||
yang_spec *yspec = NULL;
|
||||
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
yang_stmt *yspec = NULL;
|
||||
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
char *str;
|
||||
int ss = -1; /* server socket */
|
||||
cbuf *cbret = NULL; /* startup cbuf if invalid */
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ clixon_plugin_reset(clicon_handle h,
|
|||
*/
|
||||
int
|
||||
clixon_plugin_statedata(clicon_handle h,
|
||||
yang_spec *yspec,
|
||||
yang_stmt *yspec,
|
||||
char *xpath,
|
||||
cxobj **xret)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ int backend_plugin_initiate(clicon_handle h);
|
|||
|
||||
int clixon_plugin_reset(clicon_handle h, char *db);
|
||||
|
||||
int clixon_plugin_statedata(clicon_handle h, yang_spec *yspec, char *xpath, cxobj **xtop);
|
||||
int clixon_plugin_statedata(clicon_handle h, yang_stmt *yspec, char *xpath, cxobj **xtop);
|
||||
transaction_data_t * transaction_new(void);
|
||||
int transaction_free(transaction_data_t *);
|
||||
|
||||
|
|
|
|||
|
|
@ -327,7 +327,7 @@ startup_failsafe(clicon_handle h)
|
|||
*/
|
||||
int
|
||||
startup_module_state(clicon_handle h,
|
||||
yang_spec *yspec)
|
||||
yang_stmt *yspec)
|
||||
{
|
||||
int retval = -1;
|
||||
cxobj *x = NULL;
|
||||
|
|
|
|||
|
|
@ -44,6 +44,6 @@ int startup_db_reset(clicon_handle h, char *db);
|
|||
int startup_mode_startup(clicon_handle h, char *db, cbuf *cbret);
|
||||
int startup_extraxml(clicon_handle h, char *file, cbuf *cbret);
|
||||
int startup_failsafe(clicon_handle h);
|
||||
int startup_module_state(clicon_handle h, yang_spec *yspec);
|
||||
int startup_module_state(clicon_handle h, yang_stmt *yspec);
|
||||
|
||||
#endif /* _BACKEND_STARTUP_H_ */
|
||||
|
|
|
|||
|
|
@ -213,9 +213,9 @@ cli_dbxml(clicon_handle h,
|
|||
int len;
|
||||
cg_var *arg;
|
||||
cbuf *cb = NULL;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cxobj *xbot = NULL; /* xpath, NULL if datastore */
|
||||
yang_node *y = NULL; /* yang spec of xpath */
|
||||
yang_stmt *y = NULL; /* yang spec of xpath */
|
||||
cxobj *xtop = NULL; /* xpath root */
|
||||
cxobj *xa; /* attribute */
|
||||
cxobj *xb; /* body */
|
||||
|
|
@ -243,7 +243,7 @@ cli_dbxml(clicon_handle h,
|
|||
xml_type_set(xa, CX_ATTR);
|
||||
if (xml_value_set(xa, xml_operation2str(op)) < 0)
|
||||
goto done;
|
||||
if (y->yn_keyword != Y_LIST && y->yn_keyword != Y_LEAF_LIST){
|
||||
if (y->ys_keyword != Y_LIST && y->ys_keyword != Y_LEAF_LIST){
|
||||
len = cvec_len(cvv);
|
||||
if (len > 1){
|
||||
cval = cvec_i(cvv, len-1);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ yang2cli_var_identityref(yang_stmt *ys,
|
|||
cprintf(cb, ">");
|
||||
if (helptext)
|
||||
cprintf(cb, "(\"%s\")", helptext);
|
||||
if ((ybaseref = yang_find((yang_node*)ytype, Y_BASE, NULL)) != NULL &&
|
||||
if ((ybaseref = yang_find(ytype, Y_BASE, NULL)) != NULL &&
|
||||
(ybaseid = yang_find_identity(ys, ybaseref->ys_argument)) != NULL){
|
||||
if (cvec_len(ybaseid->ys_cvec) > 0){
|
||||
cprintf(cb, "|<%s:%s choice:", ys->ys_argument, cvtypestr);
|
||||
|
|
@ -329,7 +329,7 @@ yang2cli_var_sub(clicon_handle h,
|
|||
cprintf(cb, " choice:");
|
||||
i = 0;
|
||||
yi = NULL;
|
||||
while ((yi = yn_each((yang_node*)ytype, yi)) != NULL){
|
||||
while ((yi = yn_each(ytype, yi)) != NULL){
|
||||
if (yi->ys_keyword != Y_ENUM && yi->ys_keyword != Y_BIT)
|
||||
continue;
|
||||
if (i)
|
||||
|
|
@ -443,7 +443,7 @@ yang2cli_var_union(clicon_handle h,
|
|||
* not resolved types (unless they are built-in, but the resolve call is
|
||||
* made in the union_one call.
|
||||
*/
|
||||
while ((ytsub = yn_each((yang_node*)ytype, ytsub)) != NULL){
|
||||
while ((ytsub = yn_each(ytype, ytsub)) != NULL){
|
||||
if (ytsub->ys_keyword != Y_TYPE)
|
||||
continue;
|
||||
if (i++)
|
||||
|
|
@ -563,7 +563,7 @@ yang2cli_leaf(clicon_handle h,
|
|||
char *s;
|
||||
|
||||
/* description */
|
||||
if ((yd = yang_find((yang_node*)ys, Y_DESCRIPTION, NULL)) != NULL){
|
||||
if ((yd = yang_find(ys, Y_DESCRIPTION, NULL)) != NULL){
|
||||
if ((helptext = strdup(yd->ys_argument)) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "strdup");
|
||||
goto done;
|
||||
|
|
@ -618,7 +618,7 @@ yang2cli_container(clicon_handle h,
|
|||
char *s;
|
||||
|
||||
cprintf(cb, "%*s%s", level*3, "", ys->ys_argument);
|
||||
if ((yd = yang_find((yang_node*)ys, Y_DESCRIPTION, NULL)) != NULL){
|
||||
if ((yd = yang_find(ys, Y_DESCRIPTION, NULL)) != NULL){
|
||||
if ((helptext = strdup(yd->ys_argument)) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "strdup");
|
||||
goto done;
|
||||
|
|
@ -668,7 +668,7 @@ yang2cli_list(clicon_handle h,
|
|||
char *s;
|
||||
|
||||
cprintf(cb, "%*s%s", level*3, "", ys->ys_argument);
|
||||
if ((yd = yang_find((yang_node*)ys, Y_DESCRIPTION, NULL)) != NULL){
|
||||
if ((yd = yang_find(ys, Y_DESCRIPTION, NULL)) != NULL){
|
||||
if ((helptext = strdup(yd->ys_argument)) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "strdup");
|
||||
goto done;
|
||||
|
|
@ -683,7 +683,7 @@ yang2cli_list(clicon_handle h,
|
|||
/* Iterate over individual keys */
|
||||
while ((cvi = cvec_each(cvk, cvi)) != NULL) {
|
||||
keyname = cv_string_get(cvi);
|
||||
if ((yleaf = yang_find((yang_node*)ys, Y_LEAF, keyname)) == NULL){
|
||||
if ((yleaf = yang_find(ys, Y_LEAF, keyname)) == NULL){
|
||||
clicon_err(OE_XML, 0, "List statement \"%s\" has no key leaf \"%s\"",
|
||||
ys->ys_argument, keyname);
|
||||
goto done;
|
||||
|
|
@ -836,7 +836,7 @@ yang2cli_stmt(clicon_handle h,
|
|||
*/
|
||||
int
|
||||
yang2cli(clicon_handle h,
|
||||
yang_spec *yspec,
|
||||
yang_stmt *yspec,
|
||||
parse_tree *ptnew,
|
||||
enum genmodel_type gt)
|
||||
{
|
||||
|
|
@ -851,8 +851,8 @@ yang2cli(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
/* Traverse YANG, loop through all modules and generate CLI */
|
||||
for (i=0; i<yspec->yp_len; i++)
|
||||
if ((ymod = yspec->yp_stmt[i]) != NULL){
|
||||
for (i=0; i<yspec->ys_len; i++)
|
||||
if ((ymod = yspec->ys_stmt[i]) != NULL){
|
||||
if (yang2cli_stmt(h, ymod, gt, 0, cb) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int yang2cli(clicon_handle h, yang_spec *yspec, parse_tree *ptnew,
|
||||
int yang2cli(clicon_handle h, yang_stmt *yspec, parse_tree *ptnew,
|
||||
enum genmodel_type gt);
|
||||
|
||||
#endif /* _CLI_GENERATE_H_ */
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ cli_history_save(clicon_handle h)
|
|||
static int
|
||||
cli_terminate(clicon_handle h)
|
||||
{
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cxobj *x;
|
||||
|
||||
clicon_rpc_close_session(h);
|
||||
|
|
@ -279,8 +279,8 @@ main(int argc, char **argv)
|
|||
int help = 0;
|
||||
int logdst = CLICON_LOG_STDERR;
|
||||
char *restarg = NULL; /* what remains after options */
|
||||
yang_spec *yspec;
|
||||
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
yang_stmt *yspec;
|
||||
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
struct passwd *pw;
|
||||
char *str;
|
||||
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ expand_dbvar(void *h,
|
|||
int j;
|
||||
int k;
|
||||
cg_var *cv;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cxobj *xtop = NULL; /* xpath root */
|
||||
cxobj *xbot = NULL; /* xpath, NULL if datastore */
|
||||
yang_node *y = NULL; /* yang spec of xpath */
|
||||
yang_stmt *y = NULL; /* yang spec of xpath */
|
||||
yang_stmt *ytype;
|
||||
yang_stmt *ypath;
|
||||
cxobj *xcur;
|
||||
|
|
@ -183,9 +183,9 @@ expand_dbvar(void *h,
|
|||
* Here the whole syntax tree is loaded, and it would be better to offload
|
||||
* such operations to the datastore by a generic xpath function.
|
||||
*/
|
||||
if ((ytype = yang_find((yang_node*)y, Y_TYPE, NULL)) != NULL)
|
||||
if ((ytype = yang_find(y, Y_TYPE, NULL)) != NULL)
|
||||
if (strcmp(ytype->ys_argument, "leafref")==0){
|
||||
if ((ypath = yang_find((yang_node*)ytype, Y_PATH, NULL)) == NULL){
|
||||
if ((ypath = yang_find(ytype, Y_PATH, NULL)) == NULL){
|
||||
clicon_err(OE_DB, 0, "Leafref %s requires path statement", ytype->ys_argument);
|
||||
goto done;
|
||||
}
|
||||
|
|
@ -394,17 +394,17 @@ show_yang(clicon_handle h,
|
|||
cvec *cvv,
|
||||
cvec *argv)
|
||||
{
|
||||
yang_node *yn;
|
||||
yang_stmt *yn;
|
||||
char *str = NULL;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
if (cvec_len(argv) > 0){
|
||||
str = cv_string_get(cvec_i(argv, 0));
|
||||
yn = (yang_node*)yang_find((yang_node*)yspec, 0, str);
|
||||
yn = yang_find(yspec, 0, str);
|
||||
}
|
||||
else
|
||||
yn = (yang_node*)yspec;
|
||||
yn = yspec;
|
||||
yang_print(stdout, yn);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -443,7 +443,7 @@ cli_show_config(clicon_handle h,
|
|||
cxobj *xc;
|
||||
cxobj *xerr;
|
||||
enum genmodel_type gt;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
|
||||
if (cvec_len(argv) != 3 && cvec_len(argv) != 4){
|
||||
clicon_err(OE_PLUGIN, 0, "Got %d arguments. Expected: <dbname>,<format>,<xpath>[,<attr>]", cvec_len(argv));
|
||||
|
|
@ -622,7 +622,7 @@ cli_show_auto(clicon_handle h,
|
|||
cvec *argv)
|
||||
{
|
||||
int retval = 1;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
char *api_path_fmt; /* xml key format */
|
||||
// char *api_path = NULL; /* xml key */
|
||||
char *db;
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ netconf_input_packet(clicon_handle h,
|
|||
cxobj *xret = NULL; /* Return (out) */
|
||||
cxobj *xrpc;
|
||||
cxobj *xc;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
int ret;
|
||||
cxobj *xa;
|
||||
cxobj *xa2;
|
||||
|
|
@ -290,7 +290,7 @@ send_hello(clicon_handle h,
|
|||
static int
|
||||
netconf_terminate(clicon_handle h)
|
||||
{
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cxobj *x;
|
||||
|
||||
clixon_plugin_exit(h);
|
||||
|
|
@ -357,8 +357,8 @@ main(int argc,
|
|||
int logdst = CLICON_LOG_STDERR;
|
||||
struct passwd *pw;
|
||||
struct timeval tv = {0,}; /* timeout */
|
||||
yang_spec *yspec = NULL;
|
||||
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
yang_stmt *yspec = NULL;
|
||||
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
char *str;
|
||||
|
||||
/* Create handle */
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ netconf_notification_cb(int s,
|
|||
cxobj *xn = NULL; /* event xml */
|
||||
cxobj *xt = NULL; /* top xml */
|
||||
clicon_handle h = (clicon_handle)arg;
|
||||
yang_spec *yspec = NULL;
|
||||
yang_stmt *yspec = NULL;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
/* get msg (this is the reason this function is called) */
|
||||
|
|
@ -541,7 +541,7 @@ netconf_application_rpc(clicon_handle h,
|
|||
cxobj **xret)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_spec *yspec = NULL; /* application yspec */
|
||||
yang_stmt *yspec = NULL; /* application yspec */
|
||||
yang_stmt *yrpc = NULL;
|
||||
yang_stmt *ymod = NULL;
|
||||
yang_stmt *yinput;
|
||||
|
|
@ -579,11 +579,11 @@ netconf_application_rpc(clicon_handle h,
|
|||
"</rpc-error></rpc-reply>", xml_name(xn));
|
||||
goto ok;
|
||||
}
|
||||
yrpc = yang_find((yang_node*)ymod, Y_RPC, xml_name(xn));
|
||||
yrpc = yang_find(ymod, Y_RPC, xml_name(xn));
|
||||
/* Check if found */
|
||||
if (yrpc != NULL){
|
||||
/* 1. Check xn arguments with input statement. */
|
||||
if ((yinput = yang_find((yang_node*)yrpc, Y_INPUT, NULL)) != NULL){
|
||||
if ((yinput = yang_find(yrpc, Y_INPUT, NULL)) != NULL){
|
||||
xml_spec_set(xn, yinput); /* needed for xml_spec_populate */
|
||||
if (xml_apply(xn, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
||||
goto done;
|
||||
|
|
@ -616,7 +616,7 @@ netconf_application_rpc(clicon_handle h,
|
|||
* (2) Uncertain how validation errors should be logged/handled
|
||||
*/
|
||||
if (0)
|
||||
if ((youtput = yang_find((yang_node*)yrpc, Y_OUTPUT, NULL)) != NULL){
|
||||
if ((youtput = yang_find(yrpc, Y_OUTPUT, NULL)) != NULL){
|
||||
xoutput=xpath_first(*xret, "/");
|
||||
xml_spec_set(xoutput, youtput); /* needed for xml_spec_populate */
|
||||
if (xml_apply(xoutput, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ api_return_err(clicon_handle h,
|
|||
int
|
||||
restconf_terminate(clicon_handle h)
|
||||
{
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cxobj *x;
|
||||
int fs; /* fgcx socket */
|
||||
|
||||
|
|
|
|||
|
|
@ -521,8 +521,8 @@ main(int argc,
|
|||
clicon_handle h;
|
||||
char *dir;
|
||||
int logdst = CLICON_LOG_SYSLOG;
|
||||
yang_spec *yspec = NULL;
|
||||
yang_spec *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
yang_stmt *yspec = NULL;
|
||||
yang_stmt *yspecfg = NULL; /* For config XXX clixon bug */
|
||||
char *stream_path;
|
||||
int finish;
|
||||
char *str;
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ api_data_get2(clicon_handle h,
|
|||
cbuf *cbpath = NULL;
|
||||
char *path;
|
||||
cbuf *cbx = NULL;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
cxobj *xret = NULL;
|
||||
cxobj *xerr = NULL; /* malloced */
|
||||
cxobj *xe = NULL;
|
||||
|
|
@ -443,8 +443,8 @@ api_data_post(clicon_handle h,
|
|||
cxobj *xtop = NULL; /* xpath root */
|
||||
cxobj *xbot = NULL;
|
||||
cxobj *x;
|
||||
yang_node *y = NULL;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *y = NULL;
|
||||
yang_stmt *yspec;
|
||||
cxobj *xa;
|
||||
cxobj *xret = NULL;
|
||||
cxobj *xretcom = NULL; /* return from commit */
|
||||
|
|
@ -710,8 +710,8 @@ api_data_put(clicon_handle h,
|
|||
cxobj *xbot = NULL;
|
||||
cxobj *xparent;
|
||||
cxobj *x;
|
||||
yang_node *y = NULL;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *y = NULL;
|
||||
yang_stmt *yspec;
|
||||
cxobj *xa;
|
||||
char *api_path;
|
||||
cxobj *xret = NULL;
|
||||
|
|
@ -847,7 +847,7 @@ api_data_put(clicon_handle h,
|
|||
goto ok;
|
||||
}
|
||||
/* If list or leaf-list, api-path keys must match data keys */
|
||||
if (y && (y->yn_keyword == Y_LIST ||y->yn_keyword == Y_LEAF_LIST)){
|
||||
if (y && (y->ys_keyword == Y_LIST ||y->ys_keyword == Y_LEAF_LIST)){
|
||||
if (match_list_keys((yang_stmt*)y, x, xbot) < 0){
|
||||
if (netconf_operation_failed_xml(&xerr, "protocol", "api-path keys do not match data keys") < 0)
|
||||
goto done;
|
||||
|
|
@ -988,8 +988,8 @@ api_data_delete(clicon_handle h,
|
|||
cxobj *xbot = NULL;
|
||||
cxobj *xa;
|
||||
cbuf *cbx = NULL;
|
||||
yang_node *y = NULL;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *y = NULL;
|
||||
yang_stmt *yspec;
|
||||
enum operation_type op = OP_DELETE;
|
||||
cxobj *xret = NULL;
|
||||
cxobj *xretcom = NULL; /* return from commmit */
|
||||
|
|
@ -1128,7 +1128,7 @@ api_operations_get(clicon_handle h,
|
|||
int use_xml)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
yang_stmt *ymod; /* yang module */
|
||||
yang_stmt *yc;
|
||||
char *namespace;
|
||||
|
|
@ -1146,10 +1146,10 @@ api_operations_get(clicon_handle h,
|
|||
cprintf(cbx, "{\"operations\": {");
|
||||
ymod = NULL;
|
||||
i = 0;
|
||||
while ((ymod = yn_each((yang_node*)yspec, ymod)) != NULL) {
|
||||
while ((ymod = yn_each(yspec, ymod)) != NULL) {
|
||||
namespace = yang_find_mynamespace(ymod);
|
||||
yc = NULL;
|
||||
while ((yc = yn_each((yang_node*)ymod, yc)) != NULL) {
|
||||
while ((yc = yn_each(ymod, yc)) != NULL) {
|
||||
if (yc->ys_keyword != Y_RPC)
|
||||
continue;
|
||||
if (use_xml)
|
||||
|
|
@ -1207,7 +1207,7 @@ static int
|
|||
api_operations_post_input(clicon_handle h,
|
||||
FCGX_Request *r,
|
||||
char *data,
|
||||
yang_spec *yspec,
|
||||
yang_stmt *yspec,
|
||||
yang_stmt *yrpc,
|
||||
cxobj *xrpc,
|
||||
int pretty,
|
||||
|
|
@ -1342,7 +1342,7 @@ static int
|
|||
api_operations_post_output(clicon_handle h,
|
||||
FCGX_Request *r,
|
||||
cxobj *xret,
|
||||
yang_spec *yspec,
|
||||
yang_stmt *yspec,
|
||||
yang_stmt *youtput,
|
||||
char *namespace,
|
||||
int pretty,
|
||||
|
|
@ -1511,14 +1511,14 @@ api_operations_post(clicon_handle h,
|
|||
int retval = -1;
|
||||
int i;
|
||||
char *oppath = path;
|
||||
yang_spec *yspec;
|
||||
yang_stmt *yspec;
|
||||
yang_stmt *youtput = NULL;
|
||||
yang_stmt *yrpc = NULL;
|
||||
cxobj *xret = NULL;
|
||||
cxobj *xerr = NULL; /* malloced must be freed */
|
||||
cxobj *xtop = NULL; /* xpath root */
|
||||
cxobj *xbot = NULL;
|
||||
yang_node *y = NULL;
|
||||
yang_stmt *y = NULL;
|
||||
cxobj *xoutput = NULL;
|
||||
cxobj *xa;
|
||||
cxobj *xe;
|
||||
|
|
@ -1561,7 +1561,7 @@ api_operations_post(clicon_handle h,
|
|||
*/
|
||||
if (nodeid_split(oppath+1, &prefix, &id) < 0) /* +1 skip / */
|
||||
goto done;
|
||||
if ((ys = yang_find((yang_node*)yspec, Y_MODULE, prefix)) == NULL){
|
||||
if ((ys = yang_find(yspec, Y_MODULE, prefix)) == NULL){
|
||||
if (netconf_operation_failed_xml(&xerr, "protocol", "yang module not found") < 0)
|
||||
goto done;
|
||||
if ((xe = xpath_first(xerr, "rpc-error")) == NULL){
|
||||
|
|
@ -1572,7 +1572,7 @@ api_operations_post(clicon_handle h,
|
|||
goto done;
|
||||
goto ok;
|
||||
}
|
||||
if ((yrpc = yang_find((yang_node*)ys, Y_RPC, id)) == NULL){
|
||||
if ((yrpc = yang_find(ys, Y_RPC, id)) == NULL){
|
||||
if (netconf_missing_element_xml(&xerr, "application", id, "RPC not defined") < 0)
|
||||
goto done;
|
||||
if ((xe = xpath_first(xerr, "rpc-error")) == NULL){
|
||||
|
|
@ -1704,7 +1704,7 @@ api_operations_post(clicon_handle h,
|
|||
clicon_debug(1, "%s 8. Receive reply:%s", __FUNCTION__, cbuf_get(ccc));
|
||||
}
|
||||
#endif
|
||||
youtput = yang_find((yang_node*)yrpc, Y_OUTPUT, NULL);
|
||||
youtput = yang_find(yrpc, Y_OUTPUT, NULL);
|
||||
if ((ret = api_operations_post_output(h, r, xret, yspec, youtput, namespace,
|
||||
pretty, use_xml, &xoutput)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue