Discriminate XPath debugging
This commit is contained in:
parent
cb134875f9
commit
af77da38bb
5 changed files with 21 additions and 20 deletions
|
|
@ -459,6 +459,7 @@ cli_dbxml(clixon_handle h,
|
||||||
goto done;
|
goto done;
|
||||||
xbot = xtop;
|
xbot = xtop;
|
||||||
if (api_path){
|
if (api_path){
|
||||||
|
clixon_debug(CLIXON_DBG_XPATH, "%s api_path:%s", __FUNCTION__, api_path);
|
||||||
if ((ret = api_path2xml(api_path, yspec0, xtop, YC_DATANODE, 1, &xbot, &y, &xerr)) < 0)
|
if ((ret = api_path2xml(api_path, yspec0, xtop, YC_DATANODE, 1, &xbot, &y, &xerr)) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
if (ret == 0){
|
if (ret == 0){
|
||||||
|
|
|
||||||
|
|
@ -698,7 +698,7 @@ api_path2xpath_cvv(cvec *api_path,
|
||||||
/* api-path: prefix points to module */
|
/* api-path: prefix points to module */
|
||||||
if (nodeid_split(nodeid, &prefix, &name) < 0)
|
if (nodeid_split(nodeid, &prefix, &name) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s [%d] cvname: %s:%s",
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s [%d] cvname: %s:%s",
|
||||||
__FUNCTION__, i, prefix?prefix:"", name);
|
__FUNCTION__, i, prefix?prefix:"", name);
|
||||||
/* top-node must have prefix */
|
/* top-node must have prefix */
|
||||||
if (i == 0 && prefix == NULL){
|
if (i == 0 && prefix == NULL){
|
||||||
|
|
@ -762,7 +762,7 @@ api_path2xpath_cvv(cvec *api_path,
|
||||||
*/
|
*/
|
||||||
if (xml_nsctx_get_prefix(nsc, namespace, &xprefix) == 0){
|
if (xml_nsctx_get_prefix(nsc, namespace, &xprefix) == 0){
|
||||||
xprefix = yang_find_myprefix(y);
|
xprefix = yang_find_myprefix(y);
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s prefix not found add it %s", __FUNCTION__, xprefix);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s prefix not found add it %s", __FUNCTION__, xprefix);
|
||||||
/* not found, add it to nsc
|
/* not found, add it to nsc
|
||||||
* XXX: do we always have to add it? It could be default?
|
* XXX: do we always have to add it? It could be default?
|
||||||
*/
|
*/
|
||||||
|
|
@ -837,7 +837,7 @@ api_path2xpath_cvv(cvec *api_path,
|
||||||
nsc = NULL;
|
nsc = NULL;
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||||
if (cberr)
|
if (cberr)
|
||||||
cbuf_free(cberr);
|
cbuf_free(cberr);
|
||||||
if (valvec)
|
if (valvec)
|
||||||
|
|
|
||||||
|
|
@ -417,7 +417,7 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
||||||
(xt2->xs_type == XP_PRIME_NR || xt2->xs_type == XP_PRIME_STR))
|
(xt2->xs_type == XP_PRIME_NR || xt2->xs_type == XP_PRIME_STR))
|
||||||
#endif
|
#endif
|
||||||
){
|
){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s type %s vs %s\n", __FUNCTION__,
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s type %s vs %s", __FUNCTION__,
|
||||||
xpath_tree_int2str(xt1->xs_type),
|
xpath_tree_int2str(xt1->xs_type),
|
||||||
xpath_tree_int2str(xt2->xs_type));
|
xpath_tree_int2str(xt2->xs_type));
|
||||||
goto neq;
|
goto neq;
|
||||||
|
|
@ -429,19 +429,19 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
||||||
goto eq;
|
goto eq;
|
||||||
}
|
}
|
||||||
if (xt1->xs_int != xt2->xs_int){
|
if (xt1->xs_int != xt2->xs_int){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s int\n", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s int", __FUNCTION__);
|
||||||
goto neq;
|
goto neq;
|
||||||
}
|
}
|
||||||
if (xt1->xs_double != xt2->xs_double){
|
if (xt1->xs_double != xt2->xs_double){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s double\n", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s double", __FUNCTION__);
|
||||||
goto neq;
|
goto neq;
|
||||||
}
|
}
|
||||||
if (clicon_strcmp(xt1->xs_s0, xt2->xs_s0)){
|
if (clicon_strcmp(xt1->xs_s0, xt2->xs_s0)){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s s0\n", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s s0", __FUNCTION__);
|
||||||
goto neq;
|
goto neq;
|
||||||
}
|
}
|
||||||
if (clicon_strcmp(xt1->xs_s1, xt2->xs_s1)){
|
if (clicon_strcmp(xt1->xs_s1, xt2->xs_s1)){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s s1\n", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s s1", __FUNCTION__);
|
||||||
goto neq;
|
goto neq;
|
||||||
}
|
}
|
||||||
xc1 = xt1->xs_c0;
|
xc1 = xt1->xs_c0;
|
||||||
|
|
@ -450,7 +450,7 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
||||||
;
|
;
|
||||||
else{
|
else{
|
||||||
if (xc1 == NULL || xc2 == NULL){
|
if (xc1 == NULL || xc2 == NULL){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s NULL\n", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s NULL", __FUNCTION__);
|
||||||
goto neq;
|
goto neq;
|
||||||
}
|
}
|
||||||
if ((ret = xpath_tree_eq(xc1, xc2, vec, len)) < 0)
|
if ((ret = xpath_tree_eq(xc1, xc2, vec, len)) < 0)
|
||||||
|
|
@ -464,7 +464,7 @@ xpath_tree_eq(xpath_tree *xt1, /* pattern */
|
||||||
;
|
;
|
||||||
else{
|
else{
|
||||||
if (xc1 == NULL || xc2 == NULL){
|
if (xc1 == NULL || xc2 == NULL){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s NULL\n", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s NULL", __FUNCTION__);
|
||||||
goto neq;
|
goto neq;
|
||||||
}
|
}
|
||||||
if ((ret = xpath_tree_eq(xc1, xc2, vec, len)) < 0)
|
if ((ret = xpath_tree_eq(xc1, xc2, vec, len)) < 0)
|
||||||
|
|
@ -558,7 +558,7 @@ xpath_parse(const char *xpath,
|
||||||
clixon_xpath_yacc xpy = {0,};
|
clixon_xpath_yacc xpy = {0,};
|
||||||
cbuf *cb = NULL;
|
cbuf *cb = NULL;
|
||||||
|
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s xpath %s", __FUNCTION__, xpath);
|
||||||
if (xpath == NULL){
|
if (xpath == NULL){
|
||||||
clixon_err(OE_XML, EINVAL, "XPath is NULL");
|
clixon_err(OE_XML, EINVAL, "XPath is NULL");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -577,13 +577,13 @@ xpath_parse(const char *xpath,
|
||||||
xpath_scan_exit(&xpy);
|
xpath_scan_exit(&xpy);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
if (clixon_debug_get() > 2){
|
if (clixon_debug_isset(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL)){
|
||||||
if ((cb = cbuf_new()) == NULL){
|
if ((cb = cbuf_new()) == NULL){
|
||||||
clixon_err(OE_XML, errno, "cbuf_new");
|
clixon_err(OE_XML, errno, "cbuf_new");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
xpath_tree_print_cb(cb, xpy.xpy_top);
|
xpath_tree_print_cb(cb, xpy.xpy_top);
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "xpath parse tree:\n%s", cbuf_get(cb));
|
clixon_debug(CLIXON_DBG_ALWAYS, "xpath parse tree:\n%s", cbuf_get(cb));
|
||||||
}
|
}
|
||||||
xpath_parse_exit(&xpy);
|
xpath_parse_exit(&xpy);
|
||||||
xpath_scan_exit(&xpy);
|
xpath_scan_exit(&xpy);
|
||||||
|
|
@ -630,7 +630,7 @@ xpath_vec_ctx(cxobj *xcur,
|
||||||
xpath_tree *xptree = NULL;
|
xpath_tree *xptree = NULL;
|
||||||
xp_ctx xc = {0,};
|
xp_ctx xc = {0,};
|
||||||
|
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, xpath);
|
||||||
if (xpath_parse(xpath, &xptree) < 0)
|
if (xpath_parse(xpath, &xptree) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
xc.xc_type = XT_NODESET;
|
xc.xc_type = XT_NODESET;
|
||||||
|
|
@ -1125,7 +1125,7 @@ xpath2canonical(const char *xpath0,
|
||||||
cbuf *xcb = NULL;
|
cbuf *xcb = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||||
/* Parse input xpath into an xpath-tree */
|
/* Parse input xpath into an xpath-tree */
|
||||||
if (xpath_parse(xpath0, &xpt) < 0)
|
if (xpath_parse(xpath0, &xpt) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
@ -1481,7 +1481,7 @@ xpath2xml_traverse(xpath_tree *xs,
|
||||||
}
|
}
|
||||||
retval = 1;
|
retval = 1;
|
||||||
done:
|
done:
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s retval:%d", __FUNCTION__, retval);
|
||||||
return retval;
|
return retval;
|
||||||
fail:
|
fail:
|
||||||
retval = 0;
|
retval = 0;
|
||||||
|
|
@ -1518,7 +1518,7 @@ xpath2xml(char *xpath,
|
||||||
cbuf *cberr = NULL;
|
cbuf *cberr = NULL;
|
||||||
xpath_tree *xpt = NULL;
|
xpath_tree *xpt = NULL;
|
||||||
|
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s xpath:%s", __FUNCTION__, xpath);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s xpath:%s", __FUNCTION__, xpath);
|
||||||
if ((cberr = cbuf_new()) == NULL){
|
if ((cberr = cbuf_new()) == NULL){
|
||||||
clixon_err(OE_UNIX, errno, "cbuf_new");
|
clixon_err(OE_UNIX, errno, "cbuf_new");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -283,11 +283,11 @@ nodetest_recursive(cxobj *xn,
|
||||||
xsub = NULL;
|
xsub = NULL;
|
||||||
while ((xsub = xml_child_each(xn, xsub, node_type)) != NULL) {
|
while ((xsub = xml_child_each(xn, xsub, node_type)) != NULL) {
|
||||||
if (nodetest_eval(xsub, nodetest, nsc, localonly) == 1){
|
if (nodetest_eval(xsub, nodetest, nsc, localonly) == 1){
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s %x %x", __FUNCTION__, flags, xml_flag(xsub, flags));
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s %x %x", __FUNCTION__, flags, xml_flag(xsub, flags));
|
||||||
if (flags==0x0 || xml_flag(xsub, flags))
|
if (flags==0x0 || xml_flag(xsub, flags))
|
||||||
if (cxvec_append(xsub, &vec, &veclen) < 0)
|
if (cxvec_append(xsub, &vec, &veclen) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
// continue; /* Dont go deeper */
|
// continue; /* Don't go deeper */
|
||||||
}
|
}
|
||||||
if (nodetest_recursive(xsub, nodetest, node_type, flags, nsc, localonly, &vec, &veclen) < 0)
|
if (nodetest_recursive(xsub, nodetest, node_type, flags, nsc, localonly, &vec, &veclen) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
|
|
@ -471,7 +471,7 @@ yang_path_arg(yang_stmt *ys,
|
||||||
xp_yang_ctx *xyr = NULL;
|
xp_yang_ctx *xyr = NULL;
|
||||||
xp_yang_ctx *xy = NULL;
|
xp_yang_ctx *xy = NULL;
|
||||||
|
|
||||||
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
clixon_debug(CLIXON_DBG_XPATH | CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
|
||||||
if (path_arg == NULL){
|
if (path_arg == NULL){
|
||||||
clixon_err(OE_XML, EINVAL, "path-arg is NULL");
|
clixon_err(OE_XML, EINVAL, "path-arg is NULL");
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue