mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-03 21:50:52 +00:00
isisd: retrofit 'set-overload-bit' and 'set-attached-bit' cmds
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
6bb043cd0f
commit
05a3f9f041
@ -406,6 +406,44 @@ void cli_show_isis_dynamic_hostname(struct vty *vty, struct lyd_node *dnode,
|
||||
vty_out(vty, " hostname dynamic\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-isisd:isis/instance/overload
|
||||
*/
|
||||
DEFPY(set_overload_bit, set_overload_bit_cmd, "[no] set-overload-bit",
|
||||
"Reset overload bit to accept transit traffic\n"
|
||||
"Set overload bit to avoid any transit traffic\n")
|
||||
{
|
||||
nb_cli_enqueue_change(vty, "./overload",
|
||||
no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
|
||||
|
||||
return nb_cli_apply_changes(vty, NULL);
|
||||
}
|
||||
|
||||
void cli_show_isis_overload(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults)
|
||||
{
|
||||
vty_out(vty, " set-overload-bit\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-isisd:isis/instance/attached
|
||||
*/
|
||||
DEFPY(set_attached_bit, set_attached_bit_cmd, "[no] set-attached-bit",
|
||||
"Reset attached bit\n"
|
||||
"Set attached bit to identify as L1/L2 router for inter-area traffic\n")
|
||||
{
|
||||
nb_cli_enqueue_change(vty, "./attached",
|
||||
no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
|
||||
|
||||
return nb_cli_apply_changes(vty, NULL);
|
||||
}
|
||||
|
||||
void cli_show_isis_attached(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults)
|
||||
{
|
||||
vty_out(vty, " set-attached-bit\n");
|
||||
}
|
||||
|
||||
void isis_cli_init(void)
|
||||
{
|
||||
install_element(CONFIG_NODE, &router_isis_cmd);
|
||||
@ -421,6 +459,9 @@ void isis_cli_init(void)
|
||||
install_element(ISIS_NODE, &no_is_type_cmd);
|
||||
|
||||
install_element(ISIS_NODE, &dynamic_hostname_cmd);
|
||||
|
||||
install_element(ISIS_NODE, &set_overload_bit_cmd);
|
||||
install_element(ISIS_NODE, &set_attached_bit_cmd);
|
||||
}
|
||||
|
||||
#endif /* ifndef FABRICD */
|
||||
|
||||
@ -33,5 +33,9 @@ void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
void cli_show_isis_dynamic_hostname(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
void cli_show_isis_attached(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
void cli_show_isis_overload(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
|
||||
#endif /* ISISD_ISIS_CLI_H_ */
|
||||
|
||||
@ -257,14 +257,28 @@ static int isis_instance_attached_create(enum nb_event event,
|
||||
const struct lyd_node *dnode,
|
||||
union nb_resource *resource)
|
||||
{
|
||||
/* TODO: implement me. */
|
||||
struct isis_area *area;
|
||||
|
||||
if (event != NB_EV_APPLY)
|
||||
return NB_OK;
|
||||
|
||||
area = yang_dnode_get_entry(dnode, true);
|
||||
isis_area_attached_bit_set(area, true);
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static int isis_instance_attached_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);
|
||||
isis_area_attached_bit_set(area, false);
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
@ -275,14 +289,28 @@ static int isis_instance_overload_create(enum nb_event event,
|
||||
const struct lyd_node *dnode,
|
||||
union nb_resource *resource)
|
||||
{
|
||||
/* TODO: implement me. */
|
||||
struct isis_area *area;
|
||||
|
||||
if (event != NB_EV_APPLY)
|
||||
return NB_OK;
|
||||
|
||||
area = yang_dnode_get_entry(dnode, true);
|
||||
isis_area_overload_bit_set(area, true);
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static int isis_instance_overload_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);
|
||||
isis_area_overload_bit_set(area, false);
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
@ -1732,11 +1760,13 @@ const struct frr_yang_module_info frr_isisd_info = {
|
||||
.xpath = "/frr-isisd:isis/instance/attached",
|
||||
.cbs.create = isis_instance_attached_create,
|
||||
.cbs.delete = isis_instance_attached_delete,
|
||||
.cbs.cli_show = cli_show_isis_attached,
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-isisd:isis/instance/overload",
|
||||
.cbs.create = isis_instance_overload_create,
|
||||
.cbs.delete = isis_instance_overload_delete,
|
||||
.cbs.cli_show = cli_show_isis_overload,
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-isisd:isis/instance/metric-style",
|
||||
|
||||
@ -440,29 +440,6 @@ DEFUN (no_isis_bfd,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (set_overload_bit,
|
||||
set_overload_bit_cmd,
|
||||
"set-overload-bit",
|
||||
"Set overload bit to avoid any transit traffic\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
|
||||
isis_area_overload_bit_set(area, true);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_set_overload_bit,
|
||||
no_set_overload_bit_cmd,
|
||||
"no set-overload-bit",
|
||||
"Reset overload bit to accept transit traffic\n"
|
||||
"Reset overload bit\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
|
||||
isis_area_overload_bit_set(area, false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
static int isis_vty_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
@ -871,9 +848,6 @@ void isis_vty_init(void)
|
||||
install_element(INTERFACE_NODE, &isis_bfd_cmd);
|
||||
install_element(INTERFACE_NODE, &no_isis_bfd_cmd);
|
||||
|
||||
install_element(ROUTER_NODE, &set_overload_bit_cmd);
|
||||
install_element(ROUTER_NODE, &no_set_overload_bit_cmd);
|
||||
|
||||
install_element(ROUTER_NODE, &area_lsp_mtu_cmd);
|
||||
install_element(ROUTER_NODE, &no_area_lsp_mtu_cmd);
|
||||
|
||||
|
||||
@ -286,6 +286,29 @@ DEFUN (no_ip_router_isis,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (set_overload_bit,
|
||||
set_overload_bit_cmd,
|
||||
"set-overload-bit",
|
||||
"Set overload bit to avoid any transit traffic\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
|
||||
isis_area_overload_bit_set(area, true);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_set_overload_bit,
|
||||
no_set_overload_bit_cmd,
|
||||
"no set-overload-bit",
|
||||
"Reset overload bit to accept transit traffic\n"
|
||||
"Reset overload bit\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
|
||||
isis_area_overload_bit_set(area, false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void isis_vty_daemon_init(void)
|
||||
{
|
||||
install_element(ROUTER_NODE, &fabric_tier_cmd);
|
||||
@ -298,4 +321,7 @@ void isis_vty_daemon_init(void)
|
||||
install_element(INTERFACE_NODE, &ip_router_isis_cmd);
|
||||
install_element(INTERFACE_NODE, &ip6_router_isis_cmd);
|
||||
install_element(INTERFACE_NODE, &no_ip_router_isis_cmd);
|
||||
|
||||
install_element(ROUTER_NODE, &set_overload_bit_cmd);
|
||||
install_element(ROUTER_NODE, &no_set_overload_bit_cmd);
|
||||
}
|
||||
|
||||
@ -557,29 +557,6 @@ DEFUN (no_metric_style,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (set_attached_bit,
|
||||
set_attached_bit_cmd,
|
||||
"set-attached-bit",
|
||||
"Set attached bit to identify as L1/L2 router for inter-area traffic\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
|
||||
isis_area_attached_bit_set(area, true);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_set_attached_bit,
|
||||
no_set_attached_bit_cmd,
|
||||
"no set-attached-bit",
|
||||
NO_STR
|
||||
"Reset attached bit\n")
|
||||
{
|
||||
VTY_DECLVAR_CONTEXT(isis_area, area);
|
||||
|
||||
isis_area_attached_bit_set(area, false);
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (lsp_gen_interval_level,
|
||||
lsp_gen_interval_level_cmd,
|
||||
"lsp-gen-interval <level-1|level-2> (1-120)",
|
||||
@ -757,9 +734,6 @@ void isis_vty_daemon_init(void)
|
||||
install_element(ROUTER_NODE, &metric_style_cmd);
|
||||
install_element(ROUTER_NODE, &no_metric_style_cmd);
|
||||
|
||||
install_element(ROUTER_NODE, &set_attached_bit_cmd);
|
||||
install_element(ROUTER_NODE, &no_set_attached_bit_cmd);
|
||||
|
||||
install_element(ROUTER_NODE, &lsp_gen_interval_level_cmd);
|
||||
install_element(ROUTER_NODE, &no_lsp_gen_interval_level_cmd);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user