Symbolic and combined debug names in cmd-line of all applications
New debug levels: BACKEND, CLI, NETCONF,RESTCONF, SNMP, STREAM
This commit is contained in:
parent
86f251f343
commit
4e3bd6fbdd
39 changed files with 564 additions and 416 deletions
|
|
@ -137,7 +137,7 @@ cli_auto_edit(clixon_handle h,
|
|||
str = cv_string_get(cvec_i(argv, argc++));
|
||||
if (str && strncmp(str, "mtpoint:", strlen("mtpoint:")) == 0){
|
||||
mtpoint = str + strlen("mtpoint:");
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "mtpoint:%s", mtpoint);
|
||||
clixon_debug(CLIXON_DBG_CLI, "mtpoint:%s", mtpoint);
|
||||
treename = cv_string_get(cvec_i(argv, argc++));
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -884,7 +884,7 @@ cli_commit(clixon_handle h,
|
|||
cancel = (cvec_find_str(cvv, "cancel") != NULL);
|
||||
if ((timeout_var = cvec_find(cvv, "timeout")) != NULL) {
|
||||
timeout = cv_uint32_get(timeout_var);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "commit confirmed with timeout %ul", timeout);
|
||||
clixon_debug(CLIXON_DBG_CLI, "commit confirmed with timeout %ul", timeout);
|
||||
}
|
||||
persist = cvec_find_str(cvv, "persist-val");
|
||||
persist_id = cvec_find_str(cvv, "persist-id-val");
|
||||
|
|
|
|||
|
|
@ -1266,11 +1266,11 @@ yang2cli_stmt(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (yang_find(ys, Y_STATUS, "obsolete") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "obsolete: %s %s, skipped", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLI | CLIXON_DBG_DETAIL, "obsolete: %s %s, skipped", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
goto ok;
|
||||
}
|
||||
if (yang_find(ys, Y_STATUS, "deprecated") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "deprecated: %s %s", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLI | CLIXON_DBG_DETAIL, "deprecated: %s %s", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
}
|
||||
/* Check if autocli skip */
|
||||
if (yang_extension_value(ys, "skip", CLIXON_AUTOCLI_NS, &extvalue, NULL) < 0)
|
||||
|
|
@ -1543,11 +1543,11 @@ yang2cli_grouping(clixon_handle h,
|
|||
}
|
||||
/* Traverse YANG, loop through all modules and generate CLI, inline of yang2cli_stmt */
|
||||
if (yang_find(ys, Y_STATUS, "obsolete") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "obsolete: %s %s, skipped", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLI | CLIXON_DBG_DETAIL, "obsolete: %s %s, skipped", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
goto empty;
|
||||
}
|
||||
if (yang_find(ys, Y_STATUS, "deprecated") != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "deprecated: %s %s", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
clixon_debug(CLIXON_DBG_CLI | CLIXON_DBG_DETAIL, "deprecated: %s %s", yang_argument_get(ys), yang_argument_get(ys_module(ys)));
|
||||
}
|
||||
/* Only produce autocli for YANG non-config only if autocli-treeref-state is true */
|
||||
if (autocli_treeref_state(h, &treeref_state) < 0)
|
||||
|
|
@ -1576,12 +1576,12 @@ yang2cli_grouping(clixon_handle h,
|
|||
fprintf(stderr, "%s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Generated auto-cli for grouping:%s",
|
||||
clixon_debug(CLIXON_DBG_CLI, "Generated auto-cli for grouping:%s",
|
||||
yang_argument_get(ys));
|
||||
/* Add prefix: assume new are appended */
|
||||
for (i=0; i<pt_len_get(pt); i++){
|
||||
if ((co = pt_vec_i_get(pt, i)) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "command: %s",
|
||||
clixon_debug(CLIXON_DBG_CLI, "command: %s",
|
||||
co->co_command);
|
||||
co_prefix_set(co, prefix);
|
||||
}
|
||||
|
|
@ -1599,7 +1599,7 @@ yang2cli_grouping(clixon_handle h,
|
|||
clixon_log(h, LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
else
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "Top-level cli-spec %s:\n%s",
|
||||
clixon_debug(CLIXON_DBG_CLI | CLIXON_DBG_DETAIL, "Top-level cli-spec %s:\n%s",
|
||||
treename, cbuf_get(cb));
|
||||
if (cligen_parsetree_merge(pt0, NULL, pt) < 0){
|
||||
clixon_err(OE_YANG, errno, "cligen_parsetree_merge");
|
||||
|
|
@ -1706,12 +1706,12 @@ yang2cli_yspec(clixon_handle h,
|
|||
fprintf(stderr, "%s\n", cbuf_get(cb));
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Generated auto-cli for module:%s",
|
||||
clixon_debug(CLIXON_DBG_CLI, "Generated auto-cli for module:%s",
|
||||
yang_argument_get(ymod));
|
||||
/* Add prefix: assume new are appended */
|
||||
for (i=0; i<pt_len_get(pt); i++){
|
||||
if ((co = pt_vec_i_get(pt, i)) != NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "command: %s",
|
||||
clixon_debug(CLIXON_DBG_CLI, "command: %s",
|
||||
co->co_command);
|
||||
co_prefix_set(co, prefix);
|
||||
}
|
||||
|
|
@ -1730,7 +1730,7 @@ yang2cli_yspec(clixon_handle h,
|
|||
clixon_log(h, LOG_NOTICE, "%s: Top-level cli-spec %s:\n%s",
|
||||
__FUNCTION__, treename, cbuf_get(cb));
|
||||
else
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "Top-level cli-spec %s:\n%s",
|
||||
clixon_debug(CLIXON_DBG_CLI | CLIXON_DBG_DETAIL, "Top-level cli-spec %s:\n%s",
|
||||
treename, cbuf_get(cb));
|
||||
if (cligen_parsetree_merge(pt0, NULL, pt) < 0){
|
||||
clixon_err(OE_YANG, errno, "cligen_parsetree_merge");
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ autocli_start(clixon_handle h)
|
|||
yang_stmt *yspec;
|
||||
int enable = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_CLI, "");
|
||||
/* There is no single "enable-autocli" flag,
|
||||
* but set
|
||||
* <module-default>false</module-default>
|
||||
|
|
@ -402,7 +402,7 @@ autocli_start(clixon_handle h)
|
|||
if (autocli_module(h, NULL, &enable) < 0)
|
||||
goto done;
|
||||
if (!enable){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Autocli not enabled (clixon-autocli)");
|
||||
clixon_debug(CLIXON_DBG_CLI, "Autocli not enabled (clixon-autocli)");
|
||||
goto ok;
|
||||
}
|
||||
/* Init yang2cli */
|
||||
|
|
@ -481,7 +481,7 @@ usage(clixon_handle h,
|
|||
"where options are\n"
|
||||
"\t-h \t\tHelp\n"
|
||||
"\t-V \t\tPrint version and exit\n"
|
||||
"\t-D <level> \tDebug level\n"
|
||||
"\t-D <level> \tDebug level (see available levels below)\n"
|
||||
"\t-f <file> \tConfig-file (mandatory)\n"
|
||||
"\t-E <dir> \tExtra configuration file directory\n"
|
||||
"\t-l <s|e|o|n|f<file>> \tLog on (s)yslog, std(e)rr, std(o)ut, (n)one or (f)ile (stderr is default)\n"
|
||||
|
|
@ -496,7 +496,6 @@ usage(clixon_handle h,
|
|||
"\t-p <dir>\tYang directory path (see CLICON_YANG_DIR)\n"
|
||||
"\t-G \t\tPrint auto-cli CLI syntax generated from YANG\n"
|
||||
"\t-L \t\tDebug print dynamic CLI syntax including completions and expansions\n"
|
||||
|
||||
"\t-y <file>\tOverride yang spec file (dont include .yang suffix)\n"
|
||||
"\t-c <file>\tSpecify cli spec file.\n"
|
||||
"\t-U <user>\tOver-ride unix user with a pseudo user for NACM.\n"
|
||||
|
|
@ -504,6 +503,9 @@ usage(clixon_handle h,
|
|||
argv0,
|
||||
plgdir ? plgdir : "none"
|
||||
);
|
||||
fprintf(stderr, "Debug keys: ");
|
||||
clixon_debug_key_dump(stderr);
|
||||
fprintf(stderr, "\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -581,10 +583,16 @@ main(int argc,
|
|||
cligen_output(stdout, "Clixon version %s\n", CLIXON_VERSION_STRING);
|
||||
print_version++; /* plugins may also print versions w ca-version callback */
|
||||
break;
|
||||
case 'D' : /* debug */
|
||||
if (sscanf(optarg, "%d", &dbg) != 1)
|
||||
case 'D' : { /* debug */
|
||||
int d = 0;
|
||||
/* Try first symbolic, then numeric match */
|
||||
if ((d = clixon_debug_str2key(optarg)) < 0 &&
|
||||
sscanf(optarg, "%d", &d) != 1){
|
||||
usage(h, argv[0]);
|
||||
}
|
||||
dbg |= d;
|
||||
break;
|
||||
}
|
||||
case 'f': /* config file */
|
||||
if (!strlen(optarg))
|
||||
usage(h, argv[0]);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ clispec_load(clixon_handle h)
|
|||
goto done;
|
||||
/* Load the syntax parse trees into cli_syntax stx structure */
|
||||
for (i = 0; i < ndp; i++) {
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Loading clispec syntax: '%s/%s'",
|
||||
clixon_debug(CLIXON_DBG_CLI, "Loading clispec syntax: '%s/%s'",
|
||||
clispec_dir, dp[i].d_name);
|
||||
if (clispec_load_file(h, dp[i].d_name, clispec_dir, ptall, modes) < 0)
|
||||
goto done;
|
||||
|
|
@ -555,7 +555,7 @@ clicon_parse(clixon_handle h,
|
|||
if (cliread_parse(ch, cmd, pt, &match_obj, &cvv, result, &reason) < 0)
|
||||
goto done;
|
||||
/* Debug command and result code */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "result:%d command: \"%s\"", *result, cmd);
|
||||
clixon_debug(CLIXON_DBG_CLI, "result:%d command: \"%s\"", *result, cmd);
|
||||
switch (*result) {
|
||||
case CG_EOF: /* eof */
|
||||
case CG_ERROR:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue