bgpd: Cleanup 'view all' command

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>
This commit is contained in:
Donald Sharp 2017-01-23 20:50:50 -05:00
parent b00b230aa1
commit f2a8972b0b
3 changed files with 15 additions and 31 deletions

View File

@ -492,7 +492,7 @@ bgp_show_all_instances_nexthops_vty (struct vty *vty)
DEFUN (show_ip_bgp_nexthop, DEFUN (show_ip_bgp_nexthop,
show_ip_bgp_nexthop_cmd, show_ip_bgp_nexthop_cmd,
"show [ip] bgp [<view|vrf> VRFNAME] nexthop [detail]", "show [ip] bgp [<view|vrf> WORD] nexthop [detail]",
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
@ -501,7 +501,7 @@ DEFUN (show_ip_bgp_nexthop,
"Show detailed information\n") "Show detailed information\n")
{ {
int idx = 0; 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; int detail = argv_find (argv, argc, "detail", &idx) ? 1 : 0;
return show_ip_bgp_nexthop_table (vty, vrf, detail); return show_ip_bgp_nexthop_table (vty, vrf, detail);
} }

View File

@ -8067,53 +8067,37 @@ DEFUN (show_ip_bgp_regexp,
DEFUN (show_ip_bgp_instance_all, DEFUN (show_ip_bgp_instance_all,
show_ip_bgp_instance_all_cmd, 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 SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
BGP_INSTANCE_ALL_HELP_STR BGP_INSTANCE_ALL_HELP_STR
"Address Family\n" "Address Family\n"
"Address Family modifier\n"
"Address Family modifier\n"
"Address Family\n" "Address Family\n"
"Address Family modifier\n" "Address Family modifier\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 modifier\n"
JSON_STR) JSON_STR)
{ {
vrf_id_t vrf = VRF_DEFAULT;
afi_t afi = AFI_IP; afi_t afi = AFI_IP;
safi_t safi = SAFI_UNICAST; safi_t safi = SAFI_UNICAST;
int idx = 0; int idx = 0;
idx = bgp_vty_find_and_parse_afi_safi_vrf (vty, argv, argc, idx, &afi, &safi, &vrf);
/* show [ip] bgp */ if (!idx)
if (argv_find (argv, argc, "ip", &idx)) {
afi = AFI_IP; vty_out (vty, "View/Vrf Specified: %s is unknown", argv[5]->arg);
/* [<ipv4 [<unicast|multicast>]|ipv6 [<unicast|multicast>]|encap [unicast]|vpnv4 [unicast]>] */ return CMD_WARNING;
if (argv_find (argv, argc, "ipv4", &idx) || argv_find (argv, argc, "ipv6", &idx)) }
{ int uj = use_json (argc, argv);
afi = strmatch(argv[idx]->text, "ipv6") ? AFI_IP6 : AFI_IP; if (uj) argc--;
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);
bgp_show_all_instances_routes_vty (vty, afi, safi, uj); bgp_show_all_instances_routes_vty (vty, afi, safi, uj);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
static int static int
bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi, bgp_show_regexp (struct vty *vty, const char *regstr, afi_t afi,
safi_t safi, enum bgp_show_type type) safi_t safi, enum bgp_show_type type)

View File

@ -8605,7 +8605,7 @@ DEFUN (show_ip_bgp_neighbors,
SHOW_STR SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
BGP_INSTANCE_ALL_HELP_STR BGP_INSTANCE_HELP_STR
"Address Family\n" "Address Family\n"
"Address Family\n" "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, DEFUN (show_ip_bgp_peer_groups,
show_ip_bgp_peer_groups_cmd, 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 SHOW_STR
IP_STR IP_STR
BGP_STR BGP_STR
@ -9253,7 +9253,7 @@ DEFUN (show_ip_bgp_peer_groups,
vrf = pg = NULL; vrf = pg = NULL;
int idx = 0; 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; pg = argv_find (argv, argc, "PGNAME", &idx) ? argv[idx]->arg : NULL;
return bgp_show_peer_group_vty (vty, vrf, show_all_groups, pg); return bgp_show_peer_group_vty (vty, vrf, show_all_groups, pg);