mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 10:38:05 +00:00
isisd: retrofit the 'spf-delay-ietf' command
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
dcb1dcd6dc
commit
5336ba3025
@ -815,6 +815,72 @@ void cli_show_isis_spf_min_interval(struct vty *vty, struct lyd_node *dnode,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
@ -852,6 +918,8 @@ void isis_cli_init(void)
|
||||
|
||||
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 */
|
||||
|
@ -53,5 +53,7 @@ void cli_show_isis_lsp_mtu(struct vty *vty, struct lyd_node *dnode,
|
||||
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_ */
|
||||
|
@ -524,12 +524,38 @@ static int isis_instance_lsp_generation_interval_level_2_modify(
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -537,7 +563,17 @@ static int
|
||||
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;
|
||||
}
|
||||
|
||||
@ -548,7 +584,7 @@ static int isis_instance_spf_ietf_backoff_delay_init_delay_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -559,7 +595,7 @@ static int isis_instance_spf_ietf_backoff_delay_short_delay_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -570,7 +606,7 @@ static int isis_instance_spf_ietf_backoff_delay_long_delay_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -581,7 +617,7 @@ static int isis_instance_spf_ietf_backoff_delay_hold_down_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -592,7 +628,7 @@ static int isis_instance_spf_ietf_backoff_delay_time_to_learn_modify(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -1986,6 +2022,8 @@ const struct frr_yang_module_info frr_isisd_info = {
|
||||
.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",
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include <zebra.h>
|
||||
|
||||
#include "command.h"
|
||||
#include "spf_backoff.h"
|
||||
#include "bfd.h"
|
||||
|
||||
#include "isis_circuit.h"
|
||||
@ -452,64 +451,6 @@ DEFUN (area_purge_originator,
|
||||
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);
|
||||
@ -541,8 +482,5 @@ void isis_vty_init(void)
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
#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,
|
||||
@ -621,6 +622,64 @@ DEFUN (no_area_lsp_mtu,
|
||||
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);
|
||||
@ -654,4 +713,7 @@ void isis_vty_daemon_init(void)
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user