diff options
| author | Abhishek N R <abnr@vmware.com> | 2022-02-08 23:19:25 -0800 |
|---|---|---|
| committer | Abhishek N R <abnr@vmware.com> | 2022-03-28 23:53:24 -0700 |
| commit | 4f58b6aaa431128d53bf1adade64f4d34a8a7146 (patch) | |
| tree | cce96285622771d8e580f9c1ea7dbc1e6c37ef36 /pimd/pim_cmd.c | |
| parent | 626dab7f3fc54843b34dffe6588dcf2a3b8263f5 (diff) | |
pim6d: Implementing "show ipv6 pim statistics" CLI
Adding new show CLI to display pim statistics.
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
| -rw-r--r-- | pimd/pim_cmd.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 1a44646071..bbee3c943d 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -4885,9 +4885,9 @@ DEFUN (show_ip_pim_bsrp, 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 @@ -4897,17 +4897,26 @@ DEFUN (show_ip_pim_statistics, "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; } |
