]> git.proxmox.com Git - mirror_frr.git/commitdiff
pim6d: Moving the common lines of pim_show_jp_agg cli
authorSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 07:15:11 +0000 (00:15 -0700)
committerSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 07:34:24 +0000 (00:34 -0700)
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>
pimd/pim6_cmd.c
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index 8af576321235b5a2020f320e608f3bfc373d41b0..5838cf67fb053ea32da34b19cb94a8ecbf099d6c 100644 (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,
index 6c8d2e357555dde61fb61e930669f58d446f7fe8..4869c548e9ab5f40119bc2f8d09bb24c4c38cc1a 100644 (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,
index 95526e899ad1be8ec692466bb1a7c1b979cf2702..949882d1703ac7188f9e931db7ca71480a5b48ef 100644 (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;
index f7c4e54e0eb1596bc244f61773176e6b7974eccf..6719be2b948e55c552f826705e9e71e92ae3c2b3 100644 (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);