mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-06-14 19:05:37 +00:00
isisd: migrate BFD command to northbound
Specify the ISIS BFD command in the YANG model and implement the northbound callbacks. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
f2971ce34b
commit
c3e6ac0bba
@ -332,6 +332,39 @@ void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode,
|
|||||||
yang_dnode_get_string(dnode, "../area-tag"));
|
yang_dnode_get_string(dnode, "../area-tag"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
|
||||||
|
*/
|
||||||
|
DEFPY(isis_bfd,
|
||||||
|
isis_bfd_cmd,
|
||||||
|
"[no] isis bfd",
|
||||||
|
NO_STR
|
||||||
|
PROTO_HELP
|
||||||
|
"Enable BFD support\n")
|
||||||
|
{
|
||||||
|
const struct lyd_node *dnode;
|
||||||
|
|
||||||
|
dnode = yang_dnode_get(vty->candidate_config->dnode,
|
||||||
|
"%s/frr-isisd:isis", VTY_CURR_XPATH);
|
||||||
|
if (dnode == NULL)
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
|
nb_cli_enqueue_change(vty, "./frr-isisd:isis/bfd-monitoring",
|
||||||
|
NB_OP_MODIFY, no ? "false" : "true");
|
||||||
|
|
||||||
|
return nb_cli_apply_changes(vty, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cli_show_ip_isis_bfd_monitoring(struct vty *vty, struct lyd_node *dnode,
|
||||||
|
bool show_defaults)
|
||||||
|
{
|
||||||
|
if (show_defaults == false)
|
||||||
|
vty_out(vty, " %s" PROTO_NAME " bfd\n",
|
||||||
|
yang_dnode_get_bool(dnode, NULL) ? "" : "no ");
|
||||||
|
else
|
||||||
|
vty_out(vty, " no " PROTO_NAME " bfd\n");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-isisd:isis/instance/area-address
|
* XPath: /frr-isisd:isis/instance/area-address
|
||||||
*/
|
*/
|
||||||
@ -1949,6 +1982,7 @@ void isis_cli_init(void)
|
|||||||
install_element(INTERFACE_NODE, &ip_router_isis_cmd);
|
install_element(INTERFACE_NODE, &ip_router_isis_cmd);
|
||||||
install_element(INTERFACE_NODE, &ip6_router_isis_cmd);
|
install_element(INTERFACE_NODE, &ip6_router_isis_cmd);
|
||||||
install_element(INTERFACE_NODE, &no_ip_router_isis_cmd);
|
install_element(INTERFACE_NODE, &no_ip_router_isis_cmd);
|
||||||
|
install_element(INTERFACE_NODE, &isis_bfd_cmd);
|
||||||
|
|
||||||
install_element(ISIS_NODE, &net_cmd);
|
install_element(ISIS_NODE, &net_cmd);
|
||||||
|
|
||||||
|
@ -27,6 +27,8 @@ void cli_show_ip_isis_ipv4(struct vty *vty, struct lyd_node *dnode,
|
|||||||
bool show_defaults);
|
bool show_defaults);
|
||||||
void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode,
|
void cli_show_ip_isis_ipv6(struct vty *vty, struct lyd_node *dnode,
|
||||||
bool show_defaults);
|
bool show_defaults);
|
||||||
|
void cli_show_ip_isis_bfd_monitoring(struct vty *vty, struct lyd_node *dnode,
|
||||||
|
bool show_defaults);
|
||||||
void cli_show_isis_area_address(struct vty *vty, struct lyd_node *dnode,
|
void cli_show_isis_area_address(struct vty *vty, struct lyd_node *dnode,
|
||||||
bool show_defaults);
|
bool show_defaults);
|
||||||
void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode,
|
void cli_show_isis_is_type(struct vty *vty, struct lyd_node *dnode,
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include "libfrr.h"
|
#include "libfrr.h"
|
||||||
#include "linklist.h"
|
#include "linklist.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "lib/bfd.h"
|
||||||
|
#include "isisd/isis_bfd.h"
|
||||||
#include "isisd/isis_constants.h"
|
#include "isisd/isis_constants.h"
|
||||||
#include "isisd/isis_common.h"
|
#include "isisd/isis_common.h"
|
||||||
#include "isisd/isis_flags.h"
|
#include "isisd/isis_flags.h"
|
||||||
@ -1702,6 +1704,42 @@ static int lib_interface_isis_ipv6_routing_modify(enum nb_event event,
|
|||||||
return NB_OK;
|
return NB_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XPath: /frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring
|
||||||
|
*/
|
||||||
|
static int lib_interface_isis_bfd_monitoring_modify(enum nb_event event,
|
||||||
|
const struct lyd_node *dnode,
|
||||||
|
union nb_resource *resource)
|
||||||
|
{
|
||||||
|
struct isis_circuit *circuit;
|
||||||
|
bool bfd_monitoring;
|
||||||
|
|
||||||
|
if (event != NB_EV_APPLY)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
circuit = nb_running_get_entry(dnode, NULL, true);
|
||||||
|
bfd_monitoring = yang_dnode_get_bool(dnode, NULL);
|
||||||
|
|
||||||
|
if (bfd_monitoring) {
|
||||||
|
/* Sanity check: BFD session is already registered. */
|
||||||
|
if (circuit->bfd_info != NULL)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
isis_bfd_circuit_param_set(circuit, BFD_DEF_MIN_RX,
|
||||||
|
BFD_DEF_MIN_TX, BFD_DEF_DETECT_MULT,
|
||||||
|
true);
|
||||||
|
} else {
|
||||||
|
/* Sanity check: no BFD session was registered. */
|
||||||
|
if (circuit->bfd_info == NULL)
|
||||||
|
return NB_OK;
|
||||||
|
|
||||||
|
isis_bfd_circuit_cmd(circuit, ZEBRA_BFD_DEST_DEREGISTER);
|
||||||
|
bfd_info_free(&circuit->bfd_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NB_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
|
* XPath: /frr-interface:lib/interface/frr-isisd:isis/csnp-interval/level-1
|
||||||
*/
|
*/
|
||||||
@ -3211,6 +3249,11 @@ const struct frr_yang_module_info frr_isisd_info = {
|
|||||||
.modify = lib_interface_isis_ipv6_routing_modify,
|
.modify = lib_interface_isis_ipv6_routing_modify,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/bfd-monitoring",
|
||||||
|
.cbs.modify = lib_interface_isis_bfd_monitoring_modify,
|
||||||
|
.cbs.cli_show = cli_show_ip_isis_bfd_monitoring,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval",
|
.xpath = "/frr-interface:lib/interface/frr-isisd:isis/csnp-interval",
|
||||||
.cbs = {
|
.cbs = {
|
||||||
|
@ -756,6 +756,12 @@ module frr-isisd {
|
|||||||
"IS-type of this circuit.";
|
"IS-type of this circuit.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leaf bfd-monitoring {
|
||||||
|
type boolean;
|
||||||
|
default false;
|
||||||
|
description "Monitor IS-IS peers on this circuit.";
|
||||||
|
}
|
||||||
|
|
||||||
container csnp-interval {
|
container csnp-interval {
|
||||||
description
|
description
|
||||||
"Complete Sequence Number PDU (CSNP) generation interval.";
|
"Complete Sequence Number PDU (CSNP) generation interval.";
|
||||||
|
Loading…
Reference in New Issue
Block a user