pim6d: Adding "ipv6 mld" CLI

Adding the Interface level config command

ipv6 mld
To enable MLD on the interface.

Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
Abhishek N R 2022-01-18 07:38:47 -08:00
parent fe2df4f7ba
commit eaa7d656bb
2 changed files with 55 additions and 1 deletions

View file

@ -503,6 +503,52 @@ DEFPY (interface_no_ipv6_mld_join,
return nb_cli_apply_changes(vty, NULL);
}
DEFPY (interface_ipv6_mld,
interface_ipv6_mld_cmd,
"ipv6 mld",
IPV6_STR
IFACE_MLD_STR)
{
nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY, "true");
return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
"frr-routing:ipv6");
}
DEFPY (interface_no_ipv6_mld,
interface_no_ipv6_mld_cmd,
"no ipv6 mld",
NO_STR
IPV6_STR
IFACE_MLD_STR)
{
const struct lyd_node *pim_enable_dnode;
char pim_if_xpath[XPATH_MAXLEN + 20];
snprintf(pim_if_xpath, sizeof(pim_if_xpath),
"%s/frr-pim:pim/address-family[address-family='%s']",
VTY_CURR_XPATH, "frr-routing:ipv6");
pim_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
FRR_PIM_ENABLE_XPATH, VTY_CURR_XPATH,
"frr-routing:ipv6");
if (!pim_enable_dnode) {
nb_cli_enqueue_change(vty, pim_if_xpath, NB_OP_DESTROY, NULL);
nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
} else {
if (!yang_dnode_get_bool(pim_enable_dnode, ".")) {
nb_cli_enqueue_change(vty, pim_if_xpath, NB_OP_DESTROY,
NULL);
nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
} else
nb_cli_enqueue_change(vty, "./enable", NB_OP_MODIFY,
"false");
}
return nb_cli_apply_changes(vty, FRR_GMP_INTERFACE_XPATH,
"frr-routing:ipv6");
}
void pim_cmd_init(void)
{
if_cmd_init(pim_interface_config_write);
@ -546,6 +592,8 @@ void pim_cmd_init(void)
install_element(VRF_NODE, &ipv6_pim_rp_prefix_list_cmd);
install_element(CONFIG_NODE, &no_ipv6_pim_rp_prefix_list_cmd);
install_element(VRF_NODE, &no_ipv6_pim_rp_prefix_list_cmd);
install_element(INTERFACE_NODE, &interface_ipv6_mld_cmd);
install_element(INTERFACE_NODE, &interface_no_ipv6_mld_cmd);
install_element(INTERFACE_NODE, &interface_ipv6_mld_join_cmd);
install_element(INTERFACE_NODE, &interface_no_ipv6_mld_join_cmd);
}

View file

@ -348,6 +348,7 @@ static bool is_pim_interface(const struct lyd_node *dnode)
return false;
}
#if PIM_IPV == 4
static int pim_cmd_igmp_start(struct interface *ifp)
{
struct pim_interface *pim_ifp;
@ -376,6 +377,7 @@ static int pim_cmd_igmp_start(struct interface *ifp)
return NB_OK;
}
#endif /* PIM_IPV == 4 */
/*
* CLI reconfiguration affects the interface level (struct pim_interface).
@ -2554,6 +2556,7 @@ int lib_interface_gmp_address_family_destroy(struct nb_cb_destroy_args *args)
int lib_interface_gmp_address_family_enable_modify(
struct nb_cb_modify_args *args)
{
#if PIM_IPV == 4
struct interface *ifp;
bool igmp_enable;
struct pim_interface *pim_ifp;
@ -2601,7 +2604,9 @@ int lib_interface_gmp_address_family_enable_modify(
pim_if_delete(ifp);
}
}
#else
/* TBD Depends on MLD data structure changes */
#endif /* PIM_IPV == 4 */
return NB_OK;
}
@ -2675,6 +2680,7 @@ int lib_interface_gmp_address_family_mld_version_modify(
case NB_EV_PREPARE:
case NB_EV_ABORT:
case NB_EV_APPLY:
/* TBD depends on MLD data structure changes */
break;
}