summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
authorStephane Litkowski <stephane.litkowski@orange.com>2017-02-21 23:52:29 +0100
committerChristian Franke <nobody@nowhere.ws>2017-02-22 17:13:17 +0100
commit03f7e182afd3be49fdaebff1175a4e15dff983ae (patch)
tree868203e2174dc17f79ff4979646bb31e59daee15 /isisd
parentisisd: cleanup SPF scheduling (diff)
downloadfrr-03f7e182afd3be49fdaebff1175a4e15dff983ae.tar.xz
frr-03f7e182afd3be49fdaebff1175a4e15dff983ae.zip
isisd: add support for draft-ietf-rtgwg-backoff-algo
Adds CLI command "spf-delay-ietf" to area node for configuration and "show isis spf-delay-ietf" to enable node for displaying status.
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_spf.c22
-rw-r--r--isisd/isis_vty.c62
-rw-r--r--isisd/isisd.c76
-rw-r--r--isisd/isisd.h1
4 files changed, 161 insertions, 0 deletions
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index 6efc1fc4d..db46078f2 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -33,6 +33,7 @@
#include "hash.h"
#include "if.h"
#include "table.h"
+#include "spf_backoff.h"
#include "isis_constants.h"
#include "isis_common.h"
@@ -1318,6 +1319,27 @@ isis_spf_schedule (struct isis_area *area, int level)
zlog_debug ("ISIS-Spf (%s) L%d SPF schedule called, lastrun %d sec ago",
area->area_tag, level, diff);
+ if (area->spf_delay_ietf[level - 1])
+ {
+ /* Need to call schedule function also if spf delay is running to
+ * restart holdoff timer - compare draft-ietf-rtgwg-backoff-algo-04 */
+ long delay = spf_backoff_schedule(area->spf_delay_ietf[level -1]);
+ if (area->spf_timer[level - 1])
+ return ISIS_OK;
+
+ if (level == 1)
+ {
+ THREAD_TIMER_MSEC_ON(master, area->spf_timer[0],
+ isis_run_spf_l1, area, delay);
+ }
+ else
+ {
+ THREAD_TIMER_MSEC_ON(master, area->spf_timer[1],
+ isis_run_spf_l2, area, delay);
+ }
+ return ISIS_OK;
+ }
+
if (area->spf_timer[level -1])
return ISIS_OK;
diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c
index a73598bac..721959859 100644
--- a/isisd/isis_vty.c
+++ b/isisd/isis_vty.c
@@ -24,6 +24,7 @@
#include <zebra.h>
#include "command.h"
+#include "spf_backoff.h"
#include "isis_circuit.h"
#include "isis_csm.h"
@@ -1708,6 +1709,63 @@ DEFUN (no_spf_interval_l2,
return CMD_SUCCESS;
}
+DEFUN (no_spf_delay_ietf,
+ no_spf_delay_ietf_cmd,
+ "no spf-delay-ietf",
+ NO_STR
+ "IETF SPF delay algorithm\n")
+{
+ VTY_DECLVAR_CONTEXT (isis_area, area);
+
+ spf_backoff_free(area->spf_delay_ietf[0]);
+ spf_backoff_free(area->spf_delay_ietf[1]);
+ area->spf_delay_ietf[0] = NULL;
+ area->spf_delay_ietf[1] = NULL;
+
+ return CMD_SUCCESS;
+}
+
+DEFUN (spf_delay_ietf,
+ spf_delay_ietf_cmd,
+ "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
+ "IETF SPF delay algorithm\n"
+ "Delay used while in QUIET state\n"
+ "Delay used while in QUIET state in milliseconds\n"
+ "Delay used while in SHORT_WAIT state\n"
+ "Delay used while in SHORT_WAIT state in milliseconds\n"
+ "Delay used while in LONG_WAIT\n"
+ "Delay used while in LONG_WAIT state in milliseconds\n"
+ "Time with no received IGP events before considering IGP stable\n"
+ "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
+ "Maximum duration needed to learn all the events related to a single failure\n"
+ "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
+{
+ VTY_DECLVAR_CONTEXT (isis_area, area);
+
+ long init_delay = atol(argv[2]->arg);
+ long short_delay = atol(argv[4]->arg);
+ long long_delay = atol(argv[6]->arg);
+ long holddown = atol(argv[8]->arg);
+ long timetolearn = atol(argv[10]->arg);
+
+ size_t bufsiz = strlen(area->area_tag) + sizeof("IS-IS Lx");
+ char *buf = XCALLOC(MTYPE_TMP, bufsiz);
+
+ snprintf(buf, bufsiz, "IS-IS %s L1", area->area_tag);
+ spf_backoff_free(area->spf_delay_ietf[0]);
+ area->spf_delay_ietf[0] = spf_backoff_new(master, buf, init_delay,
+ short_delay, long_delay,
+ holddown, timetolearn);
+
+ snprintf(buf, bufsiz, "IS-IS %s L2", area->area_tag);
+ spf_backoff_free(area->spf_delay_ietf[1]);
+ area->spf_delay_ietf[1] = spf_backoff_new(master, buf, init_delay,
+ short_delay, long_delay,
+ holddown, timetolearn);
+
+ XFREE(MTYPE_TMP, buf);
+ return CMD_SUCCESS;
+}
static int
area_max_lsp_lifetime_set(struct vty *vty, int level,
@@ -2097,4 +2155,8 @@ isis_vty_init (void)
install_element (ISIS_NODE, &domain_passwd_md5_cmd);
install_element (ISIS_NODE, &domain_passwd_clear_cmd);
install_element (ISIS_NODE, &no_area_passwd_cmd);
+
+ install_element (ISIS_NODE, &spf_delay_ietf_cmd);
+ install_element (ISIS_NODE, &no_spf_delay_ietf_cmd);
+
}
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 4d94f243d..2863d2f67 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -35,6 +35,7 @@
#include "prefix.h"
#include "table.h"
#include "qobj.h"
+#include "spf_backoff.h"
#include "isisd/dict.h"
#include "isisd/isis_constants.h"
@@ -248,6 +249,9 @@ isis_area_destroy (struct vty *vty, const char *area_tag)
THREAD_TIMER_OFF(area->spf_timer[0]);
THREAD_TIMER_OFF(area->spf_timer[1]);
+ spf_backoff_free(area->spf_delay_ietf[0]);
+ spf_backoff_free(area->spf_delay_ietf[1]);
+
/* invalidate and validate would delete all routes from zebra */
isis_route_invalidate (area);
isis_route_validate (area);
@@ -859,6 +863,7 @@ config_write_debug (struct vty *vty)
vty_out (vty, "debug isis lsp-sched%s", VTY_NEWLINE);
write++;
}
+ write += spf_backoff_write_config(vty);
return write;
}
@@ -1276,6 +1281,57 @@ vty_out_timestr(struct vty *vty, time_t uptime)
vty_out (vty, " ago");
}
+DEFUN (show_isis_spf_ietf,
+ show_isis_spf_ietf_cmd,
+ "show isis spf-delay-ietf",
+ SHOW_STR
+ "IS-IS information\n"
+ "IS-IS SPF delay IETF information\n")
+{
+ if (!isis)
+ {
+ vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
+ return CMD_SUCCESS;
+ }
+
+ struct listnode *node;
+ struct isis_area *area;
+
+ for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
+ {
+ vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
+ VTY_NEWLINE);
+
+ for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
+ {
+ if ((area->is_type & level) == 0)
+ continue;
+
+ vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
+ vty_out (vty, " SPF delay status: ");
+ if (area->spf_timer[level -1])
+ {
+ struct timeval remain = thread_timer_remain(area->spf_timer[level - 1]);
+ vty_out(vty, "Pending, due in %ld msec%s",
+ remain.tv_sec * 1000 + remain.tv_usec / 1000,
+ VTY_NEWLINE);
+ }
+ else
+ {
+ vty_out(vty, "Not scheduled%s", VTY_NEWLINE);
+ }
+
+ if (area->spf_delay_ietf[level - 1]) {
+ vty_out(vty, " Using draft-ietf-rtgwg-backoff-algo-04%s", VTY_NEWLINE);
+ spf_backoff_show(area->spf_delay_ietf[level - 1], vty, " ");
+ } else {
+ vty_out(vty, " Using legacy backoff algo%s", VTY_NEWLINE);
+ }
+ }
+ }
+ return CMD_SUCCESS;
+}
+
DEFUN (show_isis_summary,
show_isis_summary_cmd,
"show isis summary",
@@ -1337,6 +1393,8 @@ DEFUN (show_isis_summary,
vty_out (vty, " minimum interval : %d",
area->min_spf_interval[level - 1]);
+ if (area->spf_delay_ietf[level - 1])
+ vty_out (vty, " (not used, IETF SPF delay activated)");
vty_out (vty, VTY_NEWLINE);
vty_out (vty, " IPv4 route computation:%s", VTY_NEWLINE);
@@ -2010,6 +2068,20 @@ isis_config_write (struct vty *vty)
write++;
}
}
+
+ /* IETF SPF interval */
+ if (area->spf_delay_ietf[0])
+ {
+ vty_out (vty, " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld%s",
+ spf_backoff_init_delay(area->spf_delay_ietf[0]),
+ spf_backoff_short_delay(area->spf_delay_ietf[0]),
+ spf_backoff_long_delay(area->spf_delay_ietf[0]),
+ spf_backoff_holddown(area->spf_delay_ietf[0]),
+ spf_backoff_timetolearn(area->spf_delay_ietf[0]),
+ VTY_NEWLINE);
+ write++;
+ }
+
/* Authentication passwords. */
if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
{
@@ -2097,6 +2169,8 @@ isis_init ()
install_element (VIEW_NODE, &show_isis_summary_cmd);
+ install_element (VIEW_NODE, &show_isis_spf_ietf_cmd);
+
install_element (VIEW_NODE, &show_isis_interface_cmd);
install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
@@ -2182,4 +2256,6 @@ isis_init ()
install_element (ISIS_NODE, &log_adj_changes_cmd);
install_element (ISIS_NODE, &no_log_adj_changes_cmd);
+
+ spf_backoff_cmd_init();
}
diff --git a/isisd/isisd.h b/isisd/isisd.h
index 87c4a0447..e1d3a69f8 100644
--- a/isisd/isisd.h
+++ b/isisd/isisd.h
@@ -127,6 +127,7 @@ struct isis_area
[ZEBRA_ROUTE_MAX + 1][ISIS_LEVELS];
struct route_table *ext_reach[REDIST_PROTOCOL_COUNT][ISIS_LEVELS];
+ struct spf_backoff *spf_delay_ietf[ISIS_LEVELS]; /*Structure with IETF SPF algo parameters*/
struct thread *spf_timer[ISIS_LEVELS];
QOBJ_FIELDS