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