]> git.puffer.fish Git - mirror/frr.git/commitdiff
pim6d: Moving the common lines of pim_show_channel cli
authorSai Gomathi N <nsaigomathi@vmware.com>
Thu, 2 Jun 2022 04:54:44 +0000 (21:54 -0700)
committerSai Gomathi N <nsaigomathi@vmware.com>
Thu, 9 Jun 2022 06:25:51 +0000 (23:25 -0700)
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>
pimd/pim6_cmd.c
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index 77844988eab18969e017f26e87e8c2720bd152f8..bb9e2f7db60b5b74a28bde5c14ab301571b85645 100644 (file)
@@ -1235,17 +1235,7 @@ DEFPY (show_ipv6_pim_channel,
        "PIM downstream channel info\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_channel(v->info, vty, uj);
-
-       return CMD_SUCCESS;
+       return pim_show_channel_cmd_helper(vrf, vty, !!json);
 }
 
 DEFPY (show_ipv6_pim_interface,
index 2d6ce24381af2f9703148bf9c61488fb3fd6ebcb..3cdf53709d6901dc2230ff410ab0df58d8a29f57 100644 (file)
@@ -3168,17 +3168,7 @@ DEFPY (show_ip_pim_channel,
        "PIM downstream channel info\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_channel(v->info, vty, uj);
-
-       return CMD_SUCCESS;
+       return pim_show_channel_cmd_helper(vrf, vty, !!json);
 }
 
 DEFPY (show_ip_pim_upstream_join_desired,
index d5eb763df350be0fd0fd2df0817d3097adf01eb7..895ac0c81e985c716ae407c31fe71a4b94f8ece5 100644 (file)
@@ -1945,6 +1945,20 @@ void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj)
                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,
                         json_object *json)
 {
index 9644f84e0c57476096f2f55fb68b42f0437ac1ae..21592385a475c2a2537755ebb9bdb51a0c47ee00 100644 (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_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);
 void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
                         json_object *json);
 void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty,