diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index 641cc7605f..7dda4f0180 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -440,7 +440,7 @@ bool config_bgp_aspath_validate(const char *regstr) } DEFUN(as_path, bgp_as_path_cmd, - "bgp as-path access-list WORD [seq (0-4294967295)] LINE...", + "bgp as-path access-list AS_PATH_FILTER_NAME [seq (0-4294967295)] LINE...", BGP_STR "BGP autonomous system path filter\n" "Specify an access list name\n" @@ -460,7 +460,7 @@ DEFUN(as_path, bgp_as_path_cmd, int64_t seqnum = ASPATH_SEQ_NUMBER_AUTO; /* Retrieve access list name */ - argv_find(argv, argc, "WORD", &idx); + argv_find(argv, argc, "AS_PATH_FILTER_NAME", &idx); char *alname = argv[idx]->arg; if (argv_find(argv, argc, "(0-4294967295)", &idx)) @@ -509,7 +509,7 @@ DEFUN(as_path, bgp_as_path_cmd, } DEFUN(no_as_path, no_bgp_as_path_cmd, - "no bgp as-path access-list WORD [seq (0-4294967295)] LINE...", + "no bgp as-path access-list AS_PATH_FILTER_NAME [seq (0-4294967295)] LINE...", NO_STR BGP_STR "BGP autonomous system path filter\n" @@ -529,7 +529,7 @@ DEFUN(no_as_path, no_bgp_as_path_cmd, regex_t *regex; char *aslistname = - argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL; + argv_find(argv, argc, "AS_PATH_FILTER_NAME", &idx) ? argv[idx]->arg : NULL; /* Lookup AS list from AS path list. */ aslist = as_list_lookup(aslistname); @@ -586,7 +586,7 @@ DEFUN(no_as_path, no_bgp_as_path_cmd, DEFUN (no_as_path_all, no_bgp_as_path_all_cmd, - "no bgp as-path access-list WORD", + "no bgp as-path access-list AS_PATH_FILTER_NAME", NO_STR BGP_STR "BGP autonomous system path filter\n" @@ -653,7 +653,7 @@ static void as_list_show_all(struct vty *vty, json_object *json) DEFUN (show_as_path_access_list, show_bgp_as_path_access_list_cmd, - "show bgp as-path-access-list WORD [json]", + "show bgp as-path-access-list AS_PATH_FILTER_NAME [json]", SHOW_STR BGP_STR "List AS path access lists\n" @@ -684,7 +684,7 @@ DEFUN (show_as_path_access_list, ALIAS (show_as_path_access_list, show_ip_as_path_access_list_cmd, - "show ip as-path-access-list WORD [json]", + "show ip as-path-access-list AS_PATH_FILTER_NAME [json]", SHOW_STR IP_STR "List AS path access lists\n" @@ -753,6 +753,20 @@ static struct cmd_node as_list_node = { .config_write = config_write_as_list, }; +static void bgp_aspath_filter_cmd_completion(vector comps, + struct cmd_token *token) +{ + struct as_list *aslist; + + for (aslist = as_list_master.str.head; aslist; aslist = aslist->next) + vector_set(comps, XSTRDUP(MTYPE_COMPLETION, aslist->name)); +} + +static const struct cmd_variable_handler aspath_filter_handlers[] = { + {.tokenname = "AS_PATH_FILTER_NAME", + .completions = bgp_aspath_filter_cmd_completion}, + {.completions = NULL}}; + /* Register functions. */ void bgp_filter_init(void) { @@ -766,6 +780,8 @@ void bgp_filter_init(void) install_element(VIEW_NODE, &show_ip_as_path_access_list_cmd); install_element(VIEW_NODE, &show_bgp_as_path_access_list_all_cmd); install_element(VIEW_NODE, &show_ip_as_path_access_list_all_cmd); + + cmd_variable_handler_register(aspath_filter_handlers); } void bgp_filter_reset(void) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 0eb3cc61e3..e1d4d22b7e 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -12007,7 +12007,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd, <[all$all] dampening \ |route-map WORD\ |prefix-list WORD\ - |filter-list WORD\ + |filter-list AS_PATH_FILTER_NAME\ |community-list <(1-500)|COMMUNITY_LIST_NAME> [exact-match]\ |A.B.C.D/M longer-prefixes\ |X:X::X:X/M longer-prefixes\ diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 2f37367a8f..75dbc7f3e3 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -4927,7 +4927,7 @@ DEFUN_YANG (no_match_ecommunity, DEFUN_YANG (match_aspath, match_aspath_cmd, - "match as-path WORD", + "match as-path AS_PATH_FILTER_NAME", MATCH_STR "Match BGP AS path list\n" "AS path access-list name\n") @@ -4950,7 +4950,7 @@ DEFUN_YANG (match_aspath, DEFUN_YANG (no_match_aspath, no_match_aspath_cmd, - "no match as-path [WORD]", + "no match as-path [AS_PATH_FILTER_NAME]", NO_STR MATCH_STR "Match BGP AS path list\n" diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 26da38bd7a..8e2044fd8a 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -7242,7 +7242,7 @@ static int peer_aslist_unset_vty(struct vty *vty, const char *ip_str, afi_t afi, DEFUN (neighbor_filter_list, neighbor_filter_list_cmd, - "neighbor filter-list WORD ", + "neighbor filter-list AS_PATH_FILTER_NAME ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Establish BGP filters\n" @@ -7259,7 +7259,7 @@ DEFUN (neighbor_filter_list, } ALIAS_HIDDEN(neighbor_filter_list, neighbor_filter_list_hidden_cmd, - "neighbor filter-list WORD ", + "neighbor filter-list AS_PATH_FILTER_NAME ", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Establish BGP filters\n" "AS path access-list name\n" @@ -7268,7 +7268,7 @@ ALIAS_HIDDEN(neighbor_filter_list, neighbor_filter_list_hidden_cmd, DEFUN (no_neighbor_filter_list, no_neighbor_filter_list_cmd, - "no neighbor filter-list WORD ", + "no neighbor filter-list AS_PATH_FILTER_NAME ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 @@ -7285,7 +7285,7 @@ DEFUN (no_neighbor_filter_list, } ALIAS_HIDDEN(no_neighbor_filter_list, no_neighbor_filter_list_hidden_cmd, - "no neighbor filter-list WORD ", + "no neighbor filter-list AS_PATH_FILTER_NAME ", NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 "Establish BGP filters\n" "AS path access-list name\n"