vty_out(vty, " allow-ecmp\n");
}
+/*
+ * XPath: /frr-ripngd:ripngd/instance/default-information-originate
+ */
+DEFPY (ripng_default_information_originate,
+ ripng_default_information_originate_cmd,
+ "[no] default-information originate",
+ NO_STR
+ "Default route information\n"
+ "Distribute default route\n")
+{
+ nb_cli_enqueue_change(vty, "./default-information-originate",
+ NB_OP_MODIFY, no ? "false" : "true");
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ripng_default_information_originate(struct vty *vty,
+ struct lyd_node *dnode,
+ bool show_defaults)
+{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
+
+ vty_out(vty, " default-information originate\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);
+ install_element(RIPNG_NODE, &ripng_default_information_originate_cmd);
}
bool show_defaults);
extern void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+extern void cli_show_ripng_default_information_originate(struct vty *vty,
+ struct lyd_node *dnode,
+ bool show_defaults);
#endif /* _FRR_RIPNG_CLI_H_ */
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ bool default_information;
+ struct prefix_ipv6 p;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ default_information = yang_dnode_get_bool(dnode, NULL);
+ str2prefix_ipv6("::/0", &p);
+ if (default_information) {
+ ripng_redistribute_add(ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_DEFAULT,
+ &p, 0, NULL, 0);
+ } else {
+ ripng_redistribute_delete(ZEBRA_ROUTE_RIPNG,
+ RIPNG_ROUTE_DEFAULT, &p, 0);
+ }
+
return NB_OK;
}
{
.xpath = "/frr-ripngd:ripngd/instance/default-information-originate",
.cbs.modify = ripngd_instance_default_information_originate_modify,
+ .cbs.cli_show = cli_show_ripng_default_information_originate,
},
{
.xpath = "/frr-ripngd:ripngd/instance/default-metric",
}
#endif
-/* Please be carefull to use this command. */
-DEFUN (ripng_default_information_originate,
- ripng_default_information_originate_cmd,
- "default-information originate",
- "Default route information\n"
- "Distribute default route\n")
-{
- struct prefix_ipv6 p;
-
- if (!ripng->default_information) {
- ripng->default_information = 1;
-
- str2prefix_ipv6("::/0", &p);
- ripng_redistribute_add(ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_DEFAULT,
- &p, 0, NULL, 0);
- }
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_default_information_originate,
- no_ripng_default_information_originate_cmd,
- "no default-information originate",
- NO_STR
- "Default route information\n"
- "Distribute default route\n")
-{
- struct prefix_ipv6 p;
-
- if (ripng->default_information) {
- ripng->default_information = 0;
-
- str2prefix_ipv6("::/0", &p);
- ripng_redistribute_delete(ZEBRA_ROUTE_RIPNG,
- RIPNG_ROUTE_DEFAULT, &p, 0);
- }
-
- return CMD_SUCCESS;
-}
-
/* Update ECMP routes to zebra when ECMP is disabled. */
void ripng_ecmp_disable(void)
{
if (dnode) {
nb_cli_show_dnode_cmds(vty, dnode, false);
- if (ripng->default_information)
- vty_out(vty, " default-information originate\n");
-
ripng_network_write(vty, 1);
/* RIPng default metric configuration */
install_element (RIPNG_NODE, &no_ripng_garbage_timer_cmd);
#endif /* 0 */
- install_element(RIPNG_NODE, &ripng_default_information_originate_cmd);
- install_element(RIPNG_NODE,
- &no_ripng_default_information_originate_cmd);
-
ripng_if_init();
ripng_debug_init();
unsigned long garbage_time;
int max_mtu;
int default_metric;
- int default_information;
/* Input/output buffer of RIPng. */
struct stream *ibuf;