diff options
| author | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-06-09 01:34:06 -0700 |
|---|---|---|
| committer | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-06-09 01:34:06 -0700 |
| commit | 154aa4fcd42743f9f0bc370489ed28e78fb27262 (patch) | |
| tree | 11160fbc4052e716c9c1249f2535030b7dceec58 /pimd/pim_cmd_common.c | |
| parent | bec5bdbe7f3b33efe69d624a07cb9c799c135115 (diff) | |
pim6d: Moving the common lines of pim_show_neighbors cli
Moving the common lines of pim_show_neighbors cli
in pim_cmd.c and pim6_cmd.c to pim_cmd_common.c file
Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
Diffstat (limited to 'pimd/pim_cmd_common.c')
| -rw-r--r-- | pimd/pim_cmd_common.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index ca7ab5577f..42c6c2c98c 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -2611,6 +2611,31 @@ void pim_show_nexthop(struct pim_instance *pim, struct vty *vty) hash_walk(pim->rpf_hash, pim_print_pnc_cache_walkcb, &cwd); } +int pim_show_neighbors_cmd_helper(const char *vrf, struct vty *vty, + const char *json, const char *interface) +{ + struct vrf *v; + json_object *json_parent = NULL; + + v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME); + + if (!v) + return CMD_WARNING; + + if (json) + json_parent = json_object_new_object(); + + if (interface) + pim_show_neighbors_single(v->info, vty, interface, json_parent); + else + pim_show_neighbors(v->info, vty, json_parent); + + if (json) + vty_json(vty, json_parent); + + return CMD_SUCCESS; +} + void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty, const char *neighbor, json_object *json) { |
