]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Add back missing vpnv4 commands
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 29 Nov 2016 20:25:24 +0000 (20:25 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 29 Nov 2016 20:25:24 +0000 (20:25 +0000)
* show ip bgp vpnv4 all <A.B.C.D|A.B.C.D/M> [json]
* show...vpnv4 <all|rd ...> summary...
* Fix placement of AF+SAFI specifiers for BGP clear commands
* Add more [ip]'s for bgp commands
* clean up some doc strings

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
bgpd/bgp_route.c
bgpd/bgp_vty.c

index 6c71fd525c6fb0d874fcb113881cfec07f0c455d..f03b5a54bb6a0160f66924251f4aadc06e74e8d1 100644 (file)
@@ -9056,7 +9056,7 @@ DEFUN (show_ip_bgp_neighbor_prefix_counts,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display detailed prefix count information\n"
        "JavaScript Object Notation\n")
 {
@@ -9081,7 +9081,7 @@ DEFUN (show_ip_bgp_instance_neighbor_prefix_counts,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display detailed prefix count information\n"
        "JavaScript Object Notation\n")
 {
@@ -9106,7 +9106,7 @@ DEFUN (show_bgp_ipv6_neighbor_prefix_counts,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display detailed prefix count information\n"
        "JavaScript Object Notation\n")
 {
@@ -9131,7 +9131,7 @@ DEFUN (show_bgp_instance_ipv6_neighbor_prefix_counts,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display detailed prefix count information\n"
        "JavaScript Object Notation\n")
 {
@@ -9159,7 +9159,7 @@ DEFUN (show_ip_bgp_ipv4_neighbor_prefix_counts,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display detailed prefix count information\n"
        "JavaScript Object Notation\n")
 {
@@ -9185,12 +9185,11 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts,
        IP_STR
        BGP_STR
        "Address Family\n"
-       "Address Family modifier\n"
-       "Address Family modifier\n"
+       "Display information about all VPNv4 NLRIs\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display detailed prefix count information\n"
        "JavaScript Object Notation\n")
 {
@@ -9205,6 +9204,22 @@ DEFUN (show_ip_bgp_vpnv4_neighbor_prefix_counts,
   return bgp_peer_counts (vty, peer, AFI_IP, SAFI_MPLS_VPN, uj);
 }
 
+DEFUN (show_ip_bgp_vpnv4_all_route_prefix,
+       show_ip_bgp_vpnv4_all_route_prefix_cmd,
+       "show ip bgp vpnv4 all <A.B.C.D|A.B.C.D/M> [json]",
+       SHOW_STR
+       IP_STR
+       BGP_STR
+       "Address Family\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Network in the BGP routing table to display\n"
+       "JavaScript Object Notation\n")
+{
+  int idx = 0;
+  char *network = argv_find (argv, argc, "A.B.C.D", &idx) ? argv[idx]->arg : NULL;
+  return bgp_show_route (vty, NULL, network, AFI_IP, SAFI_MPLS_VPN, 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)
@@ -9465,7 +9480,7 @@ DEFUN (show_ip_bgp_instance_neighbor_advertised_route,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display the received routes from neighbor\n"
        "Display the routes advertised to a BGP neighbor\n"
        "Route-map to modify the attributes\n"
@@ -9540,7 +9555,7 @@ DEFUN (show_ip_bgp_neighbor_received_prefix_filter,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display information received from a BGP neighbor\n"
        "Display the prefixlist filter\n"
        "JavaScript Object Notation\n")
@@ -9657,7 +9672,7 @@ DEFUN (show_ip_bgp_neighbor_routes,
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "Display flap statistics of the routes learned from neighbor\n"
        "Display the dampened routes received from neighbor\n"
        "Display routes learned from neighbor\n"
@@ -10550,16 +10565,15 @@ bgp_route_init (void)
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd);
   
   /* Restricted node: VIEW_NODE - (set of dangerous commands) */
-
   install_element (VIEW_NODE, &show_ip_bgp_instance_all_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_route_cmd);
-
   install_element (VIEW_NODE, &show_ip_bgp_instance_neighbor_advertised_route_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_neighbor_routes_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_neighbor_received_prefix_filter_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_dampening_params_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_ipv4_dampening_parameters_cmd);
+  install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_route_prefix_cmd);
 
  /* BGP dampening clear commands */
   install_element (ENABLE_NODE, &clear_ip_bgp_dampening_cmd);
index 77cf410a0fce49bcaecd733afda734e04ba0f43b..39eb6171c2256bd61fd9df31f2a2c71bb1c8d0a4 100644 (file)
@@ -5719,7 +5719,7 @@ bgp_clear_prefix (struct vty *vty, const char *view_name, const char *ip_str,
 /* one clear bgp command to rule them all */
 DEFUN (clear_ip_bgp_all,
        clear_ip_bgp_all_cmd,
-       "clear [ip] bgp [<view|vrf> WORD] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] [<soft [<in|out>]|in [prefix-filter]|out>]",
+       "clear [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> [<soft [<in|out>]|in [prefix-filter]|out>]",
        CLEAR_STR
        IP_STR
        BGP_STR
@@ -5879,7 +5879,7 @@ DEFUN (clear_ip_bgp_prefix,
 
 DEFUN (clear_bgp_ipv6_safi_prefix,
        clear_bgp_ipv6_safi_prefix_cmd,
-       "clear bgp ipv6 <unicast|multicast> prefix X:X::X:X/M",
+       "clear [ip] bgp ipv6 <unicast|multicast> prefix X:X::X:X/M",
        CLEAR_STR
        BGP_STR
        "Address Family\n"
@@ -5898,7 +5898,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix,
 
 DEFUN (clear_bgp_instance_ipv6_safi_prefix,
        clear_bgp_instance_ipv6_safi_prefix_cmd,
-       "clear bgp <view|vrf> WORD ipv6 <unicast|multicast> prefix X:X::X:X/M",
+       "clear [ip] bgp <view|vrf> WORD ipv6 <unicast|multicast> prefix X:X::X:X/M",
        CLEAR_STR
        BGP_STR
        BGP_INSTANCE_HELP_STR
@@ -6630,7 +6630,7 @@ bgp_show_summary_vty (struct vty *vty, const char *name,
 /* `show ip bgp summary' commands. */
 DEFUN (show_ip_bgp_summary,
        show_ip_bgp_summary_cmd,
-       "show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] summary [json]",
+       "show [ip] bgp [<view|vrf> WORD] [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] summary [json]",
        SHOW_STR
        IP_STR
        BGP_STR
@@ -6644,7 +6644,9 @@ DEFUN (show_ip_bgp_summary,
        "Address Family\n"
        "Address Family modifier\n"
        "Address Family\n"
-       "Address Family modifier\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Display information for a route distinguisher\n"
+       "VPN Route Distinguisher\n"
        "Summary of BGP neighbor status\n"
        "JavaScript Object Notation\n")
 {
@@ -6667,13 +6669,18 @@ DEFUN (show_ip_bgp_summary,
     if (argv_find (argv, argc, "unicast", &idx) || argv_find (argv, argc, "multicast", &idx))
       safi = strmatch (argv[idx]->text, "unicast") ? SAFI_UNICAST : SAFI_MULTICAST;
   }
-  else if (argv_find (argv, argc, "encap", &idx) || argv_find (argv, argc, "vpnv4", &idx))
+  else if (argv_find (argv, argc, "encap", &idx))
   {
     afi = AFI_IP;
-    safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN;
-    // advance idx if necessary
-    argv_find (argv, argc, "unicast", &idx);
+    safi = SAFI_ENCAP;
   }
+  else if (argv_find (argv, argc, "vpnv4", &idx))
+  {
+    // we show the same thing regardless of rd and all
+    afi = AFI_IP;
+    safi = SAFI_MPLS_VPN;
+  }
+
   int uj = use_json (argc, argv);
 
   return bgp_show_summary_vty (vty, vrf, afi, safi, uj);
@@ -8516,17 +8523,21 @@ bgp_show_neighbor_vty (struct vty *vty, const char *name,
 /* "show ip bgp neighbors" commands.  */
 DEFUN (show_ip_bgp_neighbors,
        show_ip_bgp_neighbors_cmd,
-       "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
+       "show [ip] bgp [<view|vrf> WORD] [<ipv4|ipv6|vpnv4 <all|rd ASN:nn_or_IP-address:nn>>] neighbors [<A.B.C.D|X:X::X:X|WORD>] [json]",
        SHOW_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_ALL_HELP_STR
        "Address Family\n"
        "Address Family\n"
+       "Address Family\n"
+       "Display information about all VPNv4 NLRIs\n"
+       "Display information for a route distinguisher\n"
+       "VPN Route Distinguisher\n"
        "Detailed information on TCP and BGP neighbor connections\n"
        "Neighbor to display information about\n"
        "Neighbor to display information about\n"
-       "Neighbor on bgp configured interface\n"
+       "Neighbor on BGP configured interface\n"
        "JavaScript Object Notation\n")
 {
   char *vrf = NULL;
@@ -8540,7 +8551,8 @@ DEFUN (show_ip_bgp_neighbors,
   if (argv_find (argv, argc, "WORD", &idx))
     vrf = argv[idx]->arg;
 
-  if (argv_find (argv, argc, "A.B.C.D", &idx) || argv_find (argv, argc, "X:X::X:X", &idx) ||
+  if (argv_find (argv, argc, "A.B.C.D", &idx) ||
+      argv_find (argv, argc, "X:X::X:X", &idx) ||
       argv_find (argv, argc, "WORD", &idx))
   {
     sh_type = show_peer;
@@ -10689,7 +10701,6 @@ bgp_vty_init (void)
   install_element (VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
   install_element (VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
   install_element (VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
-  install_element (VIEW_NODE, &show_ip_bgp_summary_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_updgrps_cmd);
   install_element (VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
   install_element (VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd);