From d617d5febfbba2b986206e250f1bb3ccf0f23d10 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 15 Jun 2017 13:43:26 -0400 Subject: [PATCH 1/4] *: Add vrf autocompletion for commands Switch NAME to VRFNAME and add vrf autocompletion to commands that have them Signed-off-by: Donald Sharp --- lib/if.c | 6 ++--- lib/vrf.c | 29 ++++++++++++++++++++++-- vtysh/vtysh.c | 8 +++---- zebra/interface.c | 6 ++--- zebra/router-id.c | 4 ++-- zebra/zebra_vty.c | 58 +++++++++++++++++++++++------------------------ 6 files changed, 68 insertions(+), 43 deletions(-) diff --git a/lib/if.c b/lib/if.c index dc417f8e3c..d4b3d3f7a4 100644 --- a/lib/if.c +++ b/lib/if.c @@ -678,7 +678,7 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME [vrf NAME]", + "interface IFNAME [vrf VRFNAME]", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -723,7 +723,7 @@ DEFUN (interface, DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME [vrf NAME]", + "no interface IFNAME [vrf VRFNAME]", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -774,7 +774,7 @@ if_cmd_init (void) /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address [vrf NAME]", + "show address [vrf VRFNAME]", SHOW_STR "address\n" VRF_CMD_HELP_STR) diff --git a/lib/vrf.c b/lib/vrf.c index c4e527db5b..dbba67164f 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -377,6 +377,29 @@ vrf_bitmap_check (vrf_bitmap_t bmap, vrf_id_t vrf_id) VRF_BITMAP_FLAG (offset)) ? 1 : 0; } +static void +vrf_autocomplete (vector comps, struct cmd_token *token) +{ + struct vrf *vrf = NULL; + + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + if (vrf->vrf_id != 0) + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, vrf->name)); + } +} + +static const struct cmd_variable_handler vrf_var_handlers[] = { + { + .tokenname = "VRFNAME", + .completions = vrf_autocomplete, + }, + { + .completions = NULL + }, +}; + + /* Initialize VRF module. */ void vrf_init (int (*create)(struct vrf *), @@ -408,6 +431,8 @@ vrf_init (int (*create)(struct vrf *), zlog_err ("vrf_init: failed to enable the default VRF!"); exit (1); } + + cmd_variable_handler_register (vrf_var_handlers); } /* Terminate VRF module. */ @@ -439,7 +464,7 @@ vrf_socket (int domain, int type, int protocol, vrf_id_t vrf_id) /* vrf CLI commands */ DEFUN_NOSH (vrf, vrf_cmd, - "vrf NAME", + "vrf VRFNAME", "Select a VRF to configure\n" "VRF's name\n") { @@ -464,7 +489,7 @@ DEFUN_NOSH (vrf, DEFUN_NOSH (no_vrf, no_vrf_cmd, - "no vrf NAME", + "no vrf VRFNAME", NO_STR "Delete a pseudo VRF's configuration\n" "VRF's name\n") diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ffdfd5d725..27077951b0 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1902,7 +1902,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_INTERFACE, vtysh_interface, vtysh_interface_cmd, - "interface IFNAME [vrf NAME]", + "interface IFNAME vrf VRFNAME", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -1921,7 +1921,7 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_EIGRPD DEFSH (VTYSH_ZEBRA, vtysh_no_interface_vrf_cmd, - "no interface IFNAME vrf NAME", + "no interface IFNAME vrf VRFNAME", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -1943,7 +1943,7 @@ DEFUNSH (VTYSH_NS, DEFUNSH (VTYSH_VRF, vtysh_vrf, vtysh_vrf_cmd, - "vrf NAME", + "vrf VRFNAME", "Select a VRF to configure\n" "VRF's name\n") { @@ -1953,7 +1953,7 @@ DEFUNSH (VTYSH_VRF, DEFSH (VTYSH_ZEBRA, vtysh_no_vrf_cmd, - "no vrf NAME", + "no vrf VRFNAME", NO_STR "Delete a pseudo vrf's configuration\n" "VRF's name\n") diff --git a/zebra/interface.c b/zebra/interface.c index 9393305f06..39476c6119 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1282,7 +1282,7 @@ struct cmd_node interface_node = /* Show all interfaces to vty. */ DEFUN (show_interface, show_interface_cmd, - "show interface [vrf NAME]", + "show interface [vrf VRFNAME]", SHOW_STR "Interface status and configuration\n" VRF_CMD_HELP_STR) @@ -1330,7 +1330,7 @@ DEFUN (show_interface_vrf_all, DEFUN (show_interface_name_vrf, show_interface_name_vrf_cmd, - "show interface IFNAME vrf NAME", + "show interface IFNAME vrf VRFNAME", SHOW_STR "Interface status and configuration\n" "Interface name\n" @@ -1438,7 +1438,7 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id) DEFUN (show_interface_desc, show_interface_desc_cmd, - "show interface description [vrf NAME]", + "show interface description [vrf VRFNAME]", SHOW_STR "Interface status and configuration\n" "Interface description\n" diff --git a/zebra/router-id.c b/zebra/router-id.c index 318986c1b7..f4306ba21e 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -215,7 +215,7 @@ router_id_write (struct vty *vty) DEFUN (router_id, router_id_cmd, - "router-id A.B.C.D [vrf NAME]", + "router-id A.B.C.D [vrf VRFNAME]", "Manually set the router-id\n" "IP address to use for router-id\n" VRF_CMD_HELP_STR) @@ -243,7 +243,7 @@ DEFUN (router_id, DEFUN (no_router_id, no_router_id_cmd, - "no router-id [A.B.C.D [vrf NAME]]", + "no router-id [A.B.C.D [vrf VRFNAME]]", NO_STR "Remove the manually configured router-id\n" "IP address to use for router-id\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 88778e491b..d1ca6d0a39 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -395,7 +395,7 @@ zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[], /* Static route configuration. */ DEFUN (ip_route, ip_route_cmd, - "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -425,7 +425,7 @@ DEFUN (ip_route, DEFUN (ip_route_flags, ip_route_flags_cmd, - "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -456,7 +456,7 @@ DEFUN (ip_route_flags, /* Mask as A.B.C.D format. */ DEFUN (ip_route_mask, ip_route_mask_cmd, - "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -488,7 +488,7 @@ DEFUN (ip_route_mask, DEFUN (ip_route_mask_flags, ip_route_mask_flags_cmd, - "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -520,7 +520,7 @@ DEFUN (ip_route_mask_flags, DEFUN (no_ip_route, no_ip_route_cmd, - "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -552,7 +552,7 @@ DEFUN (no_ip_route, DEFUN (no_ip_route_flags, no_ip_route_flags_cmd, - "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -580,7 +580,7 @@ DEFUN (no_ip_route_flags, DEFUN (no_ip_route_mask, no_ip_route_mask_cmd, - "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -614,7 +614,7 @@ DEFUN (no_ip_route_mask, DEFUN (no_ip_route_mask_flags, no_ip_route_mask_flags_cmd, - "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -1219,7 +1219,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi, DEFUN (show_ip_nht, show_ip_nht_cmd, - "show ip nht [vrf NAME]", + "show ip nht [vrf VRFNAME]", SHOW_STR IP_STR "IP nexthop tracking table\n" @@ -1259,7 +1259,7 @@ DEFUN (show_ip_nht_vrf_all, DEFUN (show_ipv6_nht, show_ipv6_nht_cmd, - "show ipv6 nht [vrf NAME]", + "show ipv6 nht [vrf VRFNAME]", SHOW_STR IPV6_STR "IPv6 nexthop tracking table\n" @@ -1362,7 +1362,7 @@ DEFUN (no_ipv6_nht_default_route, // dwalton one "show ip route" to rule them all DEFUN (show_ip_route, show_ip_route_cmd, - "show ip [vrf NAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]", + "show ip [vrf VRFNAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]", SHOW_STR IP_STR "IP forwarding table\n" @@ -1475,7 +1475,7 @@ DEFUN (show_ip_route, DEFUN (show_ip_route_addr, show_ip_route_addr_cmd, - "show ip route [vrf NAME] A.B.C.D", + "show ip route [vrf VRFNAME] A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -1524,7 +1524,7 @@ DEFUN (show_ip_route_addr, DEFUN (show_ip_route_prefix, show_ip_route_prefix_cmd, - "show ip route [vrf NAME] A.B.C.D/M", + "show ip route [vrf VRFNAME] A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" @@ -1724,7 +1724,7 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) /* Show route summary. */ DEFUN (show_ip_route_summary, show_ip_route_summary_cmd, - "show ip route [vrf NAME] summary", + "show ip route [vrf VRFNAME] summary", SHOW_STR IP_STR "IP routing table\n" @@ -1749,7 +1749,7 @@ DEFUN (show_ip_route_summary, /* Show route summary prefix. */ DEFUN (show_ip_route_summary_prefix, show_ip_route_summary_prefix_cmd, - "show ip route [vrf NAME] summary prefix", + "show ip route [vrf VRFNAME] summary prefix", SHOW_STR IP_STR "IP routing table\n" @@ -2165,7 +2165,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, DEFUN (ipv6_route, ipv6_route_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2211,7 +2211,7 @@ DEFUN (ipv6_route, DEFUN (ipv6_route_flags, ipv6_route_flags_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2263,7 +2263,7 @@ DEFUN (ipv6_route_flags, DEFUN (ipv6_route_ifname, ipv6_route_ifname_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2312,7 +2312,7 @@ DEFUN (ipv6_route_ifname, DEFUN (ipv6_route_ifname_flags, ipv6_route_ifname_flags_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2366,7 +2366,7 @@ DEFUN (ipv6_route_ifname_flags, DEFUN (no_ipv6_route, no_ipv6_route_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -2413,7 +2413,7 @@ DEFUN (no_ipv6_route, DEFUN (no_ipv6_route_flags, no_ipv6_route_flags_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -2465,7 +2465,7 @@ DEFUN (no_ipv6_route_flags, DEFUN (no_ipv6_route_ifname, no_ipv6_route_ifname_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -2515,7 +2515,7 @@ DEFUN (no_ipv6_route_ifname, DEFUN (no_ipv6_route_ifname_flags, no_ipv6_route_ifname_flags_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", NO_STR IP_STR "Establish static routes\n" @@ -2571,7 +2571,7 @@ DEFUN (no_ipv6_route_ifname_flags, // dwalton duplicate to here DEFUN (show_ipv6_route, show_ipv6_route_cmd, - "show ipv6 [vrf NAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]", + "show ipv6 [vrf VRFNAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]", SHOW_STR IP_STR "IP forwarding table\n" @@ -2670,7 +2670,7 @@ DEFUN (show_ipv6_route, DEFUN (show_ipv6_route_addr, show_ipv6_route_addr_cmd, - "show ipv6 route [vrf NAME] X:X::X:X", + "show ipv6 route [vrf VRFNAME] X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2719,7 +2719,7 @@ DEFUN (show_ipv6_route_addr, DEFUN (show_ipv6_route_prefix, show_ipv6_route_prefix_cmd, - "show ipv6 route [vrf NAME] X:X::X:X/M", + "show ipv6 route [vrf VRFNAME] X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2768,7 +2768,7 @@ DEFUN (show_ipv6_route_prefix, /* Show route summary. */ DEFUN (show_ipv6_route_summary, show_ipv6_route_summary_cmd, - "show ipv6 route [vrf NAME] summary", + "show ipv6 route [vrf VRFNAME] summary", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2794,7 +2794,7 @@ DEFUN (show_ipv6_route_summary, /* Show ipv6 route summary prefix. */ DEFUN (show_ipv6_route_summary_prefix, show_ipv6_route_summary_prefix_cmd, - "show ipv6 route [vrf NAME] summary prefix", + "show ipv6 route [vrf VRFNAME] summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2824,7 +2824,7 @@ DEFUN (show_ipv6_route_summary_prefix, */ DEFUN (show_ipv6_mroute, show_ipv6_mroute_cmd, - "show ipv6 mroute [vrf NAME]", + "show ipv6 mroute [vrf VRFNAME]", SHOW_STR IP_STR "IPv6 Multicast routing table\n" From 18c57037100955cd6588ccc62d0d63923bed7d07 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 15 Jun 2017 13:48:06 -0400 Subject: [PATCH 2/4] bgpd: Add view/vrf auto completion to commands Modify the ' NAME' commands to allow auto-completion of available choices. Signed-off-by: Donald Sharp --- bgpd/bgp_nexthop.c | 2 +- bgpd/bgp_route.c | 16 ++++++++-------- bgpd/bgp_vty.c | 40 ++++++++++++++++++++-------------------- bgpd/bgpd.c | 31 +++++++++++++++++++++++++++++++ bgpd/rfapi/rfapi_vty.c | 6 +++--- 5 files changed, 63 insertions(+), 32 deletions(-) diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c index 132b754104..e35f9752f1 100644 --- a/bgpd/bgp_nexthop.c +++ b/bgpd/bgp_nexthop.c @@ -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 [ WORD] nexthop [detail]", + "show [ip] bgp [ VIEWVRFNAME] nexthop [detail]", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 31c1dd8c10..979e7bda35 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8438,7 +8438,7 @@ bgp_show_lcommunity_list (struct vty *vty, struct bgp *bgp, const char *lcom, DEFUN (show_ip_bgp_large_community_list, show_ip_bgp_large_community_list_cmd, - "show [ip] bgp [ WORD] [ []] large-community-list <(1-500)|WORD> [json]", + "show [ip] bgp [ VIEWVRFNAME] [ []] large-community-list <(1-500)|WORD> [json]", SHOW_STR IP_STR BGP_STR @@ -8484,7 +8484,7 @@ DEFUN (show_ip_bgp_large_community_list, } DEFUN (show_ip_bgp_large_community, show_ip_bgp_large_community_cmd, - "show [ip] bgp [ WORD] [ []] large-community [AA:BB:CC] [json]", + "show [ip] bgp [ VIEWVRFNAME] [ []] large-community [AA:BB:CC] [json]", SHOW_STR IP_STR BGP_STR @@ -8535,7 +8535,7 @@ static int bgp_table_stats (struct vty *vty, struct bgp *bgp, afi_t afi, safi_t /* BGP route print out function. */ DEFUN (show_ip_bgp, show_ip_bgp_cmd, - "show [ip] bgp [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]]\ + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]]\ [<\ cidr-only\ |dampening \ @@ -8656,7 +8656,7 @@ DEFUN (show_ip_bgp, DEFUN (show_ip_bgp_route, show_ip_bgp_route_cmd, - "show [ip] bgp [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]]" + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]]" " [] [json]", SHOW_STR IP_STR @@ -8725,7 +8725,7 @@ DEFUN (show_ip_bgp_route, DEFUN (show_ip_bgp_regexp, show_ip_bgp_regexp_cmd, - "show [ip] bgp [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] regexp REGEX...", + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] regexp REGEX...", SHOW_STR IP_STR BGP_STR @@ -9437,7 +9437,7 @@ bgp_peer_counts (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, u_c DEFUN (show_ip_bgp_instance_neighbor_prefix_counts, show_ip_bgp_instance_neighbor_prefix_counts_cmd, - "show [ip] bgp [ WORD] [ []] " + "show [ip] bgp [ VIEWVRFNAME] [ []] " "neighbors prefix-counts [json]", SHOW_STR IP_STR @@ -9810,7 +9810,7 @@ peer_adj_routes (struct vty *vty, struct peer *peer, afi_t afi, safi_t safi, DEFUN (show_ip_bgp_instance_neighbor_advertised_route, show_ip_bgp_instance_neighbor_advertised_route_cmd, - "show [ip] bgp [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] " + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] " "neighbors [route-map WORD] [json]", SHOW_STR IP_STR @@ -9974,7 +9974,7 @@ bgp_show_neighbor_route (struct vty *vty, struct peer *peer, afi_t afi, DEFUN (show_ip_bgp_neighbor_routes, show_ip_bgp_neighbor_routes_cmd, - "show [ip] bgp [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] " + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] " "neighbors [json]", SHOW_STR IP_STR diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index f5f538de95..702427a9c4 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -275,11 +275,11 @@ argv_find_and_parse_safi (struct cmd_token **argv, int argc, int *index, safi_t * that is being parsed. * * The show commands are generally of the form: - * "show [ip] bgp [ WORD] [ []] ..." + * "show [ip] bgp [ VIEWVRFNAME] [ []] ..." * * Since we use argv_find if the show command in particular doesn't have: * [ip] - * [ WORD] + * [ VIEWVRFNAME] * [ []] * The command parsing should still be ok. * @@ -859,7 +859,7 @@ DEFUN (no_auto_summary, /* "router bgp" commands. */ DEFUN_NOSH (router_bgp, router_bgp_cmd, - "router bgp [(1-4294967295) [ WORD]]", + "router bgp [(1-4294967295) [ VIEWVRFNAME]]", ROUTER_STR BGP_STR AS_STR @@ -937,7 +937,7 @@ DEFUN_NOSH (router_bgp, /* "no router bgp" commands. */ DEFUN (no_router_bgp, no_router_bgp_cmd, - "no router bgp [(1-4294967295) [ WORD]]", + "no router bgp [(1-4294967295) [ VIEWVRFNAME]]", NO_STR ROUTER_STR BGP_STR @@ -6499,7 +6499,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 [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> []|in [prefix-filter]|out>]", + "clear [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] <*|A.B.C.D|X:X::X:X|WORD|(1-4294967295)|external|peer-group WORD> []|in [prefix-filter]|out>]", CLEAR_STR IP_STR BGP_STR @@ -6534,7 +6534,7 @@ DEFUN (clear_ip_bgp_all, /* clear [ip] bgp */ if (argv_find (argv, argc, "ip", &idx)) afi = AFI_IP; - /* [ WORD] */ + /* [ VIEWVRFNAME] */ if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) { vrf = argv[idx + 1]->arg; @@ -6604,7 +6604,7 @@ DEFUN (clear_ip_bgp_all, DEFUN (clear_ip_bgp_prefix, clear_ip_bgp_prefix_cmd, - "clear [ip] bgp [ WORD] prefix A.B.C.D/M", + "clear [ip] bgp [ VIEWVRFNAME] prefix A.B.C.D/M", CLEAR_STR IP_STR BGP_STR @@ -6617,7 +6617,7 @@ DEFUN (clear_ip_bgp_prefix, int idx = 0; - /* [ WORD] */ + /* [ VIEWVRFNAME] */ if (argv_find (argv, argc, "WORD", &idx)) vrf = argv[idx]->arg; @@ -6645,7 +6645,7 @@ DEFUN (clear_bgp_ipv6_safi_prefix, DEFUN (clear_bgp_instance_ipv6_safi_prefix, clear_bgp_instance_ipv6_safi_prefix_cmd, - "clear [ip] bgp WORD ipv6 "BGP_SAFI_CMD_STR" prefix X:X::X:X/M", + "clear [ip] bgp VIEWVRFNAME ipv6 "BGP_SAFI_CMD_STR" prefix X:X::X:X/M", CLEAR_STR IP_STR BGP_STR @@ -7474,7 +7474,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 [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] summary [json]", + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] summary [json]", SHOW_STR IP_STR BGP_STR @@ -7493,7 +7493,7 @@ DEFUN (show_ip_bgp_summary, /* show [ip] bgp */ if (argv_find (argv, argc, "ip", &idx)) afi = AFI_IP; - /* [ WORD] */ + /* [ VIEWVRFNAME] */ if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) vrf = argv[++idx]->arg; /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */ @@ -9430,7 +9430,7 @@ 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 [ WORD] [>] neighbors [] [json]", + "show [ip] bgp [ VIEWVRFNAME] [>] neighbors [] [json]", SHOW_STR IP_STR BGP_STR @@ -9610,7 +9610,7 @@ bgp_show_update_groups(struct vty *vty, const char *name, DEFUN (show_ip_bgp_updgrps, show_ip_bgp_updgrps_cmd, - "show [ip] bgp [ WORD] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] update-groups [SUBGROUP-ID]", + "show [ip] bgp [ VIEWVRFNAME] ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] update-groups [SUBGROUP-ID]", SHOW_STR IP_STR BGP_STR @@ -9630,7 +9630,7 @@ DEFUN (show_ip_bgp_updgrps, /* show [ip] bgp */ if (argv_find (argv, argc, "ip", &idx)) afi = AFI_IP; - /* [ WORD] */ + /* [ VIEWVRFNAME] */ if (argv_find (argv, argc, "view", &idx) || argv_find (argv, argc, "vrf", &idx)) vrf = argv[++idx]->arg; /* ["BGP_AFI_CMD_STR" ["BGP_SAFI_CMD_STR"]] */ @@ -9680,7 +9680,7 @@ DEFUN (show_bgp_updgrps_stats, DEFUN (show_bgp_instance_updgrps_stats, show_bgp_instance_updgrps_stats_cmd, - "show [ip] bgp WORD update-groups statistics", + "show [ip] bgp VIEWVRFNAME update-groups statistics", SHOW_STR IP_STR BGP_STR @@ -9740,7 +9740,7 @@ DEFUN (show_ip_bgp_updgrps_adj, DEFUN (show_ip_bgp_instance_updgrps_adj, show_ip_bgp_instance_updgrps_adj_cmd, - "show [ip] bgp WORD update-groups ", + "show [ip] bgp VIEWVRFNAME update-groups ", SHOW_STR IP_STR BGP_STR @@ -9798,7 +9798,7 @@ DEFUN (show_bgp_updgrps_adj, DEFUN (show_bgp_instance_updgrps_adj, show_bgp_instance_updgrps_adj_cmd, - "show [ip] bgp WORD update-groups ", + "show [ip] bgp VIEWVRFNAME update-groups ", SHOW_STR IP_STR BGP_STR @@ -9839,7 +9839,7 @@ DEFUN (show_ip_bgp_updgrps_adj_s, DEFUN (show_ip_bgp_instance_updgrps_adj_s, show_ip_bgp_instance_updgrps_adj_s_cmd, - "show [ip] bgp WORD update-groups SUBGROUP-ID ", + "show [ip] bgp VIEWVRFNAME update-groups SUBGROUP-ID ", SHOW_STR IP_STR BGP_STR @@ -9915,7 +9915,7 @@ DEFUN (show_bgp_updgrps_adj_s, DEFUN (show_bgp_instance_updgrps_adj_s, show_bgp_instance_updgrps_adj_s_cmd, - "show [ip] bgp WORD update-groups SUBGROUP-ID ", + "show [ip] bgp VIEWVRFNAME update-groups SUBGROUP-ID ", SHOW_STR IP_STR BGP_STR @@ -10102,7 +10102,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 [ WORD] peer-group [PGNAME]", + "show [ip] bgp [ VIEWVRFNAME] peer-group [PGNAME]", SHOW_STR IP_STR BGP_STR diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index cf6c00ae52..080c4e2dc7 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7681,6 +7681,35 @@ bgp_if_finish (struct bgp *bgp) extern void bgp_snmp_init (void); +static void +bgp_viewvrf_autocomplete (vector comps, struct cmd_token *token) +{ + struct vrf *vrf = NULL; + struct listnode *next; + struct bgp *bgp; + + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) + { + if (vrf->vrf_id != VRF_DEFAULT) + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, vrf->name)); + } + + for (ALL_LIST_ELEMENTS_RO (bm->bgp, next, bgp)) + { + if (bgp->inst_type != BGP_INSTANCE_TYPE_VIEW) + continue; + + vector_set (comps, XSTRDUP (MTYPE_COMPLETION, bgp->name)); + } +} + +static const struct cmd_variable_handler bgp_viewvrf_var_handlers[] = { + { + .tokenname = "VIEWVRFNAME", + .completions = bgp_viewvrf_autocomplete + }, +}; + void bgp_init (void) { @@ -7730,6 +7759,8 @@ bgp_init (void) /* BFD init */ bgp_bfd_init(); + + cmd_variable_handler_register (bgp_viewvrf_var_handlers); } void diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 7c5d6ce3fa..71443ebec5 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -5177,7 +5177,7 @@ vnc_add_vrf_prefix (struct vty *vty, DEFUN (add_vrf_prefix_rd_label_pref, add_vrf_prefix_rd_label_pref_cmd, - "add vrf NAME prefix [{rd ASN:nn_or_IP-address|label (0-1048575)|preference (0-4294967295)}]", + "add vrf VRFNAME prefix [{rd ASN:nn_or_IP-address|label (0-1048575)|preference (0-4294967295)}]", "Add\n" "To a VRF\n" "VRF name\n" @@ -5312,7 +5312,7 @@ vnc_clear_vrf (struct vty *vty, DEFUN (clear_vrf_prefix_rd, clear_vrf_prefix_rd_cmd, - "clear vrf NAME [prefix ] [rd ASN:nn_or_IP-address]", + "clear vrf VRFNAME [prefix ] [rd ASN:nn_or_IP-address]", "Clear stored data\n" "From a VRF\n" "VRF name\n" @@ -5347,7 +5347,7 @@ DEFUN (clear_vrf_prefix_rd, DEFUN (clear_vrf_all, clear_vrf_all_cmd, - "clear vrf NAME all", + "clear vrf VRFNAME all", "Clear stored data\n" "From a VRF\n" "VRF name\n" From d7a75a6ca6739e5bdbf23fa8f732bb29a3913df6 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 16 Jun 2017 13:09:37 -0400 Subject: [PATCH 3/4] lib, vtysh, zebra: Fix per CR comments Signed-off-by: Donald Sharp --- lib/if.c | 6 ++--- lib/vrf.c | 7 +++--- vtysh/vtysh.c | 8 +++---- zebra/interface.c | 6 ++--- zebra/router-id.c | 4 ++-- zebra/zebra_vty.c | 58 +++++++++++++++++++++++------------------------ 6 files changed, 44 insertions(+), 45 deletions(-) diff --git a/lib/if.c b/lib/if.c index d4b3d3f7a4..dc417f8e3c 100644 --- a/lib/if.c +++ b/lib/if.c @@ -678,7 +678,7 @@ if_sunwzebra_get (const char *name, size_t nlen, vrf_id_t vrf_id) DEFUN (interface, interface_cmd, - "interface IFNAME [vrf VRFNAME]", + "interface IFNAME [vrf NAME]", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -723,7 +723,7 @@ DEFUN (interface, DEFUN_NOSH (no_interface, no_interface_cmd, - "no interface IFNAME [vrf VRFNAME]", + "no interface IFNAME [vrf NAME]", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -774,7 +774,7 @@ if_cmd_init (void) /* For debug purpose. */ DEFUN (show_address, show_address_cmd, - "show address [vrf VRFNAME]", + "show address [vrf NAME]", SHOW_STR "address\n" VRF_CMD_HELP_STR) diff --git a/lib/vrf.c b/lib/vrf.c index dbba67164f..5199795fdf 100644 --- a/lib/vrf.c +++ b/lib/vrf.c @@ -391,7 +391,7 @@ vrf_autocomplete (vector comps, struct cmd_token *token) static const struct cmd_variable_handler vrf_var_handlers[] = { { - .tokenname = "VRFNAME", + .varname = "vrf", .completions = vrf_autocomplete, }, { @@ -399,7 +399,6 @@ static const struct cmd_variable_handler vrf_var_handlers[] = { }, }; - /* Initialize VRF module. */ void vrf_init (int (*create)(struct vrf *), @@ -464,7 +463,7 @@ vrf_socket (int domain, int type, int protocol, vrf_id_t vrf_id) /* vrf CLI commands */ DEFUN_NOSH (vrf, vrf_cmd, - "vrf VRFNAME", + "vrf NAME", "Select a VRF to configure\n" "VRF's name\n") { @@ -489,7 +488,7 @@ DEFUN_NOSH (vrf, DEFUN_NOSH (no_vrf, no_vrf_cmd, - "no vrf VRFNAME", + "no vrf NAME", NO_STR "Delete a pseudo VRF's configuration\n" "VRF's name\n") diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 27077951b0..ffdfd5d725 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1902,7 +1902,7 @@ DEFUNSH (VTYSH_ALL, DEFUNSH (VTYSH_INTERFACE, vtysh_interface, vtysh_interface_cmd, - "interface IFNAME vrf VRFNAME", + "interface IFNAME [vrf NAME]", "Select an interface to configure\n" "Interface's name\n" VRF_CMD_HELP_STR) @@ -1921,7 +1921,7 @@ DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_EIGRPD DEFSH (VTYSH_ZEBRA, vtysh_no_interface_vrf_cmd, - "no interface IFNAME vrf VRFNAME", + "no interface IFNAME vrf NAME", NO_STR "Delete a pseudo interface's configuration\n" "Interface's name\n" @@ -1943,7 +1943,7 @@ DEFUNSH (VTYSH_NS, DEFUNSH (VTYSH_VRF, vtysh_vrf, vtysh_vrf_cmd, - "vrf VRFNAME", + "vrf NAME", "Select a VRF to configure\n" "VRF's name\n") { @@ -1953,7 +1953,7 @@ DEFUNSH (VTYSH_VRF, DEFSH (VTYSH_ZEBRA, vtysh_no_vrf_cmd, - "no vrf VRFNAME", + "no vrf NAME", NO_STR "Delete a pseudo vrf's configuration\n" "VRF's name\n") diff --git a/zebra/interface.c b/zebra/interface.c index 39476c6119..9393305f06 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1282,7 +1282,7 @@ struct cmd_node interface_node = /* Show all interfaces to vty. */ DEFUN (show_interface, show_interface_cmd, - "show interface [vrf VRFNAME]", + "show interface [vrf NAME]", SHOW_STR "Interface status and configuration\n" VRF_CMD_HELP_STR) @@ -1330,7 +1330,7 @@ DEFUN (show_interface_vrf_all, DEFUN (show_interface_name_vrf, show_interface_name_vrf_cmd, - "show interface IFNAME vrf VRFNAME", + "show interface IFNAME vrf NAME", SHOW_STR "Interface status and configuration\n" "Interface name\n" @@ -1438,7 +1438,7 @@ if_show_description (struct vty *vty, vrf_id_t vrf_id) DEFUN (show_interface_desc, show_interface_desc_cmd, - "show interface description [vrf VRFNAME]", + "show interface description [vrf NAME]", SHOW_STR "Interface status and configuration\n" "Interface description\n" diff --git a/zebra/router-id.c b/zebra/router-id.c index f4306ba21e..318986c1b7 100644 --- a/zebra/router-id.c +++ b/zebra/router-id.c @@ -215,7 +215,7 @@ router_id_write (struct vty *vty) DEFUN (router_id, router_id_cmd, - "router-id A.B.C.D [vrf VRFNAME]", + "router-id A.B.C.D [vrf NAME]", "Manually set the router-id\n" "IP address to use for router-id\n" VRF_CMD_HELP_STR) @@ -243,7 +243,7 @@ DEFUN (router_id, DEFUN (no_router_id, no_router_id_cmd, - "no router-id [A.B.C.D [vrf VRFNAME]]", + "no router-id [A.B.C.D [vrf NAME]]", NO_STR "Remove the manually configured router-id\n" "IP address to use for router-id\n" diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index d1ca6d0a39..88778e491b 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -395,7 +395,7 @@ zebra_vty_ip_route_tdv_helper (int argc, struct cmd_token *argv[], /* Static route configuration. */ DEFUN (ip_route, ip_route_cmd, - "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -425,7 +425,7 @@ DEFUN (ip_route, DEFUN (ip_route_flags, ip_route_flags_cmd, - "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix (e.g. 10.0.0.0/8)\n" @@ -456,7 +456,7 @@ DEFUN (ip_route_flags, /* Mask as A.B.C.D format. */ DEFUN (ip_route_mask, ip_route_mask_cmd, - "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -488,7 +488,7 @@ DEFUN (ip_route_mask, DEFUN (ip_route_mask_flags, ip_route_mask_flags_cmd, - "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IP destination prefix\n" @@ -520,7 +520,7 @@ DEFUN (ip_route_mask_flags, DEFUN (no_ip_route, no_ip_route_cmd, - "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -552,7 +552,7 @@ DEFUN (no_ip_route, DEFUN (no_ip_route_flags, no_ip_route_flags_cmd, - "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ip route A.B.C.D/M [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -580,7 +580,7 @@ DEFUN (no_ip_route_flags, DEFUN (no_ip_route_mask, no_ip_route_mask_cmd, - "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -614,7 +614,7 @@ DEFUN (no_ip_route_mask, DEFUN (no_ip_route_mask_flags, no_ip_route_mask_flags_cmd, - "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ip route A.B.C.D A.B.C.D [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -1219,7 +1219,7 @@ do_show_ip_route (struct vty *vty, const char *vrf_name, afi_t afi, safi_t safi, DEFUN (show_ip_nht, show_ip_nht_cmd, - "show ip nht [vrf VRFNAME]", + "show ip nht [vrf NAME]", SHOW_STR IP_STR "IP nexthop tracking table\n" @@ -1259,7 +1259,7 @@ DEFUN (show_ip_nht_vrf_all, DEFUN (show_ipv6_nht, show_ipv6_nht_cmd, - "show ipv6 nht [vrf VRFNAME]", + "show ipv6 nht [vrf NAME]", SHOW_STR IPV6_STR "IPv6 nexthop tracking table\n" @@ -1362,7 +1362,7 @@ DEFUN (no_ipv6_nht_default_route, // dwalton one "show ip route" to rule them all DEFUN (show_ip_route, show_ip_route_cmd, - "show ip [vrf VRFNAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]", + "show ip [vrf NAME] [tag (1-4294967295)|A.B.C.D/M longer-prefixes|supernets-only|" FRR_IP_REDIST_STR_ZEBRA "|ospf (1-65535)] [json]", SHOW_STR IP_STR "IP forwarding table\n" @@ -1475,7 +1475,7 @@ DEFUN (show_ip_route, DEFUN (show_ip_route_addr, show_ip_route_addr_cmd, - "show ip route [vrf VRFNAME] A.B.C.D", + "show ip route [vrf NAME] A.B.C.D", SHOW_STR IP_STR "IP routing table\n" @@ -1524,7 +1524,7 @@ DEFUN (show_ip_route_addr, DEFUN (show_ip_route_prefix, show_ip_route_prefix_cmd, - "show ip route [vrf VRFNAME] A.B.C.D/M", + "show ip route [vrf NAME] A.B.C.D/M", SHOW_STR IP_STR "IP routing table\n" @@ -1724,7 +1724,7 @@ vty_show_ip_route_summary_prefix (struct vty *vty, struct route_table *table) /* Show route summary. */ DEFUN (show_ip_route_summary, show_ip_route_summary_cmd, - "show ip route [vrf VRFNAME] summary", + "show ip route [vrf NAME] summary", SHOW_STR IP_STR "IP routing table\n" @@ -1749,7 +1749,7 @@ DEFUN (show_ip_route_summary, /* Show route summary prefix. */ DEFUN (show_ip_route_summary_prefix, show_ip_route_summary_prefix_cmd, - "show ip route [vrf VRFNAME] summary prefix", + "show ip route [vrf NAME] summary prefix", SHOW_STR IP_STR "IP routing table\n" @@ -2165,7 +2165,7 @@ static_ipv6_func (struct vty *vty, int add_cmd, const char *dest_str, DEFUN (ipv6_route, ipv6_route_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2211,7 +2211,7 @@ DEFUN (ipv6_route, DEFUN (ipv6_route_flags, ipv6_route_flags_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2263,7 +2263,7 @@ DEFUN (ipv6_route_flags, DEFUN (ipv6_route_ifname, ipv6_route_ifname_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2312,7 +2312,7 @@ DEFUN (ipv6_route_ifname, DEFUN (ipv6_route_ifname_flags, ipv6_route_ifname_flags_cmd, - "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", IP_STR "Establish static routes\n" "IPv6 destination prefix (e.g. 3ffe:506::/32)\n" @@ -2366,7 +2366,7 @@ DEFUN (ipv6_route_ifname_flags, DEFUN (no_ipv6_route, no_ipv6_route_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2413,7 +2413,7 @@ DEFUN (no_ipv6_route, DEFUN (no_ipv6_route_flags, no_ipv6_route_flags_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2465,7 +2465,7 @@ DEFUN (no_ipv6_route_flags, DEFUN (no_ipv6_route_ifname, no_ipv6_route_ifname_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2515,7 +2515,7 @@ DEFUN (no_ipv6_route_ifname, DEFUN (no_ipv6_route_ifname_flags, no_ipv6_route_ifname_flags_cmd, - "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf VRFNAME]", + "no ipv6 route X:X::X:X/M [from X:X::X:X/M] X:X::X:X INTERFACE [tag (1-4294967295)] [(1-255)] [vrf NAME]", NO_STR IP_STR "Establish static routes\n" @@ -2571,7 +2571,7 @@ DEFUN (no_ipv6_route_ifname_flags, // dwalton duplicate to here DEFUN (show_ipv6_route, show_ipv6_route_cmd, - "show ipv6 [vrf VRFNAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]", + "show ipv6 [vrf NAME] [tag (1-4294967295)|X:X::X:X/M longer-prefixes|" FRR_IP6_REDIST_STR_ZEBRA "] [json]", SHOW_STR IP_STR "IP forwarding table\n" @@ -2670,7 +2670,7 @@ DEFUN (show_ipv6_route, DEFUN (show_ipv6_route_addr, show_ipv6_route_addr_cmd, - "show ipv6 route [vrf VRFNAME] X:X::X:X", + "show ipv6 route [vrf NAME] X:X::X:X", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2719,7 +2719,7 @@ DEFUN (show_ipv6_route_addr, DEFUN (show_ipv6_route_prefix, show_ipv6_route_prefix_cmd, - "show ipv6 route [vrf VRFNAME] X:X::X:X/M", + "show ipv6 route [vrf NAME] X:X::X:X/M", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2768,7 +2768,7 @@ DEFUN (show_ipv6_route_prefix, /* Show route summary. */ DEFUN (show_ipv6_route_summary, show_ipv6_route_summary_cmd, - "show ipv6 route [vrf VRFNAME] summary", + "show ipv6 route [vrf NAME] summary", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2794,7 +2794,7 @@ DEFUN (show_ipv6_route_summary, /* Show ipv6 route summary prefix. */ DEFUN (show_ipv6_route_summary_prefix, show_ipv6_route_summary_prefix_cmd, - "show ipv6 route [vrf VRFNAME] summary prefix", + "show ipv6 route [vrf NAME] summary prefix", SHOW_STR IP_STR "IPv6 routing table\n" @@ -2824,7 +2824,7 @@ DEFUN (show_ipv6_route_summary_prefix, */ DEFUN (show_ipv6_mroute, show_ipv6_mroute_cmd, - "show ipv6 mroute [vrf VRFNAME]", + "show ipv6 mroute [vrf NAME]", SHOW_STR IP_STR "IPv6 Multicast routing table\n" From 23312e71732980f3f549d648a18ee1535bd57c2f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 16 Jun 2017 13:11:12 -0400 Subject: [PATCH 4/4] bgpd: Fix as per Code Review comment Add ending value in the array. Signed-off-by: Donald Sharp --- bgpd/bgpd.c | 3 +++ bgpd/rfapi/rfapi_vty.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 080c4e2dc7..99db69b7c5 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -7708,6 +7708,9 @@ static const struct cmd_variable_handler bgp_viewvrf_var_handlers[] = { .tokenname = "VIEWVRFNAME", .completions = bgp_viewvrf_autocomplete }, + { + .completions = NULL + }, }; void diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c index 71443ebec5..7c5d6ce3fa 100644 --- a/bgpd/rfapi/rfapi_vty.c +++ b/bgpd/rfapi/rfapi_vty.c @@ -5177,7 +5177,7 @@ vnc_add_vrf_prefix (struct vty *vty, DEFUN (add_vrf_prefix_rd_label_pref, add_vrf_prefix_rd_label_pref_cmd, - "add vrf VRFNAME prefix [{rd ASN:nn_or_IP-address|label (0-1048575)|preference (0-4294967295)}]", + "add vrf NAME prefix [{rd ASN:nn_or_IP-address|label (0-1048575)|preference (0-4294967295)}]", "Add\n" "To a VRF\n" "VRF name\n" @@ -5312,7 +5312,7 @@ vnc_clear_vrf (struct vty *vty, DEFUN (clear_vrf_prefix_rd, clear_vrf_prefix_rd_cmd, - "clear vrf VRFNAME [prefix ] [rd ASN:nn_or_IP-address]", + "clear vrf NAME [prefix ] [rd ASN:nn_or_IP-address]", "Clear stored data\n" "From a VRF\n" "VRF name\n" @@ -5347,7 +5347,7 @@ DEFUN (clear_vrf_prefix_rd, DEFUN (clear_vrf_all, clear_vrf_all_cmd, - "clear vrf VRFNAME all", + "clear vrf NAME all", "Clear stored data\n" "From a VRF\n" "VRF name\n"