summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2022-03-08 09:46:31 +0100
committerGitHub <noreply@github.com>2022-03-08 09:46:31 +0100
commitf4d8394b012c75bc34f775dfa3709c5f5bfaca19 (patch)
tree2eaed2ce7d92a9b59d6a8b7d2b0f26b600e780c4
parentMerge pull request #10753 from mobash-rasool/pimv6-fixes (diff)
parentpim6d: Adding ipv6 mroute INTERFACE X:X::X:X [X:X::X:X]" cli (diff)
downloadfrr-f4d8394b012c75bc34f775dfa3709c5f5bfaca19.tar.xz
frr-f4d8394b012c75bc34f775dfa3709c5f5bfaca19.zip
Merge pull request #10393 from patrasar/master_pimv6_cli
-rw-r--r--pimd/pim6_cmd.c199
-rw-r--r--pimd/pim6_cmd.h5
-rw-r--r--pimd/pim_addr.h2
-rw-r--r--pimd/pim_cmd.c218
-rw-r--r--pimd/pim_cmd_common.c173
-rw-r--r--pimd/pim_cmd_common.h15
-rw-r--r--pimd/pim_nb.h6
7 files changed, 420 insertions, 198 deletions
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c
index 06790d3d6..1dc03dc38 100644
--- a/pimd/pim6_cmd.c
+++ b/pimd/pim6_cmd.c
@@ -210,6 +210,188 @@ DEFPY (no_ipv6_pim_register_suppress,
return pim_process_no_register_suppress_cmd(vty);
}
+DEFPY (interface_ipv6_pim,
+ interface_ipv6_pim_cmd,
+ "ipv6 pim",
+ IPV6_STR
+ PIM_STR)
+{
+ return pim_process_ip_pim_cmd(vty);
+}
+
+DEFPY (interface_no_ipv6_pim,
+ interface_no_ipv6_pim_cmd,
+ "no ipv6 pim",
+ NO_STR
+ IPV6_STR
+ PIM_STR)
+{
+ return pim_process_no_ip_pim_cmd(vty);
+}
+
+DEFPY (interface_ipv6_pim_drprio,
+ interface_ipv6_pim_drprio_cmd,
+ "ipv6 pim drpriority (1-4294967295)",
+ IPV6_STR
+ PIM_STR
+ "Set the Designated Router Election Priority\n"
+ "Value of the new DR Priority\n")
+{
+ return pim_process_ip_pim_drprio_cmd(vty, drpriority_str);
+}
+
+DEFPY (interface_no_ipv6_pim_drprio,
+ interface_no_ipv6_pim_drprio_cmd,
+ "no ip pim drpriority [(1-4294967295)]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "Revert the Designated Router Priority to default\n"
+ "Old Value of the Priority\n")
+{
+ return pim_process_no_ip_pim_drprio_cmd(vty);
+}
+
+DEFPY (interface_ipv6_pim_hello,
+ interface_ipv6_pim_hello_cmd,
+ "ipv6 pim hello (1-65535) [(1-65535)]$hold",
+ IPV6_STR
+ PIM_STR
+ IFACE_PIM_HELLO_STR
+ IFACE_PIM_HELLO_TIME_STR
+ IFACE_PIM_HELLO_HOLD_STR)
+{
+ return pim_process_ip_pim_hello_cmd(vty, hello_str, hold_str);
+}
+
+DEFPY (interface_no_ipv6_pim_hello,
+ interface_no_ipv6_pim_hello_cmd,
+ "no ipv6 pim hello [(1-65535) [(1-65535)]]",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ IFACE_PIM_HELLO_STR
+ IGNORED_IN_NO_STR
+ IGNORED_IN_NO_STR)
+{
+ return pim_process_no_ip_pim_hello_cmd(vty);
+}
+
+DEFPY (interface_ipv6_pim_activeactive,
+ interface_ipv6_pim_activeactive_cmd,
+ "[no] ipv6 pim active-active",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ "Mark interface as Active-Active for MLAG operations\n")
+{
+ return pim_process_ip_pim_activeactive_cmd(vty, no);
+}
+
+DEFPY_HIDDEN (interface_ipv6_pim_ssm,
+ interface_ipv6_pim_ssm_cmd,
+ "ipv6 pim ssm",
+ IPV6_STR
+ PIM_STR
+ IFACE_PIM_STR)
+{
+ int ret;
+
+ ret = pim_process_ip_pim_cmd(vty);
+
+ if (ret != NB_OK)
+ return ret;
+
+ vty_out(vty,
+ "Enabled PIM SM on interface; configure PIM SSM range if needed\n");
+
+ return NB_OK;
+}
+
+DEFPY_HIDDEN (interface_no_ipv6_pim_ssm,
+ interface_no_ipv6_pim_ssm_cmd,
+ "no ipv6 pim ssm",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ IFACE_PIM_STR)
+{
+ return pim_process_no_ip_pim_cmd(vty);
+}
+
+DEFPY_HIDDEN (interface_ipv6_pim_sm,
+ interface_ipv6_pim_sm_cmd,
+ "ipv6 pim sm",
+ IPV6_STR
+ PIM_STR
+ IFACE_PIM_SM_STR)
+{
+ return pim_process_ip_pim_cmd(vty);
+}
+
+DEFPY_HIDDEN (interface_no_ipv6_pim_sm,
+ interface_no_ipv6_pim_sm_cmd,
+ "no ipv6 pim sm",
+ NO_STR
+ IPV6_STR
+ PIM_STR
+ IFACE_PIM_SM_STR)
+{
+ return pim_process_no_ip_pim_cmd(vty);
+}
+
+/* boundaries */
+DEFPY (interface_ipv6_pim_boundary_oil,
+ interface_ipv6_pim_boundary_oil_cmd,
+ "ipv6 multicast boundary oil WORD",
+ IPV6_STR
+ "Generic multicast configuration options\n"
+ "Define multicast boundary\n"
+ "Filter OIL by group using prefix list\n"
+ "Prefix list to filter OIL with\n")
+{
+ return pim_process_ip_pim_boundary_oil_cmd(vty, oil);
+}
+
+DEFPY (interface_no_ipv6_pim_boundary_oil,
+ interface_no_ipv6_pim_boundary_oil_cmd,
+ "no ipv6 multicast boundary oil [WORD]",
+ NO_STR
+ IPV6_STR
+ "Generic multicast configuration options\n"
+ "Define multicast boundary\n"
+ "Filter OIL by group using prefix list\n"
+ "Prefix list to filter OIL with\n")
+{
+ return pim_process_no_ip_pim_boundary_oil_cmd(vty);
+}
+
+DEFPY (interface_ipv6_mroute,
+ interface_ipv6_mroute_cmd,
+ "ipv6 mroute INTERFACE X:X::X:X$group [X:X::X:X]$source",
+ IPV6_STR
+ "Add multicast route\n"
+ "Outgoing interface name\n"
+ "Group address\n"
+ "Source address\n")
+{
+ return pim_process_ip_mroute_cmd(vty, interface, group_str, source_str);
+}
+
+DEFPY (interface_no_ipv6_mroute,
+ interface_no_ipv6_mroute_cmd,
+ "no ipv6 mroute INTERFACE X:X::X:X$group [X:X::X:X]$source",
+ NO_STR
+ IPV6_STR
+ "Add multicast route\n"
+ "Outgoing interface name\n"
+ "Group Address\n"
+ "Source Address\n")
+{
+ return pim_process_no_ip_mroute_cmd(vty, interface, group_str,
+ source_str);
+}
+
void pim_cmd_init(void)
{
if_cmd_init(pim_interface_config_write);
@@ -228,4 +410,21 @@ void pim_cmd_init(void)
install_element(CONFIG_NODE, &no_ipv6_pim_rp_keep_alive_cmd);
install_element(CONFIG_NODE, &ipv6_pim_register_suppress_cmd);
install_element(CONFIG_NODE, &no_ipv6_pim_register_suppress_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_pim_cmd);
+ install_element(INTERFACE_NODE, &interface_no_ipv6_pim_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_pim_drprio_cmd);
+ install_element(INTERFACE_NODE, &interface_no_ipv6_pim_drprio_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_pim_hello_cmd);
+ install_element(INTERFACE_NODE, &interface_no_ipv6_pim_hello_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_pim_activeactive_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_pim_ssm_cmd);
+ install_element(INTERFACE_NODE, &interface_no_ipv6_pim_ssm_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_pim_sm_cmd);
+ install_element(INTERFACE_NODE, &interface_no_ipv6_pim_sm_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_ipv6_pim_boundary_oil_cmd);
+ install_element(INTERFACE_NODE,
+ &interface_no_ipv6_pim_boundary_oil_cmd);
+ install_element(INTERFACE_NODE, &interface_ipv6_mroute_cmd);
+ install_element(INTERFACE_NODE, &interface_no_ipv6_mroute_cmd);
}
diff --git a/pimd/pim6_cmd.h b/pimd/pim6_cmd.h
index e49045a1b..ac5eb3f9b 100644
--- a/pimd/pim6_cmd.h
+++ b/pimd/pim6_cmd.h
@@ -33,6 +33,11 @@
#define IFACE_MLD_LAST_MEMBER_QUERY_INTERVAL_STR \
"MLD last member query interval\n"
#define IFACE_MLD_LAST_MEMBER_QUERY_COUNT_STR "MLD last member query count\n"
+#define IFACE_PIM_STR "Enable PIM SSM operation\n"
+#define IFACE_PIM_SM_STR "Enable PIM SM operation\n"
+#define IFACE_PIM_HELLO_STR "Hello Interval\n"
+#define IFACE_PIM_HELLO_TIME_STR "Time in seconds for Hello Interval\n"
+#define IFACE_PIM_HELLO_HOLD_STR "Time in seconds for Hold Interval\n"
#define MROUTE_STR "IP multicast routing table\n"
#define DEBUG_MLD_STR "MLD protocol activity\n"
#define DEBUG_MLD_EVENTS_STR "MLD protocol events\n"
diff --git a/pimd/pim_addr.h b/pimd/pim_addr.h
index a278a4659..e422a2e2d 100644
--- a/pimd/pim_addr.h
+++ b/pimd/pim_addr.h
@@ -33,7 +33,6 @@ typedef struct in_addr pim_addr;
#define PIM_AFI AFI_IP
#define PIM_MAX_BITLEN IPV4_MAX_BITLEN
#define PIM_AF_NAME "ip"
-#define FRR_PIM_AF_XPATH_VAL "frr-routing:ipv4"
union pimprefixptr {
prefixtype(pimprefixptr, struct prefix, p)
@@ -53,7 +52,6 @@ typedef struct in6_addr pim_addr;
#define PIM_AFI AFI_IP6
#define PIM_MAX_BITLEN IPV6_MAX_BITLEN
#define PIM_AF_NAME "ipv6"
-#define FRR_PIM_AF_XPATH_VAL "frr-routing:ipv6"
union pimprefixptr {
prefixtype(pimprefixptr, struct prefix, p)
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 76f90cdba..a7041e8a6 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -7959,11 +7959,7 @@ DEFUN (interface_ip_pim_drprio,
{
int idx_number = 3;
- nb_cli_enqueue_change(vty, "./dr-priority", NB_OP_MODIFY,
- argv[idx_number]->arg);
-
- return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_ip_pim_drprio_cmd(vty, argv[idx_number]->arg);
}
DEFUN (interface_no_ip_pim_drprio,
@@ -7975,10 +7971,7 @@ DEFUN (interface_no_ip_pim_drprio,
"Revert the Designated Router Priority to default\n"
"Old Value of the Priority\n")
{
- nb_cli_enqueue_change(vty, "./dr-priority", NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_no_ip_pim_drprio_cmd(vty);
}
DEFPY_HIDDEN (interface_ip_igmp_query_generate,
@@ -8069,20 +8062,7 @@ DEFPY (interface_ip_pim_activeactive,
PIM_STR
"Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
{
- if (no)
- nb_cli_enqueue_change(vty, "./active-active", NB_OP_MODIFY,
- "false");
- else {
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
- "true");
-
- nb_cli_enqueue_change(vty, "./active-active", NB_OP_MODIFY,
- "true");
- }
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_ip_pim_activeactive_cmd(vty, no);
}
DEFUN_HIDDEN (interface_ip_pim_ssm,
@@ -8094,11 +8074,7 @@ DEFUN_HIDDEN (interface_ip_pim_ssm,
{
int ret;
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true");
-
- ret = nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ ret = pim_process_ip_pim_cmd(vty);
if (ret != NB_OK)
return ret;
@@ -8116,11 +8092,7 @@ DEFUN_HIDDEN (interface_ip_pim_sm,
PIM_STR
IFACE_PIM_SM_STR)
{
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true");
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_ip_pim_cmd(vty);
}
DEFUN (interface_ip_pim,
@@ -8129,12 +8101,7 @@ DEFUN (interface_ip_pim,
IP_STR
PIM_STR)
{
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true");
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
-
+ return pim_process_ip_pim_cmd(vty);
}
DEFUN_HIDDEN (interface_no_ip_pim_ssm,
@@ -8145,39 +8112,7 @@ DEFUN_HIDDEN (interface_no_ip_pim_ssm,
PIM_STR
IFACE_PIM_STR)
{
- const struct lyd_node *igmp_enable_dnode;
- char igmp_if_xpath[XPATH_MAXLEN];
-
- int printed =
- snprintf(igmp_if_xpath, sizeof(igmp_if_xpath),
- "%s/frr-gmp:gmp/address-family[address-family='%s']",
- VTY_CURR_XPATH, "frr-routing:ipv4");
-
- if (printed >= (int)(sizeof(igmp_if_xpath))) {
- vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
- XPATH_MAXLEN);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- igmp_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
- FRR_GMP_ENABLE_XPATH,
- VTY_CURR_XPATH,
- "frr-routing:ipv4");
- if (!igmp_enable_dnode) {
- nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, NULL);
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
- } else {
- if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) {
- nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY,
- NULL);
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
- } else
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
- "false");
- }
-
- return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_no_ip_pim_cmd(vty);
}
DEFUN_HIDDEN (interface_no_ip_pim_sm,
@@ -8188,41 +8123,7 @@ DEFUN_HIDDEN (interface_no_ip_pim_sm,
PIM_STR
IFACE_PIM_SM_STR)
{
- const struct lyd_node *igmp_enable_dnode;
- char igmp_if_xpath[XPATH_MAXLEN];
-
- int printed =
- snprintf(igmp_if_xpath, sizeof(igmp_if_xpath),
- "%s/frr-gmp:gmp/address-family[address-family='%s']",
- VTY_CURR_XPATH, "frr-routing:ipv4");
-
- if (printed >= (int)(sizeof(igmp_if_xpath))) {
- vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
- XPATH_MAXLEN);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- igmp_enable_dnode =
- yang_dnode_getf(vty->candidate_config->dnode,
- FRR_GMP_ENABLE_XPATH, VTY_CURR_XPATH,
- "frr-routing:ipv4");
-
- if (!igmp_enable_dnode) {
- nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, NULL);
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
- } else {
- if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) {
- nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY,
- NULL);
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
- } else
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
- "false");
- }
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_no_ip_pim_cmd(vty);
}
DEFUN (interface_no_ip_pim,
@@ -8232,41 +8133,7 @@ DEFUN (interface_no_ip_pim,
IP_STR
PIM_STR)
{
- const struct lyd_node *igmp_enable_dnode;
- char igmp_if_xpath[XPATH_MAXLEN];
-
- int printed =
- snprintf(igmp_if_xpath, sizeof(igmp_if_xpath),
- "%s/frr-gmp:gmp/address-family[address-family='%s']",
- VTY_CURR_XPATH, "frr-routing:ipv4");
-
- if (printed >= (int)(sizeof(igmp_if_xpath))) {
- vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
- XPATH_MAXLEN);
- return CMD_WARNING_CONFIG_FAILED;
- }
-
- igmp_enable_dnode =
- yang_dnode_getf(vty->candidate_config->dnode,
- FRR_GMP_ENABLE_XPATH, VTY_CURR_XPATH,
- "frr-routing:ipv4");
-
- if (!igmp_enable_dnode) {
- nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY, NULL);
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
- } else {
- if (!yang_dnode_get_bool(igmp_enable_dnode, ".")) {
- nb_cli_enqueue_change(vty, igmp_if_xpath, NB_OP_DESTROY,
- NULL);
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
- } else
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
- "false");
- }
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_no_ip_pim_cmd(vty);
}
/* boundaries */
@@ -8279,13 +8146,7 @@ DEFUN(interface_ip_pim_boundary_oil,
"Filter OIL by group using prefix list\n"
"Prefix list to filter OIL with\n")
{
- nb_cli_enqueue_change(vty, "./multicast-boundary-oil", NB_OP_MODIFY,
- argv[4]->arg);
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
-
+ return pim_process_ip_pim_boundary_oil_cmd(vty, argv[4]->arg);
}
DEFUN(interface_no_ip_pim_boundary_oil,
@@ -8298,12 +8159,7 @@ DEFUN(interface_no_ip_pim_boundary_oil,
"Filter OIL by group using prefix list\n"
"Prefix list to filter OIL with\n")
{
- nb_cli_enqueue_change(vty, "./multicast-boundary-oil", NB_OP_DESTROY,
- NULL);
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_no_ip_pim_boundary_oil_cmd(vty);
}
DEFUN (interface_ip_mroute,
@@ -8324,13 +8180,8 @@ DEFUN (interface_ip_mroute,
else
source_str = argv[idx_ipv4 + 1]->arg;
- nb_cli_enqueue_change(vty, "./oif", NB_OP_MODIFY,
- argv[idx_interface]->arg);
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_MROUTE_XPATH,
- "frr-routing:ipv4", source_str,
- argv[idx_ipv4]->arg);
+ return pim_process_ip_mroute_cmd(vty, argv[idx_interface]->arg,
+ argv[idx_ipv4]->arg, source_str);
}
DEFUN (interface_no_ip_mroute,
@@ -8343,6 +8194,7 @@ DEFUN (interface_no_ip_mroute,
"Group Address\n"
"Source Address\n")
{
+ int idx_interface = 3;
int idx_ipv4 = 4;
const char *source_str;
@@ -8351,12 +8203,8 @@ DEFUN (interface_no_ip_mroute,
else
source_str = argv[idx_ipv4 + 1]->arg;
- nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_MROUTE_XPATH,
- "frr-routing:ipv4", source_str,
- argv[idx_ipv4]->arg);
+ return pim_process_no_ip_mroute_cmd(vty, argv[idx_interface]->arg,
+ argv[idx_ipv4]->arg, source_str);
}
DEFUN (interface_ip_pim_hello,
@@ -8370,31 +8218,14 @@ DEFUN (interface_ip_pim_hello,
{
int idx_time = 3;
int idx_hold = 4;
- const struct lyd_node *igmp_enable_dnode;
-
- igmp_enable_dnode =
- yang_dnode_getf(vty->candidate_config->dnode,
- FRR_GMP_ENABLE_XPATH, VTY_CURR_XPATH,
- "frr-routing:ipv4");
- if (!igmp_enable_dnode) {
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
- "true");
- } else {
- if (!yang_dnode_get_bool(igmp_enable_dnode, "."))
- nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
- "true");
- }
-
- nb_cli_enqueue_change(vty, "./hello-interval", NB_OP_MODIFY,
- argv[idx_time]->arg);
if (argc == idx_hold + 1)
- nb_cli_enqueue_change(vty, "./hello-holdtime", NB_OP_MODIFY,
- argv[idx_hold]->arg);
+ return pim_process_ip_pim_hello_cmd(vty, argv[idx_time]->arg,
+ argv[idx_hold]->arg);
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ else
+ return pim_process_ip_pim_hello_cmd(vty, argv[idx_time]->arg,
+ NULL);
}
DEFUN (interface_no_ip_pim_hello,
@@ -8407,12 +8238,7 @@ DEFUN (interface_no_ip_pim_hello,
IGNORED_IN_NO_STR
IGNORED_IN_NO_STR)
{
- nb_cli_enqueue_change(vty, "./hello-interval", NB_OP_DESTROY, NULL);
- nb_cli_enqueue_change(vty, "./hello-holdtime", NB_OP_DESTROY, NULL);
-
- return nb_cli_apply_changes(vty,
- FRR_PIM_INTERFACE_XPATH,
- "frr-routing:ipv4");
+ return pim_process_no_ip_pim_hello_cmd(vty);
}
DEFUN (debug_igmp,
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index 6adea54a6..34472173e 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -30,6 +30,7 @@
#include "nexthop.h"
#include "vrf.h"
#include "ferr.h"
+#include "lib/srcdest_table.h"
#include "pimd.h"
#include "pim_vty.h"
@@ -326,3 +327,175 @@ int pim_process_no_register_suppress_cmd(struct vty *vty)
return nb_cli_apply_changes(vty, NULL);
}
+
+int pim_process_ip_pim_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY, "true");
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_no_ip_pim_cmd(struct vty *vty)
+{
+ const struct lyd_node *mld_enable_dnode;
+ char mld_if_xpath[XPATH_MAXLEN];
+
+ int printed =
+ snprintf(mld_if_xpath, sizeof(mld_if_xpath),
+ "%s/frr-gmp:gmp/address-family[address-family='%s']",
+ VTY_CURR_XPATH, FRR_PIM_AF_XPATH_VAL);
+
+ if (printed >= (int)(sizeof(mld_if_xpath))) {
+ vty_out(vty, "Xpath too long (%d > %u)", printed + 1,
+ XPATH_MAXLEN);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+
+ mld_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
+ FRR_GMP_ENABLE_XPATH, VTY_CURR_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+
+ if (!mld_enable_dnode) {
+ nb_cli_enqueue_change(vty, mld_if_xpath, NB_OP_DESTROY, NULL);
+ nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+ } else {
+ if (!yang_dnode_get_bool(mld_enable_dnode, ".")) {
+ nb_cli_enqueue_change(vty, mld_if_xpath, NB_OP_DESTROY,
+ NULL);
+ nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+ } else
+ nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
+ "false");
+ }
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_ip_pim_drprio_cmd(struct vty *vty, const char *drpriority_str)
+{
+ nb_cli_enqueue_change(vty, "./dr-priority", NB_OP_MODIFY,
+ drpriority_str);
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_no_ip_pim_drprio_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./dr-priority", NB_OP_DESTROY, NULL);
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_ip_pim_hello_cmd(struct vty *vty, const char *hello_str,
+ const char *hold_str)
+{
+ const struct lyd_node *mld_enable_dnode;
+
+ mld_enable_dnode = yang_dnode_getf(vty->candidate_config->dnode,
+ FRR_GMP_ENABLE_XPATH, VTY_CURR_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+
+ if (!mld_enable_dnode) {
+ nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
+ "true");
+ } else {
+ if (!yang_dnode_get_bool(mld_enable_dnode, "."))
+ nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
+ "true");
+ }
+
+ nb_cli_enqueue_change(vty, "./hello-interval", NB_OP_MODIFY, hello_str);
+
+ if (hold_str)
+ nb_cli_enqueue_change(vty, "./hello-holdtime", NB_OP_MODIFY,
+ hold_str);
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_no_ip_pim_hello_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./hello-interval", NB_OP_DESTROY, NULL);
+ nb_cli_enqueue_change(vty, "./hello-holdtime", NB_OP_DESTROY, NULL);
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_ip_pim_activeactive_cmd(struct vty *vty, const char *no)
+{
+ if (no)
+ nb_cli_enqueue_change(vty, "./active-active", NB_OP_MODIFY,
+ "false");
+ else {
+ nb_cli_enqueue_change(vty, "./pim-enable", NB_OP_MODIFY,
+ "true");
+
+ nb_cli_enqueue_change(vty, "./active-active", NB_OP_MODIFY,
+ "true");
+ }
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_ip_pim_boundary_oil_cmd(struct vty *vty, const char *oil)
+{
+ nb_cli_enqueue_change(vty, "./multicast-boundary-oil", NB_OP_MODIFY,
+ oil);
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_no_ip_pim_boundary_oil_cmd(struct vty *vty)
+{
+ nb_cli_enqueue_change(vty, "./multicast-boundary-oil", NB_OP_DESTROY,
+ NULL);
+
+ return nb_cli_apply_changes(vty, FRR_PIM_INTERFACE_XPATH,
+ FRR_PIM_AF_XPATH_VAL);
+}
+
+int pim_process_ip_mroute_cmd(struct vty *vty, const char *interface,
+ const char *group_str, const char *source_str)
+{
+ nb_cli_enqueue_change(vty, "./oif", NB_OP_MODIFY, interface);
+
+ if (!source_str) {
+ char buf[SRCDEST2STR_BUFFER];
+
+ inet_ntop(AF_INET6, &in6addr_any, buf, sizeof(buf));
+ return nb_cli_apply_changes(vty, FRR_PIM_MROUTE_XPATH,
+ FRR_PIM_AF_XPATH_VAL, buf,
+ group_str);
+ }
+
+ return nb_cli_apply_changes(vty, FRR_PIM_MROUTE_XPATH,
+ FRR_PIM_AF_XPATH_VAL, source_str,
+ group_str);
+}
+
+int pim_process_no_ip_mroute_cmd(struct vty *vty, const char *interface,
+ const char *group_str, const char *source_str)
+{
+ nb_cli_enqueue_change(vty, ".", NB_OP_DESTROY, NULL);
+
+ if (!source_str) {
+ char buf[SRCDEST2STR_BUFFER];
+
+ inet_ntop(AF_INET6, &in6addr_any, buf, sizeof(buf));
+ return nb_cli_apply_changes(vty, FRR_PIM_MROUTE_XPATH,
+ FRR_PIM_AF_XPATH_VAL, buf,
+ group_str);
+ }
+
+ return nb_cli_apply_changes(vty, FRR_PIM_MROUTE_XPATH,
+ FRR_PIM_AF_XPATH_VAL, source_str,
+ group_str);
+}
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h
index 49fc6bcbe..688a4f787 100644
--- a/pimd/pim_cmd_common.h
+++ b/pimd/pim_cmd_common.h
@@ -36,4 +36,19 @@ int pim_process_no_rp_kat_cmd(struct vty *vty);
int pim_process_register_suppress_cmd(struct vty *vty, const char *rst);
int pim_process_no_register_suppress_cmd(struct vty *vty);
+int pim_process_ip_pim_cmd(struct vty *vty);
+int pim_process_no_ip_pim_cmd(struct vty *vty);
+int pim_process_ip_pim_drprio_cmd(struct vty *vty, const char *drpriority_str);
+int pim_process_no_ip_pim_drprio_cmd(struct vty *vty);
+int pim_process_ip_pim_hello_cmd(struct vty *vty, const char *hello_str,
+ const char *hold_str);
+int pim_process_no_ip_pim_hello_cmd(struct vty *vty);
+int pim_process_ip_pim_activeactive_cmd(struct vty *vty, const char *no);
+int pim_process_ip_pim_boundary_oil_cmd(struct vty *vty, const char *oil);
+int pim_process_no_ip_pim_boundary_oil_cmd(struct vty *vty);
+int pim_process_ip_mroute_cmd(struct vty *vty, const char *interface,
+ const char *group_str, const char *source_str);
+int pim_process_no_ip_mroute_cmd(struct vty *vty, const char *interface,
+ const char *group_str, const char *src_str);
+
#endif /* PIM_CMD_COMMON_H */
diff --git a/pimd/pim_nb.h b/pimd/pim_nb.h
index 72c96d7d7..273c7e8a6 100644
--- a/pimd/pim_nb.h
+++ b/pimd/pim_nb.h
@@ -198,6 +198,12 @@ int lib_interface_gmp_address_family_static_group_destroy(
int routing_control_plane_protocols_name_validate(
struct nb_cb_create_args *args);
+#if PIM_IPV == 4
+#define FRR_PIM_AF_XPATH_VAL "frr-routing:ipv4"
+#else
+#define FRR_PIM_AF_XPATH_VAL "frr-routing:ipv6"
+#endif
+
#define FRR_PIM_VRF_XPATH \
"/frr-routing:routing/control-plane-protocols/" \
"control-plane-protocol[type='%s'][name='%s'][vrf='%s']/" \