Merge pull request #3357 from ton31337/fix/optional_args_for_extcommunity-lists

bgpd: Remove extcommunity-list by name without typing full rule
This commit is contained in:
David Lamparter 2018-12-04 15:34:59 +01:00 committed by GitHub
commit 1061bb9a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14988,6 +14988,7 @@ DEFUN (no_extcommunity_list_standard_all,
int style = EXTCOMMUNITY_LIST_STANDARD;
int direct = 0;
char *cl_number_or_name = NULL;
char *str = NULL;
int idx = 0;
if (argv_find(argv, argc, "ip", &idx)) {
@ -14996,13 +14997,25 @@ DEFUN (no_extcommunity_list_standard_all,
vty_out(vty, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
zlog_warn("Deprecated option: no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
}
idx = 0;
argv_find(argv, argc, "permit", &idx);
argv_find(argv, argc, "deny", &idx);
if (idx) {
direct = argv_find(argv, argc, "permit", &idx)
? COMMUNITY_PERMIT
: COMMUNITY_DENY;
idx = 0;
argv_find(argv, argc, "AA:NN", &idx);
str = argv_concat(argv, argc, idx);
}
idx = 0;
argv_find(argv, argc, "(1-99)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_number_or_name = argv[idx]->arg;
direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
: COMMUNITY_DENY;
argv_find(argv, argc, "AA:NN", &idx);
char *str = argv_concat(argv, argc, idx);
int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str,
direct, style);
@ -15030,6 +15043,22 @@ ALIAS (no_extcommunity_list_standard_all,
"Specify community to accept\n"
EXTCOMMUNITY_VAL_STR)
ALIAS(no_extcommunity_list_standard_all,
no_bgp_extcommunity_list_standard_all_list_cmd,
"no bgp extcommunity-list <(1-99)|standard WORD>",
NO_STR IP_STR EXTCOMMUNITY_LIST_STR
"Extended Community list number (standard)\n"
"Specify standard extcommunity-list\n"
"Community list name\n")
ALIAS(no_extcommunity_list_standard_all,
no_ip_extcommunity_list_standard_all_list_cmd,
"no ip extcommunity-list <(1-99)|standard WORD>",
NO_STR IP_STR EXTCOMMUNITY_LIST_STR
"Extended Community list number (standard)\n"
"Specify standard extcommunity-list\n"
"Community list name\n")
DEFUN (no_extcommunity_list_expanded_all,
no_bgp_extcommunity_list_expanded_all_cmd,
"no bgp extcommunity-list <(100-500)|expanded WORD> <deny|permit> LINE...",
@ -15046,6 +15075,7 @@ DEFUN (no_extcommunity_list_expanded_all,
int style = EXTCOMMUNITY_LIST_EXPANDED;
int direct = 0;
char *cl_number_or_name = NULL;
char *str = NULL;
int idx = 0;
if (argv_find(argv, argc, "ip", &idx)) {
@ -15054,13 +15084,25 @@ DEFUN (no_extcommunity_list_expanded_all,
vty_out(vty, "'no bgp extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>'\n");
zlog_warn("Deprecated option: no ip extcommunity-list <(1-99)|(100-500)|standard|expanded> <deny|permit> <LINE|AA:NN>' being used");
}
idx = 0;
argv_find(argv, argc, "permit", &idx);
argv_find(argv, argc, "deny", &idx);
if (idx) {
direct = argv_find(argv, argc, "permit", &idx)
? COMMUNITY_PERMIT
: COMMUNITY_DENY;
idx = 0;
argv_find(argv, argc, "LINE", &idx);
str = argv_concat(argv, argc, idx);
}
idx = 0;
argv_find(argv, argc, "(100-500)", &idx);
argv_find(argv, argc, "WORD", &idx);
cl_number_or_name = argv[idx]->arg;
direct = argv_find(argv, argc, "permit", &idx) ? COMMUNITY_PERMIT
: COMMUNITY_DENY;
argv_find(argv, argc, "LINE", &idx);
char *str = argv_concat(argv, argc, idx);
int ret = extcommunity_list_unset(bgp_clist, cl_number_or_name, str,
direct, style);
@ -15088,6 +15130,22 @@ ALIAS (no_extcommunity_list_expanded_all,
"Specify community to accept\n"
"An ordered list as a regular-expression\n")
ALIAS(no_extcommunity_list_expanded_all,
no_ip_extcommunity_list_expanded_all_list_cmd,
"no ip extcommunity-list <(100-500)|expanded WORD>",
NO_STR IP_STR EXTCOMMUNITY_LIST_STR
"Extended Community list number (expanded)\n"
"Specify expanded extcommunity-list\n"
"Extended Community list name\n")
ALIAS(no_extcommunity_list_expanded_all,
no_bgp_extcommunity_list_expanded_all_list_cmd,
"no bgp extcommunity-list <(100-500)|expanded WORD>",
NO_STR IP_STR EXTCOMMUNITY_LIST_STR
"Extended Community list number (expanded)\n"
"Specify expanded extcommunity-list\n"
"Extended Community list name\n")
static void extcommunity_list_show(struct vty *vty, struct community_list *list)
{
struct community_entry *entry;
@ -15301,13 +15359,19 @@ static void community_list_vty(void)
install_element(CONFIG_NODE, &bgp_extcommunity_list_standard_cmd);
install_element(CONFIG_NODE, &bgp_extcommunity_list_name_expanded_cmd);
install_element(CONFIG_NODE, &no_bgp_extcommunity_list_standard_all_cmd);
install_element(CONFIG_NODE,
&no_bgp_extcommunity_list_standard_all_list_cmd);
install_element(CONFIG_NODE, &no_bgp_extcommunity_list_expanded_all_cmd);
install_element(CONFIG_NODE,
&no_bgp_extcommunity_list_expanded_all_list_cmd);
install_element(VIEW_NODE, &show_bgp_extcommunity_list_cmd);
install_element(VIEW_NODE, &show_bgp_extcommunity_list_arg_cmd);
install_element(CONFIG_NODE, &ip_extcommunity_list_standard_cmd);
install_element(CONFIG_NODE, &ip_extcommunity_list_name_expanded_cmd);
install_element(CONFIG_NODE, &no_ip_extcommunity_list_standard_all_cmd);
install_element(CONFIG_NODE, &no_ip_extcommunity_list_standard_all_list_cmd);
install_element(CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_cmd);
install_element(CONFIG_NODE, &no_ip_extcommunity_list_expanded_all_list_cmd);
install_element(VIEW_NODE, &show_ip_extcommunity_list_cmd);
install_element(VIEW_NODE, &show_ip_extcommunity_list_arg_cmd);