regulators: Add inventory_path to JSON chassis obj

Add the property "inventory_path" to the "chassis" object in the JSON
configuration file.

This property will be used to create the required D-Bus association
between a voltage regulator sensor and the chassis that contains it.
This association is required by the Redfish support.

Long term, this new property will be required.  That is how it is
documented in the updated version of chassis.md.

However, it will be temporarily optional in the JSON schema and the C++
configuration file parser.  This temporary measure will be removed once
all known JSON configuration files have been updated to specify the new
property.

Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: I45f5e8ec86be7672a33099c94c35328862ffe11b
diff --git a/phosphor-regulators/test/validate-regulators-config_tests.cpp b/phosphor-regulators/test/validate-regulators-config_tests.cpp
index fb1a40e..e6b84ec 100644
--- a/phosphor-regulators/test/validate-regulators-config_tests.cpp
+++ b/phosphor-regulators/test/validate-regulators-config_tests.cpp
@@ -75,6 +75,7 @@
         {
           "comments": [ "Chassis number 1 containing CPUs and memory" ],
           "number": 1,
+          "inventory_path": "system/chassis",
           "devices": [
             {
               "comments": [ "IR35221 regulator producing the Vdd rail" ],
@@ -513,10 +514,11 @@
         json configFile = validConfigFile;
         EXPECT_JSON_VALID(configFile);
     }
-    // Valid: test chassis with required properties.
+    // Valid: test chassis with only required properties.
     {
         json configFile = validConfigFile;
         configFile["chassis"][0].erase("comments");
+        configFile["chassis"][0].erase("inventory_path");
         configFile["chassis"][0].erase("devices");
         EXPECT_JSON_VALID(configFile);
     }
@@ -541,6 +543,13 @@
         EXPECT_JSON_INVALID(configFile, "Validation failed.",
                             "1.3 is not of type 'integer'");
     }
+    // Invalid: test chassis with property inventory_path wrong type.
+    {
+        json configFile = validConfigFile;
+        configFile["chassis"][0]["inventory_path"] = 2;
+        EXPECT_JSON_INVALID(configFile, "Validation failed.",
+                            "2 is not of type 'string'");
+    }
     // Invalid: test chassis with property devices wrong type.
     {
         json configFile = validConfigFile;
@@ -569,6 +578,13 @@
         EXPECT_JSON_INVALID(configFile, "Validation failed.",
                             "0 is less than the minimum of 1");
     }
+    // Invalid: test chassis with property inventory_path empty string.
+    {
+        json configFile = validConfigFile;
+        configFile["chassis"][0]["inventory_path"] = "";
+        EXPECT_JSON_INVALID(configFile, "Validation failed.",
+                            "'' is too short");
+    }
 }
 TEST(ValidateRegulatorsConfigTest, ComparePresence)
 {