summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorSai Gomathi N <nsaigomathi@vmware.com>2022-06-09 22:43:52 -0700
committerSai Gomathi N <nsaigomathi@vmware.com>2022-06-09 22:43:52 -0700
commit94c691ba40002d336f84295c8f1ab41615b12aed (patch)
treeefc0a0936ba47998b107149ec35db70c05deb710 /pimd/pim_cmd.c
parentfe7eaf4065cab165d40a6010d00d5c84273a4cf0 (diff)
pim6d: Moving the reusable code of pim_show_join cli
Moving the common lines of pim_show_join_vrf and pim_show_join_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.c')
-rw-r--r--pimd/pim_cmd.c59
1 files changed, 2 insertions, 57 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index ccd3a64bed..3b2ef9aaf1 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -2460,41 +2460,7 @@ DEFPY (show_ip_pim_join,
"The Group\n"
JSON_STR)
{
- pim_sgaddr sg = {0};
- struct vrf *v;
- struct pim_instance *pim;
- json_object *json_parent = NULL;
-
- v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
- if (!v) {
- vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
- 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 (s_or_g.s_addr != INADDR_ANY) {
- if (g.s_addr != INADDR_ANY) {
- sg.src = s_or_g;
- sg.grp = g;
- } else
- sg.grp = s_or_g;
- }
-
- if (json)
- json_parent = json_object_new_object();
-
- pim_show_join(pim, vty, &sg, json_parent);
-
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_join_cmd_helper(vrf, vty, s_or_g, g, json);
}
DEFPY (show_ip_pim_join_vrf_all,
@@ -2507,28 +2473,7 @@ DEFPY (show_ip_pim_join_vrf_all,
"PIM interface join information\n"
JSON_STR)
{
- pim_sgaddr sg = {0};
- struct vrf *vrf_struct;
- json_object *json_parent = NULL;
- json_object *json_vrf = NULL;
-
- if (json)
- json_parent = json_object_new_object();
- RB_FOREACH (vrf_struct, vrf_name_head, &vrfs_by_name) {
- if (!json)
- vty_out(vty, "VRF: %s\n", vrf_struct->name);
- else
- json_vrf = json_object_new_object();
- pim_show_join(vrf_struct->info, vty, &sg, json_vrf);
-
- if (json)
- json_object_object_add(json_parent, vrf_struct->name,
- json_vrf);
- }
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_WARNING;
+ return pim_show_join_vrf_all_cmd_helper(vty, json);
}
DEFPY (show_ip_pim_jp_agg,