pim6d: Moving the common lines of pim_show_channel cli

Moving the common lines of pim_show_channel cli
in pim_cmd.c and pim6_cmd.c to pim_cmd_common.c file

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
This commit is contained in:
Sai Gomathi N 2022-06-01 21:54:44 -07:00
parent f5b2f86ac0
commit b6bf33775d
4 changed files with 17 additions and 22 deletions

View file

@ -1235,17 +1235,7 @@ DEFPY (show_ipv6_pim_channel,
"PIM downstream channel info\n" "PIM downstream channel info\n"
JSON_STR) JSON_STR)
{ {
struct vrf *v; return pim_show_channel_cmd_helper(vrf, vty, !!json);
bool uj = !!json;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
if (!v)
return CMD_WARNING;
pim_show_channel(v->info, vty, uj);
return CMD_SUCCESS;
} }
DEFPY (show_ipv6_pim_interface, DEFPY (show_ipv6_pim_interface,

View file

@ -3168,17 +3168,7 @@ DEFPY (show_ip_pim_channel,
"PIM downstream channel info\n" "PIM downstream channel info\n"
JSON_STR) JSON_STR)
{ {
struct vrf *v; return pim_show_channel_cmd_helper(vrf, vty, !!json);
bool uj = !!json;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
if (!v)
return CMD_WARNING;
pim_show_channel(v->info, vty, uj);
return CMD_SUCCESS;
} }
DEFPY (show_ip_pim_upstream_join_desired, DEFPY (show_ip_pim_upstream_join_desired,

View file

@ -1945,6 +1945,20 @@ void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj)
vty_json(vty, json); vty_json(vty, json);
} }
int pim_show_channel_cmd_helper(const char *vrf, struct vty *vty, bool uj)
{
struct vrf *v;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
if (!v)
return CMD_WARNING;
pim_show_channel(v->info, vty, uj);
return CMD_SUCCESS;
}
void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag, void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
json_object *json) json_object *json)
{ {

View file

@ -88,6 +88,7 @@ void pim_show_join(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,
void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty); void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty);
void pim_show_membership(struct pim_instance *pim, struct vty *vty, bool uj); void pim_show_membership(struct pim_instance *pim, struct vty *vty, bool uj);
void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj); void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj);
int pim_show_channel_cmd_helper(const char *vrf, struct vty *vty, bool uj);
void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag, void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
json_object *json); json_object *json);
void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty, void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty,