Structural C-code change: Merged yang_spec and yang_node types into yang_stmt

This commit is contained in:
Olof hagsand 2019-04-02 12:27:33 +02:00
parent 4f9e942103
commit b5f1f7346e
52 changed files with 492 additions and 496 deletions

View file

@ -76,7 +76,7 @@
/*! Get YANG specification for application
* Must use hash functions directly since they are not strings.
*/
yang_spec *
yang_stmt *
clicon_dbspec_yang(clicon_handle h)
{
clicon_hash_t *cdat = clicon_data(h);
@ -84,7 +84,7 @@ clicon_dbspec_yang(clicon_handle h)
void *p;
if ((p = hash_value(cdat, "dbspec_yang", &len)) != NULL)
return *(yang_spec **)p;
return *(yang_stmt **)p;
return NULL;
}
@ -92,8 +92,8 @@ clicon_dbspec_yang(clicon_handle h)
* ys must be a malloced pointer
*/
int
clicon_dbspec_yang_set(clicon_handle h,
struct yang_spec *ys)
clicon_dbspec_yang_set(clicon_handle h,
yang_stmt *ys)
{
clicon_hash_t *cdat = clicon_data(h);
@ -151,7 +151,7 @@ clicon_nacm_ext_set(clicon_handle h,
/*! Get YANG specification for clixon config
* Must use hash functions directly since they are not strings.
*/
yang_spec *
yang_stmt *
clicon_config_yang(clicon_handle h)
{
clicon_hash_t *cdat = clicon_data(h);
@ -159,7 +159,7 @@ clicon_config_yang(clicon_handle h)
void *p;
if ((p = hash_value(cdat, "control_yang", &len)) != NULL)
return *(yang_spec **)p;
return *(yang_stmt **)p;
return NULL;
}
@ -167,8 +167,8 @@ clicon_config_yang(clicon_handle h)
* ys must be a malloced pointer
*/
int
clicon_config_yang_set(clicon_handle h,
struct yang_spec *ys)
clicon_config_yang_set(clicon_handle h,
yang_stmt *ys)
{
clicon_hash_t *cdat = clicon_data(h);

View file

@ -186,7 +186,7 @@ xml_copy_marked(cxobj *x0,
* node in list is marked */
if (mark && yt && yt->ys_keyword == Y_LIST){
/* XXX: I think yang_key_match is suboptimal here */
if ((iskey = yang_key_match((yang_node*)yt, name)) < 0)
if ((iskey = yang_key_match(yt, name)) < 0)
goto done;
if (iskey){
if ((xcopy = xml_new(name, x1, xml_spec(x))) == NULL)
@ -220,7 +220,7 @@ xml_copy_marked(cxobj *x0,
*/
static int
text_read_modstate(clicon_handle h,
yang_spec *yspec,
yang_stmt *yspec,
cxobj *xt,
modstate_diff_t *msd)
{
@ -306,7 +306,7 @@ text_read_modstate(clicon_handle h,
int
xmldb_readfile(clicon_handle h,
const char *db,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xp,
modstate_diff_t *msd)
{
@ -391,7 +391,7 @@ xmldb_get_nocache(clicon_handle h,
{
int retval = -1;
char *dbfile = NULL;
yang_spec *yspec;
yang_stmt *yspec;
cxobj *xt = NULL;
cxobj *x;
int fd = -1;
@ -513,7 +513,7 @@ xmldb_get_cache(clicon_handle h,
modstate_diff_t *msd)
{
int retval = -1;
yang_spec *yspec;
yang_stmt *yspec;
cxobj *x0t = NULL; /* (cached) top of tree */
cxobj *x0;
cxobj **xvec = NULL;

View file

@ -41,6 +41,6 @@
*/
int xmldb_get_cache(clicon_handle h, const char *db, char *xpath, int config, cxobj **xret, modstate_diff_t *msd);
int xmldb_get_nocache(clicon_handle h, const char *db, char *xpath, int config, cxobj **xret, modstate_diff_t *msd);
int xmldb_readfile(clicon_handle h, const char *db, yang_spec *yspec, cxobj **xp, modstate_diff_t *msd);
int xmldb_readfile(clicon_handle h, const char *db, yang_stmt *yspec, cxobj **xp, modstate_diff_t *msd);
#endif /* _CLIXON_DATASTORE_READ_H */

View file

@ -111,7 +111,7 @@ valgrind --tool=callgrind datastore_client -d candidate -b /tmp/text -p ../datas
static int
text_modify(clicon_handle h,
cxobj *x0,
yang_node *y0,
yang_stmt *y0,
cxobj *x0p,
cxobj *x1,
enum operation_type op,
@ -144,7 +144,7 @@ text_modify(clicon_handle h,
if (xml_operation(opstr, &op) < 0)
goto done;
x1name = xml_name(x1);
if (y0->yn_keyword == Y_LEAF_LIST || y0->yn_keyword == Y_LEAF){
if (y0->ys_keyword == Y_LEAF_LIST || y0->ys_keyword == Y_LEAF){
x1bstr = xml_body(x1);
switch(op){
case OP_CREATE:
@ -181,7 +181,7 @@ text_modify(clicon_handle h,
#if 0
/* If it is key I dont want to mark it */
if ((iamkey=yang_key_match(y0->yn_parent, x1name)) < 0)
if ((iamkey=yang_key_match(y0->ys_parent, x1name)) < 0)
goto done;
if (!iamkey && op==OP_NONE)
#else
@ -262,7 +262,7 @@ text_modify(clicon_handle h,
can be modified in its entirety only.
Any "operation" attributes present on subelements of an anyxml
node are ignored by the NETCONF server.*/
if (y0->yn_keyword == Y_ANYXML || y0->yn_keyword == Y_ANYDATA){
if (y0->ys_keyword == Y_ANYXML || y0->ys_keyword == Y_ANYDATA){
if (op == OP_NONE)
break;
if (op==OP_MERGE && !permit && xnacm){
@ -344,7 +344,7 @@ text_modify(clicon_handle h,
x1cname = xml_name(x1c);
x0c = x0vec[i++];
yc = yang_find_datanode(y0, x1cname);
if ((ret = text_modify(h, x0c, (yang_node*)yc, x0, x1c, op,
if ((ret = text_modify(h, x0c, yc, x0, x1c, op,
username, xnacm, permit, cbret)) < 0)
goto done;
/* If xml return - ie netconf error xml tree, then stop and return OK */
@ -404,7 +404,7 @@ static int
text_modify_top(clicon_handle h,
cxobj *x0,
cxobj *x1,
yang_spec *yspec,
yang_stmt *yspec,
enum operation_type op,
char *username,
cxobj *xnacm,
@ -489,7 +489,7 @@ text_modify_top(clicon_handle h,
if (ys_module_by_xml(yspec, x1c, &ymod) <0)
goto done;
if (ymod != NULL)
yc = yang_find_datanode((yang_node*)ymod, x1cname);
yc = yang_find_datanode(ymod, x1cname);
if (yc == NULL){
if (netconf_unknown_element(cbret, "application", x1cname, "Unassigned yang spec") < 0)
goto done;
@ -506,7 +506,7 @@ text_modify_top(clicon_handle h,
x0c = NULL;
}
#endif
if ((ret = text_modify(h, x0c, (yang_node*)yc, x0, x1c, op,
if ((ret = text_modify(h, x0c, yc, x0, x1c, op,
username, xnacm, permit, cbret)) < 0)
goto done;
/* If xml return - ie netconf error xml tree, then stop and return OK */
@ -552,7 +552,7 @@ xml_container_presence(cxobj *x,
/* Mark node that is: container, have no children, dont have presence */
if (y->ys_keyword == Y_CONTAINER &&
xml_child_nr_notype(x, CX_ATTR)==0 &&
yang_find((yang_node*)y, Y_PRESENCE, NULL) == NULL)
yang_find(y, Y_PRESENCE, NULL) == NULL)
xml_flag_set(x, XML_FLAG_MARK); /* Mark, remove later */
retval = 0;
done:
@ -597,7 +597,7 @@ xmldb_put(clicon_handle h,
char *dbfile = NULL;
FILE *f = NULL;
cbuf *cb = NULL;
yang_spec *yspec;
yang_stmt *yspec;
cxobj *x0 = NULL;
db_elmnt *de = NULL;
int ret;

View file

@ -318,7 +318,7 @@ xml2json1_cbuf(cbuf *cb,
enum array_element_type xc_arraytype;
yang_stmt *ys;
yang_stmt *ymod; /* yang module */
yang_spec *yspec = NULL; /* yang spec */
yang_stmt *yspec = NULL; /* yang spec */
int bodystr0=1;
char *prefix=NULL; /* prefix / local namespace name */
char *namespace=NULL; /* namespace uri */
@ -728,7 +728,7 @@ xml2json_vec(FILE *f,
* @note the opposite - xml2ns is made inline in xml2json1_cbuf
*/
int
json2xml_ns(yang_spec *yspec,
json2xml_ns(yang_stmt *yspec,
cxobj *x,
cxobj **xerr)
{
@ -860,7 +860,7 @@ json_parse_str(char *str,
*/
int
json_parse_file(int fd,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xt)
{
int retval = -1;

View file

@ -976,7 +976,7 @@ netconf_malformed_message_xml(cxobj **xret,
*/
int
netconf_trymerge(cxobj *x,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xret)
{
int retval = -1;
@ -1018,7 +1018,7 @@ netconf_module_load(clicon_handle h)
{
int retval = -1;
cxobj *xc;
yang_spec *yspec;
yang_stmt *yspec;
yspec = clicon_dbspec_yang(h);
if ((xc = clicon_conf_xml(h)) == NULL){

View file

@ -131,7 +131,7 @@ clicon_option_dump(clicon_handle h,
static int
parse_configfile(clicon_handle h,
const char *filename,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xconfig)
{
struct stat st;
@ -290,7 +290,7 @@ clicon_option_add(clicon_handle h,
*/
int
clicon_options_main(clicon_handle h,
yang_spec *yspec)
yang_stmt *yspec)
{
int retval = -1;
char *configfile;

View file

@ -165,7 +165,7 @@ clicon_msg_encode(char *format, ...)
*/
int
clicon_msg_decode(struct clicon_msg *msg,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xml)
{
int retval = -1;

View file

@ -92,7 +92,7 @@ clicon_rpc_msg(clicon_handle h,
int port;
char *retdata = NULL;
cxobj *xret = NULL;
yang_spec *yspec;
yang_stmt *yspec;
#ifdef RPC_USERNAME_ASSERT
assert(strstr(msg->op_body, "username")!=NULL); /* XXX */

View file

@ -546,7 +546,7 @@ stream_notify(clicon_handle h,
va_list args;
int len;
cxobj *xev = NULL;
yang_spec *yspec = NULL;
yang_stmt *yspec = NULL;
char *str = NULL;
cbuf *cb = NULL;
char timestr[28];
@ -621,7 +621,7 @@ stream_notify_xml(clicon_handle h,
int retval = -1;
cxobj *xev = NULL;
cxobj *xml2; /* copy */
yang_spec *yspec = NULL;
yang_stmt *yspec = NULL;
char *str = NULL;
cbuf *cb = NULL;
char timestr[28];

View file

@ -1605,7 +1605,7 @@ xmltree2cbuf(cbuf *cb,
*/
static int
_xml_parse(const char *str,
yang_spec *yspec,
yang_stmt *yspec,
cxobj *xt)
{
int retval = -1;
@ -1685,7 +1685,7 @@ FSM(char *tag,
int
xml_parse_file(int fd,
char *endtag,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xt)
{
int retval = -1;
@ -1772,7 +1772,7 @@ xml_parse_file(int fd,
*/
int
xml_parse_string(const char *str,
yang_spec *yspec,
yang_stmt *yspec,
cxobj **xtop)
{
if (*xtop == NULL)
@ -1804,7 +1804,7 @@ xml_parse_string(const char *str,
*/
int
xml_parse_va(cxobj **xtop,
yang_spec *yspec,
yang_stmt *yspec,
const char *format, ...)
{
int retval = -1;

View file

@ -423,7 +423,7 @@ clixon_xml_changelog_init(clicon_handle h)
char *filename;
int fd = -1;
cxobj *xt = NULL;
yang_spec *yspec;
yang_stmt *yspec;
cbuf *cbret = NULL;
int ret;

View file

@ -213,7 +213,7 @@ xml2cli(FILE *f,
/* If list then first loop through keys */
xe = NULL;
while ((xe = xml_child_each(x, xe, -1)) != NULL){
if ((match = yang_key_match((yang_node*)ys, xml_name(xe))) < 0)
if ((match = yang_key_match(ys, xml_name(xe))) < 0)
goto done;
if (!match)
continue;
@ -226,7 +226,7 @@ xml2cli(FILE *f,
xe = NULL;
while ((xe = xml_child_each(x, xe, -1)) != NULL){
if (ys->ys_keyword == Y_LIST){
if ((match = yang_key_match((yang_node*)ys, xml_name(xe))) < 0)
if ((match = yang_key_match(ys, xml_name(xe))) < 0)
goto done;
if (match){
fprintf(f, "%s\n", cbuf_get(cbpre));
@ -268,7 +268,7 @@ validate_leafref(cxobj *xt,
if ((leafrefbody = xml_body(xt)) == NULL)
goto ok;
if ((ypath = yang_find((yang_node*)ytype, Y_PATH, NULL)) == NULL){
if ((ypath = yang_find(ytype, Y_PATH, NULL)) == NULL){
if (netconf_missing_element(cbret, "application", ytype->ys_argument, "Leafref requires path statement") < 0)
goto done;
goto fail;
@ -348,7 +348,7 @@ validate_identityref(cxobj *xt,
node = cbuf_get(cb);
}
/* This is the type's base reference */
if ((ybaseref = yang_find((yang_node*)ytype, Y_BASE, NULL)) == NULL){
if ((ybaseref = yang_find(ytype, Y_BASE, NULL)) == NULL){
if (netconf_missing_element(cbret, "application", ytype->ys_argument, "Identityref validation failed, no base") < 0)
goto done;
goto fail;
@ -501,9 +501,9 @@ check_choice(cxobj *xt,
cbuf *cbret)
{
int retval = -1;
yang_node *yc;
yang_stmt *yc;
yang_stmt *y;
yang_node *yp;
yang_stmt *yp;
cxobj *x;
cxobj *xp;
@ -516,7 +516,7 @@ check_choice(cxobj *xt,
if ((x != xt) &&
(y = xml_spec(x)) != NULL &&
(yp = yang_choice(y)) != NULL &&
yp == (yang_node*)yc){
yp == yc){
if (netconf_bad_element(cbret, "application", xml_name(x), "Element in choice statement already exists") < 0)
goto done;
goto fail;
@ -549,7 +549,7 @@ check_mandatory(cxobj *xt,
cxobj *x;
yang_stmt *y;
yang_stmt *yc;
yang_node *yp;
yang_stmt *yp;
cvec *cvk = NULL; /* vector of index keys */
cg_var *cvi;
char *keyname;
@ -598,7 +598,7 @@ check_mandatory(cxobj *xt,
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
if ((y = xml_spec(x)) != NULL &&
(yp = yang_choice(y)) != NULL &&
yp == (yang_node*)yc){
yp == yc){
break; /* leave loop with x set */
}
}
@ -777,7 +777,7 @@ xml_yang_validate_all(cxobj *xt,
/* Special case if leaf is leafref, then first check against
current xml tree
*/
if ((yc = yang_find((yang_node*)ys, Y_TYPE, NULL)) != NULL){
if ((yc = yang_find(ys, Y_TYPE, NULL)) != NULL){
if (strcmp(yc->ys_argument, "leafref") == 0){
if (validate_leafref(xt, yc, cbret) < 0)
goto done;
@ -787,7 +787,7 @@ xml_yang_validate_all(cxobj *xt,
goto done;
}
}
if ((yc = yang_find((yang_node*)ys, Y_MIN_ELEMENTS, NULL)) != NULL){
if ((yc = yang_find(ys, Y_MIN_ELEMENTS, NULL)) != NULL){
/* The behavior of the constraint depends on the type of the
* leaf-list's or list's closest ancestor node in the schema tree
* that is not a non-presence container (see Section 7.5.1):
@ -811,7 +811,7 @@ xml_yang_validate_all(cxobj *xt,
}
#endif
}
if ((yc = yang_find((yang_node*)ys, Y_MAX_ELEMENTS, NULL)) != NULL){
if ((yc = yang_find(ys, Y_MAX_ELEMENTS, NULL)) != NULL){
}
break;
@ -821,14 +821,14 @@ xml_yang_validate_all(cxobj *xt,
/* must sub-node RFC 7950 Sec 7.5.3. Can be several.
* XXX. use yang path instead? */
yc = NULL;
while ((yc = yn_each((yang_node*)ys, yc)) != NULL) {
while ((yc = yn_each(ys, yc)) != NULL) {
if (yc->ys_keyword != Y_MUST)
continue;
xpath = yc->ys_argument; /* "must" has xpath argument */
if ((nr = xpath_vec_bool(xt, "%s", xpath)) < 0)
goto done;
if (!nr){
ye = yang_find((yang_node*)yc, Y_ERROR_MESSAGE, NULL);
ye = yang_find(yc, Y_ERROR_MESSAGE, NULL);
if (netconf_operation_failed(cbret, "application",
ye?ye->ys_argument:"must xpath validation failed") < 0)
goto done;
@ -836,7 +836,7 @@ xml_yang_validate_all(cxobj *xt,
}
}
/* "when" sub-node RFC 7950 Sec 7.21.5. Can only be one. */
if ((yc = yang_find((yang_node*)ys, Y_WHEN, NULL)) != NULL){
if ((yc = yang_find(ys, Y_WHEN, NULL)) != NULL){
xpath = yc->ys_argument; /* "when" has xpath argument */
if ((nr = xpath_vec_bool(xt, "%s", xpath)) < 0)
goto done;
@ -932,7 +932,7 @@ xml2cvec(cxobj *xt,
/* Go through all children of the xml tree */
while ((xc = xml_child_each(xt, xc, CX_ELMNT)) != NULL){
name = xml_name(xc);
if ((ys = yang_find_datanode((yang_node*)yt, name)) == NULL){
if ((ys = yang_find_datanode(yt, name)) == NULL){
clicon_debug(0, "%s: yang sanity problem: %s in xml but not present in yang under %s",
__FUNCTION__, name, yt->ys_argument);
if ((body = xml_body(xc)) != NULL){
@ -1161,7 +1161,7 @@ xml_diff1(yang_stmt *ys,
* Bot xml trees should be freed with xml_free()
*/
int
xml_diff(yang_spec *yspec,
xml_diff(yang_stmt *yspec,
cxobj *x1,
cxobj *x2,
cxobj ***first,
@ -1215,7 +1215,7 @@ yang2api_path_fmt_1(yang_stmt *ys,
int inclkey,
cbuf *cb)
{
yang_node *yp; /* parent */
yang_stmt *yp; /* parent */
int i;
cvec *cvk = NULL; /* vector of index keys */
int retval = -1;
@ -1225,15 +1225,15 @@ yang2api_path_fmt_1(yang_stmt *ys,
goto done;
}
if (yp != NULL && /* XXX rm */
yp->yn_keyword != Y_MODULE &&
yp->yn_keyword != Y_SUBMODULE){
yp->ys_keyword != Y_MODULE &&
yp->ys_keyword != Y_SUBMODULE){
if (yang2api_path_fmt_1((yang_stmt *)yp, 1, cb) < 0) /* recursive call */
goto done;
if (yp->yn_keyword != Y_CHOICE && yp->yn_keyword != Y_CASE)
if (yp->ys_keyword != Y_CHOICE && yp->ys_keyword != Y_CASE)
cprintf(cb, "/");
}
else /* top symbol - mark with name prefix */
cprintf(cb, "/%s:", yp->yn_argument);
cprintf(cb, "/%s:", yp->ys_argument);
if (inclkey){
if (ys->ys_keyword != Y_CHOICE && ys->ys_keyword != Y_CASE)
@ -1241,7 +1241,7 @@ yang2api_path_fmt_1(yang_stmt *ys,
}
else{
if (ys->ys_keyword == Y_LEAF && yp &&
yp->yn_keyword == Y_LIST){
yp->ys_keyword == Y_LIST){
if (yang_key_match(yp, ys->ys_argument) == 0)
cprintf(cb, "%s", ys->ys_argument); /* Not if leaf and key */
}
@ -1521,7 +1521,7 @@ xml_tree_prune_flagged_sub(cxobj *xt,
}
/* If it is key dont remove it yet (see second round) */
if (yt){
if ((iskey = yang_key_match((yang_node*)yt, xml_name(x))) < 0)
if ((iskey = yang_key_match(yt, xml_name(x))) < 0)
goto done;
if (iskey){
anykey++;
@ -1549,7 +1549,7 @@ xml_tree_prune_flagged_sub(cxobj *xt,
while ((x = xml_child_each(xt, x, CX_ELMNT)) != NULL) {
/* If it is key remove it here */
if (yt){
if ((iskey = yang_key_match((yang_node*)yt, xml_name(x))) < 0)
if ((iskey = yang_key_match(yt, xml_name(x))) < 0)
goto done;
if (iskey && xml_purge(x) < 0)
goto done;
@ -1726,7 +1726,7 @@ xml_non_config_data(cxobj *xt,
int
xml_spec_populate_rpc(clicon_handle h,
cxobj *xrpc,
yang_spec *yspec)
yang_stmt *yspec)
{
int retval = -1;
yang_stmt *yrpc = NULL; /* yang node */
@ -1743,12 +1743,12 @@ xml_spec_populate_rpc(clicon_handle h,
if (ys_module_by_xml(yspec, x, &ymod) < 0)
goto done;
if (ymod != NULL)
yrpc = yang_find((yang_node*)ymod, Y_RPC, xml_name(x));
yrpc = yang_find(ymod, Y_RPC, xml_name(x));
/* Non-strict semantics: loop through all modules to find the node
*/
if (yrpc){
xml_spec_set(x, yrpc);
if ((yi = yang_find((yang_node*)yrpc, Y_INPUT, NULL)) != NULL){
if ((yi = yang_find(yrpc, Y_INPUT, NULL)) != NULL){
/* kludge rpc -> input XXX THIS HIDES AN ERROR IN xml_spec_populate */
xml_spec_set(x, yi);
if (xml_apply(x, CX_ELMNT, xml_spec_populate, yspec) < 0)
@ -1777,25 +1777,25 @@ xml_spec_populate(cxobj *x,
{
int retval = -1;
// clicon_handle h = (clicon_handle)arg;
yang_spec *yspec = NULL; /* yang spec */
yang_stmt *yspec = NULL; /* yang spec */
yang_stmt *y = NULL; /* yang node */
yang_stmt *yparent; /* yang parent */
yang_stmt *ymod; /* yang module */
cxobj *xp = NULL; /* xml parent */
char *name;
yspec = (yang_spec*)arg;
yspec = (yang_stmt*)arg;
if (xml_spec(x))
; // goto ok;
xp = xml_parent(x);
name = xml_name(x);
if (xp && (yparent = xml_spec(xp)) != NULL)
y = yang_find_datanode((yang_node*)yparent, name);
y = yang_find_datanode(yparent, name);
else if (yspec){
if (ys_module_by_xml(yspec, x, &ymod) < 0)
goto done;
if (ymod != NULL)
y = yang_find_schemanode((yang_node*)ymod, name);
y = yang_find_schemanode(ymod, name);
}
if (y)
xml_spec_set(x, y);
@ -1848,7 +1848,7 @@ xml_spec_populate(cxobj *x,
* @see api_path2xml For api-path to xml tree
*/
int
api_path2xpath(yang_spec *yspec,
api_path2xpath(yang_stmt *yspec,
cvec *cvv,
int offset,
cbuf *xpath)
@ -1881,10 +1881,10 @@ api_path2xpath(yang_spec *yspec,
clicon_err(OE_YANG, ENOENT, "No such yang module: %s", prefix);
goto fail;
}
y = yang_find_datanode((yang_node*)ymod, name);
y = yang_find_datanode(ymod, name);
}
else
y = yang_find_datanode((yang_node*)y, name);
y = yang_find_datanode(y, name);
if (y == NULL){
clicon_err(OE_YANG, errno, "Unknown element: '%s'", name);
goto fail;
@ -1955,10 +1955,10 @@ static int
api_path2xml_vec(char **vec,
int nvec,
cxobj *x0,
yang_node *y0,
yang_stmt *y0,
yang_class nodeclass,
cxobj **xpathp,
yang_node **ypathp)
yang_stmt **ypathp)
{
int retval = -1;
int j;
@ -1997,22 +1997,22 @@ api_path2xml_vec(char **vec,
/* Split into prefix and localname */
if (nodeid_split(nodeid, &prefix, &name) < 0)
goto done;
if (y0->yn_keyword == Y_SPEC){ /* top-node */
if (y0->ys_keyword == Y_SPEC){ /* top-node */
if (prefix == NULL){
clicon_err(OE_XML, EINVAL, "api-path element '%s', expected prefix:name", nodeid);
goto fail;
}
if ((ymod = yang_find_module_by_name((yang_spec*)y0, prefix)) == NULL){
if ((ymod = yang_find_module_by_name(y0, prefix)) == NULL){
clicon_err(OE_YANG, EINVAL, "api-path element prefix: '%s', no such yang module", prefix);
goto fail;
}
namespace = yang_find_mynamespace(ymod);
y0 = (yang_node*)ymod;
y0 = ymod;
}
y = (nodeclass==YC_SCHEMANODE)?
yang_find_schemanode((yang_node*)y0, name):
yang_find_datanode((yang_node*)y0, name);
yang_find_schemanode(y0, name):
yang_find_datanode(y0, name);
if (y == NULL){
clicon_err(OE_YANG, EINVAL, "api-path name: '%s', no such yang element", name);
goto fail;
@ -2082,7 +2082,7 @@ api_path2xml_vec(char **vec,
goto done;
}
if ((retval = api_path2xml_vec(vec+1, nvec-1,
x, (yang_node*)y,
x, y,
nodeclass,
xpathp, ypathp)) < 1)
goto done;
@ -2127,11 +2127,11 @@ api_path2xml_vec(char **vec,
*/
int
api_path2xml(char *api_path,
yang_spec *yspec,
yang_stmt *yspec,
cxobj *xtop,
yang_class nodeclass,
cxobj **xbotp,
yang_node **ybotp)
yang_stmt **ybotp)
{
int retval = -1;
char **vec = NULL;
@ -2155,7 +2155,7 @@ api_path2xml(char *api_path,
}
nvec--; /* NULL-terminated */
if ((retval = api_path2xml_vec(vec+1, nvec,
xtop, (yang_node*)yspec, nodeclass,
xtop, yspec, nodeclass,
xbotp, ybotp)) < 1)
goto done;
xml_yang_root(*xbotp, &xroot);
@ -2229,7 +2229,7 @@ xmlns_assign(cxobj *x)
*/
static int
xml_merge1(cxobj *x0,
yang_node *y0,
yang_stmt *y0,
cxobj *x0p,
cxobj *x1,
char **reason)
@ -2250,7 +2250,7 @@ xml_merge1(cxobj *x0,
assert(y0);
x1name = xml_name(x1);
if (y0->yn_keyword == Y_LEAF_LIST || y0->yn_keyword == Y_LEAF){
if (y0->ys_keyword == Y_LEAF_LIST || y0->ys_keyword == Y_LEAF){
x1bstr = xml_body(x1);
if (x0==NULL){
if ((x0 = xml_new(x1name, x0p, (yang_stmt*)y0)) == NULL)
@ -2300,7 +2300,7 @@ xml_merge1(cxobj *x0,
x0c = NULL;
if (yc && match_base_child(x0, x1c, yc, &x0c) < 0)
goto done;
if (xml_merge1(x0c, (yang_node*)yc, x0, x1c, reason) < 0)
if (xml_merge1(x0c, yc, x0, x1c, reason) < 0)
goto done;
if (*reason != NULL)
goto ok;
@ -2339,7 +2339,7 @@ xml_merge1(cxobj *x0,
int
xml_merge(cxobj *x0,
cxobj *x1,
yang_spec *yspec,
yang_stmt *yspec,
char **reason)
{
int retval = -1;
@ -2370,7 +2370,7 @@ xml_merge(cxobj *x0,
goto ok;
}
/* Get yang spec of the child */
if ((yc = yang_find_datanode((yang_node*)ymod, x1cname)) == NULL){
if ((yc = yang_find_datanode(ymod, x1cname)) == NULL){
if (reason){
if ((cbr = cbuf_new()) == NULL){
clicon_err(OE_XML, errno, "cbuf_new");
@ -2391,7 +2391,7 @@ xml_merge(cxobj *x0,
* it is treated as a match, and x0c will remain
* If it is overwritten, then x0c should be removed here.
*/
if (xml_merge1(x0c, (yang_node*)yc, x0, x1c, reason) < 0)
if (xml_merge1(x0c, yc, x0, x1c, reason) < 0)
goto done;
if (*reason != NULL)
break;
@ -2422,7 +2422,7 @@ yang_enum_int_value(cxobj *node,
int32_t *val)
{
int retval = -1;
yang_spec *yspec;
yang_stmt *yspec;
yang_stmt *ys;
yang_stmt *ytype;
yang_stmt *yrestype; /* resolved type */
@ -2436,17 +2436,17 @@ yang_enum_int_value(cxobj *node,
goto done;
if ((yspec = ys_spec(ys)) == NULL)
goto done;
if ((ytype = yang_find((yang_node *)ys, Y_TYPE, NULL)) == NULL)
if ((ytype = yang_find(ys, Y_TYPE, NULL)) == NULL)
goto done;
if (yang_type_resolve(ys, ys, ytype, &yrestype,
NULL, NULL, NULL, NULL) < 0)
goto done;
if (yrestype==NULL || strcmp(yrestype->ys_argument, "enumeration"))
goto done;
if ((yenum = yang_find((yang_node *)yrestype, Y_ENUM, xml_body(node))) == NULL)
if ((yenum = yang_find(yrestype, Y_ENUM, xml_body(node))) == NULL)
goto done;
/* Should assign value if yval not found */
if ((yval = yang_find((yang_node *)yenum, Y_VALUE, NULL)) == NULL)
if ((yval = yang_find(yenum, Y_VALUE, NULL)) == NULL)
goto done;
/* reason is string containing why int could not be parsed */
if (parse_int32(yval->ys_argument, val, &reason) < 0)

View file

@ -50,7 +50,7 @@ struct xml_parse_yacc_arg{
cxobj *ya_xelement; /* xml active element */
cxobj *ya_xparent; /* xml parent element*/
int ya_skipspace; /* If set, remove all non-terminal bodies (strip pretty-print) */
yang_spec *ya_yspec; /* If set, top-level yang-spec */
yang_stmt *ya_yspec; /* If set, top-level yang-spec */
int ya_lex_state; /* lex start condition (AMPERSAND) */
};

View file

@ -145,7 +145,7 @@ xml_cv_cache(cxobj *x,
int
xml_child_spec(cxobj *x,
cxobj *xp,
yang_spec *yspec,
yang_stmt *yspec,
yang_stmt **yresult)
{
int retval = -1;
@ -161,11 +161,11 @@ xml_child_spec(cxobj *x,
/* First case: parent already has an associated yang statement,
* then find matching child of that */
if (yparent->ys_keyword == Y_RPC){
if ((yi = yang_find((yang_node*)yparent, Y_INPUT, NULL)) != NULL)
y = yang_find_datanode((yang_node*)yi, name);
if ((yi = yang_find(yparent, Y_INPUT, NULL)) != NULL)
y = yang_find_datanode(yi, name);
}
else
y = yang_find_datanode((yang_node*)yparent, name);
y = yang_find_datanode(yparent, name);
}
else if (yspec){
/* Second case, this is a "root", need to find yang stmt from spec
@ -173,13 +173,13 @@ xml_child_spec(cxobj *x,
if (ys_module_by_xml(yspec, xp, &ymod) < 0)
goto done;
if (ymod != NULL)
y = yang_find_schemanode((yang_node*)ymod, name);
y = yang_find_schemanode(ymod, name);
}
else
y = NULL;
/* kludge rpc -> input */
if (y && y->ys_keyword == Y_RPC && yang_find((yang_node*)y, Y_INPUT, NULL))
y = yang_find((yang_node*)y, Y_INPUT, NULL);
if (y && y->ys_keyword == Y_RPC && yang_find(y, Y_INPUT, NULL))
y = yang_find(y, Y_INPUT, NULL);
*yresult = y;
retval = 0;
done:
@ -256,7 +256,7 @@ xml_cmp(const void* arg1,
* otherwise sort according to key
*/
if (yang_config(y1)==0 ||
yang_find((yang_node*)y1, Y_ORDERED_BY, "user") != NULL){
yang_find(y1, Y_ORDERED_BY, "user") != NULL){
equal = nr1-nr2;
goto done; /* Ordered by user or state data : maintain existing order */
}
@ -349,7 +349,7 @@ xml_cmp1(cxobj *x,
match = strcmp(name, xml_name(x));
break;
case Y_LEAF_LIST: /* Match with name and value */
if (userorder && yang_find((yang_node*)y, Y_ORDERED_BY, "user") != NULL)
if (userorder && yang_find(y, Y_ORDERED_BY, "user") != NULL)
*userorder=1;
if ((b=xml_body(x)) == NULL)
match = 1;
@ -357,7 +357,7 @@ xml_cmp1(cxobj *x,
match = strcmp(keyval[0], b);
break;
case Y_LIST: /* Match with array of key values */
if (userorder && yang_find((yang_node*)y, Y_ORDERED_BY, "user") != NULL)
if (userorder && yang_find(y, Y_ORDERED_BY, "user") != NULL)
*userorder=1;
/* All must match */
for (i=0; i<keynr; i++){
@ -719,8 +719,8 @@ match_base_child(cxobj *x0,
int yorder;
cxobj *x0c = NULL;
yang_stmt *y0c;
yang_node *y0p;
yang_node *yp; /* yang parent */
yang_stmt *y0p;
yang_stmt *yp; /* yang parent */
*x0cp = NULL; /* init return value */
/* Special case is if yc parent (yp) is choice/case

File diff suppressed because it is too large Load diff

View file

@ -524,7 +524,7 @@ yang_cardinality(clicon_handle h,
/* 2) For all in 1 and 1..n list, if 0 such children ->ERROR */
for (yc = &ycplist[0]; (int)yc->yc_parent == pk; yc++){
if (yc->yc_min &&
yang_find((yang_node*)yt, yc->yc_child, NULL) == NULL){
yang_find(yt, yc->yc_child, NULL) == NULL){
clicon_err(OE_YANG, 0, "%s: \"%s\" is missing but is mandatory child of \"%s\"",
modname, yang_key2str(yc->yc_child), yang_key2str(pk));
goto done;
@ -533,7 +533,7 @@ yang_cardinality(clicon_handle h,
/* 3) For all in 0..1 and 1 list, if >1 such children ->ERROR */
for (yc = &ycplist[0]; (int)yc->yc_parent == pk; yc++){
if (yc->yc_max<NMAX &&
(nr = yang_match((yang_node*)yt, yc->yc_child, NULL)) > yc->yc_max){
(nr = yang_match(yt, yc->yc_child, NULL)) > yc->yc_max){
clicon_err(OE_YANG, 0, "%s: \"%s\" has %d children of type \"%s\", but only %d allowed",
modname,
yang_key2str(pk),

View file

@ -111,7 +111,7 @@ int
yang_modules_init(clicon_handle h)
{
int retval = -1;
yang_spec *yspec;
yang_stmt *yspec;
yspec = clicon_dbspec_yang(h);
if (!clicon_option_bool(h, "CLICON_MODULE_LIBRARY_RFC7895"))
@ -143,15 +143,15 @@ yang_modules_init(clicon_handle h)
char *
yang_modules_revision(clicon_handle h)
{
yang_spec *yspec;
yang_stmt *yspec;
yang_stmt *ymod;
yang_stmt *yrev;
char *revision = NULL;
yspec = clicon_dbspec_yang(h);
if ((ymod = yang_find((yang_node*)yspec, Y_MODULE, "ietf-yang-library")) != NULL ||
(ymod = yang_find((yang_node*)yspec, Y_SUBMODULE, "ietf-yang-library")) != NULL){
if ((yrev = yang_find((yang_node*)ymod, Y_REVISION, NULL)) != NULL){
if ((ymod = yang_find(yspec, Y_MODULE, "ietf-yang-library")) != NULL ||
(ymod = yang_find(yspec, Y_SUBMODULE, "ietf-yang-library")) != NULL){
if ((yrev = yang_find(ymod, Y_REVISION, NULL)) != NULL){
revision = yrev->ys_argument;
}
}
@ -162,7 +162,7 @@ yang_modules_revision(clicon_handle h)
*/
static int
yms_build(clicon_handle h,
yang_spec *yspec,
yang_stmt *yspec,
char *msid,
int brief,
cbuf *cb)
@ -175,12 +175,12 @@ yms_build(clicon_handle h,
yang_stmt *ymod; /* generic module */
yang_stmt *yns = NULL; /* namespace */
if ((ylib = yang_find((yang_node*)yspec, Y_MODULE, module)) == NULL &&
(ylib = yang_find((yang_node*)yspec, Y_SUBMODULE, module)) == NULL){
if ((ylib = yang_find(yspec, Y_MODULE, module)) == NULL &&
(ylib = yang_find(yspec, Y_SUBMODULE, module)) == NULL){
clicon_err(OE_YANG, 0, "%s not found", module);
goto done;
}
if ((yns = yang_find((yang_node*)ylib, Y_NAMESPACE, NULL)) == NULL){
if ((yns = yang_find(ylib, Y_NAMESPACE, NULL)) == NULL){
clicon_err(OE_YANG, 0, "%s yang namespace not found", module);
goto done;
}
@ -189,17 +189,17 @@ yms_build(clicon_handle h,
cprintf(cb,"<module-set-id>%s</module-set-id>", msid);
ymod = NULL;
while ((ymod = yn_each((yang_node*)yspec, ymod)) != NULL) {
while ((ymod = yn_each(yspec, ymod)) != NULL) {
if (ymod->ys_keyword != Y_MODULE &&
ymod->ys_keyword != Y_SUBMODULE)
continue;
cprintf(cb,"<module>");
cprintf(cb,"<name>%s</name>", ymod->ys_argument);
if ((ys = yang_find((yang_node*)ymod, Y_REVISION, NULL)) != NULL)
if ((ys = yang_find(ymod, Y_REVISION, NULL)) != NULL)
cprintf(cb,"<revision>%s</revision>", ys->ys_argument);
else
cprintf(cb,"<revision></revision>");
if ((ys = yang_find((yang_node*)ymod, Y_NAMESPACE, NULL)) != NULL)
if ((ys = yang_find(ymod, Y_NAMESPACE, NULL)) != NULL)
cprintf(cb,"<namespace>%s</namespace>", ys->ys_argument);
else
cprintf(cb,"<namespace></namespace>");
@ -207,7 +207,7 @@ yms_build(clicon_handle h,
submodules */
if (!brief){
yc = NULL;
while ((yc = yn_each((yang_node*)ymod, yc)) != NULL) {
while ((yc = yn_each(ymod, yc)) != NULL) {
switch(yc->ys_keyword){
case Y_FEATURE:
if (yc->ys_cv && cv_bool_get(yc->ys_cv))
@ -220,12 +220,12 @@ yms_build(clicon_handle h,
cprintf(cb, "<conformance-type>implement</conformance-type>");
}
yc = NULL;
while ((yc = yn_each((yang_node*)ymod, yc)) != NULL) {
while ((yc = yn_each(ymod, yc)) != NULL) {
switch(yc->ys_keyword){
case Y_SUBMODULE:
cprintf(cb,"<submodule>");
cprintf(cb,"<name>%s</name>", yc->ys_argument);
if ((ys = yang_find((yang_node*)yc, Y_REVISION, NULL)) != NULL)
if ((ys = yang_find(yc, Y_REVISION, NULL)) != NULL)
cprintf(cb,"<revision>%s</revision>", ys->ys_argument);
else
cprintf(cb,"<revision></revision>");
@ -273,7 +273,7 @@ x +--ro namespace inet:uri
*/
int
yang_modules_state_get(clicon_handle h,
yang_spec *yspec,
yang_stmt *yspec,
char *xpath,
int brief,
cxobj **xret)
@ -362,7 +362,7 @@ mod_ns_upgrade(clicon_handle h,
uint32_t from = 0;
uint32_t to = 0;
int ret;
yang_spec *yspec;
yang_stmt *yspec;
/* Make upgrade callback for this XML, specifying the module
* namespace, from and to revision.
@ -376,7 +376,7 @@ mod_ns_upgrade(clicon_handle h,
yspec = clicon_dbspec_yang(h);
if ((ymod = yang_find_module_by_namespace(yspec, ns)) == NULL)
goto fail;
if ((yrev = yang_find((yang_node*)ymod, Y_REVISION, NULL)) == NULL)
if ((yrev = yang_find(ymod, Y_REVISION, NULL)) == NULL)
goto fail;
if (ys_parse_date_arg(yrev->ys_argument, &to) < 0)
goto done;

View file

@ -46,8 +46,8 @@
*/
struct ys_stack{
struct ys_stack *ys_next;
struct yang_node *ys_node;
struct ys_stack *ys_next;
yang_stmt *ys_node;
};
struct clicon_yang_yacc_arg{ /* XXX: mostly unrelevant */
@ -88,7 +88,7 @@ extern char *clixon_yang_parsetext;
int yang_scan_init(struct clicon_yang_yacc_arg *ya);
int yang_scan_exit(struct clicon_yang_yacc_arg *ya);
int yang_parse_init(struct clicon_yang_yacc_arg *ya, yang_spec *ysp);
int yang_parse_init(struct clicon_yang_yacc_arg *ya, yang_stmt *ysp);
int yang_parse_exit(struct clicon_yang_yacc_arg *ya);
int clixon_yang_parselex(void *_ya);
@ -96,6 +96,6 @@ int clixon_yang_parseparse(void *);
void clixon_yang_parseerror(void *_ya, char*);
int ystack_pop(struct clicon_yang_yacc_arg *ya);
struct ys_stack *ystack_push(struct clicon_yang_yacc_arg *ya, yang_node *yn);
struct ys_stack *ystack_push(struct clicon_yang_yacc_arg *ya, yang_stmt *yn);
#endif /* _CLIXON_YANG_PARSE_H_ */

View file

@ -218,7 +218,7 @@ clixon_yang_parseerror(void *_yy,
int
yang_parse_init(struct clicon_yang_yacc_arg *yy,
yang_spec *ysp)
yang_stmt *ysp)
{
return 0;
}
@ -246,7 +246,7 @@ ystack_pop(struct clicon_yang_yacc_arg *yy)
struct ys_stack *
ystack_push(struct clicon_yang_yacc_arg *yy,
yang_node *yn)
yang_stmt *yn)
{
struct ys_stack *ystack;
@ -278,7 +278,7 @@ ysp_add(struct clicon_yang_yacc_arg *yy,
{
struct ys_stack *ystack = yy->yy_stack;
yang_stmt *ys = NULL;
yang_node *yn;
yang_stmt *yn;
ystack = yy->yy_stack;
if (ystack == NULL){
@ -317,7 +317,7 @@ ysp_add_push(struct clicon_yang_yacc_arg *yy,
if ((ys = ysp_add(yy, keyword, argument, extra)) == NULL)
return NULL;
if (ystack_push(yy, (yang_node*)ys) == NULL)
if (ystack_push(yy, ys) == NULL)
return NULL;
return ys;
}

View file

@ -474,7 +474,7 @@ cv_validate1(cg_var *cv,
if (strcmp(restype, "enumeration") == 0){
found = 0;
yi = NULL;
while ((yi = yn_each((yang_node*)yrestype, yi)) != NULL){
while ((yi = yn_each(yrestype, yi)) != NULL){
if (yi->ys_keyword != Y_ENUM)
continue;
if (strcmp(yi->ys_argument, str) == 0){
@ -500,7 +500,7 @@ cv_validate1(cg_var *cv,
continue;
found = 0;
yi = NULL;
while ((yi = yn_each((yang_node*)yrestype, yi)) != NULL){
while ((yi = yn_each(yrestype, yi)) != NULL){
if (yi->ys_keyword != Y_BIT)
continue;
if (strcmp(yi->ys_argument, v) == 0){
@ -630,7 +630,7 @@ ys_cv_validate_union(yang_stmt *ys,
yang_stmt *yt = NULL;
char *reason1 = NULL; /* saved reason */
while ((yt = yn_each((yang_node*)yrestype, yt)) != NULL){
while ((yt = yn_each(yrestype, yt)) != NULL){
if (yt->ys_keyword != Y_TYPE)
continue;
if ((retval = ys_cv_validate_union_one(ys, reason, yt, type, val)) < 0)
@ -744,12 +744,12 @@ ys_typedef(yang_stmt *ys)
static yang_stmt *
ys_typedef_up(yang_stmt *ys)
{
yang_node *yn;
yang_stmt *yn;
while (ys != NULL && !ys_typedef(ys)){
yn = ys->ys_parent;
/* Some extra stuff to ensure ys is a stmt */
if (yn && yn->yn_keyword == Y_SPEC)
if (yn && yn->ys_keyword == Y_SPEC)
yn = NULL;
ys = (yang_stmt*)yn;
}
@ -791,7 +791,7 @@ yang_find_identity(yang_stmt *ys,
char *prefix = NULL;
yang_stmt *ymodule;
yang_stmt *yid = NULL;
yang_node *yn;
yang_stmt *yn;
if ((id = strchr(identity, ':')) == NULL)
id = identity;
@ -804,7 +804,7 @@ yang_find_identity(yang_stmt *ys,
if (prefix){ /* Go to top and find import that matches */
if ((ymodule = yang_find_module_by_prefix(ys, prefix)) == NULL)
goto done;
yid = yang_find((yang_node*)ymodule, Y_IDENTITY, id);
yid = yang_find(ymodule, Y_IDENTITY, id);
}
else{
while (1){
@ -812,11 +812,11 @@ yang_find_identity(yang_stmt *ys,
if ((ys = ys_typedef_up(ys)) == NULL) /* If reach top */
break;
/* Here find identity */
if ((yid = yang_find((yang_node*)ys, Y_IDENTITY, id)) != NULL)
if ((yid = yang_find(ys, Y_IDENTITY, id)) != NULL)
break;
/* Did not find a matching typedef there, proceed to next level */
yn = ys->ys_parent;
if (yn && yn->yn_keyword == Y_SPEC)
if (yn && yn->ys_keyword == Y_SPEC)
yn = NULL;
ys = (yang_stmt*)yn;
}
@ -910,7 +910,7 @@ yang_type_resolve(yang_stmt *yorig,
char *type;
char *prefix = NULL;
int retval = -1;
yang_node *yn;
yang_stmt *yn;
yang_stmt *yrmod; /* module where resolved type is looked for */
if (options)
@ -926,10 +926,10 @@ yang_type_resolve(yang_stmt *yorig,
goto ok;
}
/* Resolving type restrictions */
yrange = yang_find((yang_node*)ytype, Y_RANGE, NULL);
ylength = yang_find((yang_node*)ytype, Y_LENGTH, NULL);
ypattern = yang_find((yang_node*)ytype, Y_PATTERN, NULL);
yfraction = yang_find((yang_node*)ytype, Y_FRACTION_DIGITS, NULL);
yrange = yang_find(ytype, Y_RANGE, NULL);
ylength = yang_find(ytype, Y_LENGTH, NULL);
ypattern = yang_find(ytype, Y_PATTERN, NULL);
yfraction = yang_find(ytype, Y_FRACTION_DIGITS, NULL);
/* Check if type is basic type. If so, return that */
if (prefix == NULL && yang_builtin(type)){
@ -946,7 +946,7 @@ yang_type_resolve(yang_stmt *yorig,
prefix, type, ys_module(yorig)->ys_argument);
goto done;
}
if ((rytypedef = yang_find((yang_node*)yrmod, Y_TYPEDEF, type)) == NULL)
if ((rytypedef = yang_find(yrmod, Y_TYPEDEF, type)) == NULL)
goto ok; /* unresolved */
ys = rytypedef;
}
@ -958,17 +958,17 @@ yang_type_resolve(yang_stmt *yorig,
break;
}
/* Here find typedef */
if ((rytypedef = yang_find((yang_node*)ys, Y_TYPEDEF, type)) != NULL)
if ((rytypedef = yang_find(ys, Y_TYPEDEF, type)) != NULL)
break;
/* Did not find a matching typedef there, proceed to next level */
yn = ys->ys_parent;
if (yn && (yn->yn_keyword == Y_SPEC))
if (yn && (yn->ys_keyword == Y_SPEC))
yn = NULL;
ys = (yang_stmt*)yn;
}
if (rytypedef != NULL){ /* We have found a typedef */
/* Find associated type statement */
if ((rytype = yang_find((yang_node*)rytypedef, Y_TYPE, NULL)) == NULL){
if ((rytype = yang_find(rytypedef, Y_TYPE, NULL)) == NULL){
clicon_err(OE_DB, 0, "mandatory type object is not found");
goto done;
}
@ -1045,7 +1045,7 @@ yang_type_get(yang_stmt *ys,
if (options)
*options = 0x0;
/* Find mandatory type */
if ((ytype = yang_find((yang_node*)ys, Y_TYPE, NULL)) == NULL){
if ((ytype = yang_find(ys, Y_TYPE, NULL)) == NULL){
clicon_err(OE_DB, 0, "mandatory type object is not found");
goto done;
}