pimd: create a new command "ip pim" configuring pim sm

A new command "ip pim" is created to configure pim sm on an
interface, which replaces the existing commands "ip pim sm"
and "ip pim ssm" and make "ip pim sm" and "ip pim ssm" as
hidden commands. The command "ip multicast-routing" is removed
since it is already enabled on FRR by default.

Signed-off-by: Sarita Patra saritap@vmware.com
This commit is contained in:
root 2018-09-07 04:46:57 -07:00
parent 7f0f6e7b75
commit 2f5e937c49
2 changed files with 49 additions and 46 deletions

View file

@ -5640,27 +5640,6 @@ DEFUN (show_ip_pim_group_type,
return CMD_SUCCESS;
}
DEFUN_HIDDEN (ip_multicast_routing,
ip_multicast_routing_cmd,
"ip multicast-routing",
IP_STR
"Enable IP multicast forwarding\n")
{
return CMD_SUCCESS;
}
DEFUN_HIDDEN (no_ip_multicast_routing,
no_ip_multicast_routing_cmd,
"no ip multicast-routing",
NO_STR
IP_STR
"Enable IP multicast forwarding\n")
{
vty_out(vty,
"Command is Disabled and will be removed in a future version\n");
return CMD_SUCCESS;
}
DEFUN (ip_ssmpingd,
ip_ssmpingd_cmd,
"ip ssmpingd [A.B.C.D]",
@ -6431,16 +6410,12 @@ DEFUN_HIDDEN (interface_ip_pim_ssm,
return CMD_SUCCESS;
}
DEFUN (interface_ip_pim_sm,
interface_ip_pim_sm_cmd,
"ip pim sm",
IP_STR
PIM_STR
IFACE_PIM_SM_STR)
static int interface_ip_pim_helper(struct vty *vty)
{
struct pim_interface *pim_ifp;
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_add(ifp)) {
vty_out(vty, "Could not enable PIM SM on interface\n");
return CMD_WARNING_CONFIG_FAILED;
@ -6453,6 +6428,25 @@ DEFUN (interface_ip_pim_sm,
return CMD_SUCCESS;
}
DEFUN_HIDDEN (interface_ip_pim_sm,
interface_ip_pim_sm_cmd,
"ip pim sm",
IP_STR
PIM_STR
IFACE_PIM_SM_STR)
{
return interface_ip_pim_helper(vty);
}
DEFUN (interface_ip_pim,
interface_ip_pim_cmd,
"ip pim",
IP_STR
PIM_STR)
{
return interface_ip_pim_helper(vty);
}
static int pim_cmd_interface_delete(struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
@ -6478,6 +6472,17 @@ static int pim_cmd_interface_delete(struct interface *ifp)
return 1;
}
static int interface_no_ip_pim_helper(struct vty *vty)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_delete(ifp)) {
vty_out(vty, "Unable to delete interface information\n");
return CMD_WARNING_CONFIG_FAILED;
}
return CMD_SUCCESS;
}
DEFUN_HIDDEN (interface_no_ip_pim_ssm,
interface_no_ip_pim_ssm_cmd,
"no ip pim ssm",
@ -6486,16 +6491,10 @@ DEFUN_HIDDEN (interface_no_ip_pim_ssm,
PIM_STR
IFACE_PIM_STR)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_delete(ifp)) {
vty_out(vty, "Unable to delete interface information\n");
return CMD_WARNING_CONFIG_FAILED;
}
return CMD_SUCCESS;
return interface_no_ip_pim_helper(vty);
}
DEFUN (interface_no_ip_pim_sm,
DEFUN_HIDDEN (interface_no_ip_pim_sm,
interface_no_ip_pim_sm_cmd,
"no ip pim sm",
NO_STR
@ -6503,13 +6502,17 @@ DEFUN (interface_no_ip_pim_sm,
PIM_STR
IFACE_PIM_SM_STR)
{
VTY_DECLVAR_CONTEXT(interface, ifp);
if (!pim_cmd_interface_delete(ifp)) {
vty_out(vty, "Unable to delete interface information\n");
return CMD_WARNING_CONFIG_FAILED;
}
return interface_no_ip_pim_helper(vty);
}
return CMD_SUCCESS;
DEFUN (interface_no_ip_pim,
interface_no_ip_pim_cmd,
"no ip pim",
NO_STR
IP_STR
PIM_STR)
{
return interface_no_ip_pim_helper(vty);
}
/* boundaries */
@ -7466,7 +7469,7 @@ DEFUN (interface_pim_use_source,
interface_pim_use_source_cmd,
"ip pim use-source A.B.C.D",
IP_STR
"pim multicast routing\n"
PIM_STR
"Configure primary IP address\n"
"source ip address\n")
{
@ -7478,7 +7481,7 @@ DEFUN (interface_no_pim_use_source,
"no ip pim use-source [A.B.C.D]",
NO_STR
IP_STR
"pim multicast routing\n"
PIM_STR
"Delete source IP address\n"
"source ip address\n")
{
@ -8634,8 +8637,6 @@ void pim_cmd_init(void)
install_node(&debug_node, pim_debug_config_write);
install_element(CONFIG_NODE, &ip_multicast_routing_cmd);
install_element(CONFIG_NODE, &no_ip_multicast_routing_cmd);
install_element(CONFIG_NODE, &ip_pim_rp_cmd);
install_element(VRF_NODE, &ip_pim_rp_cmd);
install_element(CONFIG_NODE, &no_ip_pim_rp_cmd);
@ -8721,6 +8722,8 @@ void pim_cmd_init(void)
install_element(INTERFACE_NODE, &interface_no_ip_pim_ssm_cmd);
install_element(INTERFACE_NODE, &interface_ip_pim_sm_cmd);
install_element(INTERFACE_NODE, &interface_no_ip_pim_sm_cmd);
install_element(INTERFACE_NODE, &interface_ip_pim_cmd);
install_element(INTERFACE_NODE, &interface_no_ip_pim_cmd);
install_element(INTERFACE_NODE, &interface_ip_pim_drprio_cmd);
install_element(INTERFACE_NODE, &interface_no_ip_pim_drprio_cmd);
install_element(INTERFACE_NODE, &interface_ip_pim_hello_cmd);

View file

@ -267,7 +267,7 @@ int pim_interface_config_write(struct vty *vty)
struct pim_interface *pim_ifp = ifp->info;
if (PIM_IF_TEST_PIM(pim_ifp->options)) {
vty_out(vty, " ip pim sm\n");
vty_out(vty, " ip pim\n");
++writes;
}