psutils: Move functions from updater to utils

Move common, utility functions from updater.*pp to utils.*pp.  This will
enable those functions to be used by other command line options in the
psutils tool.

Modify --get-version and --get-model to use the new utility functions.

Also update --get-version to provide a single getVersion() function that
handles the existence of the psu.json file as a low-level implementation
detail.

Tested:
* Verified all automated tests run successfully
* Verified --get-version still works
  * With psu.json file
  * Without psu.json file
* Verified --get-model still works
  * With psu.json file
  * Without psu.json file
* Verified --update still gets correct device path, device name, and I2C
  bus/address from functions that moved to utils.*pp
* The complete test plan is available at
  https://gist.github.com/smccarney/c049e24655d32e22cab9d521d145774a

Change-Id: I51ceca10957dc9a924d0d7516dc29632a6ed82d3
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/tools/power-utils/utils.hpp b/tools/power-utils/utils.hpp
index 4c86b54..256ae60 100644
--- a/tools/power-utils/utils.hpp
+++ b/tools/power-utils/utils.hpp
@@ -23,6 +23,7 @@
 #include <memory>
 #include <string>
 #include <tuple>
+#include <utility> // for std::pair
 
 /**
  * @namespace utils
@@ -85,4 +86,41 @@
  */
 bool checkFileExists(const std::string& filePath);
 
+/**
+ * @brief Get the device name from the device path
+ *
+ * @param[in] devPath - PSU path
+ *
+ * @return device name e.g. 3-0068
+ */
+std::string getDeviceName(std::string devPath);
+
+/**
+ * @brief Function to get device path using DBus bus and PSU
+ * inventory Path
+ *
+ * @param[in] bus - The sdbusplus DBus bus connection
+ * @param[in] psuInventoryPath - PSU inventory path
+ *
+ * @return device path e.g. /sys/bus/i2c/devices/3-0068
+ */
+std::string getDevicePath(sdbusplus::bus_t& bus,
+                          const std::string& psuInventoryPath);
+
+/**
+ * @brief Parse the device name to obtain bus and device address
+ *
+ * @param[in] devName - Device name
+ *
+ * @return bus and device address
+ */
+std::pair<uint8_t, uint8_t> parseDeviceName(const std::string& devName);
+
+/**
+ * @brief Wrapper to check existence of PSU JSON file
+ *
+ * @return true or false (true if using JSON file)
+ */
+bool usePsuJsonFile();
+
 } // namespace utils