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)