From: Stephen Worley Date: Tue, 13 Oct 2020 20:09:48 +0000 (-0400) Subject: bgpd: numerical evpn type support to debug commands X-Git-Tag: base_7.6~395^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=15dc08a6001709245bee82f297bb6f0006f83286;p=matthieu%2Ffrr.git bgpd: numerical evpn type support to debug commands Add number evpn route type support for debug commands. Signed-off-by: Stephen Worley --- diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c index 3bc715fbe4..126816e3b9 100644 --- a/bgpd/bgp_debug.c +++ b/bgpd/bgp_debug.c @@ -616,21 +616,14 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv, struct prefix *argv_p; struct ethaddr mac; struct ipaddr ip; - int evpn_type; - int type_idx = 0; + int evpn_type = 0; int mac_idx = 0; int ip_idx = 0; argv_p = *argv_pp; - if (argv_find(argv, argc, "macip", &type_idx)) - evpn_type = BGP_EVPN_MAC_IP_ROUTE; - else if (argv_find(argv, argc, "multicast", &type_idx)) - evpn_type = BGP_EVPN_IMET_ROUTE; - else if (argv_find(argv, argc, "prefix", &type_idx)) - evpn_type = BGP_EVPN_IP_PREFIX_ROUTE; - else - evpn_type = 0; + if (bgp_evpn_cli_parse_type(&evpn_type, argv, argc) < 0) + return CMD_WARNING; if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) { memset(&ip, 0, sizeof(struct ipaddr)); @@ -1395,7 +1388,7 @@ DEFUN (no_debug_bgp_update_direct_peer, DEFPY (debug_bgp_update_prefix_afi_safi, debug_bgp_update_prefix_afi_safi_cmd, - "debug bgp updates prefix l2vpn$afi evpn$safi type [ip ]|multicast ip |prefix ip >", + "debug bgp updates prefix l2vpn$afi evpn$safi type < mac [ip ]| ip | ip >", DEBUG_STR BGP_STR "BGP updates\n" @@ -1404,15 +1397,18 @@ DEFPY (debug_bgp_update_prefix_afi_safi, EVPN_HELP_STR EVPN_TYPE_HELP_STR EVPN_TYPE_2_HELP_STR + EVPN_TYPE_2_HELP_STR MAC_STR MAC_STR MAC_STR IP_STR "IPv4 address\n" "IPv6 address\n" EVPN_TYPE_3_HELP_STR + EVPN_TYPE_3_HELP_STR IP_STR "IPv4 address\n" "IPv6 address\n" EVPN_TYPE_5_HELP_STR + EVPN_TYPE_5_HELP_STR IP_STR "IPv4 prefix\n" "IPv6 prefix\n") @@ -1458,7 +1454,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi, DEFPY (no_debug_bgp_update_prefix_afi_safi, no_debug_bgp_update_prefix_afi_safi_cmd, - "no debug bgp updates prefix l2vpn$afi evpn$safi type [ip ]|multicast ip |prefix ip >", + "no debug bgp updates prefix l2vpn$afi evpn$safi type < mac [ip ]| ip | ip >", NO_STR DEBUG_STR BGP_STR @@ -1468,15 +1464,18 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi, EVPN_HELP_STR EVPN_TYPE_HELP_STR EVPN_TYPE_2_HELP_STR + EVPN_TYPE_2_HELP_STR MAC_STR MAC_STR MAC_STR IP_STR "IPv4 address\n" "IPv6 address\n" EVPN_TYPE_3_HELP_STR + EVPN_TYPE_3_HELP_STR IP_STR "IPv4 address\n" "IPv6 address\n" EVPN_TYPE_5_HELP_STR + EVPN_TYPE_5_HELP_STR IP_STR "IPv4 prefix\n" "IPv6 prefix\n") diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 911b93c4ed..05d28354cc 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -3988,8 +3988,7 @@ DEFUN(show_bgp_l2vpn_evpn_summary, show_established, uj); } -/* Parse type from "type ", return -1 on failure */ -static int cli_parse_type(int *type, struct cmd_token **argv, int argc) +int bgp_evpn_cli_parse_type(int *type, struct cmd_token **argv, int argc) { int type_idx = 0; @@ -4048,7 +4047,7 @@ DEFUN(show_bgp_l2vpn_evpn_route, if (uj) json = json_object_new_object(); - if (cli_parse_type(&type, argv, argc) < 0) + if (bgp_evpn_cli_parse_type(&type, argv, argc) < 0) return CMD_WARNING; if (argv_find(argv, argc, "detail", &detail)) @@ -4108,7 +4107,7 @@ DEFUN(show_bgp_l2vpn_evpn_route_rd, } } - if (cli_parse_type(&type, argv, argc) < 0) + if (bgp_evpn_cli_parse_type(&type, argv, argc) < 0) return CMD_WARNING; evpn_show_route_rd(vty, bgp, &prd, type, json); @@ -4293,7 +4292,7 @@ DEFUN(show_bgp_l2vpn_evpn_route_vni, show_bgp_l2vpn_evpn_route_vni_cmd, vni = strtoul(argv[idx + 3]->arg, NULL, 10); - if (cli_parse_type(&type, argv, argc) < 0) + if (bgp_evpn_cli_parse_type(&type, argv, argc) < 0) return CMD_WARNING; if (argv_find(argv, argc, "vtep", &vtep_idx)) { diff --git a/bgpd/bgp_evpn_vty.h b/bgpd/bgp_evpn_vty.h index 4d07f7d038..33f6e4f1b6 100644 --- a/bgpd/bgp_evpn_vty.h +++ b/bgpd/bgp_evpn_vty.h @@ -28,4 +28,8 @@ extern void bgp_ethernetvpn_init(void); #define L2VPN_HELP_STR "Layer 2 Virtual Private Network\n" #define EVPN_HELP_STR "Ethernet Virtual Private Network\n" +/* Parse type from "type ", return -1 on failure */ +extern int bgp_evpn_cli_parse_type(int *type, struct cmd_token **argv, + int argc); + #endif /* _QUAGGA_BGP_EVPN_VTY_H */