regulators: Enhance config file parser
Enhance JSON config file parser to convert relative inventory paths to
absolute form.
Tested:
Run local CI with -Dlong-tests=enabled to enable tests for
validate-regulators-config.py.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I80237a673f9c5918898db15363847722141388e6
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 6fa34e1..123cb4d 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -236,7 +236,7 @@
// Required fru property
const json& fruElement = getRequiredProperty(element, "fru");
- std::string fru = parseString(fruElement);
+ std::string fru = parseInventoryPath(fruElement);
++propertyCount;
// Required value property
@@ -257,7 +257,7 @@
// Required fru property
const json& fruElement = getRequiredProperty(element, "fru");
- std::string fru = parseString(fruElement);
+ std::string fru = parseInventoryPath(fruElement);
++propertyCount;
// Required keyword property
@@ -331,7 +331,7 @@
// Required fru property
const json& fruElement = getRequiredProperty(element, "fru");
- std::string fru = parseString(fruElement);
+ std::string fru = parseInventoryPath(fruElement);
++propertyCount;
// Required i2c_interface property
@@ -648,6 +648,18 @@
std::move(elseActions));
}
+std::string parseInventoryPath(const json& element)
+{
+ std::string inventoryPath = parseString(element);
+ std::string absPath = "/xyz/openbmc_project/inventory";
+ if (inventoryPath.front() != '/')
+ {
+ absPath += '/';
+ }
+ absPath += inventoryPath;
+ return absPath;
+}
+
std::unique_ptr<NotAction> parseNot(const json& element)
{
// Required action to execute
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 848ed95..4b39b7e 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -485,6 +485,21 @@
}
/**
+ * Parses a JSON element containing a relative inventory path.
+ *
+ * Returns the corresponding C++ string containing the absolute inventory path.
+ *
+ * Inventory paths in the JSON configuration file are relative. Adds the
+ * necessary prefix to make the path absolute.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return absolute D-Bus inventory path
+ */
+std::string parseInventoryPath(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing a not action.
*
* Returns the corresponding C++ NotAction object.
diff --git a/phosphor-regulators/src/error_logging.cpp b/phosphor-regulators/src/error_logging.cpp
index 309d9b6..bf3467c 100644
--- a/phosphor-regulators/src/error_logging.cpp
+++ b/phosphor-regulators/src/error_logging.cpp
@@ -78,11 +78,8 @@
void DBusErrorLogging::logPMBusError(Entry::Level severity, Journal& journal,
const std::string& inventoryPath)
{
- // Convert relative inventory path to an absolute path
- std::string absInventoryPath = getAbsoluteInventoryPath(inventoryPath);
-
std::map<std::string, std::string> additionalData{};
- additionalData.emplace("CALLOUT_INVENTORY_PATH", absInventoryPath);
+ additionalData.emplace("CALLOUT_INVENTORY_PATH", inventoryPath);
logError("xyz.openbmc_project.Power.Error.PMBus", severity, additionalData,
journal);
}
@@ -90,11 +87,8 @@
void DBusErrorLogging::logWriteVerificationError(
Entry::Level severity, Journal& journal, const std::string& inventoryPath)
{
- // Convert relative inventory path to an absolute path
- std::string absInventoryPath = getAbsoluteInventoryPath(inventoryPath);
-
std::map<std::string, std::string> additionalData{};
- additionalData.emplace("CALLOUT_INVENTORY_PATH", absInventoryPath);
+ additionalData.emplace("CALLOUT_INVENTORY_PATH", inventoryPath);
logError("xyz.openbmc_project.Power.Regulators.Error.WriteVerification",
severity, additionalData, journal);
}
diff --git a/phosphor-regulators/src/error_logging.hpp b/phosphor-regulators/src/error_logging.hpp
index d1a5879..ba95561 100644
--- a/phosphor-regulators/src/error_logging.hpp
+++ b/phosphor-regulators/src/error_logging.hpp
@@ -211,26 +211,6 @@
std::vector<FFDCTuple> createFFDCTuples(std::vector<FFDCFile>& files);
/**
- * Returns the absolute form of the specified inventory path.
- *
- * The inventory paths in the JSON configuration file are relative. Add the
- * the necessary prefix to make the path absolute.
- *
- * @param inventoryPath relative D-Bus inventory path
- * @return absolute D-Bus inventory path
- */
- std::string getAbsoluteInventoryPath(const std::string& inventoryPath)
- {
- std::string absPath = "/xyz/openbmc_project/inventory";
- if ((!inventoryPath.empty()) && (inventoryPath.front() != '/'))
- {
- absPath += '/';
- }
- absPath += inventoryPath;
- return absPath;
- }
-
- /**
* Logs an error using the D-Bus CreateWithFFDCFiles method.
*
* If logging fails, a message is written to the journal but an exception is
diff --git a/phosphor-regulators/test/actions/action_environment_tests.cpp b/phosphor-regulators/test/actions/action_environment_tests.cpp
index 4100078..54afc2e 100644
--- a/phosphor-regulators/test/actions/action_environment_tests.cpp
+++ b/phosphor-regulators/test/actions/action_environment_tests.cpp
@@ -40,8 +40,10 @@
// Create Device and add to IDMap
std::unique_ptr<i2c::I2CInterface> i2cInterface =
i2c::create(1, 0x70, i2c::I2CInterface::InitialState::CLOSED);
- Device reg1{"regulator1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device reg1{
+ "regulator1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
idMap.addDevice(reg1);
// Verify object state after constructor
@@ -105,8 +107,10 @@
// Create Device and add to IDMap
std::unique_ptr<i2c::I2CInterface> i2cInterface =
i2c::create(1, 0x70, i2c::I2CInterface::InitialState::CLOSED);
- Device reg1{"regulator1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device reg1{
+ "regulator1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
idMap.addDevice(reg1);
ActionEnvironment env{idMap, "regulator1"};
diff --git a/phosphor-regulators/test/actions/compare_presence_action_tests.cpp b/phosphor-regulators/test/actions/compare_presence_action_tests.cpp
index e290a0f..aafdecc 100644
--- a/phosphor-regulators/test/actions/compare_presence_action_tests.cpp
+++ b/phosphor-regulators/test/actions/compare_presence_action_tests.cpp
@@ -30,8 +30,10 @@
TEST(ComparePresenceActionTests, Constructor)
{
- ComparePresenceAction action{"/system/chassis/motherboard/cpu3", true};
- EXPECT_EQ(action.getFRU(), "/system/chassis/motherboard/cpu3");
+ ComparePresenceAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu3", true};
+ EXPECT_EQ(action.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu3");
EXPECT_EQ(action.getValue(), true);
}
@@ -42,20 +44,26 @@
TEST(ComparePresenceActionTests, GetFRU)
{
- ComparePresenceAction action{"/system/chassis/motherboard/cpu2", true};
- EXPECT_EQ(action.getFRU(), "/system/chassis/motherboard/cpu2");
+ ComparePresenceAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu2", true};
+ EXPECT_EQ(action.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu2");
}
TEST(ComparePresenceActionTests, GetValue)
{
- ComparePresenceAction action{"/system/chassis/motherboard/cpu3", false};
+ ComparePresenceAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu3",
+ false};
EXPECT_EQ(action.getValue(), false);
}
TEST(ComparePresenceActionTests, ToString)
{
- ComparePresenceAction action{"/system/chassis/motherboard/cpu2", true};
+ ComparePresenceAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu2", true};
EXPECT_EQ(action.toString(),
- "compare_presence: { fru: /system/chassis/motherboard/cpu2, "
+ "compare_presence: { fru: "
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu2, "
"value: true }");
}
diff --git a/phosphor-regulators/test/actions/compare_vpd_action_tests.cpp b/phosphor-regulators/test/actions/compare_vpd_action_tests.cpp
index 8ae721b..d44e2e8 100644
--- a/phosphor-regulators/test/actions/compare_vpd_action_tests.cpp
+++ b/phosphor-regulators/test/actions/compare_vpd_action_tests.cpp
@@ -28,8 +28,11 @@
TEST(CompareVPDActionTests, Constructor)
{
- CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
- EXPECT_EQ(action.getFRU(), "/system/chassis/disk_backplane");
+ CompareVPDAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane", "CCIN",
+ "2D35"};
+ EXPECT_EQ(action.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane");
EXPECT_EQ(action.getKeyword(), "CCIN");
EXPECT_EQ(action.getValue(), "2D35");
}
@@ -41,26 +44,36 @@
TEST(CompareVPDActionTests, GetFRU)
{
- CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
- EXPECT_EQ(action.getFRU(), "/system/chassis/disk_backplane");
+ CompareVPDAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane", "CCIN",
+ "2D35"};
+ EXPECT_EQ(action.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane");
}
TEST(CompareVPDActionTests, GetKeyword)
{
- CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
+ CompareVPDAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane", "CCIN",
+ "2D35"};
EXPECT_EQ(action.getKeyword(), "CCIN");
}
TEST(CompareVPDActionTests, GetValue)
{
- CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
+ CompareVPDAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane", "CCIN",
+ "2D35"};
EXPECT_EQ(action.getValue(), "2D35");
}
TEST(CompareVPDActionTests, ToString)
{
- CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
- EXPECT_EQ(action.toString(),
- "compare_vpd: { fru: /system/chassis/disk_backplane, keyword: "
- "CCIN, value: 2D35 }");
+ CompareVPDAction action{
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane", "CCIN",
+ "2D35"};
+ EXPECT_EQ(action.toString(), "compare_vpd: { fru: "
+ "/xyz/openbmc_project/inventory/system/"
+ "chassis/disk_backplane, keyword: "
+ "CCIN, value: 2D35 }");
}
diff --git a/phosphor-regulators/test/actions/i2c_action_tests.cpp b/phosphor-regulators/test/actions/i2c_action_tests.cpp
index 70e55d7..07542f5 100644
--- a/phosphor-regulators/test/actions/i2c_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_action_tests.cpp
@@ -65,8 +65,10 @@
EXPECT_CALL(*i2cInterface, open).Times(1);
// Create Device, IDMap, ActionEnvironment, and I2CAction
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -90,8 +92,10 @@
EXPECT_CALL(*i2cInterface, open).Times(0);
// Create Device, IDMap, ActionEnvironment, and I2CAction
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -140,8 +144,10 @@
Throw(i2c::I2CException{"Failed to open", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, ActionEnvironment, and I2CAction
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/i2c_compare_bit_action_tests.cpp b/phosphor-regulators/test/actions/i2c_compare_bit_action_tests.cpp
index 08f48bf..d3d0ab0 100644
--- a/phosphor-regulators/test/actions/i2c_compare_bit_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_compare_bit_action_tests.cpp
@@ -96,8 +96,10 @@
.WillRepeatedly(SetArgReferee<1>(0x96));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -174,8 +176,10 @@
i2c::I2CException{"Failed to read byte", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/i2c_compare_byte_action_tests.cpp b/phosphor-regulators/test/actions/i2c_compare_byte_action_tests.cpp
index 436d987..1bd4748 100644
--- a/phosphor-regulators/test/actions/i2c_compare_byte_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_compare_byte_action_tests.cpp
@@ -70,8 +70,10 @@
.WillOnce(SetArgReferee<1>(0xD7));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -99,8 +101,10 @@
.WillOnce(SetArgReferee<1>(0xD7));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -125,8 +129,10 @@
.WillOnce(SetArgReferee<1>(0xD7));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -154,8 +160,10 @@
.WillOnce(SetArgReferee<1>(0xD7));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -201,8 +209,10 @@
i2c::I2CException{"Failed to read byte", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/i2c_compare_bytes_action_tests.cpp b/phosphor-regulators/test/actions/i2c_compare_bytes_action_tests.cpp
index d03b358..5685db7 100644
--- a/phosphor-regulators/test/actions/i2c_compare_bytes_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_compare_bytes_action_tests.cpp
@@ -161,8 +161,10 @@
.WillOnce(SetArrayArgument<2>(actualValues, actualValues + 2));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -194,8 +196,10 @@
.WillOnce(SetArrayArgument<2>(actualValues, actualValues + 3));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -223,8 +227,10 @@
.WillOnce(SetArrayArgument<2>(actualValues, actualValues + 2));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -256,8 +262,10 @@
.WillOnce(SetArrayArgument<2>(actualValues, actualValues + 3));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -285,8 +293,10 @@
.WillOnce(SetArrayArgument<2>(actualValues, actualValues + 1));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -339,8 +349,10 @@
"/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/i2c_write_bit_action_tests.cpp b/phosphor-regulators/test/actions/i2c_write_bit_action_tests.cpp
index cefc948..d3a7c18 100644
--- a/phosphor-regulators/test/actions/i2c_write_bit_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_write_bit_action_tests.cpp
@@ -101,8 +101,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -133,8 +135,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -184,8 +188,10 @@
EXPECT_CALL(*i2cInterface, write(A<uint8_t>(), A<uint8_t>())).Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -238,8 +244,10 @@
i2c::I2CException{"Failed to write byte", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/i2c_write_byte_action_tests.cpp b/phosphor-regulators/test/actions/i2c_write_byte_action_tests.cpp
index 1a858e3..4972f5b 100644
--- a/phosphor-regulators/test/actions/i2c_write_byte_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_write_byte_action_tests.cpp
@@ -72,8 +72,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -101,8 +103,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -156,8 +160,10 @@
EXPECT_CALL(*i2cInterface, write(A<uint8_t>(), A<uint8_t>())).Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -207,8 +213,10 @@
i2c::I2CException{"Failed to write byte", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/i2c_write_bytes_action_tests.cpp b/phosphor-regulators/test/actions/i2c_write_bytes_action_tests.cpp
index ec698f4..bcc196a 100644
--- a/phosphor-regulators/test/actions/i2c_write_bytes_action_tests.cpp
+++ b/phosphor-regulators/test/actions/i2c_write_bytes_action_tests.cpp
@@ -164,8 +164,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -197,8 +199,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -239,8 +243,10 @@
.Times(1);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -301,8 +307,10 @@
.Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -359,8 +367,10 @@
"/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/pmbus_read_sensor_action_tests.cpp b/phosphor-regulators/test/actions/pmbus_read_sensor_action_tests.cpp
index d24a04a..cfc4f7e 100644
--- a/phosphor-regulators/test/actions/pmbus_read_sensor_action_tests.cpp
+++ b/phosphor-regulators/test/actions/pmbus_read_sensor_action_tests.cpp
@@ -104,8 +104,10 @@
EXPECT_CALL(*i2cInterface, read(A<uint8_t>(), A<uint8_t&>())).Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -146,8 +148,10 @@
EXPECT_CALL(*i2cInterface, read(A<uint8_t>(), A<uint8_t&>())).Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -188,8 +192,10 @@
.Times(1)
.WillOnce(SetArgReferee<1>(0b0001'0111));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -254,8 +260,10 @@
.WillOnce(SetArgReferee<1>(0b0010'0000));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -312,8 +320,10 @@
i2c::I2CException{"Failed to read byte", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -370,8 +380,10 @@
i2c::I2CException{"Failed to read word", "/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/pmbus_write_vout_command_action_tests.cpp b/phosphor-regulators/test/actions/pmbus_write_vout_command_action_tests.cpp
index f2a5d9a..0afa0d8 100644
--- a/phosphor-regulators/test/actions/pmbus_write_vout_command_action_tests.cpp
+++ b/phosphor-regulators/test/actions/pmbus_write_vout_command_action_tests.cpp
@@ -124,8 +124,10 @@
.WillOnce(SetArgReferee<1>(0x014D));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -165,8 +167,10 @@
// Create Device, IDMap, and ActionEnvironment. Set volts value to 3.3
// in ActionEnvironment.
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -255,8 +259,10 @@
EXPECT_CALL(*i2cInterface, write(A<uint8_t>(), A<uint16_t>())).Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -312,8 +318,10 @@
EXPECT_CALL(*i2cInterface, write(A<uint8_t>(), A<uint16_t>())).Times(0);
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -371,8 +379,10 @@
"/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -433,8 +443,10 @@
"/dev/i2c-1", 0x70}));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
@@ -494,8 +506,10 @@
.WillOnce(SetArgReferee<1>(0x014C));
// Create Device, IDMap, and ActionEnvironment
- Device device{"reg1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device device{
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
IDMap idMap{};
idMap.addDevice(device);
ActionEnvironment env{idMap, "reg1"};
diff --git a/phosphor-regulators/test/actions/set_device_action_tests.cpp b/phosphor-regulators/test/actions/set_device_action_tests.cpp
index c39b9b0..129113e 100644
--- a/phosphor-regulators/test/actions/set_device_action_tests.cpp
+++ b/phosphor-regulators/test/actions/set_device_action_tests.cpp
@@ -42,15 +42,19 @@
// Create Device regulator1 and add to IDMap
std::unique_ptr<i2c::I2CInterface> i2cInterface =
i2c::create(1, 0x70, i2c::I2CInterface::InitialState::CLOSED);
- Device reg1{"regulator1", true, "/system/chassis/motherboard/reg1",
- std::move(i2cInterface)};
+ Device reg1{
+ "regulator1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface)};
idMap.addDevice(reg1);
// Create Device regulator2 and add to IDMap
i2cInterface =
i2c::create(1, 0x72, i2c::I2CInterface::InitialState::CLOSED);
- Device reg2{"regulator2", true, "/system/chassis/motherboard/reg2",
- std::move(i2cInterface)};
+ Device reg2{
+ "regulator2", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(i2cInterface)};
idMap.addDevice(reg2);
// Create ActionEnvironment
diff --git a/phosphor-regulators/test/chassis_tests.cpp b/phosphor-regulators/test/chassis_tests.cpp
index 3844ca4..451e137 100644
--- a/phosphor-regulators/test/chassis_tests.cpp
+++ b/phosphor-regulators/test/chassis_tests.cpp
@@ -145,9 +145,11 @@
EXPECT_CALL(*i2cInterface, close).Times(1);
// Create Device
- std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd0_reg", true, "/system/chassis/motherboard/vdd0_reg",
- std::move(i2cInterface));
+ std::unique_ptr<Device> device =
+ std::make_unique<Device>("vdd0_reg", true,
+ "/xyz/openbmc_project/inventory/"
+ "system/chassis/motherboard/vdd0_reg",
+ std::move(i2cInterface));
devices.emplace_back(std::move(device));
}
@@ -160,9 +162,11 @@
EXPECT_CALL(*i2cInterface, close).Times(1);
// Create Device
- std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd1_reg", true, "/system/chassis/motherboard/vdd1_reg",
- std::move(i2cInterface));
+ std::unique_ptr<Device> device =
+ std::make_unique<Device>("vdd1_reg", true,
+ "/xyz/openbmc_project/inventory/"
+ "system/chassis/motherboard/vdd1_reg",
+ std::move(i2cInterface));
devices.emplace_back(std::move(device));
}
@@ -225,7 +229,9 @@
createI2CInterface();
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd0_reg", true, "/system/chassis/motherboard/vdd0_reg",
+ "vdd0_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/"
+ "vdd0_reg",
std::move(i2cInterface), std::move(presenceDetection),
std::move(configuration));
devices.emplace_back(std::move(device));
@@ -243,7 +249,9 @@
createI2CInterface();
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd1_reg", true, "/system/chassis/motherboard/vdd1_reg",
+ "vdd1_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/"
+ "vdd1_reg",
std::move(i2cInterface), std::move(presenceDetection),
std::move(configuration));
devices.emplace_back(std::move(device));
@@ -364,7 +372,8 @@
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Configuration> deviceConfiguration{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
diff --git a/phosphor-regulators/test/config_file_parser_tests.cpp b/phosphor-regulators/test/config_file_parser_tests.cpp
index edfa958..d14787e 100644
--- a/phosphor-regulators/test/config_file_parser_tests.cpp
+++ b/phosphor-regulators/test/config_file_parser_tests.cpp
@@ -266,7 +266,7 @@
{
"compare_presence":
{
- "fru": "/system/chassis/motherboard/cpu3",
+ "fru": "system/chassis/motherboard/cpu3",
"value": true
}
}
@@ -281,7 +281,7 @@
{
"compare_vpd":
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"keyword": "CCIN",
"value": "2D35"
}
@@ -772,7 +772,7 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -830,7 +830,7 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -934,13 +934,15 @@
{
const json element = R"(
{
- "fru": "/system/chassis/motherboard/cpu3",
+ "fru": "system/chassis/motherboard/cpu3",
"value": true
}
)"_json;
std::unique_ptr<ComparePresenceAction> action =
parseComparePresence(element);
- EXPECT_EQ(action->getFRU(), "/system/chassis/motherboard/cpu3");
+ EXPECT_EQ(
+ action->getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu3");
EXPECT_EQ(action->getValue(), true);
}
@@ -961,7 +963,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/motherboard/cpu3",
+ "fru": "system/chassis/motherboard/cpu3",
"value": true,
"foo" : true
}
@@ -995,7 +997,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/motherboard/cpu3"
+ "fru": "system/chassis/motherboard/cpu3"
}
)"_json;
parseComparePresence(element);
@@ -1028,7 +1030,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/motherboard/cpu3",
+ "fru": "system/chassis/motherboard/cpu3",
"value": 1
}
)"_json;
@@ -1047,13 +1049,15 @@
{
const json element = R"(
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"keyword": "CCIN",
"value": "2D35"
}
)"_json;
std::unique_ptr<CompareVPDAction> action = parseCompareVPD(element);
- EXPECT_EQ(action->getFRU(), "/system/chassis/disk_backplane");
+ EXPECT_EQ(
+ action->getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/disk_backplane");
EXPECT_EQ(action->getKeyword(), "CCIN");
EXPECT_EQ(action->getValue(), "2D35");
}
@@ -1075,7 +1079,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"keyword": "CCIN",
"value": "2D35",
"foo" : true
@@ -1111,7 +1115,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"value": "2D35"
}
)"_json;
@@ -1128,7 +1132,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"keyword": "CCIN"
}
)"_json;
@@ -1163,7 +1167,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"keyword": 1,
"value": "2D35"
}
@@ -1181,7 +1185,7 @@
{
const json element = R"(
{
- "fru": "/system/chassis/disk_backplane",
+ "fru": "system/chassis/disk_backplane",
"keyword": "CCIN",
"value": 1
}
@@ -1388,14 +1392,15 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface": { "bus": 1, "address": "0x70" }
}
)"_json;
std::unique_ptr<Device> device = parseDevice(element);
EXPECT_EQ(device->getID(), "vdd_regulator");
EXPECT_EQ(device->isRegulator(), true);
- EXPECT_EQ(device->getFRU(), "/system/chassis/motherboard/regulator2");
+ EXPECT_EQ(device->getFRU(), "/xyz/openbmc_project/inventory/system/"
+ "chassis/motherboard/regulator2");
EXPECT_NE(&(device->getI2CInterface()), nullptr);
EXPECT_EQ(device->getPresenceDetection(), nullptr);
EXPECT_EQ(device->getConfiguration(), nullptr);
@@ -1408,7 +1413,7 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -1433,7 +1438,8 @@
std::unique_ptr<Device> device = parseDevice(element);
EXPECT_EQ(device->getID(), "vdd_regulator");
EXPECT_EQ(device->isRegulator(), true);
- EXPECT_EQ(device->getFRU(), "/system/chassis/motherboard/regulator2");
+ EXPECT_EQ(device->getFRU(), "/xyz/openbmc_project/inventory/system/"
+ "chassis/motherboard/regulator2");
EXPECT_NE(&(device->getI2CInterface()), nullptr);
EXPECT_NE(device->getPresenceDetection(), nullptr);
EXPECT_NE(device->getConfiguration(), nullptr);
@@ -1447,7 +1453,7 @@
{
"id": "vdd_regulator",
"is_regulator": false,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -1481,7 +1487,7 @@
{
"id": 3,
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -1504,7 +1510,7 @@
{
"id": "vdd_regulator",
"is_regulator": 3,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -1550,7 +1556,7 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface": 3
}
)"_json;
@@ -1568,7 +1574,7 @@
const json element = R"(
{
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -1590,7 +1596,7 @@
const json element = R"(
{
"id": "vdd_regulator",
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface":
{
"bus": 1,
@@ -1635,7 +1641,7 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2"
+ "fru": "system/chassis/motherboard/regulator2"
}
)"_json;
parseDevice(element);
@@ -1665,7 +1671,7 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface": { "bus": 1, "address": "0x70" },
"foo" : true
}
@@ -1688,13 +1694,13 @@
{
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface": { "bus": 1, "address": "0x70" }
},
{
"id": "vio_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator2",
+ "fru": "system/chassis/motherboard/regulator2",
"i2c_interface": { "bus": 1, "address": "0x71" }
}
]
@@ -3052,6 +3058,51 @@
}
}
+TEST(ConfigFileParserTests, ParseInventoryPath)
+{
+ // Test where works: Inventory path has a leading '/'
+ {
+ const json element = "/system/chassis/motherboard/cpu3";
+ std::string value = parseInventoryPath(element);
+ EXPECT_EQ(
+ value,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu3");
+ }
+
+ // Test where works: Inventory path does not have a leading '/'
+ {
+ const json element = "system/chassis/motherboard/cpu1";
+ std::string value = parseInventoryPath(element);
+ EXPECT_EQ(
+ value,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1");
+ }
+
+ // Test where fails: JSON element is not a string
+ try
+ {
+ const json element = R"( { "foo": "bar" } )"_json;
+ parseInventoryPath(element);
+ ADD_FAILURE() << "Should not have reached this line.";
+ }
+ catch (const std::invalid_argument& e)
+ {
+ EXPECT_STREQ(e.what(), "Element is not a string");
+ }
+
+ // Test where fails: JSON element contains an empty string
+ try
+ {
+ const json element = "";
+ parseInventoryPath(element);
+ ADD_FAILURE() << "Should not have reached this line.";
+ }
+ catch (const std::invalid_argument& e)
+ {
+ EXPECT_STREQ(e.what(), "Element contains an empty string");
+ }
+}
+
TEST(ConfigFileParserTests, ParseNot)
{
// Test where works
diff --git a/phosphor-regulators/test/configuration_tests.cpp b/phosphor-regulators/test/configuration_tests.cpp
index 260b638..7db4ac5 100644
--- a/phosphor-regulators/test/configuration_tests.cpp
+++ b/phosphor-regulators/test/configuration_tests.cpp
@@ -110,7 +110,8 @@
// Create Device that contains Configuration
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd_reg", true, "/system/chassis/motherboard/reg2",
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
std::move(i2cInterface), std::move(presenceDetection),
std::move(configuration));
Device* devicePtr = device.get();
@@ -169,7 +170,8 @@
// Create Device that contains Configuration
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd_reg", true, "/system/chassis/motherboard/reg2",
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
std::move(i2cInterface), std::move(presenceDetection),
std::move(configuration));
Device* devicePtr = device.get();
@@ -229,7 +231,8 @@
// Create Device that contains Configuration
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "vdd_reg", true, "/system/chassis/motherboard/reg2",
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
std::move(i2cInterface), std::move(presenceDetection),
std::move(configuration));
Device* devicePtr = device.get();
@@ -294,7 +297,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
@@ -362,7 +366,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
@@ -431,7 +436,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
diff --git a/phosphor-regulators/test/device_tests.cpp b/phosphor-regulators/test/device_tests.cpp
index 19271d4..ad2b9c2 100644
--- a/phosphor-regulators/test/device_tests.cpp
+++ b/phosphor-regulators/test/device_tests.cpp
@@ -53,11 +53,15 @@
{
std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
i2c::I2CInterface* i2cInterfacePtr = i2cInterface.get();
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(i2cInterface)};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(i2cInterface)};
EXPECT_EQ(device.getID(), "vdd_reg");
EXPECT_EQ(device.isRegulator(), true);
- EXPECT_EQ(device.getFRU(), "/system/chassis/motherboard/reg2");
+ EXPECT_EQ(
+ device.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2");
EXPECT_EQ(&(device.getI2CInterface()), i2cInterfacePtr);
EXPECT_EQ(device.getPresenceDetection(), nullptr);
EXPECT_EQ(device.getConfiguration(), nullptr);
@@ -90,16 +94,19 @@
rails.push_back(std::make_unique<Rail>("vdd1"));
// Create Device
- Device device{"vdd_reg",
- false,
- "/system/chassis/motherboard/reg1",
- std::move(i2cInterface),
- std::move(presenceDetection),
- std::move(configuration),
- std::move(rails)};
+ Device device{
+ "vdd_reg",
+ false,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
+ std::move(i2cInterface),
+ std::move(presenceDetection),
+ std::move(configuration),
+ std::move(rails)};
EXPECT_EQ(device.getID(), "vdd_reg");
EXPECT_EQ(device.isRegulator(), false);
- EXPECT_EQ(device.getFRU(), "/system/chassis/motherboard/reg1");
+ EXPECT_EQ(
+ device.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1");
EXPECT_EQ(&(device.getI2CInterface()), i2cInterfacePtr);
EXPECT_NE(device.getPresenceDetection(), nullptr);
EXPECT_EQ(device.getPresenceDetection()->getActions().size(), 1);
@@ -121,13 +128,14 @@
rails.push_back(std::make_unique<Rail>("vdd1"));
// Create Device
- Device device{"vdd_reg",
- false,
- "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface()),
- std::move(presenceDetection),
- std::move(configuration),
- std::move(rails)};
+ Device device{
+ "vdd_reg",
+ false,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface()),
+ std::move(presenceDetection),
+ std::move(configuration),
+ std::move(rails)};
// Add Device and Rail objects to an IDMap
IDMap idMap{};
@@ -161,8 +169,10 @@
.Times(0);
// Create Device
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(i2cInterface)};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(i2cInterface)};
// Close Device
device.close(services);
@@ -184,8 +194,10 @@
.Times(0);
// Create Device
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(i2cInterface)};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(i2cInterface)};
// Close Device
device.close(services);
@@ -212,8 +224,10 @@
EXPECT_CALL(journal, logError(expectedErrMessagesException)).Times(1);
// Create Device
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(i2cInterface)};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(i2cInterface)};
// Close Device
device.close(services);
@@ -233,7 +247,8 @@
// Create Device
std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface));
Device* devicePtr = device.get();
@@ -317,7 +332,8 @@
std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(configuration), std::move(rails));
Device* devicePtr = device.get();
@@ -344,8 +360,10 @@
{
// Test where Configuration was not specified in constructor
{
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface())};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface())};
EXPECT_EQ(device.getConfiguration(), nullptr);
}
@@ -362,12 +380,13 @@
std::make_unique<Configuration>(volts, std::move(actions));
// Create Device
- Device device{"vdd_reg",
- true,
- "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface()),
- std::move(presenceDetection),
- std::move(configuration)};
+ Device device{
+ "vdd_reg",
+ true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface()),
+ std::move(presenceDetection),
+ std::move(configuration)};
EXPECT_NE(device.getConfiguration(), nullptr);
EXPECT_EQ(device.getConfiguration()->getVolts().has_value(), true);
EXPECT_EQ(device.getConfiguration()->getVolts().value(), 3.2);
@@ -377,24 +396,31 @@
TEST(DeviceTests, GetFRU)
{
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface())};
- EXPECT_EQ(device.getFRU(), "/system/chassis/motherboard/reg2");
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface())};
+ EXPECT_EQ(device.getFRU(),
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2");
}
TEST(DeviceTests, GetI2CInterface)
{
std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
i2c::I2CInterface* i2cInterfacePtr = i2cInterface.get();
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(i2cInterface)};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(i2cInterface)};
EXPECT_EQ(&(device.getI2CInterface()), i2cInterfacePtr);
}
TEST(DeviceTests, GetID)
{
- Device device{"vdd_reg", false, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface())};
+ Device device{
+ "vdd_reg", false,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface())};
EXPECT_EQ(device.getID(), "vdd_reg");
}
@@ -402,8 +428,10 @@
{
// Test where PresenceDetection was not specified in constructor
{
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface())};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface())};
EXPECT_EQ(device.getPresenceDetection(), nullptr);
}
@@ -416,9 +444,10 @@
std::make_unique<PresenceDetection>(std::move(actions));
// Create Device
- Device device{"vdd_reg", false, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface()),
- std::move(presenceDetection)};
+ Device device{
+ "vdd_reg", false,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface()), std::move(presenceDetection)};
EXPECT_NE(device.getPresenceDetection(), nullptr);
EXPECT_EQ(device.getPresenceDetection()->getActions().size(), 1);
}
@@ -428,8 +457,10 @@
{
// Test where no rails were specified in constructor
{
- Device device{"vdd_reg", true, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface())};
+ Device device{
+ "vdd_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface())};
EXPECT_EQ(device.getRails().size(), 0);
}
@@ -444,13 +475,14 @@
rails.push_back(std::make_unique<Rail>("vdd1"));
// Create Device
- Device device{"vdd_reg",
- false,
- "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface()),
- std::move(presenceDetection),
- std::move(configuration),
- std::move(rails)};
+ Device device{
+ "vdd_reg",
+ false,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface()),
+ std::move(presenceDetection),
+ std::move(configuration),
+ std::move(rails)};
EXPECT_EQ(device.getRails().size(), 2);
EXPECT_EQ(device.getRails()[0]->getID(), "vdd0");
EXPECT_EQ(device.getRails()[1]->getID(), "vdd1");
@@ -459,8 +491,10 @@
TEST(DeviceTests, IsRegulator)
{
- Device device{"vdd_reg", false, "/system/chassis/motherboard/reg2",
- std::move(createI2CInterface())};
+ Device device{
+ "vdd_reg", false,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg2",
+ std::move(createI2CInterface())};
EXPECT_EQ(device.isRegulator(), false);
}
@@ -481,7 +515,8 @@
// Create Device
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface));
Device* devicePtr = device.get();
@@ -545,7 +580,8 @@
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Configuration> deviceConfiguration{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
diff --git a/phosphor-regulators/test/id_map_tests.cpp b/phosphor-regulators/test/id_map_tests.cpp
index 0b541a4..15ace68 100644
--- a/phosphor-regulators/test/id_map_tests.cpp
+++ b/phosphor-regulators/test/id_map_tests.cpp
@@ -39,8 +39,10 @@
std::unique_ptr<i2c::I2CInterface> i2cInterface =
i2c::create(1, 0x70, i2c::I2CInterface::InitialState::CLOSED);
std::string id{"vio_reg"};
- Device device{id, true, "/system/chassis/motherboard/vio_reg",
- std::move(i2cInterface)};
+ Device device{
+ id, true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/vio_reg",
+ std::move(i2cInterface)};
// Verify device is not initially in map
EXPECT_THROW(idMap.getDevice(id), std::invalid_argument);
@@ -68,7 +70,9 @@
{
i2cInterface =
i2c::create(1, 0x72, i2c::I2CInterface::InitialState::CLOSED);
- Device device2{"vio_reg", true, "/system/chassis/motherboard/vio_reg2",
+ Device device2{"vio_reg", true,
+ "/xyz/openbmc_project/inventory/system/chassis/"
+ "motherboard/vio_reg2",
std::move(i2cInterface)};
idMap.addDevice(device2);
ADD_FAILURE() << "Should not have reached this line.";
@@ -174,8 +178,10 @@
std::unique_ptr<i2c::I2CInterface> i2cInterface =
i2c::create(1, 0x70, i2c::I2CInterface::InitialState::CLOSED);
std::string id{"vio_reg"};
- Device device{id, true, "/system/chassis/motherboard/vio_reg",
- std::move(i2cInterface)};
+ Device device{
+ id, true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/vio_reg",
+ std::move(i2cInterface)};
// Add a device to the map
idMap.addDevice(device);
diff --git a/phosphor-regulators/test/rail_tests.cpp b/phosphor-regulators/test/rail_tests.cpp
index d5f8db2..089e6ee 100644
--- a/phosphor-regulators/test/rail_tests.cpp
+++ b/phosphor-regulators/test/rail_tests.cpp
@@ -104,7 +104,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
@@ -157,7 +158,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
@@ -237,7 +239,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
@@ -302,7 +305,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
diff --git a/phosphor-regulators/test/sensor_monitoring_tests.cpp b/phosphor-regulators/test/sensor_monitoring_tests.cpp
index 8f111eb..4d31e4e 100644
--- a/phosphor-regulators/test/sensor_monitoring_tests.cpp
+++ b/phosphor-regulators/test/sensor_monitoring_tests.cpp
@@ -102,7 +102,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
@@ -179,7 +180,8 @@
std::vector<std::unique_ptr<Rail>> rails{};
rails.emplace_back(std::move(rail));
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
Device* devicePtr = device.get();
diff --git a/phosphor-regulators/test/system_tests.cpp b/phosphor-regulators/test/system_tests.cpp
index 809d2d4..d5b5b1a 100644
--- a/phosphor-regulators/test/system_tests.cpp
+++ b/phosphor-regulators/test/system_tests.cpp
@@ -242,7 +242,8 @@
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Configuration> deviceConfiguration{};
std::unique_ptr<Device> device = std::make_unique<Device>(
- "reg1", true, "/system/chassis/motherboard/reg1",
+ "reg1", true,
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1",
std::move(i2cInterface), std::move(presenceDetection),
std::move(deviceConfiguration), std::move(rails));
diff --git a/phosphor-regulators/test/test_utils.hpp b/phosphor-regulators/test/test_utils.hpp
index f56dc18..2903d3c 100644
--- a/phosphor-regulators/test/test_utils.hpp
+++ b/phosphor-regulators/test/test_utils.hpp
@@ -67,7 +67,8 @@
// Create Device
bool isRegulator = true;
- std::string fru = "/system/chassis/motherboard/reg1";
+ std::string fru =
+ "/xyz/openbmc_project/inventory/system/chassis/motherboard/reg1";
std::unique_ptr<i2c::I2CInterface> i2cInterface = createI2CInterface();
std::unique_ptr<PresenceDetection> presenceDetection{};
std::unique_ptr<Configuration> configuration{};
diff --git a/phosphor-regulators/test/validate-regulators-config_tests.cpp b/phosphor-regulators/test/validate-regulators-config_tests.cpp
index 42038d1..fb1a40e 100644
--- a/phosphor-regulators/test/validate-regulators-config_tests.cpp
+++ b/phosphor-regulators/test/validate-regulators-config_tests.cpp
@@ -80,7 +80,7 @@
"comments": [ "IR35221 regulator producing the Vdd rail" ],
"id": "vdd_regulator",
"is_regulator": true,
- "fru": "/system/chassis/motherboard/regulator1",
+ "fru": "system/chassis/motherboard/regulator1",
"i2c_interface": {
"bus": 1,
"address": "0x70"
@@ -262,7 +262,7 @@
{
json configFile = validConfigFile;
configFile["rules"][0]["actions"][1]["compare_presence"]["fru"] =
- "/system/chassis/motherboard/regulator2";
+ "system/chassis/motherboard/regulator2";
configFile["rules"][0]["actions"][1]["compare_presence"]["value"] =
true;
EXPECT_JSON_VALID(configFile);
@@ -271,7 +271,7 @@
{
json configFile = validConfigFile;
configFile["rules"][0]["actions"][1]["compare_vpd"]["fru"] =
- "/system/chassis/motherboard/regulator2";
+ "system/chassis/motherboard/regulator2";
configFile["rules"][0]["actions"][1]["compare_vpd"]["keyword"] = "CCIN";
configFile["rules"][0]["actions"][1]["compare_vpd"]["value"] = "2D35";
EXPECT_JSON_VALID(configFile);
@@ -574,7 +574,7 @@
{
json comparePresenceFile = validConfigFile;
comparePresenceFile["rules"][0]["actions"][1]["compare_presence"]["fru"] =
- "/system/chassis/motherboard/regulator2";
+ "system/chassis/motherboard/regulator2";
comparePresenceFile["rules"][0]["actions"][1]["compare_presence"]["value"] =
true;
// Valid.
@@ -627,7 +627,7 @@
{
json compareVpdFile = validConfigFile;
compareVpdFile["rules"][0]["actions"][1]["compare_vpd"]["fru"] =
- "/system/chassis/motherboard/regulator2";
+ "system/chassis/motherboard/regulator2";
compareVpdFile["rules"][0]["actions"][1]["compare_vpd"]["keyword"] = "CCIN";
compareVpdFile["rules"][0]["actions"][1]["compare_vpd"]["value"] = "2D35";
@@ -811,7 +811,7 @@
"rule_id");
configFile["chassis"][0]["devices"][0]["configuration"]["actions"][0]
["compare_presence"]["fru"] =
- "/system/chassis/motherboard/cpu3";
+ "system/chassis/motherboard/cpu3";
configFile["chassis"][0]["devices"][0]["configuration"]["actions"][0]
["compare_presence"]["value"] = true;
EXPECT_JSON_VALID(configFile);
@@ -852,13 +852,13 @@
json configFile = configurationFile;
configFile["chassis"][0]["devices"][0]["configuration"]["actions"][0]
["compare_presence"]["fru"] =
- "/system/chassis/motherboard/cpu3";
+ "system/chassis/motherboard/cpu3";
configFile["chassis"][0]["devices"][0]["configuration"]["actions"][0]
["compare_presence"]["value"] = true;
EXPECT_JSON_INVALID(
configFile, "Validation failed.",
"{'actions': [{'compare_presence': {'fru': "
- "'/system/chassis/motherboard/cpu3', 'value': True}}], 'comments': "
+ "'system/chassis/motherboard/cpu3', 'value': True}}], 'comments': "
"['Set rail to 1.25V using standard rule'], 'rule_id': "
"'set_voltage_rule', 'volts': 1.25} is valid under each of "
"{'required': ['actions']}, {'required': ['rule_id']}");
@@ -2284,7 +2284,7 @@
"rule_id");
configFile["chassis"][0]["devices"][0]["presence_detection"]["actions"]
[0]["compare_presence"]["fru"] =
- "/system/chassis/motherboard/cpu3";
+ "system/chassis/motherboard/cpu3";
configFile["chassis"][0]["devices"][0]["presence_detection"]["actions"]
[0]["compare_presence"]["value"] = true;
configFile["chassis"][0]["devices"][0]["presence_detection"].erase(
@@ -2296,13 +2296,13 @@
json configFile = presenceDetectionFile;
configFile["chassis"][0]["devices"][0]["presence_detection"]["actions"]
[0]["compare_presence"]["fru"] =
- "/system/chassis/motherboard/cpu3";
+ "system/chassis/motherboard/cpu3";
configFile["chassis"][0]["devices"][0]["presence_detection"]["actions"]
[0]["compare_presence"]["value"] = true;
EXPECT_JSON_INVALID(
configFile, "Validation failed.",
"{'actions': [{'compare_presence': {'fru': "
- "'/system/chassis/motherboard/cpu3', 'value': True}}], 'comments': "
+ "'system/chassis/motherboard/cpu3', 'value': True}}], 'comments': "
"['Regulator is only present on the FooBar backplane'], 'rule_id': "
"'set_voltage_rule'} is valid under each of {'required': "
"['actions']}, {'required': ['rule_id']}");
@@ -2564,7 +2564,7 @@
.erase("rule_id");
configFile["chassis"][0]["devices"][0]["rails"][0]["sensor_monitoring"]
["actions"][0]["compare_presence"]["fru"] =
- "/system/chassis/motherboard/cpu3";
+ "system/chassis/motherboard/cpu3";
configFile["chassis"][0]["devices"][0]["rails"][0]["sensor_monitoring"]
["actions"][0]["compare_presence"]["value"] = true;
configFile["chassis"][0]["devices"][0]["rails"][0]["sensor_monitoring"]
@@ -2577,13 +2577,13 @@
json configFile = validConfigFile;
configFile["chassis"][0]["devices"][0]["rails"][0]["sensor_monitoring"]
["actions"][0]["compare_presence"]["fru"] =
- "/system/chassis/motherboard/cpu3";
+ "system/chassis/motherboard/cpu3";
configFile["chassis"][0]["devices"][0]["rails"][0]["sensor_monitoring"]
["actions"][0]["compare_presence"]["value"] = true;
EXPECT_JSON_INVALID(
configFile, "Validation failed.",
"{'actions': [{'compare_presence': {'fru': "
- "'/system/chassis/motherboard/cpu3', 'value': True}}], 'rule_id': "
+ "'system/chassis/motherboard/cpu3', 'value': True}}], 'rule_id': "
"'read_sensors_rule'} is valid under each of {'required': "
"['actions']}, {'required': ['rule_id']}");
}
@@ -2700,7 +2700,7 @@
configFile["chassis"][0]["devices"][1]["id"] = "vdd_regulator";
configFile["chassis"][0]["devices"][1]["is_regulator"] = true;
configFile["chassis"][0]["devices"][1]["fru"] =
- "/system/chassis/motherboard/regulator1";
+ "system/chassis/motherboard/regulator1";
configFile["chassis"][0]["devices"][1]["i2c_interface"]["bus"] = 2;
configFile["chassis"][0]["devices"][1]["i2c_interface"]["address"] =
"0x71";