yang_dnode_get_string(dnode, NULL));
}
+/*
+ * XPath: /frr-ripngd:ripngd/instance/timers
+ */
+DEFPY (ripng_timers,
+ ripng_timers_cmd,
+ "timers basic (1-65535)$update (1-65535)$timeout (1-65535)$garbage",
+ "RIPng timers setup\n"
+ "Basic timer\n"
+ "Routing table update timer value in second. Default is 30.\n"
+ "Routing information timeout timer. Default is 180.\n"
+ "Garbage collection timer. Default is 120.\n")
+{
+ nb_cli_enqueue_change(vty, "./update-interval", NB_OP_MODIFY,
+ update_str);
+ nb_cli_enqueue_change(vty, "./holddown-interval", NB_OP_MODIFY,
+ timeout_str);
+ nb_cli_enqueue_change(vty, "./flush-interval", NB_OP_MODIFY,
+ garbage_str);
+
+ return nb_cli_apply_changes(vty, "./timers");
+}
+
+DEFPY (no_ripng_timers,
+ no_ripng_timers_cmd,
+ "no timers basic [(1-65535) (1-65535) (1-65535)]",
+ NO_STR
+ "RIPng timers setup\n"
+ "Basic timer\n"
+ "Routing table update timer value in second. Default is 30.\n"
+ "Routing information timeout timer. Default is 180.\n"
+ "Garbage collection timer. Default is 120.\n")
+{
+ nb_cli_enqueue_change(vty, "./update-interval", NB_OP_MODIFY, NULL);
+ nb_cli_enqueue_change(vty, "./holddown-interval", NB_OP_MODIFY, NULL);
+ nb_cli_enqueue_change(vty, "./flush-interval", NB_OP_MODIFY, NULL);
+
+ return nb_cli_apply_changes(vty, "./timers");
+}
+
+void cli_show_ripng_timers(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, " timers basic %s %s %s\n",
+ yang_dnode_get_string(dnode, "./update-interval"),
+ yang_dnode_get_string(dnode, "./holddown-interval"),
+ yang_dnode_get_string(dnode, "./flush-interval"));
+}
+
void ripng_cli_init(void)
{
install_element(CONFIG_NODE, &router_ripng_cmd);
install_element(RIPNG_NODE, &ripng_redistribute_cmd);
install_element(RIPNG_NODE, &ripng_route_cmd);
install_element(RIPNG_NODE, &ripng_aggregate_address_cmd);
+ install_element(RIPNG_NODE, &ripng_timers_cmd);
+ install_element(RIPNG_NODE, &no_ripng_timers_cmd);
}
extern void cli_show_ripng_aggregate_address(struct vty *vty,
struct lyd_node *dnode,
bool show_defaults);
+extern void cli_show_ripng_timers(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* _FRR_RIPNG_CLI_H_ */
return NB_OK;
}
+/*
+ * XPath: /frr-ripngd:ripngd/instance/timers
+ */
+static void ripngd_instance_timers_apply_finish(const struct lyd_node *dnode)
+{
+ /* Reset update timer thread. */
+ ripng_event(RIPNG_UPDATE_EVENT, 0);
+}
+
/*
* XPath: /frr-ripngd:ripngd/instance/timers/flush-interval
*/
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ ripng->garbage_time = yang_dnode_get_uint16(dnode, NULL);
+
return NB_OK;
}
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ ripng->timeout_time = yang_dnode_get_uint16(dnode, NULL);
+
return NB_OK;
}
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ ripng->update_time = yang_dnode_get_uint16(dnode, NULL);
+
return NB_OK;
}
.cbs.delete = ripngd_instance_aggregate_address_delete,
.cbs.cli_show = cli_show_ripng_aggregate_address,
},
+ {
+ .xpath = "/frr-ripngd:ripngd/instance/timers",
+ .cbs.apply_finish = ripngd_instance_timers_apply_finish,
+ .cbs.cli_show = cli_show_ripng_timers,
+ },
{
.xpath = "/frr-ripngd:ripngd/instance/timers/flush-interval",
.cbs.modify = ripngd_instance_timers_flush_interval_modify,
return CMD_SUCCESS;
vty_out(vty, "Routing Protocol is \"RIPng\"\n");
- vty_out(vty, " Sending updates every %ld seconds with +/-50%%,",
+ vty_out(vty, " Sending updates every %u seconds with +/-50%%,",
ripng->update_time);
vty_out(vty, " next due in %lu seconds\n",
thread_timer_remain_second(ripng->t_update));
- vty_out(vty, " Timeout after %ld seconds,", ripng->timeout_time);
- vty_out(vty, " garbage collect after %ld seconds\n",
+ vty_out(vty, " Timeout after %u seconds,", ripng->timeout_time);
+ vty_out(vty, " garbage collect after %u seconds\n",
ripng->garbage_time);
/* Filtering status show. */
}
#endif /* 0 */
-DEFUN (ripng_timers,
- ripng_timers_cmd,
- "timers basic (0-65535) (0-65535) (0-65535)",
- "RIPng timers setup\n"
- "Basic timer\n"
- "Routing table update timer value in second. Default is 30.\n"
- "Routing information timeout timer. Default is 180.\n"
- "Garbage collection timer. Default is 120.\n")
-{
- int idx_number = 2;
- int idx_number_2 = 3;
- int idx_number_3 = 4;
- unsigned long update;
- unsigned long timeout;
- unsigned long garbage;
-
- update = strtoul(argv[idx_number]->arg, NULL, 10);
- timeout = strtoul(argv[idx_number_2]->arg, NULL, 10);
- garbage = strtoul(argv[idx_number_3]->arg, NULL, 10);
-
- /* Set each timer value. */
- ripng->update_time = update;
- ripng->timeout_time = timeout;
- ripng->garbage_time = garbage;
-
- /* Reset update timer thread. */
- ripng_event(RIPNG_UPDATE_EVENT, 0);
-
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_timers,
- no_ripng_timers_cmd,
- "no timers basic [(0-65535) (0-65535) (0-65535)]",
- NO_STR
- "RIPng timers setup\n"
- "Basic timer\n"
- "Routing table update timer value in second. Default is 30.\n"
- "Routing information timeout timer. Default is 180.\n"
- "Garbage collection timer. Default is 120.\n")
-{
- /* Set each timer value to the default. */
- ripng->update_time = RIPNG_UPDATE_TIMER_DEFAULT;
- ripng->timeout_time = RIPNG_TIMEOUT_TIMER_DEFAULT;
- ripng->garbage_time = RIPNG_GARBAGE_TIMER_DEFAULT;
-
- /* Reset update timer thread. */
- ripng_event(RIPNG_UPDATE_EVENT, 0);
-
- return CMD_SUCCESS;
-}
-
#if 0
DEFUN (show_ipv6_protocols,
show_ipv6_protocols_cmd,
if (dnode) {
nb_cli_show_dnode_cmds(vty, dnode, false);
- /* RIPng timers configuration. */
- if (ripng->update_time != RIPNG_UPDATE_TIMER_DEFAULT
- || ripng->timeout_time != RIPNG_TIMEOUT_TIMER_DEFAULT
- || ripng->garbage_time != RIPNG_GARBAGE_TIMER_DEFAULT) {
- vty_out(vty, " timers basic %ld %ld %ld\n",
- ripng->update_time, ripng->timeout_time,
- ripng->garbage_time);
- }
-#if 0
- if (ripng->update_time != RIPNG_UPDATE_TIMER_DEFAULT)
- vty_out (vty, " update-timer %d\n", ripng->update_time);
- if (ripng->timeout_time != RIPNG_TIMEOUT_TIMER_DEFAULT)
- vty_out (vty, " timeout-timer %d\n", ripng->timeout_time);
- if (ripng->garbage_time != RIPNG_GARBAGE_TIMER_DEFAULT)
- vty_out (vty, " garbage-timer %d\n", ripng->garbage_time);
-#endif /* 0 */
-
config_write_distribute(vty);
config_write_if_rmap(vty);
install_default(RIPNG_NODE);
- install_element(RIPNG_NODE, &ripng_timers_cmd);
- install_element(RIPNG_NODE, &no_ripng_timers_cmd);
#if 0
install_element (VIEW_NODE, &show_ipv6_protocols_cmd);
install_element (RIPNG_NODE, &ripng_update_timer_cmd);
#define RIPNG_METRIC_NEXTHOP 0xff
#define RIPNG_GROUP "ff02::9"
-/* RIPng timers. */
-#define RIPNG_UPDATE_TIMER_DEFAULT 30
-#define RIPNG_TIMEOUT_TIMER_DEFAULT 180
-#define RIPNG_GARBAGE_TIMER_DEFAULT 120
-
/* RIPng peer timeout value. */
#define RIPNG_PEER_TIMER_DEFAULT 180
/* RIPng Parameters.*/
uint8_t command;
uint8_t version;
- unsigned long update_time;
- unsigned long timeout_time;
- unsigned long garbage_time;
+ uint16_t update_time;
+ uint16_t timeout_time;
+ uint16_t garbage_time;
int max_mtu;
uint8_t default_metric;