]> git.puffer.fish Git - mirror/frr.git/commitdiff
pim6d: Moving reusable code to common api for "show pim secondary" command
authorAbhishek N R <abnr@vmware.com>
Thu, 9 Jun 2022 08:33:01 +0000 (01:33 -0700)
committerAbhishek N R <abnr@vmware.com>
Thu, 9 Jun 2022 08:33:01 +0000 (01:33 -0700)
Signed-off-by: Abhishek N R <abnr@vmware.com>
pimd/pim6_cmd.c
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index 1b83d38b91bbb99f1f4a1b7c2400999c32470e24..2f073922132d6fb2205998ab174949a3ca2c2d37 100644 (file)
@@ -844,24 +844,7 @@ DEFPY (show_ipv6_pim_secondary,
        VRF_CMD_HELP_STR
        "PIM neighbor addresses\n")
 {
-       struct pim_instance *pim;
-       struct vrf *v;
-
-       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
-       if (!v)
-               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_neighbors_secondary(pim, vty);
-
-       return CMD_SUCCESS;
+       return pim_show_secondary_helper(vrf, vty);
 }
 
 DEFPY (show_ipv6_pim_statistics,
index b67bc23523b20bd0a3624ab855ee8b38d99c9335..f8d0cf7eaf8e23c9dcc87ed9bcf41a7c5afe0061 100644 (file)
@@ -2980,24 +2980,7 @@ DEFPY (show_ip_pim_secondary,
        VRF_CMD_HELP_STR
        "PIM neighbor addresses\n")
 {
-       struct pim_instance *pim;
-       struct vrf *v;
-
-       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
-       if (!v)
-               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_neighbors_secondary(pim, vty);
-
-       return CMD_SUCCESS;
+       return pim_show_secondary_helper(vrf, vty);
 }
 
 DEFPY (show_ip_pim_state,
index 3bc7381e0d03f22c25120c3da3ab8b0479f7b3f0..303c9abe1309af1f8bd12ab6f04e5d729b9d6214 100644 (file)
@@ -3865,3 +3865,25 @@ int pim_show_rp_vrf_all_helper(struct vty *vty, const char *group_str,
 
        return CMD_SUCCESS;
 }
+
+int pim_show_secondary_helper(const char *vrf, struct vty *vty)
+{
+       struct pim_instance *pim;
+       struct vrf *v;
+
+       v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+       if (!v)
+               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_neighbors_secondary(pim, vty);
+
+       return CMD_SUCCESS;
+}
index baea749778ebc1cc71a8e0b2d4b4b43d6cd6adb7..c88dd48fe6b0a4a81809f9ad0a259b452220e923 100644 (file)
@@ -137,6 +137,7 @@ int pim_show_rp_helper(const char *vrf, struct vty *vty, const char *group_str,
                       const struct prefix *group, bool json);
 int pim_show_rp_vrf_all_helper(struct vty *vty, const char *group_str,
                               const struct prefix *group, bool json);
+int pim_show_secondary_helper(const char *vrf, struct vty *vty);
 
 /*
  * Special Macro to allow us to get the correct pim_instance;