mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-05-29 18:41:56 +00:00
Merge pull request #14728 from FRIDM636/rework_debug_pathd_pcep
pathd: rework debug pathd pcep command
This commit is contained in:
commit
d4c596d77f
@ -25,6 +25,7 @@ DECLARE_MTYPE(PCEP);
|
|||||||
#define PCEP_DEBUG_MODE_PATH 0x02
|
#define PCEP_DEBUG_MODE_PATH 0x02
|
||||||
#define PCEP_DEBUG_MODE_PCEP 0x04
|
#define PCEP_DEBUG_MODE_PCEP 0x04
|
||||||
#define PCEP_DEBUG_MODE_PCEPLIB 0x08
|
#define PCEP_DEBUG_MODE_PCEPLIB 0x08
|
||||||
|
#define PCEP_DEBUG_MODE_ALL 0x0F
|
||||||
#define PCEP_DEBUG(fmt, ...) \
|
#define PCEP_DEBUG(fmt, ...) \
|
||||||
do { \
|
do { \
|
||||||
if (DEBUG_FLAGS_CHECK(&pcep_g->dbg, PCEP_DEBUG_MODE_BASIC)) \
|
if (DEBUG_FLAGS_CHECK(&pcep_g->dbg, PCEP_DEBUG_MODE_BASIC)) \
|
||||||
|
@ -458,27 +458,31 @@ static void pcep_cli_remove_pce_connection(struct pce_opts *pce_opts)
|
|||||||
* VTY command implementations
|
* VTY command implementations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int path_pcep_cli_debug(struct vty *vty, const char *no_str,
|
static int path_pcep_cli_debug(struct vty *vty, const char *debug_type, bool set)
|
||||||
const char *basic_str, const char *path_str,
|
|
||||||
const char *message_str, const char *pceplib_str)
|
|
||||||
{
|
{
|
||||||
uint32_t mode = DEBUG_NODE2MODE(vty->node);
|
uint32_t mode = DEBUG_NODE2MODE(vty->node);
|
||||||
bool no = (no_str != NULL);
|
|
||||||
|
|
||||||
DEBUG_MODE_SET(&pcep_g->dbg, mode, !no);
|
/* Global Set */
|
||||||
|
if (debug_type == NULL) {
|
||||||
|
DEBUG_MODE_SET(&pcep_g->dbg, mode, set);
|
||||||
|
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_ALL, set);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
if (basic_str != NULL) {
|
DEBUG_MODE_SET(&pcep_g->dbg, mode, true);
|
||||||
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_BASIC, !no);
|
|
||||||
}
|
if (strcmp(debug_type, "basic") == 0)
|
||||||
if (path_str != NULL) {
|
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_BASIC, set);
|
||||||
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_PATH, !no);
|
else if (strcmp(debug_type, "path") == 0)
|
||||||
}
|
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_PATH, set);
|
||||||
if (message_str != NULL) {
|
else if (strcmp(debug_type, "message") == 0)
|
||||||
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_PCEP, !no);
|
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_PCEP, set);
|
||||||
}
|
else if (strcmp(debug_type, "pceplib") == 0)
|
||||||
if (pceplib_str != NULL) {
|
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_PCEPLIB, set);
|
||||||
DEBUG_FLAGS_SET(&pcep_g->dbg, PCEP_DEBUG_MODE_PCEPLIB, !no);
|
|
||||||
}
|
/* Unset the pcep debug mode if there is no flag at least set*/
|
||||||
|
if (!DEBUG_FLAGS_CHECK(&pcep_g->dbg, PCEP_DEBUG_MODE_ALL))
|
||||||
|
DEBUG_MODE_SET(&pcep_g->dbg, mode, false);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -1788,7 +1792,7 @@ DEFPY(show_debugging_pathd_pcep,
|
|||||||
|
|
||||||
DEFPY(pcep_cli_debug,
|
DEFPY(pcep_cli_debug,
|
||||||
pcep_cli_debug_cmd,
|
pcep_cli_debug_cmd,
|
||||||
"[no] debug pathd pcep [basic]$basic_str [path]$path_str [message]$message_str [pceplib]$pceplib_str",
|
"[no] debug pathd pcep [<basic|path|message|pceplib>$debug_type]",
|
||||||
NO_STR DEBUG_STR
|
NO_STR DEBUG_STR
|
||||||
"pathd debugging\n"
|
"pathd debugging\n"
|
||||||
"pcep module debugging\n"
|
"pcep module debugging\n"
|
||||||
@ -1797,8 +1801,7 @@ DEFPY(pcep_cli_debug,
|
|||||||
"pcep message debugging\n"
|
"pcep message debugging\n"
|
||||||
"pceplib debugging\n")
|
"pceplib debugging\n")
|
||||||
{
|
{
|
||||||
return path_pcep_cli_debug(vty, no, basic_str, path_str, message_str,
|
return path_pcep_cli_debug(vty, debug_type, !no);
|
||||||
pceplib_str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY(pcep_cli_show_srte_pcep_counters,
|
DEFPY(pcep_cli_show_srte_pcep_counters,
|
||||||
|
Loading…
Reference in New Issue
Block a user