zebra: add 'debug dplane' support and cli

Signed-off-by: Mark Stapp <mjs@voltanet.io>
This commit is contained in:
Mark Stapp 2018-06-08 09:35:07 -04:00 committed by Donald Sharp
parent 85a75f1e77
commit 6582b00201
2 changed files with 55 additions and 0 deletions

View File

@ -33,6 +33,7 @@ unsigned long zebra_debug_nht;
unsigned long zebra_debug_mpls;
unsigned long zebra_debug_vxlan;
unsigned long zebra_debug_pw;
unsigned long zebra_debug_dplane;
DEFINE_HOOK(zebra_debug_show_debugging, (struct vty *vty), (vty));
@ -89,6 +90,10 @@ DEFUN_NOSH (show_debugging_zebra,
vty_out(vty, " Zebra VXLAN debugging is on\n");
if (IS_ZEBRA_DEBUG_PW)
vty_out(vty, " Zebra pseudowire debugging is on\n");
if (IS_ZEBRA_DEBUG_DPLANE_DETAIL)
vty_out(vty, " Zebra detailed dataplane debugging is on\n");
else if (IS_ZEBRA_DEBUG_DPLANE)
vty_out(vty, " Zebra dataplane debugging is on\n");
hook_call(zebra_debug_show_debugging, vty);
return CMD_SUCCESS;
@ -261,6 +266,22 @@ DEFUN (debug_zebra_fpm,
return CMD_SUCCESS;
}
DEFUN (debug_zebra_dplane,
debug_zebra_dplane_cmd,
"debug zebra dataplane [detailed]",
DEBUG_STR
"Zebra configuration\n"
"Debug zebra dataplane events\n")
{
int idx = 0;
SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE);
if (argv_find(argv, argc, "detailed", &idx))
SET_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED);
return CMD_SUCCESS;
}
DEFUN (no_debug_zebra_events,
no_debug_zebra_events_cmd,
"no debug zebra events",
@ -376,6 +397,18 @@ DEFUN (no_debug_zebra_fpm,
return CMD_SUCCESS;
}
DEFUN (no_debug_zebra_dplane,
no_debug_zebra_dplane_cmd,
"no debug zebra dplane",
NO_STR
DEBUG_STR
"Zebra configuration\n"
"Debug zebra dataplane events\n")
{
zebra_debug_dplane = 0;
return CMD_SUCCESS;
}
/* Debug node. */
struct cmd_node debug_node = {DEBUG_NODE, "", /* Debug node has no interface. */
1};
@ -449,6 +482,15 @@ static int config_write_debug(struct vty *vty)
vty_out(vty, "debug zebra pseudowires\n");
write++;
}
if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE_DETAILED)) {
vty_out(vty, "debug zebra dplane detailed\n");
write++;
} else if (CHECK_FLAG(zebra_debug_dplane, ZEBRA_DEBUG_DPLANE)) {
vty_out(vty, "debug zebra dplane\n");
write++;
}
return write;
}
@ -462,6 +504,7 @@ void zebra_debug_init(void)
zebra_debug_mpls = 0;
zebra_debug_vxlan = 0;
zebra_debug_pw = 0;
zebra_debug_dplane = 0;
install_node(&debug_node, config_write_debug);
@ -477,6 +520,7 @@ void zebra_debug_init(void)
install_element(ENABLE_NODE, &debug_zebra_kernel_msgdump_cmd);
install_element(ENABLE_NODE, &debug_zebra_rib_cmd);
install_element(ENABLE_NODE, &debug_zebra_fpm_cmd);
install_element(ENABLE_NODE, &debug_zebra_dplane_cmd);
install_element(ENABLE_NODE, &no_debug_zebra_events_cmd);
install_element(ENABLE_NODE, &no_debug_zebra_nht_cmd);
install_element(ENABLE_NODE, &no_debug_zebra_mpls_cmd);
@ -486,6 +530,7 @@ void zebra_debug_init(void)
install_element(ENABLE_NODE, &no_debug_zebra_kernel_msgdump_cmd);
install_element(ENABLE_NODE, &no_debug_zebra_rib_cmd);
install_element(ENABLE_NODE, &no_debug_zebra_fpm_cmd);
install_element(ENABLE_NODE, &no_debug_zebra_dplane_cmd);
install_element(CONFIG_NODE, &debug_zebra_events_cmd);
install_element(CONFIG_NODE, &debug_zebra_nht_cmd);
@ -497,6 +542,7 @@ void zebra_debug_init(void)
install_element(CONFIG_NODE, &debug_zebra_kernel_msgdump_cmd);
install_element(CONFIG_NODE, &debug_zebra_rib_cmd);
install_element(CONFIG_NODE, &debug_zebra_fpm_cmd);
install_element(CONFIG_NODE, &debug_zebra_dplane_cmd);
install_element(CONFIG_NODE, &no_debug_zebra_events_cmd);
install_element(CONFIG_NODE, &no_debug_zebra_nht_cmd);
install_element(CONFIG_NODE, &no_debug_zebra_mpls_cmd);
@ -506,4 +552,5 @@ void zebra_debug_init(void)
install_element(CONFIG_NODE, &no_debug_zebra_kernel_msgdump_cmd);
install_element(CONFIG_NODE, &no_debug_zebra_rib_cmd);
install_element(CONFIG_NODE, &no_debug_zebra_fpm_cmd);
install_element(CONFIG_NODE, &no_debug_zebra_dplane_cmd);
}

View File

@ -48,6 +48,9 @@
#define ZEBRA_DEBUG_PW 0x01
#define ZEBRA_DEBUG_DPLANE 0x01
#define ZEBRA_DEBUG_DPLANE_DETAILED 0x02
/* Debug related macro. */
#define IS_ZEBRA_DEBUG_EVENT (zebra_debug_event & ZEBRA_DEBUG_EVENT)
@ -72,6 +75,10 @@
#define IS_ZEBRA_DEBUG_VXLAN (zebra_debug_vxlan & ZEBRA_DEBUG_VXLAN)
#define IS_ZEBRA_DEBUG_PW (zebra_debug_pw & ZEBRA_DEBUG_PW)
#define IS_ZEBRA_DEBUG_DPLANE (zebra_debug_dplane & ZEBRA_DEBUG_DPLANE)
#define IS_ZEBRA_DEBUG_DPLANE_DETAIL \
(zebra_debug_dplane & ZEBRA_DEBUG_DPLANE_DETAILED)
extern unsigned long zebra_debug_event;
extern unsigned long zebra_debug_packet;
extern unsigned long zebra_debug_kernel;
@ -81,6 +88,7 @@ extern unsigned long zebra_debug_nht;
extern unsigned long zebra_debug_mpls;
extern unsigned long zebra_debug_vxlan;
extern unsigned long zebra_debug_pw;
extern unsigned long zebra_debug_dplane;
extern void zebra_debug_init(void);