Always fall back to ChassisType RackMount

https://gerrit.openbmc.org/c/openbmc/bmcweb/+/75914 added support for
dynamic ChassisType. Before 75914, ChassisType was hardcoded to
RackMount. If you implement Inventory.Item.Chassis the default Chassis
Type is Unknown. Unknown in 75914 maps to Invalid and ChassisType is
left off the Redfish Chassis resource. The Redfish Validator flags this
as an error since ChassisType is a required property in the Chassis
schema.

The implementations should be setting the ChassisType but let's get
bmcweb bumps back on the rails and just set ChassisType = RackMount if
there is an error or if the Chassis Type is something we can't map (like
Unknown). This "your default ChassisType is RackMount" matches what we
had before.

Tested: Inspection and unit tests only.

Change-Id: Id577be522be7c2d3463da9c497d9063a284a4d54
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 51effb6..e2461e9 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -525,6 +525,11 @@
         return;
     }
 
+    // Chassis Type is a required property in Redfish
+    // If there is an error or some enum we don't support just sit it to Rack
+    // Mount
+    asyncResp->res.jsonValue["ChassisType"] = chassis::ChassisType::RackMount;
+
     if (type != nullptr)
     {
         auto chassisType = translateChassisTypeToRedfish(*type);
@@ -533,11 +538,6 @@
             asyncResp->res.jsonValue["ChassisType"] = chassisType;
         }
     }
-    else
-    {
-        asyncResp->res.jsonValue["ChassisType"] =
-            chassis::ChassisType::RackMount;
-    }
 }
 
 inline void handleChassisGetSubTree(
diff --git a/test/redfish-core/lib/chassis_test.cpp b/test/redfish-core/lib/chassis_test.cpp
index c6186cf..c97b42c 100644
--- a/test/redfish-core/lib/chassis_test.cpp
+++ b/test/redfish-core/lib/chassis_test.cpp
@@ -132,7 +132,8 @@
         dbus::utility::DbusVariantType(
             "xyz.openbmc_project.Inventory.Item.Chassis.ChassisType.Unknown"));
     handleChassisProperties(response, properties);
-    ASSERT_FALSE(response->res.jsonValue.contains("ChassisType"));
+    // We fall back to RackMount
+    ASSERT_EQ("RackMount", response->res.jsonValue["ChassisType"]);
 }
 
 TEST(HandleChassisProperties, FailToGetProperty)