forked from Mirror/frr
ripd: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring prefix-lists. We should differentiate. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
This commit is contained in:
parent
aabe9cf377
commit
45b868a2af
|
@ -1130,10 +1130,9 @@ DEFPY_YANG (clear_ip_rip,
|
||||||
|
|
||||||
DEFPY_YANG(
|
DEFPY_YANG(
|
||||||
rip_distribute_list, rip_distribute_list_cmd,
|
rip_distribute_list, rip_distribute_list_cmd,
|
||||||
"distribute-list [prefix]$prefix ACCESSLIST4_NAME$name <in|out>$dir [WORD$ifname]",
|
"distribute-list ACCESSLIST4_NAME$name <in|out>$dir [WORD$ifname]",
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
"Specify a prefix list\n"
|
"Access-list name\n"
|
||||||
"access-list or prefix-list name\n"
|
|
||||||
"Filter incoming routing updates\n"
|
"Filter incoming routing updates\n"
|
||||||
"Filter outgoing routing updates\n"
|
"Filter outgoing routing updates\n"
|
||||||
"Interface name\n")
|
"Interface name\n")
|
||||||
|
@ -1141,8 +1140,28 @@ DEFPY_YANG(
|
||||||
char xpath[XPATH_MAXLEN];
|
char xpath[XPATH_MAXLEN];
|
||||||
|
|
||||||
snprintf(xpath, sizeof(xpath),
|
snprintf(xpath, sizeof(xpath),
|
||||||
"./distribute-list[interface='%s']/%s/%s-list",
|
"./distribute-list[interface='%s']/%s/access-list",
|
||||||
ifname ? ifname : "", dir, prefix ? "prefix" : "access");
|
ifname ? ifname : "", dir);
|
||||||
|
/* nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); */
|
||||||
|
nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, name);
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY_YANG(
|
||||||
|
rip_distribute_list_prefix, rip_distribute_list_prefix_cmd,
|
||||||
|
"distribute-list prefix PREFIXLIST4_NAME$name <in|out>$dir [WORD$ifname]",
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Specify a prefix list\n"
|
||||||
|
"Prefix-list name\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n"
|
||||||
|
"Interface name\n")
|
||||||
|
{
|
||||||
|
char xpath[XPATH_MAXLEN];
|
||||||
|
|
||||||
|
snprintf(xpath, sizeof(xpath),
|
||||||
|
"./distribute-list[interface='%s']/%s/prefix-list",
|
||||||
|
ifname ? ifname : "", dir);
|
||||||
/* nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); */
|
/* nb_cli_enqueue_change(vty, ".", NB_OP_CREATE, NULL); */
|
||||||
nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, name);
|
nb_cli_enqueue_change(vty, xpath, NB_OP_MODIFY, name);
|
||||||
return nb_cli_apply_changes(vty, NULL);
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
@ -1150,11 +1169,10 @@ DEFPY_YANG(
|
||||||
|
|
||||||
DEFPY_YANG(no_rip_distribute_list,
|
DEFPY_YANG(no_rip_distribute_list,
|
||||||
no_rip_distribute_list_cmd,
|
no_rip_distribute_list_cmd,
|
||||||
"no distribute-list [prefix]$prefix [ACCESSLIST4_NAME$name] <in|out>$dir [WORD$ifname]",
|
"no distribute-list [ACCESSLIST4_NAME$name] <in|out>$dir [WORD$ifname]",
|
||||||
NO_STR
|
NO_STR
|
||||||
"Filter networks in routing updates\n"
|
"Filter networks in routing updates\n"
|
||||||
"Specify a prefix list\n"
|
"Access-list name\n"
|
||||||
"access-list or prefix-list name\n"
|
|
||||||
"Filter incoming routing updates\n"
|
"Filter incoming routing updates\n"
|
||||||
"Filter outgoing routing updates\n"
|
"Filter outgoing routing updates\n"
|
||||||
"Interface name\n")
|
"Interface name\n")
|
||||||
|
@ -1163,8 +1181,43 @@ DEFPY_YANG(no_rip_distribute_list,
|
||||||
char xpath[XPATH_MAXLEN];
|
char xpath[XPATH_MAXLEN];
|
||||||
|
|
||||||
snprintf(xpath, sizeof(xpath),
|
snprintf(xpath, sizeof(xpath),
|
||||||
"./distribute-list[interface='%s']/%s/%s-list",
|
"./distribute-list[interface='%s']/%s/access-list",
|
||||||
ifname ? ifname : "", dir, prefix ? "prefix" : "access");
|
ifname ? ifname : "", dir);
|
||||||
|
/*
|
||||||
|
* See if the user has specified specific list so check it exists.
|
||||||
|
*
|
||||||
|
* NOTE: Other FRR CLI commands do not do this sort of verification and
|
||||||
|
* there may be an official decision not to.
|
||||||
|
*/
|
||||||
|
if (name) {
|
||||||
|
value_node = yang_dnode_getf(vty->candidate_config->dnode, "%s/%s",
|
||||||
|
VTY_CURR_XPATH, xpath);
|
||||||
|
if (!value_node || strcmp(name, lyd_get_value(value_node))) {
|
||||||
|
vty_out(vty, "distribute list doesn't exist\n");
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY_YANG(no_rip_distribute_list_prefix,
|
||||||
|
no_rip_distribute_list_prefix_cmd,
|
||||||
|
"no distribute-list prefix [PREFIXLIST4_NAME$name] <in|out>$dir [WORD$ifname]",
|
||||||
|
NO_STR
|
||||||
|
"Filter networks in routing updates\n"
|
||||||
|
"Specify a prefix list\n"
|
||||||
|
"Prefix-list name\n"
|
||||||
|
"Filter incoming routing updates\n"
|
||||||
|
"Filter outgoing routing updates\n"
|
||||||
|
"Interface name\n")
|
||||||
|
{
|
||||||
|
const struct lyd_node *value_node;
|
||||||
|
char xpath[XPATH_MAXLEN];
|
||||||
|
|
||||||
|
snprintf(xpath, sizeof(xpath),
|
||||||
|
"./distribute-list[interface='%s']/%s/prefix-list",
|
||||||
|
ifname ? ifname : "", dir);
|
||||||
/*
|
/*
|
||||||
* See if the user has specified specific list so check it exists.
|
* See if the user has specified specific list so check it exists.
|
||||||
*
|
*
|
||||||
|
@ -1189,7 +1242,9 @@ void rip_cli_init(void)
|
||||||
install_element(CONFIG_NODE, &no_router_rip_cmd);
|
install_element(CONFIG_NODE, &no_router_rip_cmd);
|
||||||
|
|
||||||
install_element(RIP_NODE, &rip_distribute_list_cmd);
|
install_element(RIP_NODE, &rip_distribute_list_cmd);
|
||||||
|
install_element(RIP_NODE, &rip_distribute_list_prefix_cmd);
|
||||||
install_element(RIP_NODE, &no_rip_distribute_list_cmd);
|
install_element(RIP_NODE, &no_rip_distribute_list_cmd);
|
||||||
|
install_element(RIP_NODE, &no_rip_distribute_list_prefix_cmd);
|
||||||
|
|
||||||
install_element(RIP_NODE, &rip_allow_ecmp_cmd);
|
install_element(RIP_NODE, &rip_allow_ecmp_cmd);
|
||||||
install_element(RIP_NODE, &no_rip_allow_ecmp_cmd);
|
install_element(RIP_NODE, &no_rip_allow_ecmp_cmd);
|
||||||
|
|
Loading…
Reference in a new issue