mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 23:52:18 +00:00
ripngd: retrofit the 'allow-ecmp' command to the new northbound model
Trivial conversion. The ripng->ecmp variable was converted to a boolean to match the way it's defined in the YANG module. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
This commit is contained in:
parent
9a12e9e5ed
commit
1e42a07ce9
@ -75,8 +75,34 @@ void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode,
|
||||
vty_out(vty, "router ripng\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-ripngd:ripngd/instance/allow-ecmp
|
||||
*/
|
||||
DEFPY (ripng_allow_ecmp,
|
||||
ripng_allow_ecmp_cmd,
|
||||
"[no] allow-ecmp",
|
||||
NO_STR
|
||||
"Allow Equal Cost MultiPath\n")
|
||||
{
|
||||
nb_cli_enqueue_change(vty, "./allow-ecmp", NB_OP_MODIFY,
|
||||
no ? "false" : "true");
|
||||
|
||||
return nb_cli_apply_changes(vty, NULL);
|
||||
}
|
||||
|
||||
void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults)
|
||||
{
|
||||
if (!yang_dnode_get_bool(dnode, NULL))
|
||||
vty_out(vty, " no");
|
||||
|
||||
vty_out(vty, " allow-ecmp\n");
|
||||
}
|
||||
|
||||
void ripng_cli_init(void)
|
||||
{
|
||||
install_element(CONFIG_NODE, &router_ripng_cmd);
|
||||
install_element(CONFIG_NODE, &no_router_ripng_cmd);
|
||||
|
||||
install_element(RIPNG_NODE, &ripng_allow_ecmp_cmd);
|
||||
}
|
||||
|
@ -23,5 +23,7 @@
|
||||
|
||||
extern void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
extern void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
|
||||
#endif /* _FRR_RIPNG_CLI_H_ */
|
||||
|
@ -82,7 +82,13 @@ static int ripngd_instance_allow_ecmp_modify(enum nb_event event,
|
||||
const struct lyd_node *dnode,
|
||||
union nb_resource *resource)
|
||||
{
|
||||
/* TODO: implement me. */
|
||||
if (event != NB_EV_APPLY)
|
||||
return NB_OK;
|
||||
|
||||
ripng->ecmp = yang_dnode_get_bool(dnode, NULL);
|
||||
if (!ripng->ecmp)
|
||||
ripng_ecmp_disable();
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
@ -513,6 +519,7 @@ const struct frr_yang_module_info frr_ripngd_info = {
|
||||
{
|
||||
.xpath = "/frr-ripngd:ripngd/instance/allow-ecmp",
|
||||
.cbs.modify = ripngd_instance_allow_ecmp_modify,
|
||||
.cbs.cli_show = cli_show_ripng_allow_ecmp,
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-ripngd:ripngd/instance/default-information-originate",
|
||||
|
@ -2540,7 +2540,7 @@ DEFUN (no_ripng_default_information_originate,
|
||||
}
|
||||
|
||||
/* Update ECMP routes to zebra when ECMP is disabled. */
|
||||
static void ripng_ecmp_disable(void)
|
||||
void ripng_ecmp_disable(void)
|
||||
{
|
||||
struct agg_node *rp;
|
||||
struct ripng_info *rinfo, *tmp_rinfo;
|
||||
@ -2577,38 +2577,6 @@ static void ripng_ecmp_disable(void)
|
||||
}
|
||||
}
|
||||
|
||||
DEFUN (ripng_allow_ecmp,
|
||||
ripng_allow_ecmp_cmd,
|
||||
"allow-ecmp",
|
||||
"Allow Equal Cost MultiPath\n")
|
||||
{
|
||||
if (ripng->ecmp) {
|
||||
vty_out(vty, "ECMP is already enabled.\n");
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
ripng->ecmp = 1;
|
||||
zlog_info("ECMP is enabled.");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_ripng_allow_ecmp,
|
||||
no_ripng_allow_ecmp_cmd,
|
||||
"no allow-ecmp",
|
||||
NO_STR
|
||||
"Allow Equal Cost MultiPath\n")
|
||||
{
|
||||
if (!ripng->ecmp) {
|
||||
vty_out(vty, "ECMP is already disabled.\n");
|
||||
return CMD_WARNING;
|
||||
}
|
||||
|
||||
ripng->ecmp = 0;
|
||||
zlog_info("ECMP is disabled.");
|
||||
ripng_ecmp_disable();
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
/* RIPng configuration write function. */
|
||||
static int ripng_config_write(struct vty *vty)
|
||||
{
|
||||
@ -2644,10 +2612,6 @@ static int ripng_config_write(struct vty *vty)
|
||||
inet6_ntoa(rp->p.u.prefix6),
|
||||
rp->p.prefixlen);
|
||||
|
||||
/* ECMP configuration. */
|
||||
if (ripng->ecmp)
|
||||
vty_out(vty, " allow-ecmp\n");
|
||||
|
||||
/* RIPng static routes. */
|
||||
for (rp = agg_route_top(ripng->route); rp;
|
||||
rp = agg_route_next(rp))
|
||||
@ -2983,9 +2947,6 @@ void ripng_init()
|
||||
install_element(RIPNG_NODE,
|
||||
&no_ripng_default_information_originate_cmd);
|
||||
|
||||
install_element(RIPNG_NODE, &ripng_allow_ecmp_cmd);
|
||||
install_element(RIPNG_NODE, &no_ripng_allow_ecmp_cmd);
|
||||
|
||||
ripng_if_init();
|
||||
ripng_debug_init();
|
||||
|
||||
|
@ -134,7 +134,7 @@ struct ripng {
|
||||
struct thread *t_triggered_interval;
|
||||
|
||||
/* RIPng ECMP flag */
|
||||
unsigned int ecmp;
|
||||
bool ecmp;
|
||||
|
||||
/* For redistribute route map. */
|
||||
struct {
|
||||
@ -378,6 +378,7 @@ extern void ripng_redistribute_delete(int, int, struct prefix_ipv6 *,
|
||||
ifindex_t);
|
||||
extern void ripng_redistribute_withdraw(int type);
|
||||
|
||||
extern void ripng_ecmp_disable(void);
|
||||
extern void ripng_distribute_update_interface(struct interface *);
|
||||
extern void ripng_if_rmap_update_interface(struct interface *);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user