Merge pull request #3344 from ton31337/fix/optional_args_for_community-lists

bgpd: Remove community-list by name without typing full rule
This commit is contained in:
Quentin Young 2018-11-16 15:16:35 -05:00 committed by GitHub
commit 01defa9e0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13986,6 +13986,7 @@ DEFUN (no_community_list_standard_all,
COMMUNITY_VAL_STR) COMMUNITY_VAL_STR)
{ {
char *cl_name_or_number = NULL; char *cl_name_or_number = NULL;
char *str = NULL;
int direct = 0; int direct = 0;
int style = COMMUNITY_LIST_STANDARD; int style = COMMUNITY_LIST_STANDARD;
@ -13998,13 +13999,23 @@ DEFUN (no_community_list_standard_all,
zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> |AA:NN' being used"); zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> |AA:NN' being used");
} }
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, "(1-99)", &idx);
argv_find(argv, argc, "WORD", &idx); argv_find(argv, argc, "WORD", &idx);
cl_name_or_number = argv[idx]->arg; cl_name_or_number = 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 = community_list_unset(bgp_clist, cl_name_or_number, str, int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
direct, style); direct, style);
@ -14031,6 +14042,20 @@ ALIAS (no_community_list_standard_all,
"Specify community to accept\n" "Specify community to accept\n"
COMMUNITY_VAL_STR) COMMUNITY_VAL_STR)
ALIAS(no_community_list_standard_all, no_bgp_community_list_standard_all_list_cmd,
"no bgp community-list <(1-99)|standard WORD>",
NO_STR BGP_STR COMMUNITY_LIST_STR
"Community list number (standard)\n"
"Add an standard community-list entry\n"
"Community list name\n")
ALIAS(no_community_list_standard_all, no_ip_community_list_standard_all_list_cmd,
"no ip community-list <(1-99)|standard WORD>",
NO_STR BGP_STR COMMUNITY_LIST_STR
"Community list number (standard)\n"
"Add an standard community-list entry\n"
"Community list name\n")
/*community-list expanded */ /*community-list expanded */
DEFUN (community_list_expanded_all, DEFUN (community_list_expanded_all,
bgp_community_list_expanded_all_cmd, bgp_community_list_expanded_all_cmd,
@ -14103,6 +14128,7 @@ DEFUN (no_community_list_expanded_all,
COMMUNITY_VAL_STR) COMMUNITY_VAL_STR)
{ {
char *cl_name_or_number = NULL; char *cl_name_or_number = NULL;
char *str = NULL;
int direct = 0; int direct = 0;
int style = COMMUNITY_LIST_EXPANDED; int style = COMMUNITY_LIST_EXPANDED;
@ -14110,16 +14136,27 @@ DEFUN (no_community_list_expanded_all,
if (argv_find(argv, argc, "ip", &idx)) { if (argv_find(argv, argc, "ip", &idx)) {
vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n"); vty_out(vty, "This config option is deprecated, and is scheduled for removal.\n");
vty_out(vty, "if you are using this please migrate to the below command.\n"); vty_out(vty, "if you are using this please migrate to the below command.\n");
vty_out(vty, "'no community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n"); vty_out(vty, "'no bgp community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN'\n");
zlog_warn("Deprecated option: 'no community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used"); zlog_warn("Deprecated option: 'no ip community-list <(1-99)|(100-500)|standard|expanded> <deny|permit> AA:NN' being used");
} }
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, "(100-500)", &idx); argv_find(argv, argc, "(100-500)", &idx);
argv_find(argv, argc, "WORD", &idx); argv_find(argv, argc, "WORD", &idx);
cl_name_or_number = argv[idx]->arg; cl_name_or_number = 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 = community_list_unset(bgp_clist, cl_name_or_number, str, int ret = community_list_unset(bgp_clist, cl_name_or_number, str,
direct, style); direct, style);
@ -14147,6 +14184,20 @@ ALIAS (no_community_list_expanded_all,
"Specify community to accept\n" "Specify community to accept\n"
COMMUNITY_VAL_STR) COMMUNITY_VAL_STR)
ALIAS(no_community_list_expanded_all, no_bgp_community_list_expanded_all_list_cmd,
"no bgp community-list <(100-500)|expanded WORD>",
NO_STR IP_STR COMMUNITY_LIST_STR
"Community list number (expanded)\n"
"Add an expanded community-list entry\n"
"Community list name\n")
ALIAS(no_community_list_expanded_all, no_ip_community_list_expanded_all_list_cmd,
"no ip community-list <(100-500)|expanded WORD>",
NO_STR IP_STR COMMUNITY_LIST_STR
"Community list number (expanded)\n"
"Add an expanded community-list entry\n"
"Community list name\n")
/* Return configuration string of community-list entry. */ /* Return configuration string of community-list entry. */
static const char *community_list_config_str(struct community_entry *entry) static const char *community_list_config_str(struct community_entry *entry)
{ {
@ -15227,13 +15278,17 @@ static void community_list_vty(void)
install_element(CONFIG_NODE, &bgp_community_list_standard_cmd); install_element(CONFIG_NODE, &bgp_community_list_standard_cmd);
install_element(CONFIG_NODE, &bgp_community_list_expanded_all_cmd); install_element(CONFIG_NODE, &bgp_community_list_expanded_all_cmd);
install_element(CONFIG_NODE, &no_bgp_community_list_standard_all_cmd); install_element(CONFIG_NODE, &no_bgp_community_list_standard_all_cmd);
install_element(CONFIG_NODE, &no_bgp_community_list_standard_all_list_cmd);
install_element(CONFIG_NODE, &no_bgp_community_list_expanded_all_cmd); install_element(CONFIG_NODE, &no_bgp_community_list_expanded_all_cmd);
install_element(CONFIG_NODE, &no_bgp_community_list_expanded_all_list_cmd);
install_element(VIEW_NODE, &show_bgp_community_list_cmd); install_element(VIEW_NODE, &show_bgp_community_list_cmd);
install_element(VIEW_NODE, &show_bgp_community_list_arg_cmd); install_element(VIEW_NODE, &show_bgp_community_list_arg_cmd);
install_element(CONFIG_NODE, &ip_community_list_standard_cmd); install_element(CONFIG_NODE, &ip_community_list_standard_cmd);
install_element(CONFIG_NODE, &ip_community_list_expanded_all_cmd); install_element(CONFIG_NODE, &ip_community_list_expanded_all_cmd);
install_element(CONFIG_NODE, &no_ip_community_list_standard_all_cmd); install_element(CONFIG_NODE, &no_ip_community_list_standard_all_cmd);
install_element(CONFIG_NODE, &no_ip_community_list_standard_all_list_cmd);
install_element(CONFIG_NODE, &no_ip_community_list_expanded_all_cmd); install_element(CONFIG_NODE, &no_ip_community_list_expanded_all_cmd);
install_element(CONFIG_NODE, &no_ip_community_list_expanded_all_list_cmd);
install_element(VIEW_NODE, &show_ip_community_list_cmd); install_element(VIEW_NODE, &show_ip_community_list_cmd);
install_element(VIEW_NODE, &show_ip_community_list_arg_cmd); install_element(VIEW_NODE, &show_ip_community_list_arg_cmd);