mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 10:54:47 +00:00
isisd: retrofit the 'isis passive' command
Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
This commit is contained in:
parent
22af6a806d
commit
a6a36c41e2
@ -1216,6 +1216,26 @@ void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode,
|
||||
vty_out(vty, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-interface:lib/interface/frr-isisd:isis/passive
|
||||
*/
|
||||
DEFPY(isis_passive, isis_passive_cmd, "[no] isis passive",
|
||||
NO_STR
|
||||
"IS-IS routing protocol\n"
|
||||
"Configure the passive mode for interface\n")
|
||||
{
|
||||
nb_cli_enqueue_change(vty, "./frr-isisd:isis/passive",
|
||||
no ? NB_OP_DELETE : NB_OP_CREATE, NULL);
|
||||
|
||||
return nb_cli_apply_changes(vty, NULL);
|
||||
}
|
||||
|
||||
void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults)
|
||||
{
|
||||
vty_out(vty, " isis passive\n");
|
||||
}
|
||||
|
||||
void isis_cli_init(void)
|
||||
{
|
||||
install_element(CONFIG_NODE, &router_isis_cmd);
|
||||
@ -1267,6 +1287,8 @@ void isis_cli_init(void)
|
||||
install_element(ISIS_NODE, &isis_redistribute_cmd);
|
||||
|
||||
install_element(ISIS_NODE, &isis_topology_cmd);
|
||||
|
||||
install_element(INTERFACE_NODE, &isis_passive_cmd);
|
||||
}
|
||||
|
||||
#endif /* ifndef FABRICD */
|
||||
|
@ -81,5 +81,7 @@ void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
void cli_show_ip_isis_passive(struct vty *vty, struct lyd_node *dnode,
|
||||
bool show_defaults);
|
||||
|
||||
#endif /* ISISD_ISIS_CLI_H_ */
|
||||
|
@ -2021,14 +2021,62 @@ static int lib_interface_isis_passive_create(enum nb_event event,
|
||||
const struct lyd_node *dnode,
|
||||
union nb_resource *resource)
|
||||
{
|
||||
/* TODO: implement me. */
|
||||
struct isis_circuit *circuit;
|
||||
struct isis_area *area;
|
||||
|
||||
if (event != NB_EV_APPLY)
|
||||
return NB_OK;
|
||||
|
||||
circuit = yang_dnode_get_entry(dnode, true);
|
||||
if (circuit->state != C_STATE_UP) {
|
||||
circuit->is_passive = true;
|
||||
} else {
|
||||
area = circuit->area;
|
||||
isis_csm_state_change(ISIS_DISABLE, circuit, area);
|
||||
circuit->is_passive = true;
|
||||
isis_csm_state_change(ISIS_ENABLE, circuit, area);
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
static int lib_interface_isis_passive_delete(enum nb_event event,
|
||||
const struct lyd_node *dnode)
|
||||
{
|
||||
/* TODO: implement me. */
|
||||
struct isis_circuit *circuit;
|
||||
struct isis_area *area;
|
||||
struct interface *ifp;
|
||||
|
||||
switch (event) {
|
||||
case NB_EV_VALIDATE:
|
||||
circuit = yang_dnode_get_entry(dnode, false);
|
||||
if (!circuit)
|
||||
break;
|
||||
ifp = circuit->interface;
|
||||
if (!ifp)
|
||||
break;
|
||||
if (if_is_loopback(ifp)) {
|
||||
flog_warn(EC_LIB_NB_CB_CONFIG_VALIDATE,
|
||||
"Loopback is always passive");
|
||||
return NB_ERR_VALIDATION;
|
||||
}
|
||||
break;
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
break;
|
||||
case NB_EV_APPLY:
|
||||
circuit = yang_dnode_get_entry(dnode, true);
|
||||
if (circuit->state != C_STATE_UP) {
|
||||
circuit->is_passive = false;
|
||||
} else {
|
||||
area = circuit->area;
|
||||
isis_csm_state_change(ISIS_DISABLE, circuit, area);
|
||||
circuit->is_passive = false;
|
||||
isis_csm_state_change(ISIS_ENABLE, circuit, area);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
@ -2591,6 +2639,7 @@ const struct frr_yang_module_info frr_isisd_info = {
|
||||
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/passive",
|
||||
.cbs.create = lib_interface_isis_passive_create,
|
||||
.cbs.delete = lib_interface_isis_passive_delete,
|
||||
.cbs.cli_show = cli_show_ip_isis_passive,
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/password",
|
||||
|
@ -56,37 +56,6 @@ struct isis_circuit *isis_circuit_lookup(struct vty *vty)
|
||||
return circuit;
|
||||
}
|
||||
|
||||
DEFUN (isis_passive,
|
||||
isis_passive_cmd,
|
||||
PROTO_NAME " passive",
|
||||
PROTO_HELP
|
||||
"Configure the passive mode for interface\n")
|
||||
{
|
||||
struct isis_circuit *circuit = isis_circuit_lookup(vty);
|
||||
if (!circuit)
|
||||
return CMD_ERR_NO_MATCH;
|
||||
|
||||
CMD_FERR_RETURN(isis_circuit_passive_set(circuit, 1),
|
||||
"Cannot set passive: $ERR");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_isis_passive,
|
||||
no_isis_passive_cmd,
|
||||
"no " PROTO_NAME " passive",
|
||||
NO_STR
|
||||
PROTO_HELP
|
||||
"Configure the passive mode for interface\n")
|
||||
{
|
||||
struct isis_circuit *circuit = isis_circuit_lookup(vty);
|
||||
if (!circuit)
|
||||
return CMD_ERR_NO_MATCH;
|
||||
|
||||
CMD_FERR_RETURN(isis_circuit_passive_set(circuit, 0),
|
||||
"Cannot set no passive: $ERR");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (isis_passwd,
|
||||
isis_passwd_cmd,
|
||||
PROTO_NAME " password <md5|clear> WORD",
|
||||
@ -441,9 +410,6 @@ DEFUN (no_isis_bfd,
|
||||
|
||||
void isis_vty_init(void)
|
||||
{
|
||||
install_element(INTERFACE_NODE, &isis_passive_cmd);
|
||||
install_element(INTERFACE_NODE, &no_isis_passive_cmd);
|
||||
|
||||
install_element(INTERFACE_NODE, &isis_passwd_cmd);
|
||||
install_element(INTERFACE_NODE, &no_isis_passwd_cmd);
|
||||
|
||||
|
@ -692,6 +692,37 @@ DEFUN (area_purge_originator,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (isis_passive,
|
||||
isis_passive_cmd,
|
||||
PROTO_NAME " passive",
|
||||
PROTO_HELP
|
||||
"Configure the passive mode for interface\n")
|
||||
{
|
||||
struct isis_circuit *circuit = isis_circuit_lookup(vty);
|
||||
if (!circuit)
|
||||
return CMD_ERR_NO_MATCH;
|
||||
|
||||
CMD_FERR_RETURN(isis_circuit_passive_set(circuit, 1),
|
||||
"Cannot set passive: $ERR");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (no_isis_passive,
|
||||
no_isis_passive_cmd,
|
||||
"no " PROTO_NAME " passive",
|
||||
NO_STR
|
||||
PROTO_HELP
|
||||
"Configure the passive mode for interface\n")
|
||||
{
|
||||
struct isis_circuit *circuit = isis_circuit_lookup(vty);
|
||||
if (!circuit)
|
||||
return CMD_ERR_NO_MATCH;
|
||||
|
||||
CMD_FERR_RETURN(isis_circuit_passive_set(circuit, 0),
|
||||
"Cannot set no passive: $ERR");
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
void isis_vty_daemon_init(void)
|
||||
{
|
||||
install_element(ROUTER_NODE, &fabric_tier_cmd);
|
||||
@ -730,4 +761,7 @@ void isis_vty_daemon_init(void)
|
||||
install_element(ROUTER_NODE, &no_spf_delay_ietf_cmd);
|
||||
|
||||
install_element(ROUTER_NODE, &area_purge_originator_cmd);
|
||||
|
||||
install_element(INTERFACE_NODE, &isis_passive_cmd);
|
||||
install_element(INTERFACE_NODE, &no_isis_passive_cmd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user