summaryrefslogtreecommitdiffstats
path: root/ripd/rip_cli.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-05-09 06:35:01 +0200
committerRenato Westphal <renato@opensourcerouting.org>2018-10-27 20:16:12 +0200
commitb745780b5f56e9770c5ba0785bafd17b2239c6cc (patch)
tree87e54690683b69d058a6f08b18116de2936278c6 /ripd/rip_cli.c
parentripd: retrofit the 'route' command to the new northbound model (diff)
downloadfrr-b745780b5f56e9770c5ba0785bafd17b2239c6cc.tar.xz
frr-b745780b5f56e9770c5ba0785bafd17b2239c6cc.zip
ripd: retrofit the 'timer basic' command to the new northbound model
Trivial conversion. Use the northbound 'apply_finish()' callback so we'll call rip_event() only once even if we change the three RIP timers at the same time. Convert the timers to uint32_t to match their representation in the YANG model. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ripd/rip_cli.c')
-rw-r--r--ripd/rip_cli.c75
1 files changed, 75 insertions, 0 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index 00608b026..a89df5b2f 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -639,6 +639,79 @@ void cli_show_rip_route(struct vty *vty, struct lyd_node *dnode,
vty_out(vty, " route %s\n", yang_dnode_get_string(dnode, NULL));
}
+/*
+ * XPath: /frr-ripd:ripd/instance/timers
+ */
+DEFPY (rip_timers,
+ rip_timers_cmd,
+ "timers basic (5-2147483647)$update (5-2147483647)$timeout (5-2147483647)$garbage",
+ "Adjust routing timers\n"
+ "Basic routing protocol update timers\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")
+{
+ struct cli_config_change changes[] = {
+ {
+ .xpath = "./timers/update-interval",
+ .operation = NB_OP_MODIFY,
+ .value = update_str,
+ },
+ {
+ .xpath = "./timers/holddown-interval",
+ .operation = NB_OP_MODIFY,
+ .value = timeout_str,
+ },
+ {
+ .xpath = "./timers/flush-interval",
+ .operation = NB_OP_MODIFY,
+ .value = garbage_str,
+ },
+ };
+
+ return nb_cli_cfg_change(vty, NULL, changes, array_size(changes));
+}
+
+DEFPY (no_rip_timers,
+ no_rip_timers_cmd,
+ "no timers basic [(5-2147483647) (5-2147483647) (5-2147483647)]",
+ NO_STR
+ "Adjust routing timers\n"
+ "Basic routing protocol update timers\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")
+{
+ struct cli_config_change changes[] = {
+ {
+ .xpath = "./timers/update-interval",
+ .operation = NB_OP_MODIFY,
+ .value = NULL,
+ },
+ {
+ .xpath = "./timers/holddown-interval",
+ .operation = NB_OP_MODIFY,
+ .value = NULL,
+ },
+ {
+ .xpath = "./timers/flush-interval",
+ .operation = NB_OP_MODIFY,
+ .value = NULL,
+ },
+ };
+
+ return nb_cli_cfg_change(vty, NULL, changes, array_size(changes));
+}
+
+void cli_show_rip_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 rip_cli_init(void)
{
install_element(CONFIG_NODE, &router_rip_cmd);
@@ -662,4 +735,6 @@ void rip_cli_init(void)
install_element(RIP_NODE, &rip_redistribute_cmd);
install_element(RIP_NODE, &no_rip_redistribute_cmd);
install_element(RIP_NODE, &rip_route_cmd);
+ install_element(RIP_NODE, &rip_timers_cmd);
+ install_element(RIP_NODE, &no_rip_timers_cmd);
}