| Ed Tanous | 40e9b92 | 2024-09-10 13:50:16 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: Apache-2.0 |
| 2 | // SPDX-FileCopyrightText: Copyright OpenBMC Authors |
| 3 | // SPDX-FileCopyrightText: Copyright 2019 Intel Corporation |
| Nikhil Potade | a25aecc | 2019-08-23 16:35:26 -0700 | [diff] [blame] | 4 | #pragma once |
| 5 | |
| Willy Tu | 13451e3 | 2023-05-24 16:08:18 -0700 | [diff] [blame] | 6 | #include "bmcweb_config.h" |
| 7 | |
| Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 8 | #include "app.hpp" |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 9 | #include "async_resp.hpp" |
| George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 10 | #include "dbus_utility.hpp" |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 11 | #include "error_messages.hpp" |
| Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 12 | #include "generated/enums/resource.hpp" |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 13 | #include "http_request.hpp" |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 14 | #include "logging.hpp" |
| Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 15 | #include "query.hpp" |
| 16 | #include "registries/privilege_registry.hpp" |
| Christopher Meis | 7bf29ab | 2025-10-23 14:46:24 +0200 | [diff] [blame^] | 17 | #include "storage_chassis.hpp" |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 18 | #include "utils/collection.hpp" |
| James Feist | 2ad9c2f | 2019-10-29 16:26:48 -0700 | [diff] [blame] | 19 | |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 20 | #include <boost/beast/http/verb.hpp> |
| George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 21 | #include <boost/system/error_code.hpp> |
| Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 22 | #include <boost/url/format.hpp> |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 23 | #include <sdbusplus/message/native_types.hpp> |
| Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 24 | #include <sdbusplus/unpack_properties.hpp> |
| Nikhil Potade | a25aecc | 2019-08-23 16:35:26 -0700 | [diff] [blame] | 25 | |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 26 | #include <algorithm> |
| George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 27 | #include <array> |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 28 | #include <format> |
| 29 | #include <functional> |
| 30 | #include <memory> |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 31 | #include <string> |
| George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 32 | #include <string_view> |
| Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 33 | #include <utility> |
| George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 34 | |
| Nikhil Potade | a25aecc | 2019-08-23 16:35:26 -0700 | [diff] [blame] | 35 | namespace redfish |
| 36 | { |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 37 | |
| 38 | inline void handleSystemsStorageCollectionGet( |
| 39 | App& app, const crow::Request& req, |
| 40 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 41 | const std::string& systemName) |
| 42 | { |
| 43 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 44 | { |
| 45 | return; |
| 46 | } |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 47 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 48 | { |
| 49 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 50 | systemName); |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | asyncResp->res.jsonValue["@odata.type"] = |
| 55 | "#StorageCollection.StorageCollection"; |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 56 | asyncResp->res.jsonValue["@odata.id"] = std::format( |
| 57 | "/redfish/v1/Systems/{}/Storage", BMCWEB_REDFISH_SYSTEM_URI_NAME); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 58 | asyncResp->res.jsonValue["Name"] = "Storage Collection"; |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 59 | |
| Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 60 | constexpr std::array<std::string_view, 1> interface{ |
| 61 | "xyz.openbmc_project.Inventory.Item.Storage"}; |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 62 | collection_util::getCollectionMembers( |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 63 | asyncResp, |
| 64 | boost::urls::format("/redfish/v1/Systems/{}/Storage", |
| 65 | BMCWEB_REDFISH_SYSTEM_URI_NAME), |
| Lakshmi Yadlapati | 36b5f1e | 2023-09-26 23:53:28 -0500 | [diff] [blame] | 66 | interface, "/xyz/openbmc_project/inventory"); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | inline void handleStorageCollectionGet( |
| 70 | App& app, const crow::Request& req, |
| 71 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
| 72 | { |
| 73 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 74 | { |
| 75 | return; |
| 76 | } |
| 77 | asyncResp->res.jsonValue["@odata.type"] = |
| 78 | "#StorageCollection.StorageCollection"; |
| 79 | asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Storage"; |
| 80 | asyncResp->res.jsonValue["Name"] = "Storage Collection"; |
| Patrick Williams | 5a39f77 | 2023-10-20 11:20:21 -0500 | [diff] [blame] | 81 | constexpr std::array<std::string_view, 1> interface{ |
| 82 | "xyz.openbmc_project.Inventory.Item.Storage"}; |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 83 | collection_util::getCollectionMembers( |
| Lakshmi Yadlapati | 36b5f1e | 2023-09-26 23:53:28 -0500 | [diff] [blame] | 84 | asyncResp, boost::urls::format("/redfish/v1/Storage"), interface, |
| 85 | "/xyz/openbmc_project/inventory"); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 86 | } |
| 87 | |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 88 | inline void afterChassisDriveCollectionSubtree( |
| 89 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 90 | const boost::system::error_code& ec, |
| 91 | const dbus::utility::MapperGetSubTreePathsResponse& driveList) |
| 92 | { |
| 93 | if (ec) |
| 94 | { |
| Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 95 | BMCWEB_LOG_ERROR("Drive mapper call error"); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 96 | messages::internalError(asyncResp->res); |
| 97 | return; |
| 98 | } |
| 99 | |
| 100 | nlohmann::json& driveArray = asyncResp->res.jsonValue["Drives"]; |
| 101 | driveArray = nlohmann::json::array(); |
| 102 | auto& count = asyncResp->res.jsonValue["Drives@odata.count"]; |
| 103 | count = 0; |
| 104 | |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 105 | for (const std::string& drive : driveList) |
| 106 | { |
| 107 | sdbusplus::message::object_path object(drive); |
| 108 | if (object.filename().empty()) |
| 109 | { |
| Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 110 | BMCWEB_LOG_ERROR("Failed to find filename in {}", drive); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 111 | return; |
| 112 | } |
| 113 | |
| 114 | nlohmann::json::object_t driveJson; |
| 115 | driveJson["@odata.id"] = boost::urls::format( |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 116 | "/redfish/v1/Systems/{}/Storage/1/Drives/{}", |
| 117 | BMCWEB_REDFISH_SYSTEM_URI_NAME, object.filename()); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 118 | driveArray.emplace_back(std::move(driveJson)); |
| 119 | } |
| 120 | |
| 121 | count = driveArray.size(); |
| 122 | } |
| Gunnar Mills | 7ac13cc | 2024-04-01 16:05:21 -0500 | [diff] [blame] | 123 | inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
| Willy Tu | a85afbe | 2021-12-28 14:43:47 -0800 | [diff] [blame] | 124 | { |
| George Liu | 7a1dbc4 | 2022-12-07 16:03:22 +0800 | [diff] [blame] | 125 | const std::array<std::string_view, 1> interfaces = { |
| 126 | "xyz.openbmc_project.Inventory.Item.Drive"}; |
| 127 | dbus::utility::getSubTreePaths( |
| 128 | "/xyz/openbmc_project/inventory", 0, interfaces, |
| Gunnar Mills | 7ac13cc | 2024-04-01 16:05:21 -0500 | [diff] [blame] | 129 | std::bind_front(afterChassisDriveCollectionSubtree, asyncResp)); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 130 | } |
| Willy Tu | a85afbe | 2021-12-28 14:43:47 -0800 | [diff] [blame] | 131 | |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 132 | inline void afterSystemsStorageGetSubtree( |
| 133 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 134 | const std::string& storageId, const boost::system::error_code& ec, |
| 135 | const dbus::utility::MapperGetSubTreeResponse& subtree) |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 136 | { |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 137 | if (ec) |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 138 | { |
| Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 139 | BMCWEB_LOG_DEBUG("requestRoutesStorage DBUS response error"); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 140 | messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage", |
| 141 | storageId); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 142 | return; |
| 143 | } |
| Ed Tanous | 3544d2a | 2023-08-06 18:12:20 -0700 | [diff] [blame] | 144 | auto storage = std::ranges::find_if( |
| 145 | subtree, |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 146 | [&storageId](const std::pair<std::string, |
| 147 | dbus::utility::MapperServiceMap>& object) { |
| Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 148 | return sdbusplus::message::object_path(object.first).filename() == |
| 149 | storageId; |
| 150 | }); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 151 | if (storage == subtree.end()) |
| 152 | { |
| 153 | messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage", |
| 154 | storageId); |
| 155 | return; |
| 156 | } |
| 157 | |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 158 | asyncResp->res.jsonValue["@odata.type"] = "#Storage.v1_13_0.Storage"; |
| 159 | asyncResp->res.jsonValue["@odata.id"] = |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 160 | boost::urls::format("/redfish/v1/Systems/{}/Storage/{}", |
| 161 | BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId); |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 162 | asyncResp->res.jsonValue["Name"] = "Storage"; |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 163 | asyncResp->res.jsonValue["Id"] = storageId; |
| Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 164 | asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled; |
| Willy Tu | a85afbe | 2021-12-28 14:43:47 -0800 | [diff] [blame] | 165 | |
| Gunnar Mills | 7ac13cc | 2024-04-01 16:05:21 -0500 | [diff] [blame] | 166 | getDrives(asyncResp); |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 167 | asyncResp->res.jsonValue["Controllers"]["@odata.id"] = |
| 168 | boost::urls::format("/redfish/v1/Systems/{}/Storage/{}/Controllers", |
| 169 | BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 170 | } |
| 171 | |
| Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 172 | inline void handleSystemsStorageGet( |
| 173 | App& app, const crow::Request& req, |
| 174 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 175 | const std::string& systemName, const std::string& storageId) |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 176 | { |
| 177 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 178 | { |
| 179 | return; |
| 180 | } |
| Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 181 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
| Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 182 | { |
| 183 | // Option currently returns no systems. TBD |
| 184 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 185 | systemName); |
| 186 | return; |
| 187 | } |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 188 | |
| 189 | constexpr std::array<std::string_view, 1> interfaces = { |
| 190 | "xyz.openbmc_project.Inventory.Item.Storage"}; |
| 191 | dbus::utility::getSubTree( |
| 192 | "/xyz/openbmc_project/inventory", 0, interfaces, |
| 193 | std::bind_front(afterSystemsStorageGetSubtree, asyncResp, storageId)); |
| 194 | } |
| 195 | |
| 196 | inline void afterSubtree(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 197 | const std::string& storageId, |
| 198 | const boost::system::error_code& ec, |
| 199 | const dbus::utility::MapperGetSubTreeResponse& subtree) |
| 200 | { |
| 201 | if (ec) |
| 202 | { |
| Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 203 | BMCWEB_LOG_DEBUG("requestRoutesStorage DBUS response error"); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 204 | messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage", |
| 205 | storageId); |
| 206 | return; |
| 207 | } |
| Ed Tanous | 3544d2a | 2023-08-06 18:12:20 -0700 | [diff] [blame] | 208 | auto storage = std::ranges::find_if( |
| 209 | subtree, |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 210 | [&storageId](const std::pair<std::string, |
| 211 | dbus::utility::MapperServiceMap>& object) { |
| Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 212 | return sdbusplus::message::object_path(object.first).filename() == |
| 213 | storageId; |
| 214 | }); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 215 | if (storage == subtree.end()) |
| 216 | { |
| 217 | messages::resourceNotFound(asyncResp->res, "#Storage.v1_13_0.Storage", |
| 218 | storageId); |
| 219 | return; |
| 220 | } |
| 221 | |
| 222 | asyncResp->res.jsonValue["@odata.type"] = "#Storage.v1_13_0.Storage"; |
| 223 | asyncResp->res.jsonValue["@odata.id"] = |
| 224 | boost::urls::format("/redfish/v1/Storage/{}", storageId); |
| 225 | asyncResp->res.jsonValue["Name"] = "Storage"; |
| 226 | asyncResp->res.jsonValue["Id"] = storageId; |
| Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 227 | asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled; |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 228 | |
| 229 | // Storage subsystem to Storage link. |
| 230 | nlohmann::json::array_t storageServices; |
| 231 | nlohmann::json::object_t storageService; |
| 232 | storageService["@odata.id"] = |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 233 | boost::urls::format("/redfish/v1/Systems/{}/Storage/{}", |
| 234 | BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 235 | storageServices.emplace_back(storageService); |
| 236 | asyncResp->res.jsonValue["Links"]["StorageServices"] = |
| 237 | std::move(storageServices); |
| 238 | asyncResp->res.jsonValue["Links"]["StorageServices@odata.count"] = 1; |
| 239 | } |
| 240 | |
| Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 241 | inline void handleStorageGet( |
| 242 | App& app, const crow::Request& req, |
| 243 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 244 | const std::string& storageId) |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 245 | { |
| 246 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 247 | { |
| Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 248 | BMCWEB_LOG_DEBUG("requestRoutesStorage setUpRedfishRoute failed"); |
| Willy Tu | 5e577bc | 2022-07-26 00:41:55 +0000 | [diff] [blame] | 249 | return; |
| 250 | } |
| 251 | |
| 252 | constexpr std::array<std::string_view, 1> interfaces = { |
| 253 | "xyz.openbmc_project.Inventory.Item.Storage"}; |
| 254 | dbus::utility::getSubTree( |
| 255 | "/xyz/openbmc_project/inventory", 0, interfaces, |
| 256 | std::bind_front(afterSubtree, asyncResp, storageId)); |
| Willy Tu | a85afbe | 2021-12-28 14:43:47 -0800 | [diff] [blame] | 257 | } |
| 258 | |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 259 | inline void handleSystemsStorageDriveGet( |
| 260 | App& app, const crow::Request& req, |
| 261 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 262 | const std::string& systemName, const std::string& driveId) |
| 263 | { |
| 264 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 265 | { |
| 266 | return; |
| 267 | } |
| Ed Tanous | 25b54db | 2024-04-17 15:40:31 -0700 | [diff] [blame] | 268 | if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
| Ed Tanous | 7f3e84a | 2022-12-28 16:22:54 -0800 | [diff] [blame] | 269 | { |
| 270 | // Option currently returns no systems. TBD |
| 271 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 272 | systemName); |
| 273 | return; |
| 274 | } |
| 275 | |
| Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 276 | if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 277 | { |
| 278 | messages::resourceNotFound(asyncResp->res, "ComputerSystem", |
| 279 | systemName); |
| 280 | return; |
| 281 | } |
| 282 | |
| 283 | constexpr std::array<std::string_view, 1> interfaces = { |
| 284 | "xyz.openbmc_project.Inventory.Item.Drive"}; |
| 285 | dbus::utility::getSubTree( |
| 286 | "/xyz/openbmc_project/inventory", 0, interfaces, |
| 287 | std::bind_front(afterGetSubtreeSystemsStorageDrive, asyncResp, |
| 288 | driveId)); |
| 289 | } |
| 290 | |
| Christopher Meis | 7bf29ab | 2025-10-23 14:46:24 +0200 | [diff] [blame^] | 291 | inline void requestRoutesStorage(App& app) |
| John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 292 | { |
| Christopher Meis | 7bf29ab | 2025-10-23 14:46:24 +0200 | [diff] [blame^] | 293 | BMCWEB_ROUTE(app, "/redfish/v1/Storage/") |
| 294 | .privileges(redfish::privileges::getStorageCollection) |
| 295 | .methods(boost::beast::http::verb::get)( |
| 296 | std::bind_front(handleStorageCollectionGet, std::ref(app))); |
| 297 | |
| 298 | BMCWEB_ROUTE(app, "/redfish/v1/Storage/<str>/") |
| 299 | .privileges(redfish::privileges::getStorage) |
| 300 | .methods(boost::beast::http::verb::get)( |
| 301 | std::bind_front(handleStorageGet, std::ref(app))); |
| 302 | |
| 303 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/") |
| 304 | .privileges(redfish::privileges::getStorageCollection) |
| 305 | .methods(boost::beast::http::verb::get)( |
| 306 | std::bind_front(handleSystemsStorageCollectionGet, std::ref(app))); |
| 307 | |
| 308 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/<str>/") |
| 309 | .privileges(redfish::privileges::getStorage) |
| 310 | .methods(boost::beast::http::verb::get)( |
| 311 | std::bind_front(handleSystemsStorageGet, std::ref(app))); |
| 312 | |
| Ed Tanous | 22d268c | 2022-05-19 09:39:07 -0700 | [diff] [blame] | 313 | BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/1/Drives/<str>/") |
| Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 314 | .privileges(redfish::privileges::getDrive) |
| Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 315 | .methods(boost::beast::http::verb::get)( |
| Ed Tanous | 36d5233 | 2023-06-09 13:18:40 -0700 | [diff] [blame] | 316 | std::bind_front(handleSystemsStorageDriveGet, std::ref(app))); |
| John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 317 | } |
| John Edward Broadbent | 92903bd | 2022-04-26 13:40:59 -0700 | [diff] [blame] | 318 | |
| Nikhil Potade | a25aecc | 2019-08-23 16:35:26 -0700 | [diff] [blame] | 319 | } // namespace redfish |