"PIM interface\n"
JSON_STR)
{
- struct pim_instance *pim;
- 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;
+ return pim_show_statistics_helper(vrf, vty, word, !!json);
}
DEFPY (show_ipv6_pim_upstream,
"PIM interface\n"
JSON_STR)
{
- struct pim_instance *pim;
- 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;
+ return pim_show_statistics_helper(vrf, vty, word, !!json);
}
DEFPY (show_ip_multicast,
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;
+}
int pim_show_rp_vrf_all_helper(struct vty *vty, const char *group_str,
const struct prefix *group, bool json);
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;