Use Chassis interfaces to determine if chassis
Use the same interfaces used to determine members of
/redfish/v1/Chassis/ as to determine if a chassis exists,
/redfish/v1/Chassis/<ChassisId>.
Using something different, Inventory.Item.Asset, means
a /redfish/v1/Chassis/<ChassisId> could return found when it
does not belong to members of /redfish/v1/Chassis/ and
vice versa.
Changed the search depth of both commands to infinite.
Tested: Verified /redfish/v1/Chassis/ and
/redfish/v1/Chassis/<ChassisId> on a Witherspoon
Change-Id: I45cfbadfb5199224039df2d894a599e1e237cf15
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 1c4b9e0..fe6cdef 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -102,7 +102,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
- "/xyz/openbmc_project/inventory", int32_t(3), interfaces);
+ "/xyz/openbmc_project/inventory", int32_t(0), interfaces);
}
};
@@ -131,6 +131,11 @@
void doGet(crow::Response &res, const crow::Request &req,
const std::vector<std::string> ¶ms) override
{
+ const std::array<const char *, 3> interfaces = {
+ "xyz.openbmc_project.Inventory.Item.Board",
+ "xyz.openbmc_project.Inventory.Item.Chassis",
+ "xyz.openbmc_project.Inventory.Item.PowerSupply"};
+
// Check if there is required param, truly entering this shall be
// impossible.
if (params.size() != 1)
@@ -239,9 +244,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
- "/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
- "xyz.openbmc_project.Inventory.Decorator.Asset"});
+ "/xyz/openbmc_project/inventory", int32_t(0), interfaces);
}
};
} // namespace redfish