blob: 11dc7c69739b746b00467a8172a718ac19c629f4 [file] [log] [blame]
Sunny Srivastava31791052021-03-12 10:39:16 -06001#pragma once
2
3#include "app.hpp"
4#include "dbus_utility.hpp"
Ed Tanousa8e884f2023-01-13 17:40:03 -08005#include "query.hpp"
6#include "registries/privilege_registry.hpp"
Sunny Srivastava31791052021-03-12 10:39:16 -06007#include "utils/collection.hpp"
Lakshmi Yadlapati6177a302023-02-17 10:29:34 -06008#include "utils/dbus_utils.hpp"
Sunny Srivastava31791052021-03-12 10:39:16 -06009#include "utils/json_utils.hpp"
10
11#include <boost/system/error_code.hpp>
Ed Tanousef4c65b2023-04-24 15:28:50 -070012#include <boost/url/format.hpp>
Gunnar Millsf05e9162023-02-16 20:23:30 -060013#include <sdbusplus/asio/property.hpp>
Lakshmi Yadlapati6177a302023-02-17 10:29:34 -060014#include <sdbusplus/unpack_properties.hpp>
Sunny Srivastava31791052021-03-12 10:39:16 -060015
16#include <array>
17#include <functional>
18#include <memory>
Myung Bae78c90202024-02-19 13:39:56 -050019#include <optional>
Sunny Srivastava31791052021-03-12 10:39:16 -060020#include <string>
21#include <string_view>
22
23namespace redfish
24{
25
Ed Tanousac106bf2023-06-07 09:24:59 -070026inline void getFabricAdapterLocation(
27 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
28 const std::string& serviceName, const std::string& fabricAdapterPath)
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060029{
30 sdbusplus::asio::getProperty<std::string>(
31 *crow::connections::systemBus, serviceName, fabricAdapterPath,
32 "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
Ed Tanousac106bf2023-06-07 09:24:59 -070033 [asyncResp](const boost::system::error_code& ec,
34 const std::string& property) {
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060035 if (ec)
36 {
37 if (ec.value() != EBADR)
38 {
Ed Tanous62598e32023-07-17 17:06:25 -070039 BMCWEB_LOG_ERROR("DBUS response error for Location");
Ed Tanousac106bf2023-06-07 09:24:59 -070040 messages::internalError(asyncResp->res);
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060041 }
42 return;
43 }
44
Ed Tanousac106bf2023-06-07 09:24:59 -070045 asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060046 property;
Patrick Williams5a39f772023-10-20 11:20:21 -050047 });
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -060048}
49
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060050inline void
Ed Tanousac106bf2023-06-07 09:24:59 -070051 getFabricAdapterAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060052 const std::string& serviceName,
53 const std::string& fabricAdapterPath)
54{
55 sdbusplus::asio::getAllProperties(
56 *crow::connections::systemBus, serviceName, fabricAdapterPath,
57 "xyz.openbmc_project.Inventory.Decorator.Asset",
Ed Tanousac106bf2023-06-07 09:24:59 -070058 [fabricAdapterPath, asyncResp{asyncResp}](
59 const boost::system::error_code& ec,
60 const dbus::utility::DBusPropertiesMap& propertiesList) {
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060061 if (ec)
62 {
63 if (ec.value() != EBADR)
64 {
Ed Tanous62598e32023-07-17 17:06:25 -070065 BMCWEB_LOG_ERROR("DBUS response error for Properties");
Ed Tanousac106bf2023-06-07 09:24:59 -070066 messages::internalError(asyncResp->res);
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060067 }
68 return;
69 }
70
71 const std::string* serialNumber = nullptr;
72 const std::string* model = nullptr;
73 const std::string* partNumber = nullptr;
74 const std::string* sparePartNumber = nullptr;
75
76 const bool success = sdbusplus::unpackPropertiesNoThrow(
77 dbus_utils::UnpackErrorPrinter(), propertiesList, "SerialNumber",
78 serialNumber, "Model", model, "PartNumber", partNumber,
79 "SparePartNumber", sparePartNumber);
80
81 if (!success)
82 {
Ed Tanousac106bf2023-06-07 09:24:59 -070083 messages::internalError(asyncResp->res);
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060084 return;
85 }
86
87 if (serialNumber != nullptr)
88 {
Ed Tanousac106bf2023-06-07 09:24:59 -070089 asyncResp->res.jsonValue["SerialNumber"] = *serialNumber;
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060090 }
91
92 if (model != nullptr)
93 {
Ed Tanousac106bf2023-06-07 09:24:59 -070094 asyncResp->res.jsonValue["Model"] = *model;
Lakshmi Yadlapati63694212023-01-27 16:35:22 -060095 }
96
97 if (partNumber != nullptr)
98 {
Ed Tanousac106bf2023-06-07 09:24:59 -070099 asyncResp->res.jsonValue["PartNumber"] = *partNumber;
Lakshmi Yadlapati63694212023-01-27 16:35:22 -0600100 }
101
102 if (sparePartNumber != nullptr && !sparePartNumber->empty())
103 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700104 asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
Lakshmi Yadlapati63694212023-01-27 16:35:22 -0600105 }
Patrick Williams5a39f772023-10-20 11:20:21 -0500106 });
Lakshmi Yadlapati63694212023-01-27 16:35:22 -0600107}
108
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600109inline void
Ed Tanousac106bf2023-06-07 09:24:59 -0700110 getFabricAdapterState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600111 const std::string& serviceName,
112 const std::string& fabricAdapterPath)
113{
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) {
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600118 if (ec)
119 {
120 if (ec.value() != EBADR)
121 {
Ed Tanous62598e32023-07-17 17:06:25 -0700122 BMCWEB_LOG_ERROR("DBUS response error for State");
Ed Tanousac106bf2023-06-07 09:24:59 -0700123 messages::internalError(asyncResp->res);
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600124 }
125 return;
126 }
127
128 if (!present)
129 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700130 asyncResp->res.jsonValue["Status"]["State"] = "Absent";
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600131 }
Patrick Williams5a39f772023-10-20 11:20:21 -0500132 });
Lakshmi Yadlapaticd7af442023-01-27 17:31:40 -0600133}
134
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600135inline void
Ed Tanousac106bf2023-06-07 09:24:59 -0700136 getFabricAdapterHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600137 const std::string& serviceName,
138 const std::string& fabricAdapterPath)
139{
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) {
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600145 if (ec)
146 {
147 if (ec.value() != EBADR)
148 {
Ed Tanous62598e32023-07-17 17:06:25 -0700149 BMCWEB_LOG_ERROR("DBUS response error for Health");
Ed Tanousac106bf2023-06-07 09:24:59 -0700150 messages::internalError(asyncResp->res);
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600151 }
152 return;
153 }
154
155 if (!functional)
156 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700157 asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600158 }
Patrick Williams5a39f772023-10-20 11:20:21 -0500159 });
Lakshmi Yadlapati7da847b2023-01-27 17:53:18 -0600160}
161
Ed Tanousac106bf2023-06-07 09:24:59 -0700162inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600163 const std::string& systemName,
Lakshmi Yadlapati53ffeca2023-01-27 15:12:23 -0600164 const std::string& adapterId,
165 const std::string& fabricAdapterPath,
166 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 Tanousac106bf2023-06-07 09:24:59 -0700178 asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
179 asyncResp->res.jsonValue["Status"]["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
259inline void
260 handleFabricAdapterGet(App& app, const crow::Request& req,
Ed Tanousac106bf2023-06-07 09:24:59 -0700261 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600262 const std::string& systemName,
263 const std::string& adapterId)
264{
Ed Tanousac106bf2023-06-07 09:24:59 -0700265 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600266 {
267 return;
268 }
Ed Tanous25b54db2024-04-17 15:40:31 -0700269 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800270 {
271 // Option currently returns no systems. TBD
272 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
273 systemName);
274 return;
275 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700276 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Myung Bae78c90202024-02-19 13:39:56 -0500277 {
278 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
279 systemName);
280 return;
281 }
Sunny Srivastava31791052021-03-12 10:39:16 -0600282 getValidFabricAdapterPath(
Myung Bae78c90202024-02-19 13:39:56 -0500283 adapterId, std::bind_front(afterHandleFabricAdapterGet, asyncResp,
284 systemName, adapterId));
Sunny Srivastava31791052021-03-12 10:39:16 -0600285}
286
287inline void handleFabricAdapterCollectionGet(
288 crow::App& app, const crow::Request& req,
Ed Tanousac106bf2023-06-07 09:24:59 -0700289 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600290 const std::string& systemName)
291{
Ed Tanousac106bf2023-06-07 09:24:59 -0700292 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600293 {
294 return;
295 }
Ed Tanous25b54db2024-04-17 15:40:31 -0700296 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800297 {
298 // Option currently returns no systems. TBD
299 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
300 systemName);
301 return;
302 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700303 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Sunny Srivastava31791052021-03-12 10:39:16 -0600304 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700305 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
306 systemName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600307 return;
308 }
309
Ed Tanousac106bf2023-06-07 09:24:59 -0700310 asyncResp->res.addHeader(
Sunny Srivastava31791052021-03-12 10:39:16 -0600311 boost::beast::http::field::link,
312 "</redfish/v1/JsonSchemas/FabricAdapterCollection/FabricAdapterCollection.json>; rel=describedby");
Ed Tanousac106bf2023-06-07 09:24:59 -0700313 asyncResp->res.jsonValue["@odata.type"] =
Sunny Srivastava31791052021-03-12 10:39:16 -0600314 "#FabricAdapterCollection.FabricAdapterCollection";
Ed Tanousac106bf2023-06-07 09:24:59 -0700315 asyncResp->res.jsonValue["Name"] = "Fabric Adapter Collection";
316 asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
Ed Tanousef4c65b2023-04-24 15:28:50 -0700317 "/redfish/v1/Systems/{}/FabricAdapters", systemName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600318
319 constexpr std::array<std::string_view, 1> interfaces{
320 "xyz.openbmc_project.Inventory.Item.FabricAdapter"};
321 collection_util::getCollectionMembers(
Ed Tanousac106bf2023-06-07 09:24:59 -0700322 asyncResp,
Ed Tanous253f11b2024-05-16 09:38:31 -0700323 boost::urls::format("/redfish/v1/Systems/{}/FabricAdapters",
324 BMCWEB_REDFISH_SYSTEM_URI_NAME),
Lakshmi Yadlapati36b5f1e2023-09-26 23:53:28 -0500325 interfaces, "/xyz/openbmc_project/inventory");
Sunny Srivastava31791052021-03-12 10:39:16 -0600326}
327
328inline void handleFabricAdapterCollectionHead(
329 crow::App& app, const crow::Request& req,
Ed Tanousac106bf2023-06-07 09:24:59 -0700330 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600331 const std::string& systemName)
332{
Ed Tanousac106bf2023-06-07 09:24:59 -0700333 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600334 {
335 return;
336 }
Ed Tanous25b54db2024-04-17 15:40:31 -0700337 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800338 {
339 // Option currently returns no systems. TBD
340 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
341 systemName);
342 return;
343 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700344 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Sunny Srivastava31791052021-03-12 10:39:16 -0600345 {
Ed Tanousac106bf2023-06-07 09:24:59 -0700346 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
347 systemName);
Sunny Srivastava31791052021-03-12 10:39:16 -0600348 return;
349 }
Ed Tanousac106bf2023-06-07 09:24:59 -0700350 asyncResp->res.addHeader(
Sunny Srivastava31791052021-03-12 10:39:16 -0600351 boost::beast::http::field::link,
352 "</redfish/v1/JsonSchemas/FabricAdapterCollection/FabricAdapterCollection.json>; rel=describedby");
353}
354
Myung Bae78c90202024-02-19 13:39:56 -0500355inline void afterHandleFabricAdapterHead(
356 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
357 const std::string& adapterId, const boost::system::error_code& ec,
358 const std::string& fabricAdapterPath, const std::string& serviceName)
359{
360 if (ec)
361 {
362 if (ec.value() == boost::system::errc::io_error)
363 {
364 messages::resourceNotFound(asyncResp->res, "FabricAdapter",
365 adapterId);
366 return;
367 }
368
369 BMCWEB_LOG_ERROR("DBus method call failed with error {}", ec.value());
370 messages::internalError(asyncResp->res);
371 return;
372 }
373 if (fabricAdapterPath.empty() || serviceName.empty())
374 {
375 BMCWEB_LOG_WARNING("Adapter not found");
376 messages::resourceNotFound(asyncResp->res, "FabricAdapter", adapterId);
377 return;
378 }
379 asyncResp->res.addHeader(
380 boost::beast::http::field::link,
381 "</redfish/v1/JsonSchemas/FabricAdapter/FabricAdapter.json>; rel=describedby");
382}
383
Sunny Srivastava31791052021-03-12 10:39:16 -0600384inline void
385 handleFabricAdapterHead(crow::App& app, const crow::Request& req,
Ed Tanousac106bf2023-06-07 09:24:59 -0700386 const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Sunny Srivastava31791052021-03-12 10:39:16 -0600387 const std::string& systemName,
388 const std::string& adapterId)
389{
Ed Tanousac106bf2023-06-07 09:24:59 -0700390 if (!redfish::setUpRedfishRoute(app, req, asyncResp))
Sunny Srivastava31791052021-03-12 10:39:16 -0600391 {
392 return;
393 }
394
Ed Tanous25b54db2024-04-17 15:40:31 -0700395 if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
Ed Tanous7f3e84a2022-12-28 16:22:54 -0800396 {
397 // Option currently returns no systems. TBD
398 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
399 systemName);
400 return;
401 }
Ed Tanous253f11b2024-05-16 09:38:31 -0700402 if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
Myung Bae78c90202024-02-19 13:39:56 -0500403 {
404 messages::resourceNotFound(asyncResp->res, "ComputerSystem",
405 systemName);
406 return;
407 }
408 getValidFabricAdapterPath(
409 adapterId,
410 std::bind_front(afterHandleFabricAdapterHead, asyncResp, adapterId));
Sunny Srivastava31791052021-03-12 10:39:16 -0600411}
412
413inline void requestRoutesFabricAdapterCollection(App& app)
414{
415 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/")
416 .privileges(redfish::privileges::getFabricAdapterCollection)
417 .methods(boost::beast::http::verb::get)(
418 std::bind_front(handleFabricAdapterCollectionGet, std::ref(app)));
419
420 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/")
421 .privileges(redfish::privileges::headFabricAdapterCollection)
422 .methods(boost::beast::http::verb::head)(
423 std::bind_front(handleFabricAdapterCollectionHead, std::ref(app)));
424}
425
426inline void requestRoutesFabricAdapters(App& app)
427{
428 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/<str>/")
429 .privileges(redfish::privileges::getFabricAdapter)
430 .methods(boost::beast::http::verb::get)(
431 std::bind_front(handleFabricAdapterGet, std::ref(app)));
432
433 BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/FabricAdapters/<str>/")
434 .privileges(redfish::privileges::headFabricAdapter)
435 .methods(boost::beast::http::verb::head)(
436 std::bind_front(handleFabricAdapterHead, std::ref(app)));
437}
438} // namespace redfish