mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 20:13:53 +00:00
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>
This commit is contained in:
parent
154aa4fcd4
commit
78b0e69073
@ -1406,31 +1406,7 @@ DEFPY (show_ipv6_pim_neighbor_vrf_all,
|
||||
"Name of interface or neighbor\n"
|
||||
JSON_STR)
|
||||
{
|
||||
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;
|
||||
return pim_show_neighbors_vrf_all_cmd_helper(vty, json, interface);
|
||||
}
|
||||
|
||||
DEFPY (show_ipv6_pim_nexthop,
|
||||
|
@ -2850,31 +2850,7 @@ DEFPY (show_ip_pim_neighbor_vrf_all,
|
||||
"Name of interface or neighbor\n"
|
||||
JSON_STR)
|
||||
{
|
||||
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;
|
||||
return pim_show_neighbors_vrf_all_cmd_helper(vty, json, interface);
|
||||
}
|
||||
|
||||
DEFPY (show_ip_pim_secondary,
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -105,6 +105,8 @@ void ip_pim_ssm_show_group_range(struct pim_instance *pim, struct vty *vty,
|
||||
void pim_show_nexthop(struct pim_instance *pim, struct vty *vty);
|
||||
int pim_show_neighbors_cmd_helper(const char *vrf, struct vty *vty,
|
||||
const char *json, const char *interface);
|
||||
int pim_show_neighbors_vrf_all_cmd_helper(struct vty *vty, const char *json,
|
||||
const char *interface);
|
||||
void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty,
|
||||
const char *neighbor, json_object *json);
|
||||
void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
|
||||
|
Loading…
Reference in New Issue
Block a user