summaryrefslogtreecommitdiff
path: root/redfish-core/lib/chassis.hpp
diff options
context:
space:
mode:
authorGunnar Mills <gmills@us.ibm.com>2019-01-22 01:33:50 +0300
committerEd Tanous <ed.tanous@intel.com>2019-02-07 04:04:52 +0300
commit734bfe90949b230b1d3e061522f45903c10c7b08 (patch)
tree9f425119acbfb3e51df0b500b0e417d07befcf35 /redfish-core/lib/chassis.hpp
parent63faafa51e36aee569af10cb40cbd32bafc68e33 (diff)
downloadbmcweb-734bfe90949b230b1d3e061522f45903c10c7b08.tar.xz
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>
Diffstat (limited to 'redfish-core/lib/chassis.hpp')
-rw-r--r--redfish-core/lib/chassis.hpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 1c4b9e043d..fe6cdefd6e 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -102,7 +102,7 @@ class ChassisCollection : public Node
"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 @@ class Chassis : public Node
void doGet(crow::Response &res, const crow::Request &req,
const std::vector<std::string> &params) 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 @@ class Chassis : public Node
"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