blob: 20e6726c073001cb411d451f30c1d6c5c435b7cd [file] [log] [blame]
Sunny Srivastava31791052021-03-12 10:39:16 -06001#pragma once
2
3#include "app.hpp"
4#include "dbus_utility.hpp"
Ed Tanous539d8c62024-06-19 14:38:27 -07005#include "generated/enums/resource.hpp"
Ed Tanousa8e884f2023-01-13 17:40:03 -08006#include "query.hpp"
7#include "registries/privilege_registry.hpp"
Sunny Srivastava31791052021-03-12 10:39:16 -06008#include "utils/collection.hpp"
Lakshmi Yadlapati6177a302023-02-17 10:29:34 -06009#include "utils/dbus_utils.hpp"
Sunny Srivastava31791052021-03-12 10:39:16 -060010#include "utils/json_utils.hpp"
11
12#include <boost/system/error_code.hpp>
Ed Tanousef4c65b2023-04-24 15:28:50 -070013#include <boost/url/format.hpp>
Gunnar Millsf05e9162023-02-16 20:23:30 -060014#include <sdbusplus/asio/property.hpp>
Lakshmi Yadlapati6177a302023-02-17 10:29:34 -060015#include <sdbusplus/unpack_properties.hpp>
Sunny Srivastava31791052021-03-12 10:39:16 -060016
17#include <array>
18#include <functional>
19#include <memory>
Myung Bae78c90202024-02-19 13:39:56 -050020#include <optional>
Sunny Srivastava31791052021-03-12 10:39:16 -060021#include <string>
22#include <string_view>
23
24namespace redfish
25{
26
Ed Tanousac106bf2023-06-07 09:24:59 -070027inline void getFabricAdapterLocation(
28 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
29 const std::string& serviceName, const std::string& fabricAdapterPath)
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060030{
31 sdbusplus::asio::getProperty<std::string>(
32 *crow::connections::systemBus, serviceName, fabricAdapterPath,
33 "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
Ed Tanousac106bf2023-06-07 09:24:59 -070034 [asyncResp](const boost::system::error_code& ec,
35 const std::string& property) {
Patrick Williamsbd79bce2024-08-16 15:22:20 -040036 if (ec)
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060037 {
Patrick Williamsbd79bce2024-08-16 15:22:20 -040038 if (ec.value() != EBADR)
39 {
40 BMCWEB_LOG_ERROR("DBUS response error for Location");
41 messages::internalError(asyncResp->res);
42 }
43 return;
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060044 }
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060045
Patrick Williamsbd79bce2024-08-16 15:22:20 -040046 asyncResp->res
47 .jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
48 property;
49 });
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060050}
51
Patrick Williamsbd79bce2024-08-16 15:22:20 -040052inline void getFabricAdapterAsset(
53 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
54 const std::string& serviceName, const std::string& fabricAdapterPath)
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060055{
56 sdbusplus::asio::getAllProperties(
57 *crow::connections::systemBus, serviceName, fabricAdapterPath,
58 "xyz.openbmc_project.Inventory.Decorator.Asset",
Ed Tanousac106bf2023-06-07 09:24:59 -070059 [fabricAdapterPath, asyncResp{asyncResp}](
60 const boost::system::error_code& ec,
61 const dbus::utility::DBusPropertiesMap& propertiesList) {
Patrick Williamsbd79bce2024-08-16 15:22:20 -040062 if (ec)
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060063 {
Patrick Williamsbd79bce2024-08-16 15:22:20 -040064 if (ec.value() != EBADR)
65 {
66 BMCWEB_LOG_ERROR("DBUS response error for Properties");
67 messages::internalError(asyncResp->res);
68 }
69 return;
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060070 }
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060071
Patrick Williamsbd79bce2024-08-16 15:22:20 -040072 const std::string* serialNumber = nullptr;
73 const std::string* model = nullptr;
74 const std::string* partNumber = nullptr;
75 const std::string* sparePartNumber = nullptr;
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060076
Patrick Williamsbd79bce2024-08-16 15:22:20 -040077 const bool success = sdbusplus::unpackPropertiesNoThrow(
78 dbus_utils::UnpackErrorPrinter(), propertiesList,
79 "SerialNumber", serialNumber, "Model", model, "PartNumber",
80 partNumber, "SparePartNumber", sparePartNumber);
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060081
Patrick Williamsbd79bce2024-08-16 15:22:20 -040082 if (!success)
83 {
84 messages::internalError(asyncResp->res);
85 return;
86 }
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060087
Patrick Williamsbd79bce2024-08-16 15:22:20 -040088 if (serialNumber != nullptr)
89 {
90 asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
91 }
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060092
Patrick Williamsbd79bce2024-08-16 15:22:20 -040093 if (model != nullptr)
94 {
95 asyncResp->res.jsonValue["Model"] = *model;
96 }
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060097
Patrick Williamsbd79bce2024-08-16 15:22:20 -040098 if (partNumber != nullptr)
99 {
100 asyncResp->res.jsonValue["PartNumber"] = *partNumber;
101 }
Lakshmi Yadlapati63694212023-01-27 16:35:22 -0600102
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400103 if (sparePartNumber != nullptr && !sparePartNumber->empty())
104 {
105 asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
106 }
107 });
Lakshmi Yadlapati63694212023-01-27 16:35:22 -0600108}
109
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400110inline void getFabricAdapterState(
111 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
112 const std::string& serviceName, const std::string& fabricAdapterPath)
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600113{
114 sdbusplus::asio::getProperty<bool>(
115 *crow::connections::systemBus, serviceName, fabricAdapterPath,
116 "xyz.openbmc_project.Inventory.Item", "Present",
Ed Tanousac106bf2023-06-07 09:24:59 -0700117 [asyncResp](const boost::system::error_code& ec, const bool present) {
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400118 if (ec)
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600119 {
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400120 if (ec.value() != EBADR)
121 {
122 BMCWEB_LOG_ERROR("DBUS response error for State");
123 messages::internalError(asyncResp->res);
124 }
125 return;
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600126 }
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600127
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400128 if (!present)
129 {
130 asyncResp->res.jsonValue["Status"]["State"] =
131 resource::State::Absent;
132 }
133 });
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600134}
135
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400136inline void getFabricAdapterHealth(
137 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
138 const std::string& serviceName, const std::string& fabricAdapterPath)
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600139{
140 sdbusplus::asio::getProperty<bool>(
141 *crow::connections::systemBus, serviceName, fabricAdapterPath,
142 "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
Ed Tanousac106bf2023-06-07 09:24:59 -0700143 [asyncResp](const boost::system::error_code& ec,
144 const bool functional) {
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400145 if (ec)
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600146 {
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400147 if (ec.value() != EBADR)
148 {
149 BMCWEB_LOG_ERROR("DBUS response error for Health");
150 messages::internalError(asyncResp->res);
151 }
152 return;
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600153 }
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600154
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400155 if (!functional)
156 {
157 asyncResp->res.jsonValue["Status"]["Health"] =
158 resource::Health::Critical;
159 }
160 });
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600161}
162
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400163inline void doAdapterGet(
164 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
165 const std::string& systemName, const std::string& adapterId,
166 const std::string& fabricAdapterPath, const std::string& serviceName)
Sunny Srivastava31791052021-03-12 10:39:16 -0600167{
Ed Tanousac106bf2023-06-07 09:24:59 -0700168 asyncResp->res.addHeader(
Sunny Srivastava31791052021-03-12 10:39:16 -0600169 boost::beast::http::field::link,
170 "</redfish/v1/JsonSchemas/FabricAdapter/FabricAdapter.json>; rel=describedby");
Ed Tanousac106bf2023-06-07 09:24:59 -0700171 asyncResp->res.jsonValue["@odata.type"] =
172 "#FabricAdapter.v1_4_0.FabricAdapter";
173 asyncResp->res.jsonValue["Name"] = "Fabric Adapter";
174 asyncResp->res.jsonValue["Id"] = adapterId;
175 asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
Ed Tanousef4c65b2023-04-24 15:28:50 -0700176 "/redfish/v1/Systems/{}/FabricAdapters/{}", systemName, adapterId);
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -0600177
Ed Tanous539d8c62024-06-19 14:38:27 -0700178 asyncResp->res.jsonValue["Status"]["State"] = resource::State::Enabled;
179 asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK;
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600180
Ed Tanousac106bf2023-06-07 09:24:59 -0700181 getFabricAdapterLocation(asyncResp, serviceName, fabricAdapterPath);
182 getFabricAdapterAsset(asyncResp, serviceName, fabricAdapterPath);
183 getFabricAdapterState(asyncResp, serviceName, fabricAdapterPath);
184 getFabricAdapterHealth(asyncResp, serviceName, fabricAdapterPath);
Sunny Srivastava31791052021-03-12 10:39:16 -0600185}
186
Myung Bae78c90202024-02-19 13:39:56 -0500187inline void afterGetValidFabricAdapterPath(
188 const std::string& adapterId,
189 std::function<void(const boost::system::error_code&,
190 const std::string& fabricAdapterPath,
191 const std::string& serviceName)>& callback,
192 const boost::system::error_code& ec,
193 const dbus::utility::MapperGetSubTreeResponse& subtree)
Sunny Srivastava31791052021-03-12 10:39:16 -0600194{
Myung Bae78c90202024-02-19 13:39:56 -0500195 std::string fabricAdapterPath;
196 std::string serviceName;
197 if (ec)
198 {
199 callback(ec, fabricAdapterPath, serviceName);
200 return;
201 }
Sunny Srivastava31791052021-03-12 10:39:16 -0600202
Myung Bae78c90202024-02-19 13:39:56 -0500203 for (const auto& [adapterPath, serviceMap] : subtree)
204 {
205 std::string fabricAdapterName =
206 sdbusplus::message::object_path(adapterPath).filename();
207 if (fabricAdapterName == adapterId)
208 {
209 fabricAdapterPath = adapterPath;
210 serviceName = serviceMap.begin()->first;
211 break;
212 }
213 }
214 callback(ec, fabricAdapterPath, serviceName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600215}
216
217inline void getValidFabricAdapterPath(
Myung Bae78c90202024-02-19 13:39:56 -0500218 const std::string& adapterId,
219 std::function<void(const boost::system::error_code& ec,
220 const std::string& fabricAdapterPath,
Sunny Srivastava31791052021-03-12 10:39:16 -0600221 const std::string& serviceName)>&& callback)
222{
Sunny Srivastava31791052021-03-12 10:39:16 -0600223 constexpr std::array<std::string_view, 1> interfaces{
224 "xyz.openbmc_project.Inventory.Item.FabricAdapter"};
Myung Bae78c90202024-02-19 13:39:56 -0500225 dbus::utility::getSubTree("/xyz/openbmc_project/inventory", 0, interfaces,
226 std::bind_front(afterGetValidFabricAdapterPath,
227 adapterId, std::move(callback)));
228}
Sunny Srivastava31791052021-03-12 10:39:16 -0600229
Myung Bae78c90202024-02-19 13:39:56 -0500230inline void afterHandleFabricAdapterGet(
231 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
232 const std::string& systemName, const std::string& adapterId,
233 const boost::system::error_code& ec, const std::string& fabricAdapterPath,
234 const std::string& serviceName)
235{
236 if (ec)
237 {
238 if (ec.value() == boost::system::errc::io_error)
Sunny Srivastava31791052021-03-12 10:39:16 -0600239 {
Myung Bae78c90202024-02-19 13:39:56 -0500240 messages::resourceNotFound(asyncResp->res, "FabricAdapter",
241 adapterId);
Sunny Srivastava31791052021-03-12 10:39:16 -0600242 return;
243 }
Myung Bae78c90202024-02-19 13:39:56 -0500244
245 BMCWEB_LOG_ERROR("DBus method call failed with error {}", ec.value());
246 messages::internalError(asyncResp->res);
247 return;
248 }
249 if (fabricAdapterPath.empty() || serviceName.empty())
250 {
Ed Tanous62598e32023-07-17 17:06:25 -0700251 BMCWEB_LOG_WARNING("Adapter not found");
Ed Tanousac106bf2023-06-07 09:24:59 -0700252 messages::resourceNotFound(asyncResp->res, "FabricAdapter", adapterId);
Myung Bae78c90202024-02-19 13:39:56 -0500253 return;
254 }
255 doAdapterGet(asyncResp, systemName, adapterId, fabricAdapterPath,
256 serviceName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600257}
258
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400259inline void handleFabricAdapterGet(
260 App& app, const crow::Request& req,
261 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
262 const std::string& systemName, const std::string& adapterId)
Sunny Srivastava31791052021-03-12 10:39:16 -0600263{
Ed Tanousac106bf2023-06-07 09:24:59 -0700264 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600265 {
266 return;
267 }
Ed Tanous25b54db2024-04-17 15:40:31 -0700268 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800269 {
270 // Option currently returns no systems. TBD
271 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
272 systemName);
273 return;
274 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700275 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Myung Bae78c90202024-02-19 13:39:56 -0500276 {
277 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
278 systemName);
279 return;
280 }
Sunny Srivastava31791052021-03-12 10:39:16 -0600281 getValidFabricAdapterPath(
Myung Bae78c90202024-02-19 13:39:56 -0500282 adapterId, std::bind_front(afterHandleFabricAdapterGet, asyncResp,
283 systemName, adapterId));
Sunny Srivastava31791052021-03-12 10:39:16 -0600284}
285
286inline void handleFabricAdapterCollectionGet(
287 crow::App& app, const crow::Request& req,
Ed Tanousac106bf2023-06-07 09:24:59 -0700288 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600289 const std::string& systemName)
290{
Ed Tanousac106bf2023-06-07 09:24:59 -0700291 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600292 {
293 return;
294 }
Ed Tanous25b54db2024-04-17 15:40:31 -0700295 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800296 {
297 // Option currently returns no systems. TBD
298 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
299 systemName);
300 return;
301 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700302 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Sunny Srivastava31791052021-03-12 10:39:16 -0600303 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700304 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
305 systemName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600306 return;
307 }
308
Ed Tanousac106bf2023-06-07 09:24:59 -0700309 asyncResp->res.addHeader(
Sunny Srivastava31791052021-03-12 10:39:16 -0600310 boost::beast::http::field::link,
311 "</redfish/v1/JsonSchemas/FabricAdapterCollection/FabricAdapterCollection.json>; rel=describedby");
Ed Tanousac106bf2023-06-07 09:24:59 -0700312 asyncResp->res.jsonValue["@odata.type"] =
Sunny Srivastava31791052021-03-12 10:39:16 -0600313 "#FabricAdapterCollection.FabricAdapterCollection";
Ed Tanousac106bf2023-06-07 09:24:59 -0700314 asyncResp->res.jsonValue["Name"] = "Fabric Adapter Collection";
315 asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
Ed Tanousef4c65b2023-04-24 15:28:50 -0700316 "/redfish/v1/Systems/{}/FabricAdapters", systemName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600317
318 constexpr std::array<std::string_view, 1> interfaces{
319 "xyz.openbmc_project.Inventory.Item.FabricAdapter"};
320 collection_util::getCollectionMembers(
Ed Tanousac106bf2023-06-07 09:24:59 -0700321 asyncResp,
Ed Tanous253f11b2024-05-16 09:38:31 -0700322 boost::urls::format("/redfish/v1/Systems/{}/FabricAdapters",
323 BMCWEB_REDFISH_SYSTEM_URI_NAME),
Lakshmi Yadlapati36b5f1e2023-09-26 23:53:28 -0500324 interfaces, "/xyz/openbmc_project/inventory");
Sunny Srivastava31791052021-03-12 10:39:16 -0600325}
326
327inline void handleFabricAdapterCollectionHead(
328 crow::App& app, const crow::Request& req,
Ed Tanousac106bf2023-06-07 09:24:59 -0700329 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600330 const std::string& systemName)
331{
Ed Tanousac106bf2023-06-07 09:24:59 -0700332 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600333 {
334 return;
335 }
Ed Tanous25b54db2024-04-17 15:40:31 -0700336 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800337 {
338 // Option currently returns no systems. TBD
339 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
340 systemName);
341 return;
342 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700343 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Sunny Srivastava31791052021-03-12 10:39:16 -0600344 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700345 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
346 systemName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600347 return;
348 }
Ed Tanousac106bf2023-06-07 09:24:59 -0700349 asyncResp->res.addHeader(
Sunny Srivastava31791052021-03-12 10:39:16 -0600350 boost::beast::http::field::link,
351 "</redfish/v1/JsonSchemas/FabricAdapterCollection/FabricAdapterCollection.json>; rel=describedby");
352}
353
Myung Bae78c90202024-02-19 13:39:56 -0500354inline void afterHandleFabricAdapterHead(
355 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
356 const std::string& adapterId, const boost::system::error_code& ec,
357 const std::string& fabricAdapterPath, const std::string& serviceName)
358{
359 if (ec)
360 {
361 if (ec.value() == boost::system::errc::io_error)
362 {
363 messages::resourceNotFound(asyncResp->res, "FabricAdapter",
364 adapterId);
365 return;
366 }
367
368 BMCWEB_LOG_ERROR("DBus method call failed with error {}", ec.value());
369 messages::internalError(asyncResp->res);
370 return;
371 }
372 if (fabricAdapterPath.empty() || serviceName.empty())
373 {
374 BMCWEB_LOG_WARNING("Adapter not found");
375 messages::resourceNotFound(asyncResp->res, "FabricAdapter", adapterId);
376 return;
377 }
378 asyncResp->res.addHeader(
379 boost::beast::http::field::link,
380 "</redfish/v1/JsonSchemas/FabricAdapter/FabricAdapter.json>; rel=describedby");
381}
382
Patrick Williamsbd79bce2024-08-16 15:22:20 -0400383inline void handleFabricAdapterHead(
384 crow::App& app, const crow::Request& req,
385 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
386 const std::string& systemName, const std::string& adapterId)
Sunny Srivastava31791052021-03-12 10:39:16 -0600387{
Ed Tanousac106bf2023-06-07 09:24:59 -0700388 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600389 {
390 return;
391 }
392
Ed Tanous25b54db2024-04-17 15:40:31 -0700393 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800394 {
395 // Option currently returns no systems. TBD
396 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
397 systemName);
398 return;
399 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700400 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Myung Bae78c90202024-02-19 13:39:56 -0500401 {
402 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
403 systemName);
404 return;
405 }
406 getValidFabricAdapterPath(
407 adapterId,
408 std::bind_front(afterHandleFabricAdapterHead, asyncResp, adapterId));
Sunny Srivastava31791052021-03-12 10:39:16 -0600409}
410
411inline void requestRoutesFabricAdapterCollection(App& app)
412{
413 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/")
414 .privileges(redfish::privileges::getFabricAdapterCollection)
415 .methods(boost::beast::http::verb::get)(
416 std::bind_front(handleFabricAdapterCollectionGet, std::ref(app)));
417
418 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/")
419 .privileges(redfish::privileges::headFabricAdapterCollection)
420 .methods(boost::beast::http::verb::head)(
421 std::bind_front(handleFabricAdapterCollectionHead, std::ref(app)));
422}
423
424inline void requestRoutesFabricAdapters(App& app)
425{
426 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/<str>/")
427 .privileges(redfish::privileges::getFabricAdapter)
428 .methods(boost::beast::http::verb::get)(
429 std::bind_front(handleFabricAdapterGet, std::ref(app)));
430
431 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/<str>/")
432 .privileges(redfish::privileges::headFabricAdapter)
433 .methods(boost::beast::http::verb::head)(
434 std::bind_front(handleFabricAdapterHead, std::ref(app)));
435}
436} // namespace redfish