]> git.puffer.fish Git - matthieu/frr.git/commitdiff
pim6d: Moving reusable code to common api for "show pim upstream join desired" command
authorAbhishek N R <abnr@vmware.com>
Thu, 9 Jun 2022 09:57:49 +0000 (02:57 -0700)
committerAbhishek N R <abnr@vmware.com>
Thu, 9 Jun 2022 09:57:49 +0000 (02:57 -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 446395272e80e062368505d55d0b72e7225872b6..998e0d1d7451f2be0efd38c640cbf44da4432999 100644 (file)
@@ -900,25 +900,7 @@ DEFPY (show_ipv6_pim_upstream_join_desired,
        "PIM upstream join-desired\n"
        JSON_STR)
 {
-       struct pim_instance *pim;
-       struct vrf *v;
-       bool uj = !!json;
-
-       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_join_desired(pim, vty, uj);
-
-       return CMD_SUCCESS;
+       return pim_show_upstream_join_desired_helper(vrf, vty, !!json);
 }
 
 DEFPY (show_ipv6_pim_upstream_rpf,
index ac16fd1b7ffc0a3e978b23ffaba161e9f05b9a65..54e1aae4d11160ff1df99eaa48ae07f0b38f82e6 100644 (file)
@@ -3118,25 +3118,7 @@ DEFPY (show_ip_pim_upstream_join_desired,
        "PIM upstream join-desired\n"
        JSON_STR)
 {
-       struct pim_instance *pim;
-       struct vrf *v;
-       bool uj = !!json;
-
-       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_join_desired(pim, vty, uj);
-
-       return CMD_SUCCESS;
+       return pim_show_upstream_join_desired_helper(vrf, vty, !!json);
 }
 
 DEFPY (show_ip_pim_upstream_rpf,
index 1159ebd3dd1623327a49acc8f3597bc2a7d80968..26a6e8a1c3aaa2b53035b3a3c199320bbc47f783 100644 (file)
@@ -3980,3 +3980,26 @@ int pim_show_upstream_vrf_all_helper(struct vty *vty, bool json)
 
        return CMD_SUCCESS;
 }
+
+int pim_show_upstream_join_desired_helper(const char *vrf, struct vty *vty,
+                                         bool uj)
+{
+       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_join_desired(pim, vty, uj);
+
+       return CMD_SUCCESS;
+}
index 013db7959960d077721af85b62d7eaf200ef70c9..038f7f4d7ff31303312f6a3b51c0dfe632f2f628 100644 (file)
@@ -143,6 +143,8 @@ int pim_show_statistics_helper(const char *vrf, struct vty *vty,
 int pim_show_upstream_helper(const char *vrf, struct vty *vty, pim_addr s_or_g,
                             pim_addr g, bool json);
 int pim_show_upstream_vrf_all_helper(struct vty *vty, bool json);
+int pim_show_upstream_join_desired_helper(const char *vrf, struct vty *vty,
+                                         bool uj);
 
 /*
  * Special Macro to allow us to get the correct pim_instance;