]> git.proxmox.com Git - mirror_frr.git/commitdiff
pim6d: Adding "ipv6 pim hello (1-65535) [(1-65535)]" CLI
authorsarita patra <saritap@vmware.com>
Tue, 1 Mar 2022 02:18:42 +0000 (18:18 -0800)
committersarita patra <saritap@vmware.com>
Tue, 1 Mar 2022 14:26:13 +0000 (06:26 -0800)
This cli used to configure PIMV6 hello and hold timer on interface.

Signed-off-by: sarita patra <saritap@vmware.com>
pimd/pim6_cmd.c
pimd/pim6_cmd.h
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index 3c796930deb87d2cc97cc7a234ea44b58b3d370e..330cff755faf8689ae7068f3f8457361adfe8af7 100644 (file)
@@ -252,6 +252,31 @@ DEFPY (interface_no_ipv6_pim_drprio,
        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);
+}
+
 void pim_cmd_init(void)
 {
        if_cmd_init(pim_interface_config_write);
@@ -274,4 +299,6 @@ void pim_cmd_init(void)
        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);
 }
index e49045a1b52fa242d1d43ab6918caa15fb38e9a3..68b185c25b504c24571f36435635177c48a55a6c 100644 (file)
@@ -33,6 +33,9 @@
 #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_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"
index 5aa1797223ded6c59e39afd4e0f3d69a40841942..19044064f3d3d6021f7f5721a11cc8aa8920ca08 100644 (file)
@@ -8324,31 +8324,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,
@@ -8361,12 +8344,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,
index 2355a5cd0e7faae83ce6252684f6f98609e066c0..386a837548bc08e3c6fbb5ab224b835220d10bc7 100644 (file)
@@ -388,3 +388,40 @@ int pim_process_no_ip_pim_drprio_cmd(struct vty *vty)
        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);
+}
index aaf10734f553ea4e4d7299b709eef9a45a07d628..44c70e1cb62afb756c9f6efa22c2ee2d24a8323c 100644 (file)
@@ -40,5 +40,8 @@ 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);
 
 #endif /* PIM_CMD_COMMON_H */