Discriminate YANG debugging

This commit is contained in:
Philip Prindeville 2024-01-04 11:25:14 -07:00 committed by Olof Hagsand
parent 20b233e96f
commit cb134875f9
8 changed files with 20 additions and 20 deletions

View file

@ -1440,7 +1440,7 @@ yang_find_prefix_by_namespace(yang_stmt *ys,
yang_stmt *yimport;
yang_stmt *yprefix;
clixon_debug(CLIXON_DBG_DETAIL, "%s", __FUNCTION__);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s namespace %s", __FUNCTION__, ns);
if (prefix == NULL){
clixon_err(OE_YANG, EINVAL, "prefix is NULL");
goto done;
@ -2776,7 +2776,7 @@ ys_populate_feature(clixon_handle h,
cv_name_set(cv, feature);
cv_bool_set(cv, found);
if (found)
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s:%s", __FUNCTION__, module, feature);
clixon_debug(CLIXON_DBG_YANG, "%s %s:%s", __FUNCTION__, module, feature);
yang_cv_set(ys, cv);
ok:
retval = 0;
@ -2865,7 +2865,7 @@ ys_populate_unknown(clixon_handle h,
#ifdef XML_EXPLICIT_INDEX
/* Add explicit index extension */
if ((retval = yang_search_index_extension(h, yext, ys)) < 0) {
clixon_debug(CLIXON_DBG_DEFAULT, "plugin_extension() failed");
clixon_debug(CLIXON_DBG_YANG, "plugin_extension() failed");
return -1;
}
#endif
@ -3078,7 +3078,7 @@ yang_features(clixon_handle h,
ret = 0;
if (yang_subparse(yang_argument_get(ys), ys, YA_IF_FEATURE, mainfile, 1, &ret, h) < 0)
goto done;
clixon_debug(CLIXON_DBG_DETAIL, "%s %s %d", __FUNCTION__, yang_argument_get(ys), ret);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s %d", __FUNCTION__, yang_argument_get(ys), ret);
if (ret == 0)
goto disabled;
}
@ -3276,7 +3276,7 @@ schema_nodeid_iterate(yang_stmt *yn,
goto done;
}
if (ys == NULL){
clixon_debug(CLIXON_DBG_DEFAULT, "%s: %s not found, last id found:%s",
clixon_debug(CLIXON_DBG_YANG, "%s: %s not found, last id found:%s",
__FUNCTION__, id, yang_argument_get(yp));
goto ok;
}
@ -4027,7 +4027,7 @@ yang_search_index_extension(clixon_handle h,
extname = yang_argument_get(yext);
if (strcmp(modname, "clixon-config") != 0 || strcmp(extname, "search_index") != 0)
goto ok;
clixon_debug(CLIXON_DBG_DEFAULT, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
clixon_debug(CLIXON_DBG_YANG, "%s Enabled extension:%s:%s", __FUNCTION__, modname, extname);
yp = yang_parent_get(ys);
if (yang_list_index_add(yp) < 0)
goto done;

View file

@ -395,7 +395,7 @@ yang_modules_state_get(clixon_handle h,
}
retval = 1;
done:
clixon_debug(CLIXON_DBG_DEFAULT, "%s %d", __FUNCTION__, retval);
clixon_debug(CLIXON_DBG_YANG, "%s %d", __FUNCTION__, retval);
if (xvec)
free(xvec);
if (cb)
@ -756,7 +756,7 @@ ietf_yang_metadata_extension_cb(clixon_handle h,
if (strcmp(modname, "ietf-yang-metadata") != 0 || strcmp(extname, "annotation") != 0)
goto ok;
name = cv_string_get(yang_cv_get(ys));
clixon_debug(CLIXON_DBG_DEFAULT, "%s Enabled extension:%s:%s:%s", __FUNCTION__, modname, extname, name);
clixon_debug(CLIXON_DBG_YANG, "%s Enabled extension:%s:%s:%s", __FUNCTION__, modname, extname, name);
/* XXX Nothing yet - this should signal that xml attribute annotations are allowed
* Possibly, add an "annotation" YANG node.
*/

View file

@ -167,7 +167,7 @@
/* typecast macro */
#define _YY ((clixon_yang_yacc *)_yy)
#define _YYERROR(msg) {clixon_debug(CLIXON_DBG_DEFAULT, "YYERROR %s '%s' %d", (msg), clixon_yang_parsetext, _YY->yy_linenum); YYERROR;}
#define _YYERROR(msg) {clixon_debug(CLIXON_DBG_YANG, "YYERROR %s '%s' %d", (msg), clixon_yang_parsetext, _YY->yy_linenum); YYERROR;}
/* add _yy to error parameters */
#define YY_(msgid) msgid
@ -204,8 +204,8 @@
* Disable it to stop any calls to clixon_debug. Having it on by default would mean very large debug outputs.
*/
#if 0
#define _PARSE_DEBUG(s) clixon_debug(1,(s))
#define _PARSE_DEBUG1(s, s1) clixon_debug(1,(s), (s1))
#define _PARSE_DEBUG(s) clixon_debug(CLIXON_DBG_YANG, (s))
#define _PARSE_DEBUG1(s, s1) clixon_debug(CLIXON_DBG_YANG, (s), (s1))
#else
#define _PARSE_DEBUG(s)
#define _PARSE_DEBUG1(s, s1)

View file

@ -243,7 +243,7 @@ yang_augment_node(clixon_handle h,
goto done;
}
schema_nodeid = yang_argument_get(ys);
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, schema_nodeid);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, schema_nodeid);
/* Find the target */
if (yang_abs_schema_nodeid(ys, schema_nodeid, &ytarget) < 0)
goto done;
@ -913,7 +913,7 @@ filename2revision(const char *filename,
clixon_err(OE_UNIX, errno, "strdup");
goto done;
}
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, base);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, base);
if ((p = rindex(base, '.')) != NULL) /* strip postfix .yang */
*p = '\0';
if ((p = index(base, '@')) != NULL){ /* extract revision date */
@ -1064,7 +1064,7 @@ yang_parse_filename(clixon_handle h,
FILE *fp = NULL;
struct stat st;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s", __FUNCTION__, filename);
clixon_debug(CLIXON_DBG_YANG, "%s %s", __FUNCTION__, filename);
if (stat(filename, &st) < 0){
clixon_err(OE_YANG, errno, "%s not found", filename);
goto done;

View file

@ -162,7 +162,7 @@ yang_mount_get(yang_stmt *y,
cvec *cvv;
cg_var *cv;
clixon_debug(CLIXON_DBG_DETAIL, "%s %s %p", __FUNCTION__, xpath, y);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s %p", __FUNCTION__, xpath, y);
/* Special value in yang unknown node for mount-points: mapping from xpath->mounted yspec */
if ((cvv = yang_cvec_get(y)) != NULL &&
(cv = cvec_find(cvv, xpath)) != NULL &&
@ -194,7 +194,7 @@ yang_mount_set(yang_stmt *y,
cg_var *cv;
cg_var *cv2;
clixon_debug(CLIXON_DBG_DEFAULT, "%s %s %p", __FUNCTION__, xpath, y);
clixon_debug(CLIXON_DBG_YANG, "%s %s %p", __FUNCTION__, xpath, y);
if ((cvv = yang_cvec_get(y)) != NULL &&
(cv = cvec_find(cvv, xpath)) != NULL &&
(yspec0 = cv_void_get(cv)) != NULL){

View file

@ -96,7 +96,7 @@
/* Enable for debugging, steals some cycles otherwise */
#if 0
#define _PARSE_DEBUG(s) clixon_debug(1,(s))
#define _PARSE_DEBUG(s) clixon_debug(CLIXON_DBG_YANG, (s))
#else
#define _PARSE_DEBUG(s)
#endif

View file

@ -83,7 +83,7 @@ yang_subparse(char *str,
int retval = -1;
clixon_yang_sub_parse_yacc ife = {0,};
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, str);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, str);
ife.if_parse_string = str;
ife.if_linenum = linenum;
if (enabled)
@ -125,7 +125,7 @@ yang_schema_nodeid_subparse(char *str,
int retval = -1;
clixon_yang_schemanode_yacc ife = {0,};
clixon_debug(CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, str);
clixon_debug(CLIXON_DBG_YANG | CLIXON_DBG_DETAIL, "%s %s", __FUNCTION__, str);
ife.if_parse_string = str;
ife.if_linenum = linenum;
ife.if_mainfile = mainfile;

View file

@ -106,7 +106,7 @@
/* Enable for debugging, steals some cycles otherwise */
#if 0
#define _PARSE_DEBUG(s) clixon_debug(1,(s))
#define _PARSE_DEBUG(s) clixon_debug(CLIXON_DBG_YANG, (s))
#else
#define _PARSE_DEBUG(s)
#endif