]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: debug flags for MH
authorAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Fri, 27 Mar 2020 14:55:59 +0000 (07:55 -0700)
committerAnuradha Karuppiah <anuradhak@cumulusnetworks.com>
Wed, 5 Aug 2020 13:46:12 +0000 (06:46 -0700)
Filters for MH debug logs

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
bgpd/bgp_debug.c
bgpd/bgp_debug.h

index 9f32d450b9e4e4d364a068282cd3cdc14a28d38e..255a7f238bb8c140a518c9cbdb1b5f996b95ed31 100644 (file)
@@ -64,6 +64,7 @@ unsigned long conf_bgp_debug_flowspec;
 unsigned long conf_bgp_debug_labelpool;
 unsigned long conf_bgp_debug_pbr;
 unsigned long conf_bgp_debug_graceful_restart;
+unsigned long conf_bgp_debug_evpn_mh;
 
 unsigned long term_bgp_debug_as4;
 unsigned long term_bgp_debug_neighbor_events;
@@ -82,6 +83,7 @@ unsigned long term_bgp_debug_flowspec;
 unsigned long term_bgp_debug_labelpool;
 unsigned long term_bgp_debug_pbr;
 unsigned long term_bgp_debug_graceful_restart;
+unsigned long term_bgp_debug_evpn_mh;
 
 struct list *bgp_debug_neighbor_events_peers = NULL;
 struct list *bgp_debug_keepalive_peers = NULL;
@@ -2006,6 +2008,57 @@ DEFUN (no_debug_bgp_pbr,
        return CMD_SUCCESS;
 }
 
+DEFPY (debug_bgp_evpn_mh,
+       debug_bgp_evpn_mh_cmd,
+       "[no$no] debug bgp evpn mh <es$es|route$rt>",
+       NO_STR
+       DEBUG_STR
+       BGP_STR
+       "EVPN\n"
+       "Multihoming\n"
+       "Ethernet Segment debugging\n"
+       "Route debugging\n")
+{
+       if (es) {
+               if (vty->node == CONFIG_NODE) {
+                       if (no)
+                               DEBUG_OFF(evpn_mh, EVPN_MH_ES);
+                       else
+                               DEBUG_ON(evpn_mh, EVPN_MH_ES);
+               } else {
+                       if (no) {
+                               TERM_DEBUG_OFF(evpn_mh, EVPN_MH_ES);
+                               vty_out(vty,
+                                       "BGP EVPN-MH ES debugging is off\n");
+                       } else {
+                               TERM_DEBUG_ON(evpn_mh, EVPN_MH_ES);
+                               vty_out(vty,
+                                       "BGP EVPN-MH ES debugging is on\n");
+                       }
+               }
+       }
+       if (rt) {
+               if (vty->node == CONFIG_NODE) {
+                       if (no)
+                               DEBUG_OFF(evpn_mh, EVPN_MH_RT);
+                       else
+                               DEBUG_ON(evpn_mh, EVPN_MH_RT);
+               } else {
+                       if (no) {
+                               TERM_DEBUG_OFF(evpn_mh, EVPN_MH_RT);
+                               vty_out(vty,
+                                       "BGP EVPN-MH route debugging is off\n");
+                       } else {
+                               TERM_DEBUG_ON(evpn_mh, EVPN_MH_RT);
+                               vty_out(vty,
+                                       "BGP EVPN-MH route debugging is on\n");
+                       }
+               }
+       }
+
+       return CMD_SUCCESS;
+}
+
 DEFUN (debug_bgp_labelpool,
        debug_bgp_labelpool_cmd,
        "debug bgp labelpool",
@@ -2085,6 +2138,8 @@ DEFUN (no_debug_bgp,
        TERM_DEBUG_OFF(pbr, PBR);
        TERM_DEBUG_OFF(pbr, PBR_ERROR);
        TERM_DEBUG_OFF(graceful_restart, GRACEFUL_RESTART);
+       TERM_DEBUG_OFF(evpn_mh, EVPN_MH_ES);
+       TERM_DEBUG_OFF(evpn_mh, EVPN_MH_RT);
 
        vty_out(vty, "All possible debugging has been turned off\n");
 
@@ -2169,6 +2224,11 @@ DEFUN_NOSH (show_debugging_bgp,
        if (BGP_DEBUG(pbr, PBR_ERROR))
                vty_out(vty, "  BGP policy based routing error debugging is on\n");
 
+       if (BGP_DEBUG(evpn_mh, EVPN_MH_ES))
+               vty_out(vty, "  BGP EVPN-MH ES debugging is on\n");
+       if (BGP_DEBUG(evpn_mh, EVPN_MH_RT))
+               vty_out(vty, "  BGP EVPN-MH route debugging is on\n");
+
        vty_out(vty, "\n");
        return CMD_SUCCESS;
 }
@@ -2284,6 +2344,16 @@ static int bgp_config_write_debug(struct vty *vty)
                vty_out(vty, "debug bgp graceful-restart\n");
                write++;
        }
+
+       if (CONF_BGP_DEBUG(evpn_mh, EVPN_MH_ES)) {
+               vty_out(vty, "debug bgp evpn mh es\n");
+               write++;
+       }
+       if (CONF_BGP_DEBUG(evpn_mh, EVPN_MH_RT)) {
+               vty_out(vty, "debug bgp evpn mh route\n");
+               write++;
+       }
+
        return write;
 }
 
@@ -2410,6 +2480,8 @@ void bgp_debug_init(void)
        install_element(ENABLE_NODE, &no_debug_bgp_pbr_cmd);
        install_element(CONFIG_NODE, &no_debug_bgp_pbr_cmd);
 
+       install_element(ENABLE_NODE, &debug_bgp_evpn_mh_cmd);
+       install_element(CONFIG_NODE, &debug_bgp_evpn_mh_cmd);
 }
 
 /* Return true if this prefix is on the per_prefix_list of prefixes to debug
index 69f25566a95336432d307c3b91cad8799ea2f6c2..f16cfee4f228e75bed53048b643b53094a97809b 100644 (file)
@@ -77,6 +77,7 @@ extern unsigned long conf_bgp_debug_flowspec;
 extern unsigned long conf_bgp_debug_labelpool;
 extern unsigned long conf_bgp_debug_pbr;
 extern unsigned long conf_bgp_debug_graceful_restart;
+extern unsigned long conf_bgp_debug_evpn_mh;
 
 extern unsigned long term_bgp_debug_as4;
 extern unsigned long term_bgp_debug_neighbor_events;
@@ -93,6 +94,7 @@ extern unsigned long term_bgp_debug_flowspec;
 extern unsigned long term_bgp_debug_labelpool;
 extern unsigned long term_bgp_debug_pbr;
 extern unsigned long term_bgp_debug_graceful_restart;
+extern unsigned long term_bgp_debug_evpn_mh;
 
 extern struct list *bgp_debug_neighbor_events_peers;
 extern struct list *bgp_debug_keepalive_peers;
@@ -129,6 +131,8 @@ struct bgp_debug_filter {
 #define BGP_DEBUG_LABELPOOL           0x01
 #define BGP_DEBUG_PBR                 0x01
 #define BGP_DEBUG_PBR_ERROR           0x02
+#define BGP_DEBUG_EVPN_MH_ES          0x01
+#define BGP_DEBUG_EVPN_MH_RT          0x02
 
 #define BGP_DEBUG_PACKET_SEND         0x01
 #define BGP_DEBUG_PACKET_SEND_DETAIL  0x02