From 4c63a661e367cdbb16edbdaff50a804428027dcc Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 28 Sep 2016 18:54:17 +0200 Subject: [PATCH] bgpd: vty commands added for EVPN address family Enhancement of the following show vty evpn commands: show bgp l2vpn evpn all A.B.C.D Signed-off-by: Philippe Guibert --- bgpd/bgp_evpn_vty.c | 3 --- bgpd/bgp_evpn_vty.h | 4 ++++ bgpd/bgp_route.c | 25 +++++++++++++++++++++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c index 9016f530bc..862d0ff92b 100644 --- a/bgpd/bgp_evpn_vty.c +++ b/bgpd/bgp_evpn_vty.c @@ -31,9 +31,6 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #include "bgpd/bgp_vpn.h" #include "bgpd/bgp_evpn_vty.h" -#define L2VPN_HELP_STR "Layer 2 Virtual Private Network\n" -#define EVPN_HELP_STR "Ethernet Virtual Private Network\n" - #define SHOW_DISPLAY_STANDARD 0 #define SHOW_DISPLAY_TAGS 1 #define SHOW_DISPLAY_OVERLAY 2 diff --git a/bgpd/bgp_evpn_vty.h b/bgpd/bgp_evpn_vty.h index 367a4bd20d..ed654d90b2 100644 --- a/bgpd/bgp_evpn_vty.h +++ b/bgpd/bgp_evpn_vty.h @@ -24,4 +24,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 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" + + #endif /* _QUAGGA_BGP_EVPN_VTY_H */ diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 9145a9af73..d5d5546a8d 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9269,7 +9269,27 @@ DEFUN (show_ip_bgp_vpn_all_route_prefix, } #endif /* KEEP_OLD_VPN_COMMANDS */ -static void +DEFUN (show_ip_bgp_l2vpn_evpn_all_route_prefix, + show_ip_bgp_l2vpn_evpn_all_route_prefix_cmd, + "show [ip] bgp l2vpn evpn all [json]", + SHOW_STR + IP_STR + BGP_STR + L2VPN_HELP_STR + EVPN_HELP_STR + "Display information about all EVPN NLRIs\n" + "Network in the BGP routing table to display\n" + "Network in the BGP routing table to display\n" + JSON_STR) +{ + int idx = 0; + char *network = NULL; + network = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL; + network = argv_find (argv, argc, "A.B.C.D/M", &idx) ? argv[idx]->arg : NULL; + return bgp_show_route (vty, NULL, network, AFI_L2VPN, SAFI_EVPN, NULL, 0, BGP_PATH_ALL, use_json(argc, argv)); +} + + static void show_adj_route (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, int in, const char *rmap_name, u_char use_json, json_object *json) { @@ -10624,7 +10644,8 @@ bgp_route_init (void) install_element (VIEW_NODE, &show_ip_bgp_vpn_all_route_prefix_cmd); #endif /* KEEP_OLD_VPN_COMMANDS */ install_element (VIEW_NODE, &show_bgp_afi_vpn_rd_route_cmd); - + install_element (VIEW_NODE, &show_ip_bgp_l2vpn_evpn_all_route_prefix_cmd); + /* BGP dampening clear commands */ install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd); install_element (ENABLE_NODE, &clear_ip_bgp_dampening_prefix_cmd); -- 2.39.5