]> git.puffer.fish Git - mirror/frr.git/commitdiff
pim6d: Moving the common lines of pim_local_membership cli
authorSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 07:31:33 +0000 (00:31 -0700)
committerSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 07:34:33 +0000 (00:34 -0700)
Moving the common lines of pim_local_membership 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 5838cf67fb053ea32da34b19cb94a8ecbf099d6c..3fb36eae71ef3c9cd3fd5437050466a2cafaafeb 100644 (file)
@@ -1376,17 +1376,7 @@ DEFPY (show_ipv6_pim_local_membership,
        "PIM interface local-membership\n"
        JSON_STR)
 {
-       struct vrf *v;
-       bool uj = !!json;
-
-       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
-       if (!v)
-               return CMD_WARNING;
-
-       pim_show_membership(v->info, vty, uj);
-
-       return CMD_SUCCESS;
+       return pim_show_membership_cmd_helper(vrf, vty, !!json);
 }
 
 DEFPY (show_ipv6_pim_neighbor,
index 4869c548e9ab5f40119bc2f8d09bb24c4c38cc1a..31162fdf1e39f16c7bed4c577daf0d65575e51e1 100644 (file)
@@ -2553,17 +2553,7 @@ DEFPY (show_ip_pim_local_membership,
        "PIM interface local-membership\n"
        JSON_STR)
 {
-       struct vrf *v;
-       bool uj = !!json;
-
-       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
-       if (!v)
-               return CMD_WARNING;
-
-       pim_show_membership(v->info, vty, uj);
-
-       return CMD_SUCCESS;
+       return pim_show_membership_cmd_helper(vrf, vty, !!json);
 }
 
 static void pim_show_mlag_up_entry_detail(struct vrf *vrf,
index 949882d1703ac7188f9e931db7ca71480a5b48ef..ca7ab5577f4608a5a0b88bb1d616b966433ad89d 100644 (file)
@@ -1758,6 +1758,20 @@ void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty)
        }
 }
 
+int pim_show_membership_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_membership(v->info, vty, uj);
+
+       return CMD_SUCCESS;
+}
+
 static void pim_show_membership_helper(struct vty *vty,
                                       struct pim_interface *pim_ifp,
                                       struct pim_ifchannel *ch,
index 6719be2b948e55c552f826705e9e71e92ae3c2b3..b16dd4b9481f289964594ec2db081468cc4dce1f 100644 (file)
@@ -87,6 +87,7 @@ 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);
+int pim_show_membership_cmd_helper(const char *vrf, 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);
 int pim_show_channel_cmd_helper(const char *vrf, struct vty *vty, bool uj);