]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pim6d: Implementing "clear ipv6 pim interface traffic" command.
authorAbhishek N R <abnr@vmware.com>
Mon, 18 Jul 2022 13:08:19 +0000 (06:08 -0700)
committerAbhishek N R <abnr@vmware.com>
Tue, 2 Aug 2022 05:08:40 +0000 (22:08 -0700)
Signed-off-by: Abhishek N R <abnr@vmware.com>
doc/user/pimv6.rst
pimd/pim6_cmd.c
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index bda9eaec8011c615b9dbec76323bc169153c4e1e..e6585d0bacb113846fee08e63d0f4259019233c1 100644 (file)
@@ -389,6 +389,11 @@ Clear commands reset various variables.
 
    Reset PIMv6 interfaces.
 
+.. clicmd:: clear ipv6 pim [vrf NAME] interface traffic
+
+   When this command is issued, resets the information about the 
+   number of PIM protocol packets sent/received on an interface.
+
 .. clicmd:: clear ipv6 pim oil
 
    Rescan PIMv6 OIL (output interface list).
index d72a67243b91447be74ec583fbc7904a84284820..c209c5e1386b20451d83ec05e55924e4ac9fd12c 100644 (file)
@@ -1260,6 +1260,19 @@ DEFPY (clear_ipv6_pim_statistics,
        return CMD_SUCCESS;
 }
 
+DEFPY (clear_ipv6_pim_interface_traffic,
+       clear_ipv6_pim_interface_traffic_cmd,
+       "clear ipv6 pim [vrf NAME] interface traffic",
+       CLEAR_STR
+       IPV6_STR
+       CLEAR_IP_PIM_STR
+       VRF_CMD_HELP_STR
+       "Reset PIM interfaces\n"
+       "Reset Protocol Packet counters\n")
+{
+       return clear_pim_interface_traffic(vrf, vty);
+}
+
 DEFPY (clear_ipv6_mroute,
        clear_ipv6_mroute_cmd,
        "clear ipv6 mroute [vrf NAME]$name",
@@ -1619,6 +1632,7 @@ void pim_cmd_init(void)
        install_element(ENABLE_NODE, &clear_ipv6_mroute_count_cmd);
        install_element(ENABLE_NODE, &clear_ipv6_pim_bsr_db_cmd);
        install_element(ENABLE_NODE, &clear_ipv6_pim_interfaces_cmd);
+       install_element(ENABLE_NODE, &clear_ipv6_pim_interface_traffic_cmd);
 
        install_element(ENABLE_NODE, &debug_pimv6_cmd);
        install_element(ENABLE_NODE, &debug_pimv6_nht_cmd);
index 9681493808139a77f1094b916bcc832eed2619ac..a3188128fa409a3daaebf2c366ba1345de222e13 100644 (file)
@@ -1678,50 +1678,17 @@ DEFPY (clear_ip_pim_interfaces,
        return CMD_SUCCESS;
 }
 
-DEFUN (clear_ip_pim_interface_traffic,
+DEFPY (clear_ip_pim_interface_traffic,
        clear_ip_pim_interface_traffic_cmd,
        "clear ip pim [vrf NAME] interface traffic",
-       "Reset functions\n"
-       "IP information\n"
-       "PIM clear commands\n"
+       CLEAR_STR
+       IP_STR
+       CLEAR_IP_PIM_STR
        VRF_CMD_HELP_STR
        "Reset PIM interfaces\n"
        "Reset Protocol Packet counters\n")
 {
-       int idx = 2;
-       struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
-       struct interface *ifp = NULL;
-       struct pim_interface *pim_ifp = NULL;
-
-       if (!vrf)
-               return CMD_WARNING;
-
-       FOR_ALL_INTERFACES (vrf, ifp) {
-               pim_ifp = ifp->info;
-
-               if (!pim_ifp)
-                       continue;
-
-               pim_ifp->pim_ifstat_hello_recv = 0;
-               pim_ifp->pim_ifstat_hello_sent = 0;
-               pim_ifp->pim_ifstat_join_recv = 0;
-               pim_ifp->pim_ifstat_join_send = 0;
-               pim_ifp->pim_ifstat_prune_recv = 0;
-               pim_ifp->pim_ifstat_prune_send = 0;
-               pim_ifp->pim_ifstat_reg_recv = 0;
-               pim_ifp->pim_ifstat_reg_send = 0;
-               pim_ifp->pim_ifstat_reg_stop_recv = 0;
-               pim_ifp->pim_ifstat_reg_stop_send = 0;
-               pim_ifp->pim_ifstat_assert_recv = 0;
-               pim_ifp->pim_ifstat_assert_send = 0;
-               pim_ifp->pim_ifstat_bsm_rx = 0;
-               pim_ifp->pim_ifstat_bsm_tx = 0;
-               pim_ifp->igmp_ifstat_joins_sent = 0;
-               pim_ifp->igmp_ifstat_joins_failed = 0;
-               pim_ifp->igmp_peak_group_count = 0;
-       }
-
-       return CMD_SUCCESS;
+       return clear_pim_interface_traffic(vrf, vty);
 }
 
 DEFPY (clear_ip_pim_oil,
index b7bd7375c595218db0c8b0837b51887e60a1d5b3..ce1fb427734156ad9301600b19ee4bfc3f364631 100644 (file)
@@ -4023,6 +4023,46 @@ void clear_pim_statistics(struct pim_instance *pim)
        }
 }
 
+int clear_pim_interface_traffic(const char *vrf, struct vty *vty)
+{
+       struct interface *ifp = NULL;
+       struct pim_interface *pim_ifp = NULL;
+
+       struct vrf *v = pim_cmd_lookup(vty, vrf);
+
+       if (!v)
+               return CMD_WARNING;
+
+       FOR_ALL_INTERFACES (v, ifp) {
+               pim_ifp = ifp->info;
+
+               if (!pim_ifp)
+                       continue;
+
+               pim_ifp->pim_ifstat_hello_recv = 0;
+               pim_ifp->pim_ifstat_hello_sent = 0;
+               pim_ifp->pim_ifstat_join_recv = 0;
+               pim_ifp->pim_ifstat_join_send = 0;
+               pim_ifp->pim_ifstat_prune_recv = 0;
+               pim_ifp->pim_ifstat_prune_send = 0;
+               pim_ifp->pim_ifstat_reg_recv = 0;
+               pim_ifp->pim_ifstat_reg_send = 0;
+               pim_ifp->pim_ifstat_reg_stop_recv = 0;
+               pim_ifp->pim_ifstat_reg_stop_send = 0;
+               pim_ifp->pim_ifstat_assert_recv = 0;
+               pim_ifp->pim_ifstat_assert_send = 0;
+               pim_ifp->pim_ifstat_bsm_rx = 0;
+               pim_ifp->pim_ifstat_bsm_tx = 0;
+#if PIM_IPV == 4
+               pim_ifp->igmp_ifstat_joins_sent = 0;
+               pim_ifp->igmp_ifstat_joins_failed = 0;
+               pim_ifp->igmp_peak_group_count = 0;
+#endif
+       }
+
+       return CMD_SUCCESS;
+}
+
 int pim_debug_pim_cmd(void)
 {
        PIM_DO_DEBUG_PIM_EVENTS;
index 02acb1685863075b4aaebb9fcc3907960182ac0d..27c029670e59ce5c78bbb82f48d53170d311e7d2 100644 (file)
@@ -139,6 +139,7 @@ int clear_ip_mroute_count_command(struct vty *vty, const char *name);
 struct vrf *pim_cmd_lookup(struct vty *vty, const char *name);
 void clear_mroute(struct pim_instance *pim);
 void clear_pim_statistics(struct pim_instance *pim);
+int clear_pim_interface_traffic(const char *vrf, struct vty *vty);
 int pim_debug_pim_cmd(void);
 int pim_no_debug_pim_cmd(void);
 int pim_debug_pim_packets_cmd(const char *hello, const char *joins,