mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 09:52:27 +00:00
Merge pull request #9848 from ton31337/feature/as-path_autocomplete
bgpd: Add autocomplete for as-path filters
This commit is contained in:
commit
bf4af4ffb5
@ -440,7 +440,7 @@ bool config_bgp_aspath_validate(const char *regstr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEFUN(as_path, bgp_as_path_cmd,
|
DEFUN(as_path, bgp_as_path_cmd,
|
||||||
"bgp as-path access-list WORD [seq (0-4294967295)] <deny|permit> LINE...",
|
"bgp as-path access-list AS_PATH_FILTER_NAME [seq (0-4294967295)] <deny|permit> LINE...",
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"BGP autonomous system path filter\n"
|
"BGP autonomous system path filter\n"
|
||||||
"Specify an access list name\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;
|
int64_t seqnum = ASPATH_SEQ_NUMBER_AUTO;
|
||||||
|
|
||||||
/* Retrieve access list name */
|
/* Retrieve access list name */
|
||||||
argv_find(argv, argc, "WORD", &idx);
|
argv_find(argv, argc, "AS_PATH_FILTER_NAME", &idx);
|
||||||
char *alname = argv[idx]->arg;
|
char *alname = argv[idx]->arg;
|
||||||
|
|
||||||
if (argv_find(argv, argc, "(0-4294967295)", &idx))
|
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,
|
DEFUN(no_as_path, no_bgp_as_path_cmd,
|
||||||
"no bgp as-path access-list WORD [seq (0-4294967295)] <deny|permit> LINE...",
|
"no bgp as-path access-list AS_PATH_FILTER_NAME [seq (0-4294967295)] <deny|permit> LINE...",
|
||||||
NO_STR
|
NO_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"BGP autonomous system path filter\n"
|
"BGP autonomous system path filter\n"
|
||||||
@ -529,7 +529,7 @@ DEFUN(no_as_path, no_bgp_as_path_cmd,
|
|||||||
regex_t *regex;
|
regex_t *regex;
|
||||||
|
|
||||||
char *aslistname =
|
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. */
|
/* Lookup AS list from AS path list. */
|
||||||
aslist = as_list_lookup(aslistname);
|
aslist = as_list_lookup(aslistname);
|
||||||
@ -586,7 +586,7 @@ DEFUN(no_as_path, no_bgp_as_path_cmd,
|
|||||||
|
|
||||||
DEFUN (no_as_path_all,
|
DEFUN (no_as_path_all,
|
||||||
no_bgp_as_path_all_cmd,
|
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
|
NO_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"BGP autonomous system path filter\n"
|
"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,
|
DEFUN (show_as_path_access_list,
|
||||||
show_bgp_as_path_access_list_cmd,
|
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
|
SHOW_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"List AS path access lists\n"
|
"List AS path access lists\n"
|
||||||
@ -684,7 +684,7 @@ DEFUN (show_as_path_access_list,
|
|||||||
|
|
||||||
ALIAS (show_as_path_access_list,
|
ALIAS (show_as_path_access_list,
|
||||||
show_ip_as_path_access_list_cmd,
|
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
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
"List AS path access lists\n"
|
"List AS path access lists\n"
|
||||||
@ -753,6 +753,20 @@ static struct cmd_node as_list_node = {
|
|||||||
.config_write = config_write_as_list,
|
.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. */
|
/* Register functions. */
|
||||||
void bgp_filter_init(void)
|
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_ip_as_path_access_list_cmd);
|
||||||
install_element(VIEW_NODE, &show_bgp_as_path_access_list_all_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);
|
install_element(VIEW_NODE, &show_ip_as_path_access_list_all_cmd);
|
||||||
|
|
||||||
|
cmd_variable_handler_register(aspath_filter_handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bgp_filter_reset(void)
|
void bgp_filter_reset(void)
|
||||||
|
@ -12007,7 +12007,7 @@ DEFPY(show_ip_bgp, show_ip_bgp_cmd,
|
|||||||
<[all$all] dampening <parameters>\
|
<[all$all] dampening <parameters>\
|
||||||
|route-map WORD\
|
|route-map WORD\
|
||||||
|prefix-list WORD\
|
|prefix-list WORD\
|
||||||
|filter-list WORD\
|
|filter-list AS_PATH_FILTER_NAME\
|
||||||
|community-list <(1-500)|COMMUNITY_LIST_NAME> [exact-match]\
|
|community-list <(1-500)|COMMUNITY_LIST_NAME> [exact-match]\
|
||||||
|A.B.C.D/M longer-prefixes\
|
|A.B.C.D/M longer-prefixes\
|
||||||
|X:X::X:X/M longer-prefixes\
|
|X:X::X:X/M longer-prefixes\
|
||||||
|
@ -4927,7 +4927,7 @@ DEFUN_YANG (no_match_ecommunity,
|
|||||||
|
|
||||||
DEFUN_YANG (match_aspath,
|
DEFUN_YANG (match_aspath,
|
||||||
match_aspath_cmd,
|
match_aspath_cmd,
|
||||||
"match as-path WORD",
|
"match as-path AS_PATH_FILTER_NAME",
|
||||||
MATCH_STR
|
MATCH_STR
|
||||||
"Match BGP AS path list\n"
|
"Match BGP AS path list\n"
|
||||||
"AS path access-list name\n")
|
"AS path access-list name\n")
|
||||||
@ -4950,7 +4950,7 @@ DEFUN_YANG (match_aspath,
|
|||||||
|
|
||||||
DEFUN_YANG (no_match_aspath,
|
DEFUN_YANG (no_match_aspath,
|
||||||
no_match_aspath_cmd,
|
no_match_aspath_cmd,
|
||||||
"no match as-path [WORD]",
|
"no match as-path [AS_PATH_FILTER_NAME]",
|
||||||
NO_STR
|
NO_STR
|
||||||
MATCH_STR
|
MATCH_STR
|
||||||
"Match BGP AS path list\n"
|
"Match BGP AS path list\n"
|
||||||
|
@ -7242,7 +7242,7 @@ static int peer_aslist_unset_vty(struct vty *vty, const char *ip_str, afi_t afi,
|
|||||||
|
|
||||||
DEFUN (neighbor_filter_list,
|
DEFUN (neighbor_filter_list,
|
||||||
neighbor_filter_list_cmd,
|
neighbor_filter_list_cmd,
|
||||||
"neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
|
"neighbor <A.B.C.D|X:X::X:X|WORD> filter-list AS_PATH_FILTER_NAME <in|out>",
|
||||||
NEIGHBOR_STR
|
NEIGHBOR_STR
|
||||||
NEIGHBOR_ADDR_STR2
|
NEIGHBOR_ADDR_STR2
|
||||||
"Establish BGP filters\n"
|
"Establish BGP filters\n"
|
||||||
@ -7259,7 +7259,7 @@ DEFUN (neighbor_filter_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALIAS_HIDDEN(neighbor_filter_list, neighbor_filter_list_hidden_cmd,
|
ALIAS_HIDDEN(neighbor_filter_list, neighbor_filter_list_hidden_cmd,
|
||||||
"neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
|
"neighbor <A.B.C.D|X:X::X:X|WORD> filter-list AS_PATH_FILTER_NAME <in|out>",
|
||||||
NEIGHBOR_STR NEIGHBOR_ADDR_STR2
|
NEIGHBOR_STR NEIGHBOR_ADDR_STR2
|
||||||
"Establish BGP filters\n"
|
"Establish BGP filters\n"
|
||||||
"AS path access-list name\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,
|
DEFUN (no_neighbor_filter_list,
|
||||||
no_neighbor_filter_list_cmd,
|
no_neighbor_filter_list_cmd,
|
||||||
"no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
|
"no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list AS_PATH_FILTER_NAME <in|out>",
|
||||||
NO_STR
|
NO_STR
|
||||||
NEIGHBOR_STR
|
NEIGHBOR_STR
|
||||||
NEIGHBOR_ADDR_STR2
|
NEIGHBOR_ADDR_STR2
|
||||||
@ -7285,7 +7285,7 @@ DEFUN (no_neighbor_filter_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
ALIAS_HIDDEN(no_neighbor_filter_list, no_neighbor_filter_list_hidden_cmd,
|
ALIAS_HIDDEN(no_neighbor_filter_list, no_neighbor_filter_list_hidden_cmd,
|
||||||
"no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list WORD <in|out>",
|
"no neighbor <A.B.C.D|X:X::X:X|WORD> filter-list AS_PATH_FILTER_NAME <in|out>",
|
||||||
NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
|
NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2
|
||||||
"Establish BGP filters\n"
|
"Establish BGP filters\n"
|
||||||
"AS path access-list name\n"
|
"AS path access-list name\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user