mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-02 13:23:44 +00:00
pim6d: Add 'clear ipv6 mroute [vrf NAME] count' CLI
Adding clear ipv6 mroute count command for resetting multicast routes and count. Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
This commit is contained in:
parent
09a754ead1
commit
4e65109c7f
@ -1992,6 +1992,18 @@ DEFPY (clear_ipv6_pim_oil,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFPY (clear_ipv6_mroute_count,
|
||||
clear_ipv6_mroute_count_cmd,
|
||||
"clear ipv6 mroute [vrf NAME]$name count",
|
||||
CLEAR_STR
|
||||
IPV6_STR
|
||||
MROUTE_STR
|
||||
VRF_CMD_HELP_STR
|
||||
"Route and packet count data\n")
|
||||
{
|
||||
return clear_ip_mroute_count_command(vty, name);
|
||||
}
|
||||
|
||||
void pim_cmd_init(void)
|
||||
{
|
||||
if_cmd_init(pim_interface_config_write);
|
||||
@ -2102,4 +2114,5 @@ void pim_cmd_init(void)
|
||||
install_element(ENABLE_NODE, &clear_ipv6_pim_statistics_cmd);
|
||||
install_element(ENABLE_NODE, &clear_ipv6_mroute_cmd);
|
||||
install_element(ENABLE_NODE, &clear_ipv6_pim_oil_cmd);
|
||||
install_element(ENABLE_NODE, &clear_ipv6_mroute_count_cmd);
|
||||
}
|
||||
|
@ -3786,47 +3786,16 @@ DEFPY (show_ip_mroute_vrf_all,
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
DEFUN (clear_ip_mroute_count,
|
||||
DEFPY (clear_ip_mroute_count,
|
||||
clear_ip_mroute_count_cmd,
|
||||
"clear ip mroute [vrf NAME] count",
|
||||
"clear ip mroute [vrf NAME]$name count",
|
||||
CLEAR_STR
|
||||
IP_STR
|
||||
MROUTE_STR
|
||||
VRF_CMD_HELP_STR
|
||||
"Route and packet count data\n")
|
||||
{
|
||||
int idx = 2;
|
||||
struct listnode *node;
|
||||
struct channel_oil *c_oil;
|
||||
struct static_route *sr;
|
||||
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
|
||||
struct pim_instance *pim;
|
||||
|
||||
if (!vrf)
|
||||
return CMD_WARNING;
|
||||
|
||||
pim = vrf->info;
|
||||
frr_each(rb_pim_oil, &pim->channel_oil_head, c_oil) {
|
||||
if (!c_oil->installed)
|
||||
continue;
|
||||
|
||||
pim_mroute_update_counters(c_oil);
|
||||
c_oil->cc.origpktcnt = c_oil->cc.pktcnt;
|
||||
c_oil->cc.origbytecnt = c_oil->cc.bytecnt;
|
||||
c_oil->cc.origwrong_if = c_oil->cc.wrong_if;
|
||||
}
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sr)) {
|
||||
if (!sr->c_oil.installed)
|
||||
continue;
|
||||
|
||||
pim_mroute_update_counters(&sr->c_oil);
|
||||
|
||||
sr->c_oil.cc.origpktcnt = sr->c_oil.cc.pktcnt;
|
||||
sr->c_oil.cc.origbytecnt = sr->c_oil.cc.bytecnt;
|
||||
sr->c_oil.cc.origwrong_if = sr->c_oil.cc.wrong_if;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
return clear_ip_mroute_count_command(vty, name);
|
||||
}
|
||||
|
||||
DEFPY (show_ip_mroute_count,
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "pim_nht.h"
|
||||
#include "pim_sock.h"
|
||||
#include "pim_ssm.h"
|
||||
#include "pim_static.h"
|
||||
#include "pim_addr.h"
|
||||
#include "pim_static.h"
|
||||
|
||||
@ -3564,6 +3565,41 @@ void show_mroute_summary(struct pim_instance *pim, struct vty *vty,
|
||||
}
|
||||
}
|
||||
|
||||
int clear_ip_mroute_count_command(struct vty *vty, const char *name)
|
||||
{
|
||||
struct listnode *node;
|
||||
struct channel_oil *c_oil;
|
||||
struct static_route *sr;
|
||||
struct vrf *v = pim_cmd_lookup(vty, name);
|
||||
struct pim_instance *pim;
|
||||
|
||||
if (!v)
|
||||
return CMD_WARNING;
|
||||
|
||||
pim = v->info;
|
||||
frr_each (rb_pim_oil, &pim->channel_oil_head, c_oil) {
|
||||
if (!c_oil->installed)
|
||||
continue;
|
||||
|
||||
pim_mroute_update_counters(c_oil);
|
||||
c_oil->cc.origpktcnt = c_oil->cc.pktcnt;
|
||||
c_oil->cc.origbytecnt = c_oil->cc.bytecnt;
|
||||
c_oil->cc.origwrong_if = c_oil->cc.wrong_if;
|
||||
}
|
||||
|
||||
for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sr)) {
|
||||
if (!sr->c_oil.installed)
|
||||
continue;
|
||||
|
||||
pim_mroute_update_counters(&sr->c_oil);
|
||||
|
||||
sr->c_oil.cc.origpktcnt = sr->c_oil.cc.pktcnt;
|
||||
sr->c_oil.cc.origbytecnt = sr->c_oil.cc.bytecnt;
|
||||
sr->c_oil.cc.origwrong_if = sr->c_oil.cc.wrong_if;
|
||||
}
|
||||
return CMD_SUCCESS;
|
||||
}
|
||||
|
||||
struct vrf *pim_cmd_lookup(struct vty *vty, const char *name)
|
||||
{
|
||||
struct vrf *vrf;
|
||||
|
@ -121,6 +121,7 @@ void show_mroute_count(struct pim_instance *pim, struct vty *vty,
|
||||
json_object *json);
|
||||
void show_mroute_summary(struct pim_instance *pim, struct vty *vty,
|
||||
json_object *json);
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user