mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 08:28:27 +00:00
pimd: support BFD profiles configuration
Allow users to pre configure BFD sessions with a profile. Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
This commit is contained in:
parent
3544d257b7
commit
745b8d4a68
@ -56,6 +56,10 @@ void pim_bfd_write_config(struct vty *vty, struct interface *ifp)
|
||||
else
|
||||
#endif /* ! HAVE_BFDD */
|
||||
vty_out(vty, " ip pim bfd\n");
|
||||
|
||||
if (pim_ifp->bfd_config.profile)
|
||||
vty_out(vty, " ip pim bfd profile %s\n",
|
||||
pim_ifp->bfd_config.profile);
|
||||
}
|
||||
|
||||
static void pim_neighbor_bfd_cb(struct bfd_session_params *bsp,
|
||||
@ -92,6 +96,7 @@ void pim_bfd_info_nbr_create(struct pim_interface *pim_ifp,
|
||||
pim_ifp->bfd_config.min_rx, pim_ifp->bfd_config.min_tx);
|
||||
bfd_sess_set_ipv4_addrs(neigh->bfd_session, NULL, &neigh->source_addr);
|
||||
bfd_sess_set_interface(neigh->bfd_session, neigh->interface->name);
|
||||
bfd_sess_set_profile(neigh->bfd_session, pim_ifp->bfd_config.profile);
|
||||
bfd_sess_install(neigh->bfd_session);
|
||||
}
|
||||
|
||||
|
@ -9676,12 +9676,14 @@ DEFUN (interface_no_pim_use_source,
|
||||
"frr-routing:ipv4");
|
||||
}
|
||||
|
||||
DEFUN (ip_pim_bfd,
|
||||
DEFPY (ip_pim_bfd,
|
||||
ip_pim_bfd_cmd,
|
||||
"ip pim bfd",
|
||||
"ip pim bfd [profile BFDPROF$prof]",
|
||||
IP_STR
|
||||
PIM_STR
|
||||
"Enables BFD support\n")
|
||||
"Enables BFD support\n"
|
||||
"Use BFD profile\n"
|
||||
"Use BFD profile name\n")
|
||||
{
|
||||
const struct lyd_node *igmp_enable_dnode;
|
||||
|
||||
@ -9698,6 +9700,22 @@ DEFUN (ip_pim_bfd,
|
||||
}
|
||||
|
||||
nb_cli_enqueue_change(vty, "./bfd", NB_OP_CREATE, NULL);
|
||||
if (prof)
|
||||
nb_cli_enqueue_change(vty, "./bfd/profile", NB_OP_MODIFY, prof);
|
||||
|
||||
return nb_cli_apply_changes(vty, "./frr-pim:pim");
|
||||
}
|
||||
|
||||
DEFPY(no_ip_pim_bfd_profile, no_ip_pim_bfd_profile_cmd,
|
||||
"no ip pim bfd profile [BFDPROF]",
|
||||
NO_STR
|
||||
IP_STR
|
||||
PIM_STR
|
||||
"Enables BFD support\n"
|
||||
"Disable BFD profile\n"
|
||||
"BFD Profile name\n")
|
||||
{
|
||||
nb_cli_enqueue_change(vty, "./bfd/profile", NB_OP_DESTROY, NULL);
|
||||
|
||||
return nb_cli_apply_changes(vty, "./frr-pim:pim");
|
||||
}
|
||||
@ -11694,6 +11712,7 @@ void pim_cmd_init(void)
|
||||
/* Install BFD command */
|
||||
install_element(INTERFACE_NODE, &ip_pim_bfd_cmd);
|
||||
install_element(INTERFACE_NODE, &ip_pim_bfd_param_cmd);
|
||||
install_element(INTERFACE_NODE, &no_ip_pim_bfd_profile_cmd);
|
||||
install_element(INTERFACE_NODE, &no_ip_pim_bfd_cmd);
|
||||
#if HAVE_BFDD == 0
|
||||
install_element(INTERFACE_NODE, &no_ip_pim_bfd_param_cmd);
|
||||
|
@ -166,6 +166,7 @@ struct pim_interface {
|
||||
uint32_t min_rx;
|
||||
uint32_t min_tx;
|
||||
uint8_t detection_multiplier;
|
||||
char *profile;
|
||||
} bfd_config;
|
||||
};
|
||||
|
||||
|
@ -258,6 +258,13 @@ const struct frr_yang_module_info frr_pim_info = {
|
||||
.modify = lib_interface_pim_bfd_detect_mult_modify,
|
||||
}
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-interface:lib/interface/frr-pim:pim/bfd/profile",
|
||||
.cbs = {
|
||||
.modify = lib_interface_pim_bfd_profile_modify,
|
||||
.destroy = lib_interface_pim_bfd_profile_destroy,
|
||||
}
|
||||
},
|
||||
{
|
||||
.xpath = "/frr-interface:lib/interface/frr-pim:pim/bsm",
|
||||
.cbs = {
|
||||
|
@ -121,6 +121,8 @@ int lib_interface_pim_bfd_min_rx_interval_modify(struct nb_cb_modify_args *args)
|
||||
int lib_interface_pim_bfd_min_tx_interval_modify(
|
||||
struct nb_cb_modify_args *args);
|
||||
int lib_interface_pim_bfd_detect_mult_modify(struct nb_cb_modify_args *args);
|
||||
int lib_interface_pim_bfd_profile_modify(struct nb_cb_modify_args *args);
|
||||
int lib_interface_pim_bfd_profile_destroy(struct nb_cb_destroy_args *args);
|
||||
int lib_interface_pim_bsm_modify(struct nb_cb_modify_args *args);
|
||||
int lib_interface_pim_unicast_bsm_modify(struct nb_cb_modify_args *args);
|
||||
int lib_interface_pim_active_active_modify(struct nb_cb_modify_args *args);
|
||||
|
@ -2004,6 +2004,53 @@ int lib_interface_pim_bfd_detect_mult_modify(struct nb_cb_modify_args *args)
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-interface:lib/interface/frr-pim:pim/bfd/profile
|
||||
*/
|
||||
int lib_interface_pim_bfd_profile_modify(struct nb_cb_modify_args *args)
|
||||
{
|
||||
struct interface *ifp;
|
||||
struct pim_interface *pim_ifp;
|
||||
|
||||
switch (args->event) {
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
/* NOTHING */
|
||||
break;
|
||||
case NB_EV_APPLY:
|
||||
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
||||
pim_ifp = ifp->info;
|
||||
XFREE(MTYPE_TMP, pim_ifp->bfd_config.profile);
|
||||
pim_ifp->bfd_config.profile = XSTRDUP(
|
||||
MTYPE_TMP, yang_dnode_get_string(args->dnode, NULL));
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
int lib_interface_pim_bfd_profile_destroy(struct nb_cb_destroy_args *args)
|
||||
{
|
||||
struct interface *ifp;
|
||||
struct pim_interface *pim_ifp;
|
||||
|
||||
switch (args->event) {
|
||||
case NB_EV_VALIDATE:
|
||||
case NB_EV_PREPARE:
|
||||
case NB_EV_ABORT:
|
||||
/* NOTHING */
|
||||
break;
|
||||
case NB_EV_APPLY:
|
||||
ifp = nb_running_get_entry(args->dnode, NULL, true);
|
||||
pim_ifp = ifp->info;
|
||||
XFREE(MTYPE_TMP, pim_ifp->bfd_config.profile);
|
||||
break;
|
||||
}
|
||||
|
||||
return NB_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* XPath: /frr-interface:lib/interface/frr-pim:pim/bsm
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user