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/main.cpp b/tools/power-utils/main.cpp
index 8ca7c04..236f0d6 100644
--- a/tools/power-utils/main.cpp
+++ b/tools/power-utils/main.cpp
@@ -13,11 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "config.h"
-
#include "model.hpp"
#include "updater.hpp"
-#include "utils.hpp"
#include "version.hpp"
#include <CLI/CLI.hpp>
@@ -55,18 +52,10 @@
std::string ret;
- bool useJsonFile = utils::checkFileExists(PSU_JSON_PATH);
auto bus = sdbusplus::bus::new_default();
if (!psuPathVersion.empty())
{
- if (!useJsonFile)
- {
- ret = version::getVersion(bus, psuPathVersion);
- }
- else
- {
- ret = version::getVersion(psuPathVersion);
- }
+ ret = version::getVersion(bus, psuPathVersion);
}
if (!psuPathModel.empty())
{
diff --git a/tools/power-utils/model.cpp b/tools/power-utils/model.cpp
index 6677eac..7bfda66 100644
--- a/tools/power-utils/model.cpp
+++ b/tools/power-utils/model.cpp
@@ -140,8 +140,7 @@
std::string model;
try
{
- // If PSU JSON file exists
- if (checkFileExists(PSU_JSON_PATH))
+ if (usePsuJsonFile())
{
// Obtain PSU information from JSON file
model = internal::getModelJson(psuInventoryPath);
diff --git a/tools/power-utils/test/meson.build b/tools/power-utils/test/meson.build
index 61c5f53..33d3df1 100644
--- a/tools/power-utils/test/meson.build
+++ b/tools/power-utils/test/meson.build
@@ -1,33 +1,13 @@
test(
- 'test_version',
+ 'psutils-tests',
executable(
- 'test_version',
- 'test_version.cpp',
- '../version.cpp',
- '../utils.cpp',
- dependencies: [
- gtest,
- nlohmann_json_dep,
- phosphor_logging,
- ],
- implicit_include_directories: false,
- include_directories: libpower_inc,
- link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
- link_with: [
- libpower,
- ],
- objects: record_manager,
- )
-)
-
-test(
- 'test_updater',
- executable(
- 'test_updater',
+ 'psutils-tests',
'test_updater.cpp',
+ 'test_utils.cpp',
+ 'test_version.cpp',
'../updater.cpp',
'../utils.cpp',
+ '../version.cpp',
dependencies: [
gtest,
gmock,
@@ -46,6 +26,5 @@
libpower,
libi2c_dev_mock
],
- objects: record_manager,
)
)
diff --git a/tools/power-utils/test/test_updater.cpp b/tools/power-utils/test/test_updater.cpp
index 9c34926..a56d2df 100644
--- a/tools/power-utils/test/test_updater.cpp
+++ b/tools/power-utils/test/test_updater.cpp
@@ -27,17 +27,6 @@
using ::testing::An;
using ::testing::Pointee;
-namespace updater
-{
-namespace internal
-{
-
-std::string getDeviceName(std::string devPath);
-std::pair<uint8_t, uint8_t> parseDeviceName(const std::string& devName);
-
-} // namespace internal
-} // namespace updater
-
using namespace updater;
class TestUpdater : public ::testing::Test
@@ -103,30 +92,3 @@
EXPECT_CALL(i2c, read(0xf1, An<uint8_t&>()));
updater->doUpdate();
}
-
-TEST_F(TestUpdater, getDeviceName)
-{
- auto ret = internal::getDeviceName("");
- EXPECT_TRUE(ret.empty());
-
- ret = internal::getDeviceName("/sys/bus/i2c/devices/3-0069");
- EXPECT_EQ("3-0069", ret);
-
- ret = internal::getDeviceName("/sys/bus/i2c/devices/3-0069/");
- EXPECT_EQ("3-0069", ret);
-}
-
-TEST_F(TestUpdater, parseDeviceName)
-{
- auto [id, addr] = internal::parseDeviceName("3-0068");
- EXPECT_EQ(3, id);
- EXPECT_EQ(0x68, addr);
-
- std::tie(id, addr) = internal::parseDeviceName("11-0069");
- EXPECT_EQ(11, id);
- EXPECT_EQ(0x69, addr);
-
- EXPECT_THROW(internal::parseDeviceName("no-number"), std::invalid_argument);
-
- EXPECT_DEATH(internal::parseDeviceName("invalid"), "");
-}
diff --git a/tools/power-utils/test/test_utils.cpp b/tools/power-utils/test/test_utils.cpp
new file mode 100644
index 0000000..b88d024
--- /dev/null
+++ b/tools/power-utils/test/test_utils.cpp
@@ -0,0 +1,50 @@
+/**
+ * Copyright © 2024 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "../utils.hpp"
+
+#include <stdexcept>
+#include <tuple>
+
+#include <gtest/gtest.h>
+
+using namespace utils;
+
+TEST(TestUtils, getDeviceName)
+{
+ auto ret = getDeviceName("");
+ EXPECT_TRUE(ret.empty());
+
+ ret = getDeviceName("/sys/bus/i2c/devices/3-0069");
+ EXPECT_EQ("3-0069", ret);
+
+ ret = getDeviceName("/sys/bus/i2c/devices/3-0069/");
+ EXPECT_EQ("3-0069", ret);
+}
+
+TEST(TestUtils, parseDeviceName)
+{
+ auto [id, addr] = parseDeviceName("3-0068");
+ EXPECT_EQ(3, id);
+ EXPECT_EQ(0x68, addr);
+
+ std::tie(id, addr) = parseDeviceName("11-0069");
+ EXPECT_EQ(11, id);
+ EXPECT_EQ(0x69, addr);
+
+ EXPECT_THROW(parseDeviceName("no-number"), std::invalid_argument);
+
+ EXPECT_DEATH(parseDeviceName("invalid"), "");
+}
diff --git a/tools/power-utils/updater.cpp b/tools/power-utils/updater.cpp
index dab0460..c48decb 100644
--- a/tools/power-utils/updater.cpp
+++ b/tools/power-utils/updater.cpp
@@ -13,8 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "config.h"
-
#include "updater.hpp"
#include "pmbus.hpp"
@@ -22,8 +20,6 @@
#include "utility.hpp"
#include "utils.hpp"
-#include <sys/stat.h>
-
#include <phosphor-logging/log.hpp>
#include <chrono>
@@ -44,75 +40,6 @@
constexpr uint8_t CRC8_POLYNOMIAL = 0x07;
constexpr uint8_t CRC8_INITIAL = 0x00;
-/* Get the device name from the device path */
-std::string getDeviceName(std::string devPath)
-{
- if (devPath.back() == '/')
- {
- devPath.pop_back();
- }
- return fs::path(devPath).stem().string();
-}
-
-// Construct the device path using the I2C bus and address or read inventory
-// path
-std::string getDevicePath(sdbusplus::bus_t& bus,
- const std::string& psuInventoryPath)
-{
- try
- {
- if (internal::usePsuJsonFile())
- {
- auto data = util::loadJSONFromFile(PSU_JSON_PATH);
- if (data == nullptr)
- {
- return {};
- }
- auto devicePath = data["psuDevices"][psuInventoryPath];
- if (devicePath.empty())
- {
- log<level::WARNING>("Unable to find psu devices or path");
- }
- return devicePath;
- }
- else
- {
- const auto& [i2cbus, i2caddr] =
- utils::getPsuI2c(bus, psuInventoryPath);
- const auto DevicePath = "/sys/bus/i2c/devices/";
- std::ostringstream ss;
- ss << std::hex << std::setw(4) << std::setfill('0') << i2caddr;
- std::string addrStr = ss.str();
- std::string busStr = std::to_string(i2cbus);
- std::string devPath = DevicePath + busStr + "-" + addrStr;
- return devPath;
- }
- }
- catch (const std::exception& e)
- {
- log<level::ERR>(
- std::format("Error in getDevicePath: {}", e.what()).c_str());
- return {};
- }
- catch (...)
- {
- log<level::ERR>("Unknown error occurred in getDevicePath");
- return {};
- }
-}
-
-// Parse the device name to get I2C bus and address
-std::pair<uint8_t, uint8_t> parseDeviceName(const std::string& devName)
-{
- // Get I2C bus and device address, e.g. 3-0068
- // is parsed to bus 3, device address 0x68
- auto pos = devName.find('-');
- assert(pos != std::string::npos);
- uint8_t busId = std::stoi(devName.substr(0, pos));
- uint8_t devAddr = std::stoi(devName.substr(pos + 1), nullptr, 16);
- return {busId, devAddr};
-}
-
// Get the appropriate Updater class instance based PSU model number
std::unique_ptr<updater::Updater> getClassInstance(
const std::string& model, const std::string& psuInventoryPath,
@@ -250,17 +177,12 @@
return readDataBytes;
}
-// Wrapper to check existence of PSU JSON file.
-bool usePsuJsonFile()
-{
- return utils::checkFileExists(PSU_JSON_PATH);
-}
} // namespace internal
bool update(sdbusplus::bus_t& bus, const std::string& psuInventoryPath,
const std::string& imageDir)
{
- auto devPath = internal::getDevicePath(bus, psuInventoryPath);
+ auto devPath = utils::getDevicePath(bus, psuInventoryPath);
if (devPath.empty())
{
@@ -289,8 +211,7 @@
Updater::Updater(const std::string& psuInventoryPath,
const std::string& devPath, const std::string& imageDir) :
bus(sdbusplus::bus::new_default()), psuInventoryPath(psuInventoryPath),
- devPath(devPath), devName(internal::getDeviceName(devPath)),
- imageDir(imageDir)
+ devPath(devPath), devName(utils::getDeviceName(devPath)), imageDir(imageDir)
{
fs::path p = fs::path(devPath) / "driver";
try
@@ -397,7 +318,7 @@
// directly read the debugfs to get the status.
try
{
- auto path = internal::getDevicePath(bus, p);
+ auto path = utils::getDevicePath(bus, p);
PMBus pmbus(path);
uint16_t statusWord = pmbus.read(STATUS_WORD, Type::Debug);
auto status0Vout = pmbus.insertPageNum(STATUS_VOUT, 0);
@@ -457,7 +378,7 @@
void Updater::createI2CDevice()
{
- auto [id, addr] = internal::parseDeviceName(devName);
+ auto [id, addr] = utils::parseDeviceName(devName);
i2c = i2c::create(id, addr);
}
} // namespace updater
diff --git a/tools/power-utils/updater.hpp b/tools/power-utils/updater.hpp
index 251347e..c02541b 100644
--- a/tools/power-utils/updater.hpp
+++ b/tools/power-utils/updater.hpp
@@ -19,11 +19,9 @@
#include <sdbusplus/bus.hpp>
-#include <chrono>
#include <filesystem>
#include <memory>
#include <string>
-#include <thread>
class TestUpdater;
@@ -168,36 +166,6 @@
{
/**
- * @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 Factory function to create an Updater instance based on PSU model
* number
*
@@ -275,11 +243,5 @@
std::vector<uint8_t> readFirmwareBytes(std::ifstream& inputFile,
const size_t numberOfBytesToRead);
-/**
- * @brief Wrapper to check existence of PSU JSON file
- *
- * @return true or false (true if using JSON file)
- */
-bool usePsuJsonFile();
} // namespace internal
} // namespace updater
diff --git a/tools/power-utils/utils.cpp b/tools/power-utils/utils.cpp
index 0afc4a8..e70004d 100644
--- a/tools/power-utils/utils.cpp
+++ b/tools/power-utils/utils.cpp
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include "config.h"
+
#include "utils.hpp"
#include "utility.hpp"
@@ -20,14 +22,21 @@
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/Device/error.hpp>
+#include <cassert>
#include <exception>
+#include <filesystem>
+#include <format>
+#include <iomanip>
+#include <ios>
#include <iostream>
#include <regex>
+#include <sstream>
#include <stdexcept>
using namespace phosphor::logging;
using namespace phosphor::power::util;
using namespace sdbusplus::xyz::openbmc_project::Common::Device::Error;
+namespace fs = std::filesystem;
namespace utils
{
@@ -165,4 +174,73 @@
return false;
}
+std::string getDeviceName(std::string devPath)
+{
+ if (devPath.back() == '/')
+ {
+ devPath.pop_back();
+ }
+ return fs::path(devPath).stem().string();
+}
+
+std::string getDevicePath(sdbusplus::bus_t& bus,
+ const std::string& psuInventoryPath)
+{
+ try
+ {
+ if (usePsuJsonFile())
+ {
+ auto data = loadJSONFromFile(PSU_JSON_PATH);
+ if (data == nullptr)
+ {
+ return {};
+ }
+ auto devicePath = data["psuDevices"][psuInventoryPath];
+ if (devicePath.empty())
+ {
+ log<level::WARNING>("Unable to find psu devices or path");
+ }
+ return devicePath;
+ }
+ else
+ {
+ const auto [i2cbus, i2caddr] = getPsuI2c(bus, psuInventoryPath);
+ const auto DevicePath = "/sys/bus/i2c/devices/";
+ std::ostringstream ss;
+ ss << std::hex << std::setw(4) << std::setfill('0') << i2caddr;
+ std::string addrStr = ss.str();
+ std::string busStr = std::to_string(i2cbus);
+ std::string devPath = DevicePath + busStr + "-" + addrStr;
+ return devPath;
+ }
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>(
+ std::format("Error in getDevicePath: {}", e.what()).c_str());
+ return {};
+ }
+ catch (...)
+ {
+ log<level::ERR>("Unknown error occurred in getDevicePath");
+ return {};
+ }
+}
+
+std::pair<uint8_t, uint8_t> parseDeviceName(const std::string& devName)
+{
+ // Get I2C bus and device address, e.g. 3-0068
+ // is parsed to bus 3, device address 0x68
+ auto pos = devName.find('-');
+ assert(pos != std::string::npos);
+ uint8_t busId = std::stoi(devName.substr(0, pos));
+ uint8_t devAddr = std::stoi(devName.substr(pos + 1), nullptr, 16);
+ return {busId, devAddr};
+}
+
+bool usePsuJsonFile()
+{
+ return checkFileExists(PSU_JSON_PATH);
+}
+
} // namespace utils
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
diff --git a/tools/power-utils/version.cpp b/tools/power-utils/version.cpp
index 26507ee..738664d 100644
--- a/tools/power-utils/version.cpp
+++ b/tools/power-utils/version.cpp
@@ -39,6 +39,17 @@
namespace internal
{
+// PsuInfo contains the device path, PMBus access type, and sysfs file name
+using PsuVersionInfo =
+ std::tuple<std::string, phosphor::pmbus::Type, std::string>;
+
+/**
+ * @brief Get PSU version information
+ *
+ * @param[in] psuInventoryPath - The PSU inventory path.
+ *
+ * @return tuple - device path, PMBus access type, and sysfs file name
+ */
PsuVersionInfo getVersionInfo(const std::string& psuInventoryPath)
{
auto data = loadJSONFromFile(PSU_JSON_PATH);
@@ -64,24 +75,83 @@
auto type = getPMBusAccessType(data);
- std::string versionStr;
+ std::string fileName;
for (const auto& fru : data["fruConfigs"])
{
- if (fru["propertyName"] == "Version")
+ if (fru.contains("propertyName") &&
+ (fru["propertyName"] == "Version") && fru.contains("fileName"))
{
- versionStr = fru["fileName"].get<std::string>();
+ fileName = fru["fileName"];
break;
}
}
- if (versionStr.empty())
+ if (fileName.empty())
{
log<level::WARNING>("Unable to find Version file");
return {};
}
- return std::make_tuple(*devicePath, type, versionStr);
+ return std::make_tuple(*devicePath, type, fileName);
}
-// A default implemention compare the string itself
+/**
+ * @brief Get the PSU version from sysfs.
+ *
+ * Obtain PSU information from the PSU JSON file.
+ *
+ * Throws an exception if an error occurs.
+ *
+ * @param[in] psuInventoryPath - PSU D-Bus inventory path
+ *
+ * @return PSU version, or "" if none found
+ */
+std::string getVersionJson(const std::string& psuInventoryPath)
+{
+ // Get PSU device path, PMBus access type, and sysfs file name from JSON
+ const auto [devicePath, type, fileName] = getVersionInfo(psuInventoryPath);
+
+ // Read version from sysfs file
+ std::string version;
+ if (!devicePath.empty() && !fileName.empty())
+ {
+ phosphor::pmbus::PMBus pmbus(devicePath);
+ version = pmbus.readString(fileName, type);
+ }
+ return version;
+}
+
+/**
+ * @brief Get the PSU version from sysfs.
+ *
+ * Obtain PSU information from D-Bus.
+ *
+ * Throws an exception if an error occurs.
+ *
+ * @param[in] bus - D-Bus connection
+ * @param[in] psuInventoryPath - PSU D-Bus inventory path
+ *
+ * @return PSU version, or "" if none found
+ */
+std::string getVersionDbus(sdbusplus::bus_t& bus,
+ const std::string& psuInventoryPath)
+{
+ // Get PSU I2C bus/address and create PMBus interface
+ const auto [i2cbus, i2caddr] = getPsuI2c(bus, psuInventoryPath);
+ auto pmbus = getPmbusIntf(i2cbus, i2caddr);
+
+ // Read version from sysfs file
+ std::string name = "fw_version";
+ auto type = phosphor::pmbus::Type::HwmonDeviceDebug;
+ std::string version = pmbus->readString(name, type);
+ return version;
+}
+
+/**
+ * @brief Get firmware latest version
+ *
+ * @param[in] versions - String of versions
+ *
+ * @return version - latest firmware level
+ */
std::string getLatestDefault(const std::vector<std::string>& versions)
{
std::string latest;
@@ -97,38 +167,22 @@
} // namespace internal
-std::string getVersion(const std::string& psuInventoryPath)
-{
- const auto& [devicePath, type, versionStr] =
- internal::getVersionInfo(psuInventoryPath);
- if (devicePath.empty() || versionStr.empty())
- {
- return "";
- }
- std::string version;
- try
- {
- phosphor::pmbus::PMBus pmbus(devicePath);
- version = pmbus.readString(versionStr, type);
- }
- catch (const std::exception& ex)
- {
- log<level::ERR>(ex.what());
- }
- return version;
-}
-
std::string getVersion(sdbusplus::bus_t& bus,
const std::string& psuInventoryPath)
{
std::string version;
try
{
- const auto& [i2cbus, i2caddr] = getPsuI2c(bus, psuInventoryPath);
- auto pmbus = getPmbusIntf(i2cbus, i2caddr);
- std::string name = "fw_version";
- auto type = phosphor::pmbus::Type::HwmonDeviceDebug;
- version = pmbus->readString(name, type);
+ if (usePsuJsonFile())
+ {
+ // Obtain PSU information from JSON file
+ version = internal::getVersionJson(psuInventoryPath);
+ }
+ else
+ {
+ // Obtain PSU information from D-Bus
+ version = internal::getVersionDbus(bus, psuInventoryPath);
+ }
}
catch (const std::exception& e)
{
@@ -157,4 +211,5 @@
// So just compare by strings is OK for these cases
return internal::getLatestDefault(versions);
}
+
} // namespace version
diff --git a/tools/power-utils/version.hpp b/tools/power-utils/version.hpp
index 4770a71..98735fe 100644
--- a/tools/power-utils/version.hpp
+++ b/tools/power-utils/version.hpp
@@ -20,58 +20,22 @@
#include <sdbusplus/bus.hpp>
#include <string>
-#include <tuple>
#include <vector>
namespace version
{
-namespace internal
-{
-// PsuInfo contains the device path, pmbus read type, and the version string
-using PsuVersionInfo =
- std::tuple<std::string, phosphor::pmbus::Type, std::string>;
-
-/**
- * @brief Get PSU version information
- *
- * @param[in] psuInventoryPath - The PSU inventory path.
- *
- * @return tuple - device path, pmbus read type and PSU version
- */
-PsuVersionInfo getVersionInfo(const std::string& psuInventoryPath);
-
-/**
- * @brief Get firmware latest version
- *
- * @param[in] versions - String of versions
- *
- * @return version - latest firmware level
- */
-std::string getLatestDefault(const std::vector<std::string>& versions);
-
-} // namespace internal
-
/**
* Get the software version of the PSU using sysfs
*
- * @param[in] bus - Systemd bus connection
- * @param[in] psuInventoryPath - The inventory path of the PSU
+ * @param[in] bus - D-Bus connection
+ * @param[in] psuInventoryPath - PSU D-Bus inventory path
*
- * @return The version of the PSU
+ * @return PSU version, or "" if version could not be found
*/
std::string getVersion(sdbusplus::bus_t& bus,
const std::string& psuInventoryPath);
/**
- * Get the software version of the PSU using psu.json
- *
- * @param[in] psuInventoryPath - The inventory path of the PSU
- *
- * @return The version of the PSU
- */
-std::string getVersion(const std::string& psuInventoryPath);
-
-/**
* Get the latest version from a list of versions
*
* @param[in] versions - The list of PSU version strings