]> git.puffer.fish Git - mirror/frr.git/commitdiff
pimd: Moving pim_cli_get_vrf_name function to common file
authorMobashshera Rasool <mrasool@vmware.com>
Fri, 25 Feb 2022 08:59:14 +0000 (00:59 -0800)
committerMobashshera Rasool <mrasool@vmware.com>
Mon, 28 Feb 2022 09:38:41 +0000 (01:38 -0800)
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
pimd/pim_cmd.c
pimd/pim_cmd_common.c
pimd/pim_cmd_common.h

index 851af0ffca14212356afded8a8a5497c14552601..88b45d9eec0d21cedd5f7cbd46c5c5d8df159d88 100644 (file)
@@ -3761,31 +3761,6 @@ static void clear_interfaces(struct pim_instance *pim)
                return CMD_WARNING_CONFIG_FAILED;                       \
        }
 
-/**
- * Get current node VRF name.
- *
- * NOTE:
- * In case of failure it will print error message to user.
- *
- * \returns name or NULL if failed to get VRF.
- */
-static const char *pim_cli_get_vrf_name(struct vty *vty)
-{
-       const struct lyd_node *vrf_node;
-
-       /* Not inside any VRF context. */
-       if (vty->xpath_index == 0)
-               return VRF_DEFAULT_NAME;
-
-       vrf_node = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
-       if (vrf_node == NULL) {
-               vty_out(vty, "%% Failed to get vrf dnode in configuration\n");
-               return NULL;
-       }
-
-       return yang_dnode_get_string(vrf_node, "./name");
-}
-
 /**
  * Compatibility function to keep the legacy mesh group CLI behavior:
  * Delete group when there are no more configurations in it.
index 23fff2f477381435d6a99d828de102e2b3af14e8..a85a2f0b4d7c5cb9e0abb9d0744fb1e4faade54e 100644 (file)
 #include "pim_errors.h"
 #include "pim_nb.h"
 
+/**
+ * Get current node VRF name.
+ *
+ * NOTE:
+ * In case of failure it will print error message to user.
+ *
+ * \returns name or NULL if failed to get VRF.
+ */
+const char *pim_cli_get_vrf_name(struct vty *vty)
+{
+       const struct lyd_node *vrf_node;
+
+       /* Not inside any VRF context. */
+       if (vty->xpath_index == 0)
+               return VRF_DEFAULT_NAME;
+
+       vrf_node = yang_dnode_get(vty->candidate_config->dnode, VTY_CURR_XPATH);
+       if (vrf_node == NULL) {
+               vty_out(vty, "%% Failed to get vrf dnode in configuration\n");
+               return NULL;
+       }
+
+       return yang_dnode_get_string(vrf_node, "./name");
+}
 
index 5ca600791a59b4661fcc4312b2878a7d25a153db..d0cc9b7d44e4c1a8a3fca4fe3605f445d85b1511 100644 (file)
@@ -19,4 +19,6 @@
  */
 #ifndef PIM_CMD_COMMON_H
 #define PIM_CMD_COMMON_H
+
+const char *pim_cli_get_vrf_name(struct vty *vty);
 #endif /* PIM_CMD_COMMON_H */