diff options
author | Abhishek N R <abnr@vmware.com> | 2022-06-09 13:04:14 +0200 |
---|---|---|
committer | Abhishek N R <abnr@vmware.com> | 2022-06-09 13:04:14 +0200 |
commit | 334d2f8c3d30ef565fde12f0bd76d08aecb4e837 (patch) | |
tree | 7ceaacd7b253a88b1c93fd6552e056da0ff542bf /pimd/pim_cmd.c | |
parent | pim6d: Moving reusable code to common api for "show ip/ipv6 multicast" command (diff) | |
download | frr-334d2f8c3d30ef565fde12f0bd76d08aecb4e837.tar.xz frr-334d2f8c3d30ef565fde12f0bd76d08aecb4e837.zip |
pim6d: Moving reusable code to common api for "show ip/ipv6 multicast count" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r-- | pimd/pim_cmd.c | 49 |
1 files changed, 2 insertions, 47 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 1766bd1fa..dc36471f6 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -3341,31 +3341,7 @@ DEFPY (show_ip_multicast_count, VRF_CMD_HELP_STR 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_multicast_interfaces(pim, vty, json_parent); - - if (json) - vty_json(vty, json_parent); - - return CMD_SUCCESS; + return pim_show_multicast_count_helper(vrf, vty, !!json); } DEFPY (show_ip_multicast_count_vrf_all, @@ -3378,28 +3354,7 @@ DEFPY (show_ip_multicast_count_vrf_all, VRF_CMD_HELP_STR 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_multicast_interfaces(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_multicast_count_vrf_all_helper(vty, !!json); } DEFPY (show_ip_mroute, |