]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Cleanup 'view all' command
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 24 Jan 2017 01:50:50 +0000 (20:50 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 24 Jan 2017 03:34:50 +0000 (22:34 -0500)
1) Make [<view|vrf> WORD] consistent
2) Fix inconsistent help string
3) Fix the show .. vrf all command

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_nexthop.c
bgpd/bgp_route.c
bgpd/bgp_vty.c

index 0a9747b526ed23aee3339f2b2cf64eaadde25a00..0cf96101c2142f3bf9b8a4784b8f6e3b95aa373f 100644 (file)
@@ -492,7 +492,7 @@ bgp_show_all_instances_nexthops_vty (struct vty *vty)
 
 DEFUN (show_ip_bgp_nexthop,
        show_ip_bgp_nexthop_cmd,
-       "show [ip] bgp [<view|vrf> VRFNAME] nexthop [detail]",
+       "show [ip] bgp [<view|vrf> WORD] nexthop [detail]",
        SHOW_STR
        IP_STR
        BGP_STR
@@ -501,7 +501,7 @@ DEFUN (show_ip_bgp_nexthop,
        "Show detailed information\n")
 {
   int idx = 0;
-  char *vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL;
+  char *vrf = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
   int detail = argv_find (argv, argc, "detail", &idx) ? 1 : 0;
   return show_ip_bgp_nexthop_table (vty, vrf, detail);
 }
index 8adc6bd971bc6dacdfce09be27018f965d186ff2..c9fcbf9fb4e757948c14d3f3306757f4adca3d2e 100644 (file)
@@ -8067,53 +8067,37 @@ DEFUN (show_ip_bgp_regexp,
 
 DEFUN (show_ip_bgp_instance_all,
        show_ip_bgp_instance_all_cmd,
-       "show [ip] bgp <view|vrf> all [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] [json]",
+       "show [ip] bgp <view|vrf> all [<ipv4|ipv6> [<unicast|multicast|vpn|encap>]] [json]",
        SHOW_STR
        IP_STR
        BGP_STR
        BGP_INSTANCE_ALL_HELP_STR
        "Address Family\n"
-       "Address Family modifier\n"
-       "Address Family modifier\n"
        "Address Family\n"
        "Address Family modifier\n"
        "Address Family modifier\n"
-       "Address Family\n"
        "Address Family modifier\n"
-       "Address Family\n"
        "Address Family modifier\n"
        JSON_STR)
 {
+  vrf_id_t vrf = VRF_DEFAULT;
   afi_t afi = AFI_IP;
   safi_t safi = SAFI_UNICAST;
 
   int idx = 0;
-
-  /* show [ip] bgp */
-  if (argv_find (argv, argc, "ip", &idx))
-    afi = AFI_IP;
-  /* [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] */
-  if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx))
-  {
-    afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP;
-    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))
-  {
-    afi = AFI_IP;
-    safi = strmatch (argv[idx]->text, "encap") ? SAFI_ENCAP : SAFI_MPLS_VPN;
-    // advance idx if necessary
-    argv_find (argv, argc, "unicast", &idx);
-  }
-
-  u_char uj = use_json(argc, argv);
+  idx = bgp_vty_find_and_parse_afi_safi_vrf (vty, argv, argc, idx, &afi, &safi, &vrf);
+  if (!idx)
+    {
+      vty_out (vty, "View/Vrf Specified: %s is unknown", argv[5]->arg);
+      return CMD_WARNING;
+    }
+  int uj = use_json (argc, argv);
+  if (uj) argc--;
 
   bgp_show_all_instances_routes_vty (vty, afi, safi, uj);
   return CMD_SUCCESS;
 }
 
-
 static int
 bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi,
                 safi_t safi, enum bgp_show_type type)
index 7f4bd49d295476dca3e9479de1169d4ad7cbd833..fa19308cb137aa9db6a823213521e5a932bfb2d9 100644 (file)
@@ -8605,7 +8605,7 @@ DEFUN (show_ip_bgp_neighbors,
        SHOW_STR
        IP_STR
        BGP_STR
-       BGP_INSTANCE_ALL_HELP_STR
+       BGP_INSTANCE_HELP_STR
        "Address Family\n"
        "Address Family\n"
        "Address Family\n"
@@ -9241,7 +9241,7 @@ bgp_show_peer_group_vty (struct vty *vty, const char *name,
 
 DEFUN (show_ip_bgp_peer_groups,
        show_ip_bgp_peer_groups_cmd,
-       "show [ip] bgp [<view|vrf> VRFNAME] peer-group [PGNAME]",
+       "show [ip] bgp [<view|vrf> WORD] peer-group [PGNAME]",
        SHOW_STR
        IP_STR
        BGP_STR
@@ -9253,7 +9253,7 @@ DEFUN (show_ip_bgp_peer_groups,
   vrf = pg = NULL;
   int idx = 0;
 
-  vrf = argv_find (argv, argc, "VRFNAME", &idx) ? argv[idx]->arg : NULL;
+  vrf = argv_find (argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
   pg = argv_find (argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL;
 
   return bgp_show_peer_group_vty (vty, vrf, show_all_groups, pg);