mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 02:53:55 +00:00
pim6d: Implementing "show ipv6 pim statistics" CLI
Adding new show CLI to display pim statistics. Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
parent
626dab7f3f
commit
4f58b6aaa4
@ -811,6 +811,42 @@ DEFPY (show_ipv6_pim_secondary,
|
|||||||
return CMD_SUCCESS;
|
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)
|
void pim_cmd_init(void)
|
||||||
{
|
{
|
||||||
if_cmd_init(pim_interface_config_write);
|
if_cmd_init(pim_interface_config_write);
|
||||||
@ -868,4 +904,5 @@ void pim_cmd_init(void)
|
|||||||
install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
|
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_rpf_vrf_all_cmd);
|
||||||
install_element(VIEW_NODE, &show_ipv6_pim_secondary_cmd);
|
install_element(VIEW_NODE, &show_ipv6_pim_secondary_cmd);
|
||||||
|
install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
|
||||||
}
|
}
|
||||||
|
@ -4885,9 +4885,9 @@ DEFUN (show_ip_pim_bsrp,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_pim_statistics,
|
DEFPY (show_ip_pim_statistics,
|
||||||
show_ip_pim_statistics_cmd,
|
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
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
PIM_STR
|
PIM_STR
|
||||||
@ -4897,17 +4897,26 @@ DEFUN (show_ip_pim_statistics,
|
|||||||
"PIM interface\n"
|
"PIM interface\n"
|
||||||
JSON_STR)
|
JSON_STR)
|
||||||
{
|
{
|
||||||
int idx = 2;
|
struct pim_instance *pim;
|
||||||
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
|
struct vrf *v;
|
||||||
bool uj = use_json(argc, argv);
|
bool uj = !!json;
|
||||||
|
|
||||||
if (!vrf)
|
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
|
||||||
|
|
||||||
|
if (!v)
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
|
|
||||||
if (argv_find(argv, argc, "WORD", &idx))
|
pim = pim_get_pim_instance(v->vrf_id);
|
||||||
pim_show_statistics(vrf->info, vty, argv[idx]->arg, uj);
|
|
||||||
|
if (!pim) {
|
||||||
|
vty_out(vty, "%% Unable to find pim instance\n");
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (word)
|
||||||
|
pim_show_statistics(pim, vty, word, uj);
|
||||||
else
|
else
|
||||||
pim_show_statistics(vrf->info, vty, NULL, uj);
|
pim_show_statistics(pim, vty, NULL, uj);
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user