summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorChau Ly <chaul@amperecomputing.com>2023-10-15 17:55:30 +0300
committerEd Tanous <ed@tanous.net>2023-11-29 22:21:23 +0300
commit7164bc62dd26ec92b01985aaae97ecc48276dea5 (patch)
tree645e66a54b28ae3f4a53e39171d439615cf9ef4c /redfish-core
parent549bed29de868521f646325a5533b25ba10aee1e (diff)
downloadbmcweb-7164bc62dd26ec92b01985aaae97ecc48276dea5.tar.xz
chassis: Tidy up lambda funcs in get chassis
This commit tries to avoid the cumbersomeness of lambda functions used directly or indirectly by handleChassisGet method. Lengthy lambda functions are replaced by or involve normal functions. There's no functional change in this commit. Change-Id: I67e028cdab3ea4407dafde0a510b37a160497f48 Signed-off-by: Chau Ly <chaul@amperecomputing.com>
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/chassis.hpp583
1 files changed, 289 insertions, 294 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 594449c809..72f5011db2 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -22,6 +22,7 @@
#include "health.hpp"
#include "led.hpp"
#include "query.hpp"
+#include "redfish_util.hpp"
#include "registries/privilege_registry.hpp"
#include "utils/collection.hpp"
#include "utils/dbus_utils.hpp"
@@ -134,62 +135,52 @@ inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
});
}
-inline void getIntrusionByService(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
- const std::string& service,
- const std::string& objPath)
-{
- BMCWEB_LOG_DEBUG("Get intrusion status by service ");
-
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service, objPath,
- "xyz.openbmc_project.Chassis.Intrusion", "Status",
- [asyncResp{std::move(asyncResp)}](const boost::system::error_code& ec,
- const std::string& value) {
- if (ec)
- {
- // do not add err msg in redfish response, because this is not
- // mandatory property
- BMCWEB_LOG_ERROR("DBUS response error {}", ec);
- return;
- }
-
- asyncResp->res.jsonValue["PhysicalSecurity"]["IntrusionSensorNumber"] =
- 1;
- asyncResp->res.jsonValue["PhysicalSecurity"]["IntrusionSensor"] = value;
- });
-}
-
/**
* Retrieves physical security properties over dbus
*/
-inline void
- getPhysicalSecurityData(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
+inline void handlePhysicalSecurityGetSubTree(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const boost::system::error_code& ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree)
{
- constexpr std::array<std::string_view, 1> interfaces = {
- "xyz.openbmc_project.Chassis.Intrusion"};
- dbus::utility::getSubTree(
- "/xyz/openbmc_project", 0, interfaces,
- [asyncResp{std::move(asyncResp)}](
- const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreeResponse& subtree) {
- if (ec)
+ if (ec)
+ {
+ // do not add err msg in redfish response, because this is not
+ // mandatory property
+ BMCWEB_LOG_INFO("DBUS error: no matched iface {}", ec);
+ return;
+ }
+ // Iterate over all retrieved ObjectPaths.
+ for (const auto& object : subtree)
+ {
+ if (!object.second.empty())
{
- // do not add err msg in redfish response, because this is not
- // mandatory property
- BMCWEB_LOG_INFO("DBUS error: no matched iface {}", ec);
+ const auto service = object.second.front();
+
+ BMCWEB_LOG_DEBUG("Get intrusion status by service ");
+
+ sdbusplus::asio::getProperty<std::string>(
+ *crow::connections::systemBus, service.first, object.first,
+ "xyz.openbmc_project.Chassis.Intrusion", "Status",
+ [asyncResp](const boost::system::error_code& ec1,
+ const std::string& value) {
+ if (ec1)
+ {
+ // do not add err msg in redfish response, because this is
+ // not
+ // mandatory property
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec1);
+ return;
+ }
+ asyncResp->res
+ .jsonValue["PhysicalSecurity"]["IntrusionSensorNumber"] = 1;
+ asyncResp->res
+ .jsonValue["PhysicalSecurity"]["IntrusionSensor"] = value;
+ });
+
return;
}
- // Iterate over all retrieved ObjectPaths.
- for (const auto& object : subtree)
- {
- if (!object.second.empty())
- {
- const auto service = object.second.front();
- getIntrusionByService(asyncResp, service.first, object.first);
- return;
- }
- }
- });
+ }
}
inline void handleChassisCollectionGet(
@@ -363,286 +354,290 @@ inline void getChassisUUID(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
});
}
-inline void
- handleChassisGet(App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& chassisId)
+inline void handleDecoratorAssetProperties(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId, const std::string& path,
+ const dbus::utility::DBusPropertiesMap& propertiesList)
{
- if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ const std::string* partNumber = nullptr;
+ const std::string* serialNumber = nullptr;
+ const std::string* manufacturer = nullptr;
+ const std::string* model = nullptr;
+ const std::string* sparePartNumber = nullptr;
+
+ const bool success = sdbusplus::unpackPropertiesNoThrow(
+ dbus_utils::UnpackErrorPrinter(), propertiesList, "PartNumber",
+ partNumber, "SerialNumber", serialNumber, "Manufacturer", manufacturer,
+ "Model", model, "SparePartNumber", sparePartNumber);
+
+ if (!success)
{
+ messages::internalError(asyncResp->res);
return;
}
- constexpr std::array<std::string_view, 2> interfaces = {
- "xyz.openbmc_project.Inventory.Item.Board",
- "xyz.openbmc_project.Inventory.Item.Chassis"};
- dbus::utility::getSubTree(
- "/xyz/openbmc_project/inventory", 0, interfaces,
- [asyncResp, chassisId(std::string(chassisId))](
- const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreeResponse& subtree) {
- if (ec)
+ if (partNumber != nullptr)
+ {
+ asyncResp->res.jsonValue["PartNumber"] = *partNumber;
+ }
+
+ if (serialNumber != nullptr)
+ {
+ asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
+ }
+
+ if (manufacturer != nullptr)
+ {
+ asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
+ }
+
+ if (model != nullptr)
+ {
+ asyncResp->res.jsonValue["Model"] = *model;
+ }
+
+ // SparePartNumber is optional on D-Bus
+ // so skip if it is empty
+ if (sparePartNumber != nullptr && !sparePartNumber->empty())
+ {
+ asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
+ }
+
+ asyncResp->res.jsonValue["Name"] = chassisId;
+ asyncResp->res.jsonValue["Id"] = chassisId;
+#ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
+ asyncResp->res.jsonValue["Thermal"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Thermal", chassisId);
+ // Power object
+ asyncResp->res.jsonValue["Power"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Power", chassisId);
+#endif
+#ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
+ asyncResp->res.jsonValue["ThermalSubsystem"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/ThermalSubsystem",
+ chassisId);
+ asyncResp->res.jsonValue["PowerSubsystem"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/PowerSubsystem", chassisId);
+ asyncResp->res.jsonValue["EnvironmentMetrics"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/EnvironmentMetrics",
+ chassisId);
+#endif
+ // SensorCollection
+ asyncResp->res.jsonValue["Sensors"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Sensors", chassisId);
+ asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+
+ nlohmann::json::array_t computerSystems;
+ nlohmann::json::object_t system;
+ system["@odata.id"] = "/redfish/v1/Systems/system";
+ computerSystems.emplace_back(std::move(system));
+ asyncResp->res.jsonValue["Links"]["ComputerSystems"] =
+ std::move(computerSystems);
+
+ nlohmann::json::array_t managedBy;
+ nlohmann::json::object_t manager;
+ manager["@odata.id"] = "/redfish/v1/Managers/bmc";
+ managedBy.emplace_back(std::move(manager));
+ asyncResp->res.jsonValue["Links"]["ManagedBy"] = std::move(managedBy);
+ getChassisState(asyncResp);
+ getStorageLink(asyncResp, path);
+}
+
+inline void handleChassisGetSubTree(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId, const boost::system::error_code& ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree)
+{
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR("DBUS response error {}", ec);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ // Iterate over all retrieved ObjectPaths.
+ for (const std::pair<
+ std::string,
+ std::vector<std::pair<std::string, std::vector<std::string>>>>&
+ object : subtree)
+ {
+ const std::string& path = object.first;
+ const std::vector<std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
+
+ sdbusplus::message::object_path objPath(path);
+ if (objPath.filename() != chassisId)
{
- BMCWEB_LOG_ERROR("DBUS response error {}", ec);
- messages::internalError(asyncResp->res);
- return;
+ continue;
}
- // Iterate over all retrieved ObjectPaths.
- for (const std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>&
- object : subtree)
+
+ getChassisConnectivity(asyncResp, chassisId, path);
+
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+
+ if constexpr (bmcwebEnableHealthPopulate)
{
- const std::string& path = object.first;
- const std::vector<std::pair<std::string, std::vector<std::string>>>&
- connectionNames = object.second;
+ dbus::utility::getAssociationEndPoints(
+ path + "/all_sensors",
+ [health](const boost::system::error_code& ec2,
+ const dbus::utility::MapperEndPoints& resp) {
+ if (ec2)
+ {
+ return; // no sensors = no failures
+ }
+ health->inventory = resp;
+ });
- sdbusplus::message::object_path objPath(path);
- if (objPath.filename() != chassisId)
+ health->populate();
+ }
+
+ if (connectionNames.empty())
+ {
+ BMCWEB_LOG_ERROR("Got 0 Connection names");
+ continue;
+ }
+
+ asyncResp->res.jsonValue["@odata.type"] = "#Chassis.v1_22_0.Chassis";
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}", chassisId);
+ asyncResp->res.jsonValue["Name"] = "Chassis Collection";
+ asyncResp->res.jsonValue["ChassisType"] = "RackMount";
+ asyncResp->res.jsonValue["Actions"]["#Chassis.Reset"]["target"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Actions/Chassis.Reset",
+ chassisId);
+ asyncResp->res
+ .jsonValue["Actions"]["#Chassis.Reset"]["@Redfish.ActionInfo"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/ResetActionInfo",
+ chassisId);
+ asyncResp->res.jsonValue["PCIeDevices"]["@odata.id"] =
+ "/redfish/v1/Systems/system/PCIeDevices";
+
+ dbus::utility::getAssociationEndPoints(
+ path + "/drive",
+ [asyncResp, chassisId](const boost::system::error_code& ec3,
+ const dbus::utility::MapperEndPoints& resp) {
+ if (ec3 || resp.empty())
{
- continue;
+ return; // no drives = no failures
}
- getChassisConnectivity(asyncResp, chassisId, path);
+ nlohmann::json reference;
+ reference["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Drives", chassisId);
+ asyncResp->res.jsonValue["Drives"] = std::move(reference);
+ });
+
+ const std::string& connectionName = connectionNames[0].first;
- auto health = std::make_shared<HealthPopulate>(asyncResp);
+ const std::vector<std::string>& interfaces2 = connectionNames[0].second;
+ const std::array<const char*, 2> hasIndicatorLed = {
+ "xyz.openbmc_project.Inventory.Item.Panel",
+ "xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
- if constexpr (bmcwebEnableHealthPopulate)
+ const std::string assetTagInterface =
+ "xyz.openbmc_project.Inventory.Decorator.AssetTag";
+ const std::string replaceableInterface =
+ "xyz.openbmc_project.Inventory.Decorator.Replaceable";
+ for (const auto& interface : interfaces2)
+ {
+ if (interface == assetTagInterface)
{
- dbus::utility::getAssociationEndPoints(
- path + "/all_sensors",
- [health](const boost::system::error_code& ec2,
- const dbus::utility::MapperEndPoints& resp) {
+ sdbusplus::asio::getProperty<std::string>(
+ *crow::connections::systemBus, connectionName, path,
+ assetTagInterface, "AssetTag",
+ [asyncResp, chassisId](const boost::system::error_code& ec2,
+ const std::string& property) {
if (ec2)
{
- return; // no sensors = no failures
+ BMCWEB_LOG_ERROR("DBus response error for AssetTag: {}",
+ ec2);
+ messages::internalError(asyncResp->res);
+ return;
}
- health->inventory = resp;
+ asyncResp->res.jsonValue["AssetTag"] = property;
});
-
- health->populate();
}
-
- if (connectionNames.empty())
+ else if (interface == replaceableInterface)
{
- BMCWEB_LOG_ERROR("Got 0 Connection names");
- continue;
+ sdbusplus::asio::getProperty<bool>(
+ *crow::connections::systemBus, connectionName, path,
+ replaceableInterface, "HotPluggable",
+ [asyncResp, chassisId](const boost::system::error_code& ec2,
+ const bool property) {
+ if (ec2)
+ {
+ BMCWEB_LOG_ERROR(
+ "DBus response error for HotPluggable: {}", ec2);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["HotPluggable"] = property;
+ });
}
+ }
- asyncResp->res.jsonValue["@odata.type"] =
- "#Chassis.v1_22_0.Chassis";
- asyncResp->res.jsonValue["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}", chassisId);
- asyncResp->res.jsonValue["Name"] = "Chassis Collection";
- asyncResp->res.jsonValue["ChassisType"] = "RackMount";
- asyncResp->res.jsonValue["Actions"]["#Chassis.Reset"]["target"] =
- boost::urls::format(
- "/redfish/v1/Chassis/{}/Actions/Chassis.Reset", chassisId);
- asyncResp->res
- .jsonValue["Actions"]["#Chassis.Reset"]["@Redfish.ActionInfo"] =
- boost::urls::format("/redfish/v1/Chassis/{}/ResetActionInfo",
- chassisId);
- asyncResp->res.jsonValue["PCIeDevices"]["@odata.id"] =
- "/redfish/v1/Systems/system/PCIeDevices";
-
- dbus::utility::getAssociationEndPoints(
- path + "/drive",
- [asyncResp,
- chassisId](const boost::system::error_code& ec3,
- const dbus::utility::MapperEndPoints& resp) {
- if (ec3 || resp.empty())
- {
- return; // no drives = no failures
- }
-
- nlohmann::json reference;
- reference["@odata.id"] = boost::urls::format(
- "/redfish/v1/Chassis/{}/Drives", chassisId);
- asyncResp->res.jsonValue["Drives"] = std::move(reference);
- });
-
- const std::string& connectionName = connectionNames[0].first;
+ for (const char* interface : hasIndicatorLed)
+ {
+ if (std::ranges::find(interfaces2, interface) != interfaces2.end())
+ {
+ getIndicatorLedState(asyncResp);
+ getSystemLocationIndicatorActive(asyncResp);
+ break;
+ }
+ }
- const std::vector<std::string>& interfaces2 =
- connectionNames[0].second;
- const std::array<const char*, 2> hasIndicatorLed = {
- "xyz.openbmc_project.Inventory.Item.Panel",
- "xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
+ sdbusplus::asio::getAllProperties(
+ *crow::connections::systemBus, connectionName, path,
+ "xyz.openbmc_project.Inventory.Decorator.Asset",
+ [asyncResp, chassisId,
+ path](const boost::system::error_code&,
+ const dbus::utility::DBusPropertiesMap& propertiesList) {
+ handleDecoratorAssetProperties(asyncResp, chassisId, path,
+ propertiesList);
+ });
- const std::string assetTagInterface =
- "xyz.openbmc_project.Inventory.Decorator.AssetTag";
- const std::string replaceableInterface =
- "xyz.openbmc_project.Inventory.Decorator.Replaceable";
- for (const auto& interface : interfaces2)
+ for (const auto& interface : interfaces2)
+ {
+ if (interface == "xyz.openbmc_project.Common.UUID")
{
- if (interface == assetTagInterface)
- {
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, connectionName, path,
- assetTagInterface, "AssetTag",
- [asyncResp,
- chassisId](const boost::system::error_code& ec2,
- const std::string& property) {
- if (ec2)
- {
- BMCWEB_LOG_ERROR(
- "DBus response error for AssetTag: {}", ec2);
- messages::internalError(asyncResp->res);
- return;
- }
- asyncResp->res.jsonValue["AssetTag"] = property;
- });
- }
- else if (interface == replaceableInterface)
- {
- sdbusplus::asio::getProperty<bool>(
- *crow::connections::systemBus, connectionName, path,
- replaceableInterface, "HotPluggable",
- [asyncResp,
- chassisId](const boost::system::error_code& ec2,
- const bool property) {
- if (ec2)
- {
- BMCWEB_LOG_ERROR(
- "DBus response error for HotPluggable: {}",
- ec2);
- messages::internalError(asyncResp->res);
- return;
- }
- asyncResp->res.jsonValue["HotPluggable"] = property;
- });
- }
+ getChassisUUID(asyncResp, connectionName, path);
}
-
- for (const char* interface : hasIndicatorLed)
+ else if (interface ==
+ "xyz.openbmc_project.Inventory.Decorator.LocationCode")
{
- if (std::ranges::find(interfaces2, interface) !=
- interfaces2.end())
- {
- getIndicatorLedState(asyncResp);
- getSystemLocationIndicatorActive(asyncResp);
- break;
- }
+ getChassisLocationCode(asyncResp, connectionName, path);
}
+ }
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, connectionName, path,
- "xyz.openbmc_project.Inventory.Decorator.Asset",
- [asyncResp, chassisId(std::string(chassisId)),
- path](const boost::system::error_code& /*ec2*/,
- const dbus::utility::DBusPropertiesMap& propertiesList) {
- const std::string* partNumber = nullptr;
- const std::string* serialNumber = nullptr;
- const std::string* manufacturer = nullptr;
- const std::string* model = nullptr;
- const std::string* sparePartNumber = nullptr;
-
- const bool success = sdbusplus::unpackPropertiesNoThrow(
- dbus_utils::UnpackErrorPrinter(), propertiesList,
- "PartNumber", partNumber, "SerialNumber", serialNumber,
- "Manufacturer", manufacturer, "Model", model,
- "SparePartNumber", sparePartNumber);
-
- if (!success)
- {
- messages::internalError(asyncResp->res);
- return;
- }
-
- if (partNumber != nullptr)
- {
- asyncResp->res.jsonValue["PartNumber"] = *partNumber;
- }
-
- if (serialNumber != nullptr)
- {
- asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
- }
-
- if (manufacturer != nullptr)
- {
- asyncResp->res.jsonValue["Manufacturer"] = *manufacturer;
- }
-
- if (model != nullptr)
- {
- asyncResp->res.jsonValue["Model"] = *model;
- }
-
- // SparePartNumber is optional on D-Bus
- // so skip if it is empty
- if (sparePartNumber != nullptr && !sparePartNumber->empty())
- {
- asyncResp->res.jsonValue["SparePartNumber"] =
- *sparePartNumber;
- }
+ return;
+ }
- asyncResp->res.jsonValue["Name"] = chassisId;
- asyncResp->res.jsonValue["Id"] = chassisId;
-#ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
- asyncResp->res.jsonValue["Thermal"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/Thermal",
- chassisId);
- // Power object
- asyncResp->res.jsonValue["Power"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/Power",
- chassisId);
-#endif
-#ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
- asyncResp->res.jsonValue["ThermalSubsystem"]["@odata.id"] =
- boost::urls::format(
- "/redfish/v1/Chassis/{}/ThermalSubsystem", chassisId);
- asyncResp->res.jsonValue["PowerSubsystem"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/PowerSubsystem",
- chassisId);
- asyncResp->res.jsonValue["EnvironmentMetrics"]["@odata.id"] =
- boost::urls::format(
- "/redfish/v1/Chassis/{}/EnvironmentMetrics", chassisId);
-#endif
- // SensorCollection
- asyncResp->res.jsonValue["Sensors"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/Sensors",
- chassisId);
- asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
-
- nlohmann::json::array_t computerSystems;
- nlohmann::json::object_t system;
- system["@odata.id"] = "/redfish/v1/Systems/system";
- computerSystems.emplace_back(std::move(system));
- asyncResp->res.jsonValue["Links"]["ComputerSystems"] =
- std::move(computerSystems);
-
- nlohmann::json::array_t managedBy;
- nlohmann::json::object_t manager;
- manager["@odata.id"] = "/redfish/v1/Managers/bmc";
- managedBy.emplace_back(std::move(manager));
- asyncResp->res.jsonValue["Links"]["ManagedBy"] =
- std::move(managedBy);
- getChassisState(asyncResp);
- getStorageLink(asyncResp, path);
- });
+ // Couldn't find an object with that name. return an error
+ messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
+}
- for (const auto& interface : interfaces2)
- {
- if (interface == "xyz.openbmc_project.Common.UUID")
- {
- getChassisUUID(asyncResp, connectionName, path);
- }
- else if (interface ==
- "xyz.openbmc_project.Inventory.Decorator.LocationCode")
- {
- getChassisLocationCode(asyncResp, connectionName, path);
- }
- }
+inline void
+ handleChassisGet(App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ constexpr std::array<std::string_view, 2> interfaces = {
+ "xyz.openbmc_project.Inventory.Item.Board",
+ "xyz.openbmc_project.Inventory.Item.Chassis"};
- return;
- }
+ dbus::utility::getSubTree(
+ "/xyz/openbmc_project/inventory", 0, interfaces,
+ std::bind_front(handleChassisGetSubTree, asyncResp, chassisId));
- // Couldn't find an object with that name. return an error
- messages::resourceNotFound(asyncResp->res, "Chassis", chassisId);
- });
+ constexpr std::array<std::string_view, 1> interfaces2 = {
+ "xyz.openbmc_project.Chassis.Intrusion"};
- getPhysicalSecurityData(asyncResp);
+ dbus::utility::getSubTree(
+ "/xyz/openbmc_project", 0, interfaces2,
+ std::bind_front(handlePhysicalSecurityGetSubTree, asyncResp));
}
inline void