summaryrefslogtreecommitdiffstats
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorAbhishek N R <abnr@vmware.com>2022-06-09 13:53:12 +0200
committerAbhishek N R <abnr@vmware.com>2022-06-09 13:53:12 +0200
commit789d0ec4def92ec1fe6a0d24d5eefe7ba8f0fd0f (patch)
treedda1f5c07e04deaadd17bf1cccf186721bf6a039 /pimd/pim_cmd.c
parentpim6d: Moving reusable code to common api for "show ip/ipv6 mroute count" com... (diff)
downloadfrr-789d0ec4def92ec1fe6a0d24d5eefe7ba8f0fd0f.tar.xz
frr-789d0ec4def92ec1fe6a0d24d5eefe7ba8f0fd0f.zip
pim6d: Moving reusable code to common api for "show mroute summary" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c51
1 files changed, 2 insertions, 49 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 3442f8315..9abd5a3b7 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3433,31 +3433,7 @@ DEFPY (show_ip_mroute_summary,
"Summary of all mroutes\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();
-
- show_mroute_summary(pim, vty, json_parent);
-
- if (json)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_mroute_summary_helper(vrf, vty, !!json);
}
DEFPY (show_ip_mroute_summary_vrf_all,
@@ -3470,30 +3446,7 @@ DEFPY (show_ip_mroute_summary_vrf_all,
"Summary of all mroutes\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();
-
- show_mroute_summary(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_mroute_summary_vrf_all_helper(vty, !!json);
}
DEFUN (show_ip_rib,