clixon-config.yang: Added CLICON_DEBUG, Removed: CLICON_NETCONF_DUPLICATE_ALLOW

Rearranged and grouped options
clixon-lib.yang: Added debug types
Removed git reliance in test - moved to configure script
This commit is contained in:
Olof hagsand 2024-05-21 13:02:20 +02:00
parent c8a8197e92
commit b6480ac07d
15 changed files with 320 additions and 174 deletions

View file

@ -644,10 +644,7 @@ from_client_edit_config(clixon_handle h,
*/
if ((ret = xml_yang_validate_minmax(xc, 1, &xret)) < 0)
goto done;
/* Disable duplicate check in NETCONF messages.*/
if (clicon_option_bool(h, "CLICON_NETCONF_DUPLICATE_ALLOW"))
;
else if (ret == 1 && (ret = xml_yang_validate_unique_recurse(xc, &xret)) < 0)
if (ret == 1 && (ret = xml_yang_validate_unique_recurse(xc, &xret)) < 0)
goto done;
/* xmldb_put (difflist handling) requires list keys */
if (ret == 1 && (ret = xml_yang_validate_list_key_only(xc, &xret)) < 0)

View file

@ -632,6 +632,17 @@ cli_del(clixon_handle h,
return retval;
}
/*! Get debug level of CLI client
*/
int
cli_debug_show(clixon_handle h,
cvec *cvv,
cvec *argv)
{
cligen_output(stdout, "CLI debug:0x%x\n", clixon_debug_get());
return 0;
}
/*! Set debug level on CLI client (not backend daemon)
*
* @param[in] h Clixon handle
@ -644,8 +655,8 @@ cli_del(clixon_handle h,
*/
int
cli_debug_cli(clixon_handle h,
cvec *cvv,
cvec *argv)
cvec *cvv,
cvec *argv)
{
int retval = -1;
cg_var *cv;
@ -736,7 +747,6 @@ cli_debug_restconf(clixon_handle h,
return retval;
}
/*! Set syntax mode
*
* @param[in] h Clixon handle

View file

@ -751,6 +751,7 @@ main(int argc,
break;
}
}
argc -= optind;
argv += optind;
@ -761,6 +762,24 @@ main(int argc,
/* Defer: Wait to the last minute to print help message */
if (help)
usage(h, argv[0]);
/* Unless -D, set debug level to CLICON_DEBUG set
* Only works for one value.
*/
{
char *dstr;
int d = 0;
dstr = clicon_option_str(h, "CLICON_DEBUG");
if (dbg == 0 && dstr && strlen(dstr)){
if ((d = clixon_debug_str2key(dstr)) < 0 &&
sscanf(optarg, "%d", &d) != 1){
clixon_err(OE_CFG, 0, "Parsing CLICON_DEBUG: %s", dstr);
goto done;
}
clixon_debug_init(h, d);
clixon_log_init(h, __PROGRAM__, d?LOG_DEBUG:LOG_INFO, logdst);
}
}
/* Split remaining argv/argc into <cmd> and <extra-options> */
if (options_split(h, argv0, argc, argv, &restarg) < 0)

View file

@ -91,6 +91,7 @@ int cli_merge(clixon_handle h, cvec *vars, cvec *argv);
int cli_create(clixon_handle h, cvec *vars, cvec *argv);
int cli_remove(clixon_handle h, cvec *vars, cvec *argv);
int cli_del(clixon_handle h, cvec *vars, cvec *argv);
int cli_debug_show(clixon_handle h, cvec *cvv, cvec *argv);
int cli_debug_cli(clixon_handle h, cvec *vars, cvec *argv);
int cli_debug_backend(clixon_handle h, cvec *vars, cvec *argv);
int cli_debug_restconf(clixon_handle h, cvec *vars, cvec *argv);