bgpd: Add new configuration cli for graceful restart.
There is support to configure graceful restart timer. This is the
time to wait to delete stale routes before a BGP open message is
received.
bgp graceful-restart restart-time <1-3600>
no bgp graceful-restart [<1-255>]
* bgpd/bgp_vty.c
* Define command strings for above CLI
* bgpd/bgpd.c
* bgp_config_write(): Output graceful restart-time configuration
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index a8383cf..3b69a1b 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -1044,6 +1044,26 @@
return CMD_SUCCESS;
}
+DEFUN (bgp_graceful_restart_restart_time,
+ bgp_graceful_restart_restart_time_cmd,
+ "bgp graceful-restart restart-time <1-3600>",
+ "BGP specific commands\n"
+ "Graceful restart capability parameters\n"
+ "Set the time to wait to delete stale routes before a BGP open message is received\n"
+ "Delay value (seconds)\n")
+{
+ struct bgp *bgp;
+ u_int32_t restart;
+
+ bgp = vty->index;
+ if (! bgp)
+ return CMD_WARNING;
+
+ VTY_GET_INTEGER_RANGE ("restart-time", restart, argv[0], 1, 3600);
+ bgp->restart_time = restart;
+ return CMD_SUCCESS;
+}
+
DEFUN (no_bgp_graceful_restart_stalepath_time,
no_bgp_graceful_restart_stalepath_time_cmd,
"no bgp graceful-restart stalepath-time",
@@ -1062,6 +1082,24 @@
return CMD_SUCCESS;
}
+DEFUN (no_bgp_graceful_restart_restart_time,
+ no_bgp_graceful_restart_restart_time_cmd,
+ "no bgp graceful-restart restart-time",
+ NO_STR
+ "BGP specific commands\n"
+ "Graceful restart capability parameters\n"
+ "Set the time to wait to delete stale routes before a BGP open message is received\n")
+{
+ struct bgp *bgp;
+
+ bgp = vty->index;
+ if (! bgp)
+ return CMD_WARNING;
+
+ bgp->restart_time = BGP_DEFAULT_RESTART_TIME;
+ return CMD_SUCCESS;
+}
+
ALIAS (no_bgp_graceful_restart_stalepath_time,
no_bgp_graceful_restart_stalepath_time_val_cmd,
"no bgp graceful-restart stalepath-time <1-3600>",
@@ -1071,6 +1109,15 @@
"Set the max time to hold onto restarting peer's stale paths\n"
"Delay value (seconds)\n")
+ALIAS (no_bgp_graceful_restart_restart_time,
+ no_bgp_graceful_restart_restart_time_val_cmd,
+ "no bgp graceful-restart restart-time <1-3600>",
+ NO_STR
+ "BGP specific commands\n"
+ "Graceful restart capability parameters\n"
+ "Set the time to wait to delete stale routes before a BGP open message is received\n"
+ "Delay value (seconds)\n")
+
/* "bgp fast-external-failover" configuration. */
DEFUN (bgp_fast_external_failover,
bgp_fast_external_failover_cmd,
@@ -9901,6 +9948,9 @@
install_element (BGP_NODE, &bgp_graceful_restart_stalepath_time_cmd);
install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_cmd);
install_element (BGP_NODE, &no_bgp_graceful_restart_stalepath_time_val_cmd);
+ install_element (BGP_NODE, &bgp_graceful_restart_restart_time_cmd);
+ install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_cmd);
+ install_element (BGP_NODE, &no_bgp_graceful_restart_restart_time_val_cmd);
/* "bgp fast-external-failover" commands */
install_element (BGP_NODE, &bgp_fast_external_failover_cmd);
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 3517011..e86665b 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -5484,6 +5484,9 @@
if (bgp->stalepath_time != BGP_DEFAULT_STALEPATH_TIME)
vty_out (vty, " bgp graceful-restart stalepath-time %d%s",
bgp->stalepath_time, VTY_NEWLINE);
+ if (bgp->restart_time != BGP_DEFAULT_RESTART_TIME)
+ vty_out (vty, " bgp graceful-restart restart-time %d%s",
+ bgp->restart_time, VTY_NEWLINE);
if (bgp_flag_check (bgp, BGP_FLAG_GRACEFUL_RESTART))
vty_out (vty, " bgp graceful-restart%s", VTY_NEWLINE);