forked from Mirror/frr
pim6d: Moving reusable code to common api for "show pim statistics" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
parent
5e52c8d5c8
commit
19296b58e4
|
@ -859,28 +859,7 @@ DEFPY (show_ipv6_pim_statistics,
|
||||||
"PIM interface\n"
|
"PIM interface\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
struct pim_instance *pim;
|
return pim_show_statistics_helper(vrf, vty, word, !!json);
|
||||||
struct vrf *v;
|
|
||||||
bool uj = !!json;
|
|
||||||
|
|
||||||
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
|
|
||||||
|
|
||||||
if (!v)
|
|
||||||
return CMD_WARNING;
|
|
||||||
|
|
||||||
pim = pim_get_pim_instance(v->vrf_id);
|
|
||||||
|
|
||||||
if (!pim) {
|
|
||||||
vty_out(vty, "%% Unable to find pim instance\n");
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (word)
|
|
||||||
pim_show_statistics(pim, vty, word, uj);
|
|
||||||
else
|
|
||||||
pim_show_statistics(pim, vty, NULL, uj);
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ipv6_pim_upstream,
|
DEFPY (show_ipv6_pim_upstream,
|
||||||
|
|
|
@ -3442,28 +3442,7 @@ DEFPY (show_ip_pim_statistics,
|
||||||
"PIM interface\n"
|
"PIM interface\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
struct pim_instance *pim;
|
return pim_show_statistics_helper(vrf, vty, word, !!json);
|
||||||
struct vrf *v;
|
|
||||||
bool uj = !!json;
|
|
||||||
|
|
||||||
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
|
|
||||||
|
|
||||||
if (!v)
|
|
||||||
return CMD_WARNING;
|
|
||||||
|
|
||||||
pim = pim_get_pim_instance(v->vrf_id);
|
|
||||||
|
|
||||||
if (!pim) {
|
|
||||||
vty_out(vty, "%% Unable to find pim instance\n");
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (word)
|
|
||||||
pim_show_statistics(pim, vty, word, uj);
|
|
||||||
else
|
|
||||||
pim_show_statistics(pim, vty, NULL, uj);
|
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFPY (show_ip_multicast,
|
DEFPY (show_ip_multicast,
|
||||||
|
|
|
@ -3887,3 +3887,29 @@ int pim_show_secondary_helper(const char *vrf, struct vty *vty)
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pim_show_statistics_helper(const char *vrf, struct vty *vty,
|
||||||
|
const char *word, bool uj)
|
||||||
|
{
|
||||||
|
struct pim_instance *pim;
|
||||||
|
struct vrf *v;
|
||||||
|
|
||||||
|
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
|
if (!v)
|
||||||
|
return CMD_WARNING;
|
||||||
|
|
||||||
|
pim = pim_get_pim_instance(v->vrf_id);
|
||||||
|
|
||||||
|
if (!pim) {
|
||||||
|
vty_out(vty, "%% Unable to find pim instance\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (word)
|
||||||
|
pim_show_statistics(pim, vty, word, uj);
|
||||||
|
else
|
||||||
|
pim_show_statistics(pim, vty, NULL, uj);
|
||||||
|
|
||||||
|
return CMD_SUCCESS;
|
||||||
|
}
|
||||||
|
|
|
@ -138,6 +138,8 @@ int pim_show_rp_helper(const char *vrf, struct vty *vty, const char *group_str,
|
||||||
int pim_show_rp_vrf_all_helper(struct vty *vty, const char *group_str,
|
int pim_show_rp_vrf_all_helper(struct vty *vty, const char *group_str,
|
||||||
const struct prefix *group, bool json);
|
const struct prefix *group, bool json);
|
||||||
int pim_show_secondary_helper(const char *vrf, struct vty *vty);
|
int pim_show_secondary_helper(const char *vrf, struct vty *vty);
|
||||||
|
int pim_show_statistics_helper(const char *vrf, struct vty *vty,
|
||||||
|
const char *word, bool uj);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Special Macro to allow us to get the correct pim_instance;
|
* Special Macro to allow us to get the correct pim_instance;
|
||||||
|
|
Loading…
Reference in a new issue