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);
}
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_ */
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;
}
{
.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",
}
/* 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;
}
}
-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)
{
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))
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();
struct thread *t_triggered_interval;
/* RIPng ECMP flag */
- unsigned int ecmp;
+ bool ecmp;
/* For redistribute route map. */
struct {
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 *);