diff options
| author | Abhishek N R <abnr@vmware.com> | 2022-06-09 01:59:58 -0700 |
|---|---|---|
| committer | Abhishek N R <abnr@vmware.com> | 2022-06-09 01:59:58 -0700 |
| commit | 19296b58e4ceb9539a20e08777f90cea7a49c77e (patch) | |
| tree | 6aa97687b764d1c1285474005f63cb1d522e8de6 /pimd/pim_cmd_common.c | |
| parent | 5e52c8d5c84e35cc5bbddeb79929ba38324b0204 (diff) | |
pim6d: Moving reusable code to common api for "show pim statistics" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd_common.c')
| -rw-r--r-- | pimd/pim_cmd_common.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index 303c9abe13..46f48e91a1 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -3887,3 +3887,29 @@ int pim_show_secondary_helper(const char *vrf, struct vty *vty) 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; +} |
