}
}
+/*
+ * XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
+ */
+DEFPY(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")
+{
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_CREATE,
+ NULL);
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/init-delay",
+ NB_OP_MODIFY, init_delay_str);
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/short-delay",
+ NB_OP_MODIFY, short_delay_str);
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/long-delay",
+ NB_OP_MODIFY, long_delay_str);
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/hold-down",
+ NB_OP_MODIFY, holddown_str);
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay/time-to-learn",
+ NB_OP_MODIFY, time_to_learn_str);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+DEFPY(no_spf_delay_ietf, no_spf_delay_ietf_cmd,
+ "no spf-delay-ietf [init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)]",
+ NO_STR
+ "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")
+{
+ nb_cli_enqueue_change(vty, "./spf/ietf-backoff-delay", NB_OP_DELETE,
+ NULL);
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty,
+ " spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n",
+ yang_dnode_get_string(dnode, "./init-delay"),
+ yang_dnode_get_string(dnode, "./short-delay"),
+ yang_dnode_get_string(dnode, "./long-delay"),
+ yang_dnode_get_string(dnode, "./hold-down"),
+ yang_dnode_get_string(dnode, "./time-to-learn"));
+}
+
void isis_cli_init(void)
{
install_element(CONFIG_NODE, &router_isis_cmd);
install_element(ISIS_NODE, &spf_interval_cmd);
install_element(ISIS_NODE, &no_spf_interval_cmd);
+ install_element(ISIS_NODE, &spf_delay_ietf_cmd);
+ install_element(ISIS_NODE, &no_spf_delay_ietf_cmd);
}
#endif /* ifndef FABRICD */
bool show_defaults);
void cli_show_isis_spf_min_interval(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+void cli_show_isis_spf_ietf_backoff(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* ISISD_ISIS_CLI_H_ */
/*
* XPath: /frr-isisd:isis/instance/spf/ietf-backoff-delay
*/
+static void ietf_backoff_delay_apply_finish(const struct lyd_node *dnode)
+{
+ long init_delay = yang_dnode_get_uint16(dnode, "./init-delay");
+ long short_delay = yang_dnode_get_uint16(dnode, "./short-delay");
+ long long_delay = yang_dnode_get_uint16(dnode, "./long-delay");
+ long holddown = yang_dnode_get_uint16(dnode, "./hold-down");
+ long timetolearn = yang_dnode_get_uint16(dnode, "./time-to-learn");
+ struct isis_area *area = yang_dnode_get_entry(dnode, true);
+ 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);
+}
+
static int
isis_instance_spf_ietf_backoff_delay_create(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ /* All the work is done in the apply_finish */
return NB_OK;
}
isis_instance_spf_ietf_backoff_delay_delete(enum nb_event event,
const struct lyd_node *dnode)
{
- /* TODO: implement me. */
+ struct isis_area *area;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ area = yang_dnode_get_entry(dnode, true);
+ 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 NB_OK;
}
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ /* All the work is done in the apply_finish */
return NB_OK;
}
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ /* All the work is done in the apply_finish */
return NB_OK;
}
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ /* All the work is done in the apply_finish */
return NB_OK;
}
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ /* All the work is done in the apply_finish */
return NB_OK;
}
enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ /* All the work is done in the apply_finish */
return NB_OK;
}
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay",
.cbs.create = isis_instance_spf_ietf_backoff_delay_create,
.cbs.delete = isis_instance_spf_ietf_backoff_delay_delete,
+ .cbs.apply_finish = ietf_backoff_delay_apply_finish,
+ .cbs.cli_show = cli_show_isis_spf_ietf_backoff,
},
{
.xpath = "/frr-isisd:isis/instance/spf/ietf-backoff-delay/init-delay",
#include <zebra.h>
#include "command.h"
-#include "spf_backoff.h"
#include "bfd.h"
#include "isis_circuit.h"
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;
-}
-
void isis_vty_init(void)
{
install_element(INTERFACE_NODE, &isis_passive_cmd);
install_element(ROUTER_NODE, &area_purge_originator_cmd);
- install_element(ROUTER_NODE, &spf_delay_ietf_cmd);
- install_element(ROUTER_NODE, &no_spf_delay_ietf_cmd);
-
isis_vty_daemon_init();
}
#include "isisd/isis_lsp.h"
#include "isisd/isis_csm.h"
#include "isisd/isis_circuit.h"
+#include "lib/spf_backoff.h"
DEFUN (fabric_tier,
fabric_tier_cmd,
return isis_vty_lsp_mtu_set(vty, DEFAULT_LSP_MTU);
}
+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;
+}
+
void isis_vty_daemon_init(void)
{
install_element(ROUTER_NODE, &fabric_tier_cmd);
install_element(ROUTER_NODE, &spf_interval_cmd);
install_element(ROUTER_NODE, &no_spf_interval_cmd);
+
+ install_element(ROUTER_NODE, &spf_delay_ietf_cmd);
+ install_element(ROUTER_NODE, &no_spf_delay_ietf_cmd);
}