pseq: Parsing support for chassis_template element

Add JSON parsing support for the new chassis_template element in the
phosphor-power-sequencer configuration file.

Also move the type alias 'json = nlohmann::json' from
config_file_parse.cpp to config_file_parser.hpp. This simplifies the
function declarations and allows them to textually match the function
definitions.

Tested:
* Ran automated tests.

Change-Id: I666ae0a6382ffec6643d3e268117d006b6c4dd2a
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/phosphor-power-sequencer/src/config_file_parser.cpp b/phosphor-power-sequencer/src/config_file_parser.cpp
index 4539eb7..6d9b169 100644
--- a/phosphor-power-sequencer/src/config_file_parser.cpp
+++ b/phosphor-power-sequencer/src/config_file_parser.cpp
@@ -29,7 +29,6 @@
 
 using namespace phosphor::power::json_parser_utils;
 using ConfigFileParserError = phosphor::power::util::ConfigFileParserError;
-using json = nlohmann::json;
 namespace fs = std::filesystem;
 
 namespace phosphor::power::sequencer::config_file_parser
@@ -95,6 +94,44 @@
 namespace internal
 {
 
+std::tuple<std::string, JSONRefWrapper> parseChassisTemplate(
+    const json& element)
+{
+    verifyIsObject(element);
+    unsigned int propertyCount{0};
+
+    // Optional comments property; value not stored
+    if (element.contains("comments"))
+    {
+        ++propertyCount;
+    }
+
+    // Required id property
+    const json& idElement = getRequiredProperty(element, "id");
+    std::string id = parseString(idElement);
+    ++propertyCount;
+
+    // Required number property
+    // Just verify it exists; cannot be parsed without variable values
+    getRequiredProperty(element, "number");
+    ++propertyCount;
+
+    // Required inventory_path property
+    // Just verify it exists; cannot be parsed without variable values
+    getRequiredProperty(element, "inventory_path");
+    ++propertyCount;
+
+    // Required power_sequencers property
+    // Just verify it exists; cannot be parsed without variable values
+    getRequiredProperty(element, "power_sequencers");
+    ++propertyCount;
+
+    // Verify no invalid properties exist
+    verifyPropertyCount(element, propertyCount);
+
+    return {id, JSONRefWrapper{element}};
+}
+
 GPIO parseGPIO(const json& element,
                const std::map<std::string, std::string>& variables)
 {