regulators: Add inventory path to Chassis class
A previous commit added the "inventory_path" property to the "chassis"
object in the JSON configuration file.
This commit adds that new property to the C++ implementation:
* Chassis class and associated gtests
* JSON configuration file parser functions and associated gtests
* Other gtests affected by the change to the Chassis constructor
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I7406f874263d01e6faa2b8c333cb1baf915cf2ac
diff --git a/phosphor-regulators/src/chassis.hpp b/phosphor-regulators/src/chassis.hpp
index 7462094..30f62ff 100644
--- a/phosphor-regulators/src/chassis.hpp
+++ b/phosphor-regulators/src/chassis.hpp
@@ -61,15 +61,16 @@
*
* @param number Chassis number within the system. Chassis numbers start at
* 1 because chassis 0 represents the entire system.
+ * @param inventoryPath D-Bus inventory path for this chassis
* @param devices Devices within this chassis, if any. The vector should
* contain regulator devices and any related devices required
* to perform regulator operations.
*/
- explicit Chassis(unsigned int number,
+ explicit Chassis(unsigned int number, const std::string& inventoryPath,
std::vector<std::unique_ptr<Device>> devices =
std::vector<std::unique_ptr<Device>>{}) :
number{number},
- devices{std::move(devices)}
+ inventoryPath{inventoryPath}, devices{std::move(devices)}
{
if (number < 1)
{
@@ -122,6 +123,16 @@
}
/**
+ * Returns the D-Bus inventory path for this chassis.
+ *
+ * @return inventory path
+ */
+ const std::string& getInventoryPath() const
+ {
+ return inventoryPath;
+ }
+
+ /**
* Returns the chassis number within the system.
*
* @return chassis number
@@ -152,6 +163,11 @@
const unsigned int number{};
/**
+ * D-Bus inventory path for this chassis.
+ */
+ const std::string inventoryPath{};
+
+ /**
* Devices within this chassis, if any.
*
* The vector contains regulator devices and any related devices
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 99abd6c..5238741 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -203,6 +203,15 @@
}
++propertyCount;
+ // Optional inventory_path property. Will be required in future.
+ std::string inventoryPath{"/xyz/openbmc_project/inventory/system/chassis"};
+ auto inventoryPathIt = element.find("inventory_path");
+ if (inventoryPathIt != element.end())
+ {
+ inventoryPath = parseInventoryPath(*inventoryPathIt);
+ ++propertyCount;
+ }
+
// Optional devices property
std::vector<std::unique_ptr<Device>> devices{};
auto devicesIt = element.find("devices");
@@ -215,7 +224,7 @@
// Verify no invalid properties exist
verifyPropertyCount(element, propertyCount);
- return std::make_unique<Chassis>(number, std::move(devices));
+ return std::make_unique<Chassis>(number, inventoryPath, std::move(devices));
}
std::vector<std::unique_ptr<Chassis>> parseChassisArray(const json& element)
diff --git a/phosphor-regulators/test/chassis_tests.cpp b/phosphor-regulators/test/chassis_tests.cpp
index 36042d4..c04e917 100644
--- a/phosphor-regulators/test/chassis_tests.cpp
+++ b/phosphor-regulators/test/chassis_tests.cpp
@@ -46,12 +46,17 @@
using ::testing::Return;
using ::testing::TypedEq;
+// Default chassis inventory path
+static const std::string defaultInventoryPath{
+ "/xyz/openbmc_project/inventory/system/chassis"};
+
TEST(ChassisTests, Constructor)
{
// Test where works: Only required parameters are specified
{
- Chassis chassis{2};
+ Chassis chassis{2, defaultInventoryPath};
EXPECT_EQ(chassis.getNumber(), 2);
+ EXPECT_EQ(chassis.getInventoryPath(), defaultInventoryPath);
EXPECT_EQ(chassis.getDevices().size(), 0);
}
@@ -63,15 +68,16 @@
devices.emplace_back(createDevice("vdd_reg2"));
// Create Chassis
- Chassis chassis{1, std::move(devices)};
+ Chassis chassis{1, defaultInventoryPath, std::move(devices)};
EXPECT_EQ(chassis.getNumber(), 1);
+ EXPECT_EQ(chassis.getInventoryPath(), defaultInventoryPath);
EXPECT_EQ(chassis.getDevices().size(), 2);
}
// Test where fails: Invalid chassis number < 1
try
{
- Chassis chassis{0};
+ Chassis chassis{0, defaultInventoryPath};
ADD_FAILURE() << "Should not have reached this line.";
}
catch (const std::invalid_argument& e)
@@ -93,7 +99,7 @@
devices.emplace_back(createDevice("reg3"));
// Create Chassis
- Chassis chassis{1, std::move(devices)};
+ Chassis chassis{1, defaultInventoryPath, std::move(devices)};
// Add Device and Rail objects within the Chassis to an IDMap
IDMap idMap{};
@@ -132,7 +138,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, defaultInventoryPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -163,7 +169,7 @@
EXPECT_CALL(journal, logDebug("Closing devices in chassis 2")).Times(1);
// Create Chassis
- Chassis chassis{2};
+ Chassis chassis{2, defaultInventoryPath};
// Call closeDevices()
chassis.closeDevices(services);
@@ -213,7 +219,7 @@
}
// Create Chassis
- Chassis chassis{1, std::move(devices)};
+ Chassis chassis{1, defaultInventoryPath, std::move(devices)};
// Call closeDevices()
chassis.closeDevices(services);
@@ -232,7 +238,8 @@
EXPECT_CALL(journal, logError(A<const std::string&>())).Times(0);
// Create Chassis
- std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(1);
+ std::unique_ptr<Chassis> chassis =
+ std::make_unique<Chassis>(1, defaultInventoryPath);
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -300,8 +307,8 @@
}
// Create Chassis
- std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(2, std::move(devices));
+ std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
+ 2, defaultInventoryPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -319,7 +326,7 @@
{
// Test where no devices were specified in constructor
{
- Chassis chassis{2};
+ Chassis chassis{2, defaultInventoryPath};
EXPECT_EQ(chassis.getDevices().size(), 0);
}
@@ -331,16 +338,22 @@
devices.emplace_back(createDevice("vdd_reg2"));
// Create Chassis
- Chassis chassis{1, std::move(devices)};
+ Chassis chassis{1, defaultInventoryPath, std::move(devices)};
EXPECT_EQ(chassis.getDevices().size(), 2);
EXPECT_EQ(chassis.getDevices()[0]->getID(), "vdd_reg1");
EXPECT_EQ(chassis.getDevices()[1]->getID(), "vdd_reg2");
}
}
+TEST(ChassisTests, GetInventoryPath)
+{
+ Chassis chassis{3, defaultInventoryPath};
+ EXPECT_EQ(chassis.getInventoryPath(), defaultInventoryPath);
+}
+
TEST(ChassisTests, GetNumber)
{
- Chassis chassis{3};
+ Chassis chassis{3, defaultInventoryPath};
EXPECT_EQ(chassis.getNumber(), 3);
}
@@ -356,8 +369,8 @@
// Create Chassis
std::vector<std::unique_ptr<Device>> devices{};
- std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
+ 1, defaultInventoryPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -421,8 +434,8 @@
// Create Chassis
devices.emplace_back(std::move(device));
- std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
+ 1, defaultInventoryPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
diff --git a/phosphor-regulators/test/config_file_parser_tests.cpp b/phosphor-regulators/test/config_file_parser_tests.cpp
index 19bf73b..c2cf08e 100644
--- a/phosphor-regulators/test/config_file_parser_tests.cpp
+++ b/phosphor-regulators/test/config_file_parser_tests.cpp
@@ -760,6 +760,8 @@
)"_json;
std::unique_ptr<Chassis> chassis = parseChassis(element);
EXPECT_EQ(chassis->getNumber(), 1);
+ EXPECT_EQ(chassis->getInventoryPath(),
+ "/xyz/openbmc_project/inventory/system/chassis");
EXPECT_EQ(chassis->getDevices().size(), 0);
}
@@ -769,6 +771,7 @@
{
"comments": [ "comments property" ],
"number": 2,
+ "inventory_path": "system/chassis2",
"devices": [
{
"id": "vdd_regulator",
@@ -785,6 +788,8 @@
)"_json;
std::unique_ptr<Chassis> chassis = parseChassis(element);
EXPECT_EQ(chassis->getNumber(), 2);
+ EXPECT_EQ(chassis->getInventoryPath(),
+ "/xyz/openbmc_project/inventory/system/chassis2");
EXPECT_EQ(chassis->getDevices().size(), 1);
EXPECT_EQ(chassis->getDevices()[0]->getID(), "vdd_regulator");
}
@@ -805,6 +810,40 @@
EXPECT_STREQ(e.what(), "Element is not an unsigned integer");
}
+ // Test where fails: inventory_path is invalid: Not a string
+ try
+ {
+ const json element = R"(
+ {
+ "number": 2,
+ "inventory_path": true
+ }
+ )"_json;
+ parseChassis(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: inventory_path is invalid: Empty string
+ try
+ {
+ const json element = R"(
+ {
+ "number": 2,
+ "inventory_path": ""
+ }
+ )"_json;
+ parseChassis(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 where fails: Invalid property specified
try
{
diff --git a/phosphor-regulators/test/configuration_tests.cpp b/phosphor-regulators/test/configuration_tests.cpp
index 47279be..2f4ded6 100644
--- a/phosphor-regulators/test/configuration_tests.cpp
+++ b/phosphor-regulators/test/configuration_tests.cpp
@@ -49,6 +49,9 @@
using ::testing::Throw;
using ::testing::TypedEq;
+static const std::string chassisInvPath{
+ "/xyz/openbmc_project/inventory/system/chassis"};
+
TEST(ConfigurationTests, Constructor)
{
// Test where volts value specified
@@ -122,7 +125,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -182,7 +185,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -249,7 +252,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -315,7 +318,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -384,7 +387,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -460,7 +463,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
diff --git a/phosphor-regulators/test/device_tests.cpp b/phosphor-regulators/test/device_tests.cpp
index c3ed166..0c386fb 100644
--- a/phosphor-regulators/test/device_tests.cpp
+++ b/phosphor-regulators/test/device_tests.cpp
@@ -50,6 +50,9 @@
using ::testing::Throw;
using ::testing::TypedEq;
+static const std::string chassisInvPath{
+ "/xyz/openbmc_project/inventory/system/chassis"};
+
TEST(DeviceTests, Constructor)
{
// Test where only required parameters are specified
@@ -190,7 +193,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -342,7 +345,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -375,7 +378,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -461,7 +464,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -624,7 +627,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -662,7 +665,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -700,7 +703,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -755,7 +758,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -821,7 +824,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
diff --git a/phosphor-regulators/test/presence_detection_tests.cpp b/phosphor-regulators/test/presence_detection_tests.cpp
index e89af2c..c63f403 100644
--- a/phosphor-regulators/test/presence_detection_tests.cpp
+++ b/phosphor-regulators/test/presence_detection_tests.cpp
@@ -107,8 +107,8 @@
// Create Chassis that contains Device
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
- std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::unique_ptr<Chassis> chassis = std::make_unique<Chassis>(
+ 1, "/xyz/openbmc_project/inventory/system/chassis", std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
diff --git a/phosphor-regulators/test/rail_tests.cpp b/phosphor-regulators/test/rail_tests.cpp
index f0d9529..4f52701 100644
--- a/phosphor-regulators/test/rail_tests.cpp
+++ b/phosphor-regulators/test/rail_tests.cpp
@@ -44,6 +44,9 @@
using ::testing::Return;
using ::testing::TypedEq;
+static const std::string chassisInvPath{
+ "/xyz/openbmc_project/inventory/system/chassis"};
+
TEST(RailTests, Constructor)
{
// Test where only required parameters are specified
@@ -115,7 +118,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -169,7 +172,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -250,7 +253,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -316,7 +319,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
diff --git a/phosphor-regulators/test/sensor_monitoring_tests.cpp b/phosphor-regulators/test/sensor_monitoring_tests.cpp
index f2f4359..4dfd415 100644
--- a/phosphor-regulators/test/sensor_monitoring_tests.cpp
+++ b/phosphor-regulators/test/sensor_monitoring_tests.cpp
@@ -50,6 +50,9 @@
using ::testing::Throw;
using ::testing::TypedEq;
+static const std::string chassisInvPath{
+ "/xyz/openbmc_project/inventory/system/chassis"};
+
TEST(SensorMonitoringTests, Constructor)
{
std::vector<std::unique_ptr<Action>> actions{};
@@ -115,7 +118,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -198,7 +201,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
diff --git a/phosphor-regulators/test/system_tests.cpp b/phosphor-regulators/test/system_tests.cpp
index 5ce76ed..2bd94e0 100644
--- a/phosphor-regulators/test/system_tests.cpp
+++ b/phosphor-regulators/test/system_tests.cpp
@@ -43,6 +43,9 @@
using ::testing::Return;
using ::testing::TypedEq;
+static const std::string chassisInvPath{
+ "/xyz/openbmc_project/inventory/system/chassis"};
+
TEST(SystemTests, Constructor)
{
// Create Rules
@@ -53,7 +56,8 @@
std::vector<std::unique_ptr<Chassis>> chassis{};
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(createDevice("reg1", {"rail1"}));
- chassis.emplace_back(std::make_unique<Chassis>(1, std::move(devices)));
+ chassis.emplace_back(
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices)));
// Create System
System system{std::move(rules), std::move(chassis)};
@@ -87,7 +91,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
Chassis* chassisPtr = chassis.get();
// Create System that contains Chassis
@@ -123,8 +127,8 @@
// Create Chassis
std::vector<std::unique_ptr<Chassis>> chassis{};
- chassis.emplace_back(std::make_unique<Chassis>(1));
- chassis.emplace_back(std::make_unique<Chassis>(3));
+ chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1'));
+ chassis.emplace_back(std::make_unique<Chassis>(3, chassisInvPath + '3'));
// Create System
System system{std::move(rules), std::move(chassis)};
@@ -148,8 +152,8 @@
// Create Chassis
std::vector<std::unique_ptr<Chassis>> chassis{};
- chassis.emplace_back(std::make_unique<Chassis>(1));
- chassis.emplace_back(std::make_unique<Chassis>(3));
+ chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1'));
+ chassis.emplace_back(std::make_unique<Chassis>(3, chassisInvPath + '3'));
// Create System
System system{std::move(rules), std::move(chassis)};
@@ -165,8 +169,8 @@
// Create Chassis
std::vector<std::unique_ptr<Chassis>> chassis{};
- chassis.emplace_back(std::make_unique<Chassis>(1));
- chassis.emplace_back(std::make_unique<Chassis>(3));
+ chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1'));
+ chassis.emplace_back(std::make_unique<Chassis>(3, chassisInvPath + '3'));
// Create System
System system{std::move(rules), std::move(chassis)};
@@ -189,14 +193,16 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(createDevice("reg1", {"rail1"}));
devices.emplace_back(createDevice("reg2", {"rail2a", "rail2b"}));
- chassis.emplace_back(std::make_unique<Chassis>(1, std::move(devices)));
+ chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath + '1',
+ std::move(devices)));
}
{
// Chassis 2
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(createDevice("reg3", {"rail3a", "rail3b"}));
devices.emplace_back(createDevice("reg4"));
- chassis.emplace_back(std::make_unique<Chassis>(2, std::move(devices)));
+ chassis.emplace_back(std::make_unique<Chassis>(2, chassisInvPath + '2',
+ std::move(devices)));
}
// Create System
@@ -233,7 +239,7 @@
// Create Chassis
std::vector<std::unique_ptr<Chassis>> chassis{};
- chassis.emplace_back(std::make_unique<Chassis>(1));
+ chassis.emplace_back(std::make_unique<Chassis>(1, chassisInvPath));
// Create System
System system{std::move(rules), std::move(chassis)};
@@ -293,7 +299,7 @@
std::vector<std::unique_ptr<Device>> devices{};
devices.emplace_back(std::move(device));
std::unique_ptr<Chassis> chassis =
- std::make_unique<Chassis>(1, std::move(devices));
+ std::make_unique<Chassis>(1, chassisInvPath, std::move(devices));
// Create System that contains Chassis
std::vector<std::unique_ptr<Rule>> rules{};