pim6d: Moving the common lines of pim_show_jp_agg cli

Moving the common lines of pim_show_jp_agg 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-09 00:15:11 -07:00
parent 342ba5f3bd
commit 3ca4082343
4 changed files with 26 additions and 38 deletions

View File

@ -1363,25 +1363,7 @@ DEFPY (show_ipv6_pim_jp_agg,
VRF_CMD_HELP_STR
"join prune aggregation list\n")
{
struct vrf *v;
struct pim_instance *pim;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
if (!v) {
vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
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;
}
pim_show_jp_agg_list(pim, vty);
return CMD_SUCCESS;
return pim_show_jp_agg_list_cmd_helper(vrf, vty);
}
DEFPY (show_ipv6_pim_local_membership,

View File

@ -2540,25 +2540,7 @@ DEFPY (show_ip_pim_jp_agg,
VRF_CMD_HELP_STR
"join prune aggregation list\n")
{
struct vrf *v;
struct pim_instance *pim;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
if (!v) {
vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
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;
}
pim_show_jp_agg_list(pim, vty);
return CMD_SUCCESS;
return pim_show_jp_agg_list_cmd_helper(vrf, vty);
}
DEFPY (show_ip_pim_local_membership,

View File

@ -1701,6 +1701,29 @@ static void pim_show_jp_agg_helper(struct vty *vty, struct interface *ifp,
is_join ? "J" : "P");
}
int pim_show_jp_agg_list_cmd_helper(const char *vrf, struct vty *vty)
{
struct vrf *v;
struct pim_instance *pim;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
if (!v) {
vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
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;
}
pim_show_jp_agg_list(pim, vty);
return CMD_SUCCESS;
}
void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty)
{
struct interface *ifp;

View File

@ -85,6 +85,7 @@ void pim_print_ifp_flags(struct vty *vty, struct interface *ifp);
void json_object_pim_upstream_add(json_object *json, struct pim_upstream *up);
void pim_show_join(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,
json_object *json);
int pim_show_jp_agg_list_cmd_helper(const char *vrf, 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_channel(struct pim_instance *pim, struct vty *vty, bool uj);