mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 13:33:15 +00:00
isisd: retrofit the 'lsp-mtu' command
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
ea120aa053
commit
27a45d16aa
@ -735,6 +735,34 @@ void cli_show_isis_lsp_max_lifetime(struct vty *vty, struct lyd_node *dnode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-isisd:isis/instance/lsp/mtu
|
||||||
|
*/
|
||||||
|
DEFPY(area_lsp_mtu, area_lsp_mtu_cmd, "lsp-mtu (128-4352)$val",
|
||||||
|
"Configure the maximum size of generated LSPs\n"
|
||||||
|
"Maximum size of generated LSPs\n")
|
||||||
|
{
|
||||||
|
nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, val_str);
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFPY(no_area_lsp_mtu, no_area_lsp_mtu_cmd, "no lsp-mtu [(128-4352)]",
|
||||||
|
NO_STR
|
||||||
|
"Configure the maximum size of generated LSPs\n"
|
||||||
|
"Maximum size of generated LSPs\n")
|
||||||
|
{
|
||||||
|
nb_cli_enqueue_change(vty, "./lsp/mtu", NB_OP_MODIFY, NULL);
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cli_show_isis_lsp_mtu(struct vty *vty, struct lyd_node *dnode,
|
||||||
|
bool show_defaults)
|
||||||
|
{
|
||||||
|
vty_out(vty, " lsp-mtu %s\n", yang_dnode_get_string(dnode, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
void isis_cli_init(void)
|
void isis_cli_init(void)
|
||||||
{
|
{
|
||||||
install_element(CONFIG_NODE, &router_isis_cmd);
|
install_element(CONFIG_NODE, &router_isis_cmd);
|
||||||
@ -767,6 +795,8 @@ void isis_cli_init(void)
|
|||||||
install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd);
|
install_element(ISIS_NODE, &no_lsp_refresh_interval_cmd);
|
||||||
install_element(ISIS_NODE, &max_lsp_lifetime_cmd);
|
install_element(ISIS_NODE, &max_lsp_lifetime_cmd);
|
||||||
install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd);
|
install_element(ISIS_NODE, &no_max_lsp_lifetime_cmd);
|
||||||
|
install_element(ISIS_NODE, &area_lsp_mtu_cmd);
|
||||||
|
install_element(ISIS_NODE, &no_area_lsp_mtu_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* ifndef FABRICD */
|
#endif /* ifndef FABRICD */
|
||||||
|
@ -49,5 +49,7 @@ void cli_show_isis_lsp_ref_interval(struct vty *vty, struct lyd_node *dnode,
|
|||||||
bool show_defaults);
|
bool show_defaults);
|
||||||
void cli_show_isis_lsp_max_lifetime(struct vty *vty, struct lyd_node *dnode,
|
void cli_show_isis_lsp_max_lifetime(struct vty *vty, struct lyd_node *dnode,
|
||||||
bool show_defaults);
|
bool show_defaults);
|
||||||
|
void cli_show_isis_lsp_mtu(struct vty *vty, struct lyd_node *dnode,
|
||||||
|
bool show_defaults);
|
||||||
|
|
||||||
#endif /* ISISD_ISIS_CLI_H_ */
|
#endif /* ISISD_ISIS_CLI_H_ */
|
||||||
|
@ -361,7 +361,39 @@ static int isis_instance_lsp_mtu_modify(enum nb_event event,
|
|||||||
const struct lyd_node *dnode,
|
const struct lyd_node *dnode,
|
||||||
union nb_resource *resource)
|
union nb_resource *resource)
|
||||||
{
|
{
|
||||||
/* TODO: implement me. */
|
struct listnode *node;
|
||||||
|
struct isis_circuit *circuit;
|
||||||
|
uint16_t lsp_mtu = yang_dnode_get_uint16(dnode, NULL);
|
||||||
|
struct isis_area *area;
|
||||||
|
|
||||||
|
switch (event) {
|
||||||
|
case NB_EV_VALIDATE:
|
||||||
|
area = yang_dnode_get_entry(dnode, false);
|
||||||
|
if (!area)
|
||||||
|
break;
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
|
||||||
|
if (circuit->state != C_STATE_INIT
|
||||||
|
&& circuit->state != C_STATE_UP)
|
||||||
|
continue;
|
||||||
|
if (lsp_mtu > isis_circuit_pdu_size(circuit)) {
|
||||||
|
flog_warn(
|
||||||
|
EC_LIB_NB_CB_CONFIG_VALIDATE,
|
||||||
|
"ISIS area contains circuit %s, which has a maximum PDU size of %zu",
|
||||||
|
circuit->interface->name,
|
||||||
|
isis_circuit_pdu_size(circuit));
|
||||||
|
return NB_ERR_VALIDATION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case NB_EV_PREPARE:
|
||||||
|
case NB_EV_ABORT:
|
||||||
|
break;
|
||||||
|
case NB_EV_APPLY:
|
||||||
|
area = yang_dnode_get_entry(dnode, true);
|
||||||
|
isis_area_lsp_mtu_set(area, lsp_mtu);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1898,6 +1930,7 @@ const struct frr_yang_module_info frr_isisd_info = {
|
|||||||
{
|
{
|
||||||
.xpath = "/frr-isisd:isis/instance/lsp/mtu",
|
.xpath = "/frr-isisd:isis/instance/lsp/mtu",
|
||||||
.cbs.modify = isis_instance_lsp_mtu_modify,
|
.cbs.modify = isis_instance_lsp_mtu_modify,
|
||||||
|
.cbs.cli_show = cli_show_isis_lsp_mtu,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-isisd:isis/instance/lsp/refresh-interval",
|
.xpath = "/frr-isisd:isis/instance/lsp/refresh-interval",
|
||||||
|
@ -440,53 +440,6 @@ DEFUN (no_isis_bfd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int isis_vty_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
|
|
||||||
{
|
|
||||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
|
||||||
struct listnode *node;
|
|
||||||
struct isis_circuit *circuit;
|
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
|
|
||||||
if (circuit->state != C_STATE_INIT
|
|
||||||
&& circuit->state != C_STATE_UP)
|
|
||||||
continue;
|
|
||||||
if (lsp_mtu > isis_circuit_pdu_size(circuit)) {
|
|
||||||
vty_out(vty,
|
|
||||||
"ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
|
|
||||||
circuit->interface->name,
|
|
||||||
isis_circuit_pdu_size(circuit));
|
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
isis_area_lsp_mtu_set(area, lsp_mtu);
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (area_lsp_mtu,
|
|
||||||
area_lsp_mtu_cmd,
|
|
||||||
"lsp-mtu (128-4352)",
|
|
||||||
"Configure the maximum size of generated LSPs\n"
|
|
||||||
"Maximum size of generated LSPs\n")
|
|
||||||
{
|
|
||||||
int idx_number = 1;
|
|
||||||
unsigned int lsp_mtu;
|
|
||||||
|
|
||||||
lsp_mtu = strtoul(argv[idx_number]->arg, NULL, 10);
|
|
||||||
|
|
||||||
return isis_vty_lsp_mtu_set(vty, lsp_mtu);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (no_area_lsp_mtu,
|
|
||||||
no_area_lsp_mtu_cmd,
|
|
||||||
"no lsp-mtu [(128-4352)]",
|
|
||||||
NO_STR
|
|
||||||
"Configure the maximum size of generated LSPs\n"
|
|
||||||
"Maximum size of generated LSPs\n")
|
|
||||||
{
|
|
||||||
return isis_vty_lsp_mtu_set(vty, DEFAULT_LSP_MTU);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (area_purge_originator,
|
DEFUN (area_purge_originator,
|
||||||
area_purge_originator_cmd,
|
area_purge_originator_cmd,
|
||||||
"[no] purge-originator",
|
"[no] purge-originator",
|
||||||
@ -616,9 +569,6 @@ void isis_vty_init(void)
|
|||||||
install_element(INTERFACE_NODE, &isis_bfd_cmd);
|
install_element(INTERFACE_NODE, &isis_bfd_cmd);
|
||||||
install_element(INTERFACE_NODE, &no_isis_bfd_cmd);
|
install_element(INTERFACE_NODE, &no_isis_bfd_cmd);
|
||||||
|
|
||||||
install_element(ROUTER_NODE, &area_lsp_mtu_cmd);
|
|
||||||
install_element(ROUTER_NODE, &no_area_lsp_mtu_cmd);
|
|
||||||
|
|
||||||
install_element(ROUTER_NODE, &area_purge_originator_cmd);
|
install_element(ROUTER_NODE, &area_purge_originator_cmd);
|
||||||
|
|
||||||
install_element(ROUTER_NODE, &spf_interval_cmd);
|
install_element(ROUTER_NODE, &spf_interval_cmd);
|
||||||
|
@ -544,6 +544,54 @@ DEFUN (no_max_lsp_lifetime,
|
|||||||
DEFAULT_LSP_LIFETIME);
|
DEFAULT_LSP_LIFETIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int isis_vty_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
|
||||||
|
{
|
||||||
|
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||||
|
struct listnode *node;
|
||||||
|
struct isis_circuit *circuit;
|
||||||
|
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
|
||||||
|
if (circuit->state != C_STATE_INIT
|
||||||
|
&& circuit->state != C_STATE_UP)
|
||||||
|
continue;
|
||||||
|
if (lsp_mtu > isis_circuit_pdu_size(circuit)) {
|
||||||
|
vty_out(vty,
|
||||||
|
"ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
|
||||||
|
circuit->interface->name,
|
||||||
|
isis_circuit_pdu_size(circuit));
|
||||||
|
return CMD_WARNING_CONFIG_FAILED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isis_area_lsp_mtu_set(area, lsp_mtu);
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (area_lsp_mtu,
|
||||||
|
area_lsp_mtu_cmd,
|
||||||
|
"lsp-mtu (128-4352)",
|
||||||
|
"Configure the maximum size of generated LSPs\n"
|
||||||
|
"Maximum size of generated LSPs\n")
|
||||||
|
{
|
||||||
|
int idx_number = 1;
|
||||||
|
unsigned int lsp_mtu;
|
||||||
|
|
||||||
|
lsp_mtu = strtoul(argv[idx_number]->arg, NULL, 10);
|
||||||
|
|
||||||
|
return isis_vty_lsp_mtu_set(vty, lsp_mtu);
|
||||||
|
}
|
||||||
|
|
||||||
|
DEFUN (no_area_lsp_mtu,
|
||||||
|
no_area_lsp_mtu_cmd,
|
||||||
|
"no lsp-mtu [(128-4352)]",
|
||||||
|
NO_STR
|
||||||
|
"Configure the maximum size of generated LSPs\n"
|
||||||
|
"Maximum size of generated LSPs\n")
|
||||||
|
{
|
||||||
|
return isis_vty_lsp_mtu_set(vty, DEFAULT_LSP_MTU);
|
||||||
|
}
|
||||||
|
|
||||||
void isis_vty_daemon_init(void)
|
void isis_vty_daemon_init(void)
|
||||||
{
|
{
|
||||||
install_element(ROUTER_NODE, &fabric_tier_cmd);
|
install_element(ROUTER_NODE, &fabric_tier_cmd);
|
||||||
@ -571,4 +619,7 @@ void isis_vty_daemon_init(void)
|
|||||||
|
|
||||||
install_element(ROUTER_NODE, &max_lsp_lifetime_cmd);
|
install_element(ROUTER_NODE, &max_lsp_lifetime_cmd);
|
||||||
install_element(ROUTER_NODE, &no_max_lsp_lifetime_cmd);
|
install_element(ROUTER_NODE, &no_max_lsp_lifetime_cmd);
|
||||||
|
|
||||||
|
install_element(ROUTER_NODE, &area_lsp_mtu_cmd);
|
||||||
|
install_element(ROUTER_NODE, &no_area_lsp_mtu_cmd);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user