summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorAbhishek N R <abnr@vmware.com>2022-06-09 07:49:16 +0200
committerAbhishek N R <abnr@vmware.com>2022-06-09 07:49:16 +0200
commit6d1bd8c28a7b8df89420c5819bd1224d55895811 (patch)
tree01161ebd1644753322da50e4a64751e5dd9f5c85 /pimd/pim_cmd.c
parentMerge pull request #11369 from donaldsharp/pim_addr_cmp (diff)
downloadfrr-6d1bd8c28a7b8df89420c5819bd1224d55895811.tar.xz
frr-6d1bd8c28a7b8df89420c5819bd1224d55895811.zip
pim6d: Moving resuable code to common api for "show pim rpf" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c48
1 files changed, 2 insertions, 46 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 2d6ce2438..53ea54e90 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3343,31 +3343,7 @@ DEFPY (show_ip_pim_rpf,
"PIM cached source rpf information\n"
JSON_STR)
{
- struct pim_instance *pim;
- struct vrf *v;
- json_object *json_parent = NULL;
-
- 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 (json)
- json_parent = json_object_new_object();
-
- pim_show_rpf(pim, vty, json_parent);
-
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_rpf_helper(vrf, vty, !!json);
}
DEFPY (show_ip_pim_rpf_vrf_all,
@@ -3380,27 +3356,7 @@ DEFPY (show_ip_pim_rpf_vrf_all,
"PIM cached source rpf information\n"
JSON_STR)
{
- struct vrf *vrf;
- json_object *json_parent = NULL;
- json_object *json_vrf = NULL;
-
- if (json)
- json_parent = json_object_new_object();
-
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (!json)
- vty_out(vty, "VRF: %s\n", vrf->name);
- else
- json_vrf = json_object_new_object();
- pim_show_rpf(vrf->info, vty, json_vrf);
- if (json)
- json_object_object_add(json_parent, vrf->name,
- json_vrf);
- }
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_rpf_vrf_all_helper(vty, !!json);
}
DEFPY (show_ip_pim_nexthop,