return CMD_SUCCESS;
}
+DEFPY (show_ipv6_pim_statistics,
+ show_ipv6_pim_statistics_cmd,
+ "show ipv6 pim [vrf NAME] statistics [interface WORD$word] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM statistics\n"
+ INTERFACE_STR
+ "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;
+}
+
void pim_cmd_init(void)
{
if_cmd_init(pim_interface_config_write);
install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_rpf_vrf_all_cmd);
install_element(VIEW_NODE, &show_ipv6_pim_secondary_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
}
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_statistics,
+DEFPY (show_ip_pim_statistics,
show_ip_pim_statistics_cmd,
- "show ip pim [vrf NAME] statistics [interface WORD] [json]",
+ "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
SHOW_STR
IP_STR
PIM_STR
"PIM interface\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- if (argv_find(argv, argc, "WORD", &idx))
- pim_show_statistics(vrf->info, vty, argv[idx]->arg, uj);
+ 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(vrf->info, vty, NULL, uj);
+ pim_show_statistics(pim, vty, NULL, uj);
return CMD_SUCCESS;
}