diff options
author | Abhishek N R <abnr@vmware.com> | 2022-06-09 12:29:02 +0200 |
---|---|---|
committer | Abhishek N R <abnr@vmware.com> | 2022-06-09 12:29:02 +0200 |
commit | e7c01c676950b0fe48ab44310a65e22cbcc5d0ee (patch) | |
tree | fc2d6aaf11cb4b31a312dcf459f570188d51b2ac /pimd/pim_cmd.c | |
parent | pim6d: Moving reusable code to common api for "show pim upstream rpf" command (diff) | |
download | frr-e7c01c676950b0fe48ab44310a65e22cbcc5d0ee.tar.xz frr-e7c01c676950b0fe48ab44310a65e22cbcc5d0ee.zip |
pim6d: Moving reusable code to common api for "show pim state" command
Signed-off-by: Abhishek N R <abnr@vmware.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r-- | pimd/pim_cmd.c | 48 |
1 files changed, 2 insertions, 46 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 225d79c2e..6cd9e5fbd 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -2995,31 +2995,7 @@ DEFPY (show_ip_pim_state, "Multicast address\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_state(pim, vty, s_or_g_str, g_str, json_parent); - - if (json) - vty_json(vty, json_parent); - - return CMD_SUCCESS; + return pim_show_state_helper(vrf, vty, s_or_g_str, g_str, !!json); } DEFPY (show_ip_pim_state_vrf_all, @@ -3034,27 +3010,7 @@ DEFPY (show_ip_pim_state_vrf_all, "Multicast address\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_state(vrf->info, vty, s_or_g_str, g_str, 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_state_vrf_all_helper(vty, s_or_g_str, g_str, !!json); } DEFPY (show_ip_pim_upstream, |