diff options
| author | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-06-09 02:36:08 -0700 |
|---|---|---|
| committer | Sai Gomathi N <nsaigomathi@vmware.com> | 2022-06-09 02:36:08 -0700 |
| commit | 78b0e6907301bf93500a9341035541770f90b896 (patch) | |
| tree | 194953def96b3b2ed112c9e36319b29aa9178718 /pimd/pim_cmd_common.c | |
| parent | 154aa4fcd42743f9f0bc370489ed28e78fb27262 (diff) | |
pim6d: Moving the common lines of pim_show_neighbors_vrf_all cli
Moving the common lines of pim_show_neighbors_vrf_all 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 | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c index 42c6c2c98c..e7299f2214 100644 --- a/pimd/pim_cmd_common.c +++ b/pimd/pim_cmd_common.c @@ -2636,6 +2636,36 @@ int pim_show_neighbors_cmd_helper(const char *vrf, struct vty *vty, return CMD_SUCCESS; } +int pim_show_neighbors_vrf_all_cmd_helper(struct vty *vty, const char *json, + const char *interface) +{ + struct vrf *v; + json_object *json_parent = NULL; + json_object *json_vrf = NULL; + + if (json) + json_parent = json_object_new_object(); + RB_FOREACH (v, vrf_name_head, &vrfs_by_name) { + if (!json) + vty_out(vty, "VRF: %s\n", v->name); + else + json_vrf = json_object_new_object(); + + if (interface) + pim_show_neighbors_single(v->info, vty, interface, + json_vrf); + else + pim_show_neighbors(v->info, vty, json_vrf); + + if (json) + json_object_object_add(json_parent, v->name, json_vrf); + } + 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) { |
