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>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Tested-by: NetDEF CI System <cisystem@netdef.org>
This commit is contained in:
Philippe Guibert 2016-05-24 16:52:02 +02:00 committed by Donald Sharp
parent 6e13ed4af9
commit eb6f1b41e8
2 changed files with 53 additions and 0 deletions

View File

@ -1816,6 +1816,26 @@ DEFUN (bgp_graceful_restart_stalepath_time,
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",
@ -1834,6 +1854,24 @@ DEFUN (no_bgp_graceful_restart_stalepath_time,
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>",
@ -1843,6 +1881,15 @@ ALIAS (no_bgp_graceful_restart_stalepath_time,
"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,
@ -14532,6 +14579,9 @@ bgp_vty_init (void)
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);

View File

@ -7221,6 +7221,9 @@ bgp_config_write (struct vty *vty)
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);