warnings and asserts
This commit is contained in:
parent
0d7351093b
commit
07fe90b4c4
4 changed files with 18 additions and 6 deletions
|
|
@ -408,7 +408,7 @@ api_data_put(clicon_handle h,
|
|||
cbuf *cbx = NULL;
|
||||
cxobj *x;
|
||||
cxobj *xbot = NULL;
|
||||
cxobj *xtop;
|
||||
cxobj *xtop = NULL;
|
||||
cxobj *xp;
|
||||
yang_node *y = NULL;
|
||||
yang_spec *yspec;
|
||||
|
|
|
|||
|
|
@ -773,6 +773,11 @@ text_put(xmldb_handle xh,
|
|||
clicon_err(OE_XML, 0, "dbfile NULL");
|
||||
goto done;
|
||||
}
|
||||
if (x1 && strcmp(xml_name(x1),"config")!=0){
|
||||
clicon_err(OE_XML, 0, "Top-level symbol of modification tree is %s, expected \"config\"",
|
||||
xml_name(x1));
|
||||
goto done;
|
||||
}
|
||||
if ((yspec = th->th_yangspec) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "No yang spec");
|
||||
goto done;
|
||||
|
|
@ -797,8 +802,13 @@ text_put(xmldb_handle xh,
|
|||
if (singleconfigroot(x0, &x0) < 0)
|
||||
goto done;
|
||||
}
|
||||
assert(strcmp(xml_name(x0),"config")==0);
|
||||
/* Here x0 looks like: <config>...</config> */
|
||||
if (strcmp(xml_name(x0),"config")!=0){
|
||||
clicon_err(OE_XML, 0, "Top-level symbol is %s, expected \"config\"",
|
||||
xml_name(x0));
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Validate existing config tree */
|
||||
if (xml_apply(x0, CX_ELMNT, xml_spec_populate, yspec) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -1473,7 +1473,9 @@ api_path2xml_vec(char **vec,
|
|||
yang_stmt *y = NULL;
|
||||
|
||||
if ((name = vec[0]) == NULL){
|
||||
if (xpathp)
|
||||
*xpathp = x0;
|
||||
if (ypathp)
|
||||
*ypathp = y0;
|
||||
return 0;
|
||||
} /* E.g "x=1,2" -> name:x restval=1,2 */
|
||||
|
|
|
|||
|
|
@ -168,12 +168,12 @@ xml_parse_bslash1(struct xml_parse_yacc_arg *ya,
|
|||
cxobj *xc;
|
||||
|
||||
if (strcmp(xml_name(x), name)){
|
||||
clicon_err(OE_XML, 0, "Sanity check failed: %s vs %s",
|
||||
clicon_err(OE_XML, 0, "XML parse sanity check failed: %s vs %s",
|
||||
xml_name(x), name);
|
||||
goto done;
|
||||
}
|
||||
if (xml_namespace(x)!=NULL){
|
||||
clicon_err(OE_XML, 0, "Sanity check failed: %s:%s vs %s\n",
|
||||
clicon_err(OE_XML, 0, "XML parse sanity check failed: %s:%s vs %s\n",
|
||||
xml_namespace(x), xml_name(x), name);
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue