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 2018 Intel Corporation |
Borawski.Lukasz | 9c310685 | 2018-02-09 15:24:22 +0100 | [diff] [blame] | 4 | #pragma once |
| 5 | |
Willy Tu | 13451e3 | 2023-05-24 16:08:18 -0700 | [diff] [blame] | 6 | #include "bmcweb_config.h" |
| 7 | |
Sui Chen | a51fc2d | 2022-07-14 17:21:53 -0700 | [diff] [blame] | 8 | #include "app.hpp" |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 9 | #include "async_resp.hpp" |
| 10 | #include "dbus_singleton.hpp" |
Sui Chen | a51fc2d | 2022-07-14 17:21:53 -0700 | [diff] [blame] | 11 | #include "dbus_utility.hpp" |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 12 | #include "error_messages.hpp" |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 13 | #include "generated/enums/action_info.hpp" |
| 14 | #include "generated/enums/manager.hpp" |
| 15 | #include "generated/enums/resource.hpp" |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 16 | #include "http_request.hpp" |
| 17 | #include "logging.hpp" |
| 18 | #include "persistent_data.hpp" |
Sui Chen | a51fc2d | 2022-07-14 17:21:53 -0700 | [diff] [blame] | 19 | #include "query.hpp" |
rohitpai | c1a75eb | 2025-01-03 19:13:36 +0530 | [diff] [blame] | 20 | #include "redfish.hpp" |
Jennifer Lee | c5d03ff | 2019-03-08 15:42:58 -0800 | [diff] [blame] | 21 | #include "redfish_util.hpp" |
Sui Chen | a51fc2d | 2022-07-14 17:21:53 -0700 | [diff] [blame] | 22 | #include "registries/privilege_registry.hpp" |
Krzysztof Grobelny | fac6e53 | 2022-08-04 12:42:45 +0200 | [diff] [blame] | 23 | #include "utils/dbus_utils.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 24 | #include "utils/json_utils.hpp" |
Sui Chen | a51fc2d | 2022-07-14 17:21:53 -0700 | [diff] [blame] | 25 | #include "utils/sw_utils.hpp" |
| 26 | #include "utils/systemd_utils.hpp" |
Ed Tanous | 2b82937 | 2022-08-03 14:22:34 -0700 | [diff] [blame] | 27 | #include "utils/time_utils.hpp" |
Borawski.Lukasz | 9c310685 | 2018-02-09 15:24:22 +0100 | [diff] [blame] | 28 | |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 29 | #include <systemd/sd-bus.h> |
| 30 | |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 31 | #include <boost/beast/http/status.hpp> |
| 32 | #include <boost/beast/http/verb.hpp> |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 33 | #include <boost/system/error_code.hpp> |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 34 | #include <boost/url/format.hpp> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 35 | #include <boost/url/url.hpp> |
| 36 | #include <nlohmann/json.hpp> |
Krzysztof Grobelny | fac6e53 | 2022-08-04 12:42:45 +0200 | [diff] [blame] | 37 | #include <sdbusplus/asio/property.hpp> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 38 | #include <sdbusplus/message.hpp> |
| 39 | #include <sdbusplus/message/native_types.hpp> |
Krzysztof Grobelny | fac6e53 | 2022-08-04 12:42:45 +0200 | [diff] [blame] | 40 | #include <sdbusplus/unpack_properties.hpp> |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 41 | |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 42 | #include <array> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 43 | #include <cstddef> |
Gunnar Mills | 4bfefa7 | 2020-07-30 13:54:29 -0500 | [diff] [blame] | 44 | #include <cstdint> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 45 | #include <format> |
| 46 | #include <functional> |
| 47 | #include <map> |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 48 | #include <memory> |
Konstantin Aladyshev | 9970e93 | 2024-02-20 09:51:29 +0300 | [diff] [blame] | 49 | #include <optional> |
Ed Tanous | 3544d2a | 2023-08-06 18:12:20 -0700 | [diff] [blame] | 50 | #include <ranges> |
Konstantin Aladyshev | 9970e93 | 2024-02-20 09:51:29 +0300 | [diff] [blame] | 51 | #include <string> |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 52 | #include <string_view> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 53 | #include <utility> |
Ed Tanous | d785720 | 2025-01-28 15:32:26 -0800 | [diff] [blame] | 54 | #include <vector> |
James Feist | 5b4aa86 | 2018-08-16 14:07:01 -0700 | [diff] [blame] | 55 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 56 | namespace redfish |
| 57 | { |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 58 | |
Jagpal Singh Gill | d27c31e | 2024-10-15 15:10:19 -0700 | [diff] [blame] | 59 | inline std::string getBMCUpdateServiceName() |
| 60 | { |
| 61 | if constexpr (BMCWEB_REDFISH_UPDATESERVICE_USE_DBUS) |
| 62 | { |
| 63 | return "xyz.openbmc_project.Software.Manager"; |
| 64 | } |
| 65 | return "xyz.openbmc_project.Software.BMC.Updater"; |
| 66 | } |
| 67 | |
| 68 | inline std::string getBMCUpdateServicePath() |
| 69 | { |
| 70 | if constexpr (BMCWEB_REDFISH_UPDATESERVICE_USE_DBUS) |
| 71 | { |
| 72 | return "/xyz/openbmc_project/software/bmc"; |
| 73 | } |
| 74 | return "/xyz/openbmc_project/software"; |
| 75 | } |
| 76 | |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 77 | /** |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 78 | * Function reboots the BMC. |
| 79 | * |
| 80 | * @param[in] asyncResp - Shared pointer for completing asynchronous calls |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 81 | */ |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 82 | inline void doBMCGracefulRestart( |
| 83 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 84 | { |
| 85 | const char* processName = "xyz.openbmc_project.State.BMC"; |
| 86 | const char* objectPath = "/xyz/openbmc_project/state/bmc0"; |
| 87 | const char* interfaceName = "xyz.openbmc_project.State.BMC"; |
| 88 | const std::string& propertyValue = |
| 89 | "xyz.openbmc_project.State.BMC.Transition.Reboot"; |
| 90 | const char* destProperty = "RequestedBMCTransition"; |
| 91 | |
| 92 | // Create the D-Bus variant for D-Bus call. |
George Liu | 9ae226f | 2023-06-21 17:56:46 +0800 | [diff] [blame] | 93 | sdbusplus::asio::setProperty( |
| 94 | *crow::connections::systemBus, processName, objectPath, interfaceName, |
| 95 | destProperty, propertyValue, |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 96 | [asyncResp](const boost::system::error_code& ec) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 97 | // Use "Set" method to set the property value. |
| 98 | if (ec) |
| 99 | { |
| 100 | BMCWEB_LOG_DEBUG("[Set] Bad D-Bus request error: {}", ec); |
| 101 | messages::internalError(asyncResp->res); |
| 102 | return; |
| 103 | } |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 104 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 105 | messages::success(asyncResp->res); |
| 106 | }); |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 107 | } |
| 108 | |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 109 | inline void doBMCForceRestart( |
| 110 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
Jayaprakash Mutyala | f92af38 | 2020-06-16 23:29:41 +0000 | [diff] [blame] | 111 | { |
| 112 | const char* processName = "xyz.openbmc_project.State.BMC"; |
| 113 | const char* objectPath = "/xyz/openbmc_project/state/bmc0"; |
| 114 | const char* interfaceName = "xyz.openbmc_project.State.BMC"; |
| 115 | const std::string& propertyValue = |
| 116 | "xyz.openbmc_project.State.BMC.Transition.HardReboot"; |
| 117 | const char* destProperty = "RequestedBMCTransition"; |
| 118 | |
| 119 | // Create the D-Bus variant for D-Bus call. |
George Liu | 9ae226f | 2023-06-21 17:56:46 +0800 | [diff] [blame] | 120 | sdbusplus::asio::setProperty( |
| 121 | *crow::connections::systemBus, processName, objectPath, interfaceName, |
| 122 | destProperty, propertyValue, |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 123 | [asyncResp](const boost::system::error_code& ec) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 124 | // Use "Set" method to set the property value. |
| 125 | if (ec) |
| 126 | { |
| 127 | BMCWEB_LOG_DEBUG("[Set] Bad D-Bus request error: {}", ec); |
| 128 | messages::internalError(asyncResp->res); |
| 129 | return; |
| 130 | } |
Jayaprakash Mutyala | f92af38 | 2020-06-16 23:29:41 +0000 | [diff] [blame] | 131 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 132 | messages::success(asyncResp->res); |
| 133 | }); |
Jayaprakash Mutyala | f92af38 | 2020-06-16 23:29:41 +0000 | [diff] [blame] | 134 | } |
| 135 | |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 136 | /** |
| 137 | * ManagerResetAction class supports the POST method for the Reset (reboot) |
| 138 | * action. |
| 139 | */ |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 140 | inline void requestRoutesManagerResetAction(App& app) |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 141 | { |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 142 | /** |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 143 | * Function handles POST method request. |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 144 | * Analyzes POST body before sending Reset (Reboot) request data to D-Bus. |
Jayaprakash Mutyala | f92af38 | 2020-06-16 23:29:41 +0000 | [diff] [blame] | 145 | * OpenBMC supports ResetType "GracefulRestart" and "ForceRestart". |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 146 | */ |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 147 | |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 148 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/Actions/Manager.Reset/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 149 | .privileges(redfish::privileges::postManager) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 150 | .methods(boost::beast::http::verb::post)( |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 151 | [&app](const crow::Request& req, |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 152 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 153 | const std::string& managerId) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 154 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 155 | { |
| 156 | return; |
| 157 | } |
| 158 | if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) |
| 159 | { |
| 160 | messages::resourceNotFound(asyncResp->res, "Manager", |
| 161 | managerId); |
| 162 | return; |
| 163 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 164 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 165 | BMCWEB_LOG_DEBUG("Post Manager Reset."); |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 166 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 167 | std::string resetType; |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 168 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 169 | if (!json_util::readJsonAction(req, asyncResp->res, "ResetType", |
| 170 | resetType)) |
| 171 | { |
| 172 | return; |
| 173 | } |
Gunnar Mills | 2a5c440 | 2020-05-19 09:07:24 -0500 | [diff] [blame] | 174 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 175 | if (resetType == "GracefulRestart") |
| 176 | { |
| 177 | BMCWEB_LOG_DEBUG("Proceeding with {}", resetType); |
| 178 | doBMCGracefulRestart(asyncResp); |
| 179 | return; |
| 180 | } |
| 181 | if (resetType == "ForceRestart") |
| 182 | { |
| 183 | BMCWEB_LOG_DEBUG("Proceeding with {}", resetType); |
| 184 | doBMCForceRestart(asyncResp); |
| 185 | return; |
| 186 | } |
| 187 | BMCWEB_LOG_DEBUG("Invalid property value for ResetType: {}", |
| 188 | resetType); |
| 189 | messages::actionParameterNotSupported(asyncResp->res, resetType, |
| 190 | "ResetType"); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 191 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 192 | return; |
| 193 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 194 | } |
Jennifer Lee | ed5befb | 2018-08-10 11:29:45 -0700 | [diff] [blame] | 195 | |
Gunnar Mills | 3e40fc7 | 2020-05-19 19:18:17 -0500 | [diff] [blame] | 196 | /** |
| 197 | * ManagerResetToDefaultsAction class supports POST method for factory reset |
| 198 | * action. |
| 199 | */ |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 200 | inline void requestRoutesManagerResetToDefaultsAction(App& app) |
Gunnar Mills | 3e40fc7 | 2020-05-19 19:18:17 -0500 | [diff] [blame] | 201 | { |
Gunnar Mills | 3e40fc7 | 2020-05-19 19:18:17 -0500 | [diff] [blame] | 202 | /** |
| 203 | * Function handles ResetToDefaults POST method request. |
| 204 | * |
| 205 | * Analyzes POST body message and factory resets BMC by calling |
| 206 | * BMC code updater factory reset followed by a BMC reboot. |
| 207 | * |
| 208 | * BMC code updater factory reset wipes the whole BMC read-write |
| 209 | * filesystem which includes things like the network settings. |
| 210 | * |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 211 | * OpenBMC only supports ResetType "ResetAll". |
Gunnar Mills | 3e40fc7 | 2020-05-19 19:18:17 -0500 | [diff] [blame] | 212 | */ |
Gunnar Mills | 3e40fc7 | 2020-05-19 19:18:17 -0500 | [diff] [blame] | 213 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 214 | BMCWEB_ROUTE(app, |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 215 | "/redfish/v1/Managers/<str>/Actions/Manager.ResetToDefaults/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 216 | .privileges(redfish::privileges::postManager) |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 217 | .methods(boost::beast::http::verb::post)( |
| 218 | [&app](const crow::Request& req, |
| 219 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 220 | const std::string& managerId) { |
| 221 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 222 | { |
| 223 | return; |
| 224 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 225 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 226 | if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) |
| 227 | { |
| 228 | messages::resourceNotFound(asyncResp->res, "Manager", |
| 229 | managerId); |
| 230 | return; |
| 231 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 232 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 233 | BMCWEB_LOG_DEBUG("Post ResetToDefaults."); |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 234 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 235 | std::optional<std::string> resetType; |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 236 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 237 | if (!json_util::readJsonAction( // |
| 238 | req, asyncResp->res, // |
| 239 | "ResetType", resetType // |
| 240 | )) |
| 241 | { |
| 242 | BMCWEB_LOG_DEBUG("Missing property ResetType."); |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 243 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 244 | messages::actionParameterMissing( |
| 245 | asyncResp->res, "ResetToDefaults", "ResetType"); |
| 246 | return; |
| 247 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 248 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 249 | if (resetType != "ResetAll") |
| 250 | { |
| 251 | BMCWEB_LOG_DEBUG("Invalid property value for ResetType: {}", |
| 252 | *resetType); |
| 253 | messages::actionParameterNotSupported( |
| 254 | asyncResp->res, *resetType, "ResetType"); |
| 255 | return; |
| 256 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 257 | |
Gunnar Mills | 18bf4bf | 2025-05-09 08:22:38 -0500 | [diff] [blame^] | 258 | crow::connections::systemBus->async_method_call( |
| 259 | [asyncResp](const boost::system::error_code& ec) { |
| 260 | if (ec) |
| 261 | { |
| 262 | BMCWEB_LOG_DEBUG("Failed to ResetToDefaults: {}", |
| 263 | ec); |
| 264 | messages::internalError(asyncResp->res); |
| 265 | return; |
| 266 | } |
| 267 | // Factory Reset doesn't actually happen until a reboot |
| 268 | // Can't erase what the BMC is running on |
| 269 | doBMCGracefulRestart(asyncResp); |
| 270 | }, |
| 271 | getBMCUpdateServiceName(), getBMCUpdateServicePath(), |
| 272 | "xyz.openbmc_project.Common.FactoryReset", "Reset"); |
| 273 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 274 | } |
Gunnar Mills | 3e40fc7 | 2020-05-19 19:18:17 -0500 | [diff] [blame] | 275 | |
AppaRao Puli | 1cb1a9e | 2020-07-17 23:38:57 +0530 | [diff] [blame] | 276 | /** |
| 277 | * ManagerResetActionInfo derived class for delivering Manager |
| 278 | * ResetType AllowableValues using ResetInfo schema. |
| 279 | */ |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 280 | inline void requestRoutesManagerResetActionInfo(App& app) |
AppaRao Puli | 1cb1a9e | 2020-07-17 23:38:57 +0530 | [diff] [blame] | 281 | { |
AppaRao Puli | 1cb1a9e | 2020-07-17 23:38:57 +0530 | [diff] [blame] | 282 | /** |
| 283 | * Functions triggers appropriate requests on DBus |
| 284 | */ |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 285 | |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 286 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/ResetActionInfo/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 287 | .privileges(redfish::privileges::getActionInfo) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 288 | .methods(boost::beast::http::verb::get)( |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 289 | [&app](const crow::Request& req, |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 290 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 291 | const std::string& managerId) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 292 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 293 | { |
| 294 | return; |
| 295 | } |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 296 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 297 | if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) |
| 298 | { |
| 299 | messages::resourceNotFound(asyncResp->res, "Manager", |
| 300 | managerId); |
| 301 | return; |
| 302 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 303 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 304 | asyncResp->res.jsonValue["@odata.type"] = |
| 305 | "#ActionInfo.v1_1_2.ActionInfo"; |
| 306 | asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( |
| 307 | "/redfish/v1/Managers/{}/ResetActionInfo", |
| 308 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 309 | asyncResp->res.jsonValue["Name"] = "Reset Action Info"; |
| 310 | asyncResp->res.jsonValue["Id"] = "ResetActionInfo"; |
| 311 | nlohmann::json::object_t parameter; |
| 312 | parameter["Name"] = "ResetType"; |
| 313 | parameter["Required"] = true; |
| 314 | parameter["DataType"] = action_info::ParameterTypes::String; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 315 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 316 | nlohmann::json::array_t allowableValues; |
| 317 | allowableValues.emplace_back("GracefulRestart"); |
| 318 | allowableValues.emplace_back("ForceRestart"); |
| 319 | parameter["AllowableValues"] = std::move(allowableValues); |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 320 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 321 | nlohmann::json::array_t parameters; |
| 322 | parameters.emplace_back(std::move(parameter)); |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 323 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 324 | asyncResp->res.jsonValue["Parameters"] = std::move(parameters); |
| 325 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 326 | } |
AppaRao Puli | 1cb1a9e | 2020-07-17 23:38:57 +0530 | [diff] [blame] | 327 | |
SunnySrivastava1984 | 071d8fd | 2020-10-28 02:20:30 -0500 | [diff] [blame] | 328 | /** |
| 329 | * @brief Retrieves BMC manager location data over DBus |
| 330 | * |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 331 | * @param[in] asyncResp Shared pointer for completing asynchronous calls |
SunnySrivastava1984 | 071d8fd | 2020-10-28 02:20:30 -0500 | [diff] [blame] | 332 | * @param[in] connectionName - service name |
| 333 | * @param[in] path - object path |
| 334 | * @return none |
| 335 | */ |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 336 | inline void getLocation(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
SunnySrivastava1984 | 071d8fd | 2020-10-28 02:20:30 -0500 | [diff] [blame] | 337 | const std::string& connectionName, |
| 338 | const std::string& path) |
| 339 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 340 | BMCWEB_LOG_DEBUG("Get BMC manager Location data."); |
SunnySrivastava1984 | 071d8fd | 2020-10-28 02:20:30 -0500 | [diff] [blame] | 341 | |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 342 | dbus::utility::getProperty<std::string>( |
| 343 | connectionName, path, |
Jonathan Doman | 1e1e598 | 2021-06-11 09:36:17 -0700 | [diff] [blame] | 344 | "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode", |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 345 | [asyncResp](const boost::system::error_code& ec, |
| 346 | const std::string& property) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 347 | if (ec) |
| 348 | { |
| 349 | BMCWEB_LOG_DEBUG("DBUS response error for " |
| 350 | "Location"); |
| 351 | messages::internalError(asyncResp->res); |
| 352 | return; |
| 353 | } |
SunnySrivastava1984 | 071d8fd | 2020-10-28 02:20:30 -0500 | [diff] [blame] | 354 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 355 | asyncResp->res |
| 356 | .jsonValue["Location"]["PartLocation"]["ServiceLabel"] = |
| 357 | property; |
| 358 | }); |
SunnySrivastava1984 | 071d8fd | 2020-10-28 02:20:30 -0500 | [diff] [blame] | 359 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 360 | // avoid name collision systems.hpp |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 361 | inline void managerGetLastResetTime( |
| 362 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 363 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 364 | BMCWEB_LOG_DEBUG("Getting Manager Last Reset Time"); |
Ed Tanous | 52cc112 | 2020-07-18 13:51:21 -0700 | [diff] [blame] | 365 | |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 366 | dbus::utility::getProperty<uint64_t>( |
| 367 | "xyz.openbmc_project.State.BMC", "/xyz/openbmc_project/state/bmc0", |
| 368 | "xyz.openbmc_project.State.BMC", "LastRebootTime", |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 369 | [asyncResp](const boost::system::error_code& ec, |
| 370 | const uint64_t lastResetTime) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 371 | if (ec) |
| 372 | { |
| 373 | BMCWEB_LOG_DEBUG("D-BUS response error {}", ec); |
| 374 | return; |
| 375 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 376 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 377 | // LastRebootTime is epoch time, in milliseconds |
| 378 | // https://github.com/openbmc/phosphor-dbus-interfaces/blob/7f9a128eb9296e926422ddc312c148b625890bb6/xyz/openbmc_project/State/BMC.interface.yaml#L19 |
| 379 | uint64_t lastResetTimeStamp = lastResetTime / 1000; |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 380 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 381 | // Convert to ISO 8601 standard |
| 382 | asyncResp->res.jsonValue["LastResetTime"] = |
| 383 | redfish::time_utils::getDateTimeUint(lastResetTimeStamp); |
| 384 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 385 | } |
| 386 | |
| 387 | /** |
| 388 | * @brief Set the running firmware image |
| 389 | * |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 390 | * @param[i,o] asyncResp - Async response object |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 391 | * @param[i] runningFirmwareTarget - Image to make the running image |
| 392 | * |
| 393 | * @return void |
| 394 | */ |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 395 | inline void setActiveFirmwareImage( |
| 396 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 397 | const std::string& runningFirmwareTarget) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 398 | { |
| 399 | // Get the Id from /redfish/v1/UpdateService/FirmwareInventory/<Id> |
| 400 | std::string::size_type idPos = runningFirmwareTarget.rfind('/'); |
| 401 | if (idPos == std::string::npos) |
| 402 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 403 | messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget, |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 404 | "@odata.id"); |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 405 | BMCWEB_LOG_DEBUG("Can't parse firmware ID!"); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 406 | return; |
| 407 | } |
| 408 | idPos++; |
| 409 | if (idPos >= runningFirmwareTarget.size()) |
| 410 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 411 | messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget, |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 412 | "@odata.id"); |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 413 | BMCWEB_LOG_DEBUG("Invalid firmware ID."); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 414 | return; |
| 415 | } |
| 416 | std::string firmwareId = runningFirmwareTarget.substr(idPos); |
| 417 | |
| 418 | // Make sure the image is valid before setting priority |
George Liu | 5eb468d | 2023-06-20 17:03:24 +0800 | [diff] [blame] | 419 | sdbusplus::message::object_path objPath("/xyz/openbmc_project/software"); |
| 420 | dbus::utility::getManagedObjects( |
Jagpal Singh Gill | d27c31e | 2024-10-15 15:10:19 -0700 | [diff] [blame] | 421 | getBMCUpdateServiceName(), objPath, |
George Liu | 5eb468d | 2023-06-20 17:03:24 +0800 | [diff] [blame] | 422 | [asyncResp, firmwareId, runningFirmwareTarget]( |
| 423 | const boost::system::error_code& ec, |
| 424 | const dbus::utility::ManagedObjectType& subtree) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 425 | if (ec) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 426 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 427 | BMCWEB_LOG_DEBUG("D-Bus response error getting objects."); |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 428 | messages::internalError(asyncResp->res); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 429 | return; |
| 430 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 431 | |
| 432 | if (subtree.empty()) |
| 433 | { |
| 434 | BMCWEB_LOG_DEBUG("Can't find image!"); |
| 435 | messages::internalError(asyncResp->res); |
| 436 | return; |
| 437 | } |
| 438 | |
| 439 | bool foundImage = false; |
| 440 | for (const auto& object : subtree) |
| 441 | { |
| 442 | const std::string& path = |
| 443 | static_cast<const std::string&>(object.first); |
| 444 | std::size_t idPos2 = path.rfind('/'); |
| 445 | |
| 446 | if (idPos2 == std::string::npos) |
| 447 | { |
| 448 | continue; |
| 449 | } |
| 450 | |
| 451 | idPos2++; |
| 452 | if (idPos2 >= path.size()) |
| 453 | { |
| 454 | continue; |
| 455 | } |
| 456 | |
| 457 | if (path.substr(idPos2) == firmwareId) |
| 458 | { |
| 459 | foundImage = true; |
| 460 | break; |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | if (!foundImage) |
| 465 | { |
| 466 | messages::propertyValueNotInList( |
| 467 | asyncResp->res, runningFirmwareTarget, "@odata.id"); |
| 468 | BMCWEB_LOG_DEBUG("Invalid firmware ID."); |
| 469 | return; |
| 470 | } |
| 471 | |
| 472 | BMCWEB_LOG_DEBUG("Setting firmware version {} to priority 0.", |
| 473 | firmwareId); |
| 474 | |
| 475 | // Only support Immediate |
| 476 | // An addition could be a Redfish Setting like |
| 477 | // ActiveSoftwareImageApplyTime and support OnReset |
| 478 | sdbusplus::asio::setProperty( |
Jagpal Singh Gill | d27c31e | 2024-10-15 15:10:19 -0700 | [diff] [blame] | 479 | *crow::connections::systemBus, getBMCUpdateServiceName(), |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 480 | "/xyz/openbmc_project/software/" + firmwareId, |
| 481 | "xyz.openbmc_project.Software.RedundancyPriority", "Priority", |
| 482 | static_cast<uint8_t>(0), |
| 483 | [asyncResp](const boost::system::error_code& ec2) { |
| 484 | if (ec2) |
| 485 | { |
| 486 | BMCWEB_LOG_DEBUG("D-Bus response error setting."); |
| 487 | messages::internalError(asyncResp->res); |
| 488 | return; |
| 489 | } |
| 490 | doBMCGracefulRestart(asyncResp); |
| 491 | }); |
George Liu | 5eb468d | 2023-06-20 17:03:24 +0800 | [diff] [blame] | 492 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 493 | } |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 494 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 495 | inline void afterSetDateTime( |
| 496 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 497 | const boost::system::error_code& ec, const sdbusplus::message_t& msg) |
Ed Tanous | c51afd5 | 2024-03-07 10:13:14 -0800 | [diff] [blame] | 498 | { |
| 499 | if (ec) |
| 500 | { |
| 501 | BMCWEB_LOG_DEBUG("Failed to set elapsed time. DBUS response error {}", |
| 502 | ec); |
| 503 | const sd_bus_error* dbusError = msg.get_error(); |
| 504 | if (dbusError != nullptr) |
| 505 | { |
| 506 | std::string_view errorName(dbusError->name); |
| 507 | if (errorName == |
| 508 | "org.freedesktop.timedate1.AutomaticTimeSyncEnabled") |
| 509 | { |
| 510 | BMCWEB_LOG_DEBUG("Setting conflict"); |
| 511 | messages::propertyValueConflict( |
| 512 | asyncResp->res, "DateTime", |
| 513 | "Managers/NetworkProtocol/NTPProcotolEnabled"); |
| 514 | return; |
| 515 | } |
| 516 | } |
| 517 | messages::internalError(asyncResp->res); |
| 518 | return; |
| 519 | } |
| 520 | asyncResp->res.result(boost::beast::http::status::no_content); |
| 521 | } |
| 522 | |
| 523 | inline void setDateTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 524 | const std::string& datetime) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 525 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 526 | BMCWEB_LOG_DEBUG("Set date time: {}", datetime); |
Borawski.Lukasz | 9c310685 | 2018-02-09 15:24:22 +0100 | [diff] [blame] | 527 | |
Ed Tanous | c2e3200 | 2023-01-07 22:05:08 -0800 | [diff] [blame] | 528 | std::optional<redfish::time_utils::usSinceEpoch> us = |
| 529 | redfish::time_utils::dateStringToEpoch(datetime); |
| 530 | if (!us) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 531 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 532 | messages::propertyValueFormatError(asyncResp->res, datetime, |
| 533 | "DateTime"); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 534 | return; |
| 535 | } |
Ed Tanous | c51afd5 | 2024-03-07 10:13:14 -0800 | [diff] [blame] | 536 | // Set the absolute datetime |
| 537 | bool relative = false; |
| 538 | bool interactive = false; |
| 539 | crow::connections::systemBus->async_method_call( |
| 540 | [asyncResp](const boost::system::error_code& ec, |
| 541 | const sdbusplus::message_t& msg) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 542 | afterSetDateTime(asyncResp, ec, msg); |
| 543 | }, |
Ed Tanous | c51afd5 | 2024-03-07 10:13:14 -0800 | [diff] [blame] | 544 | "org.freedesktop.timedate1", "/org/freedesktop/timedate1", |
| 545 | "org.freedesktop.timedate1", "SetTime", us->count(), relative, |
| 546 | interactive); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 547 | } |
| 548 | |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 549 | inline void checkForQuiesced( |
| 550 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
Ed Tanous | 75815e5 | 2022-10-05 17:21:13 -0700 | [diff] [blame] | 551 | { |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 552 | dbus::utility::getProperty<std::string>( |
| 553 | "org.freedesktop.systemd1", |
Ed Tanous | 75815e5 | 2022-10-05 17:21:13 -0700 | [diff] [blame] | 554 | "/org/freedesktop/systemd1/unit/obmc-bmc-service-quiesce@0.target", |
| 555 | "org.freedesktop.systemd1.Unit", "ActiveState", |
| 556 | [asyncResp](const boost::system::error_code& ec, |
| 557 | const std::string& val) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 558 | if (!ec) |
Ed Tanous | 75815e5 | 2022-10-05 17:21:13 -0700 | [diff] [blame] | 559 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 560 | if (val == "active") |
| 561 | { |
| 562 | asyncResp->res.jsonValue["Status"]["Health"] = |
| 563 | resource::Health::Critical; |
| 564 | asyncResp->res.jsonValue["Status"]["State"] = |
| 565 | resource::State::Quiesced; |
| 566 | return; |
| 567 | } |
Ed Tanous | 75815e5 | 2022-10-05 17:21:13 -0700 | [diff] [blame] | 568 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 569 | asyncResp->res.jsonValue["Status"]["Health"] = resource::Health::OK; |
| 570 | asyncResp->res.jsonValue["Status"]["State"] = |
| 571 | resource::State::Enabled; |
| 572 | }); |
Ed Tanous | 75815e5 | 2022-10-05 17:21:13 -0700 | [diff] [blame] | 573 | } |
| 574 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 575 | inline void requestRoutesManager(App& app) |
| 576 | { |
| 577 | std::string uuid = persistent_data::getConfig().systemUuid; |
| 578 | |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 579 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 580 | .privileges(redfish::privileges::getManager) |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 581 | .methods( |
| 582 | boost::beast::http::verb:: |
| 583 | get)([&app, |
| 584 | uuid](const crow::Request& req, |
| 585 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 586 | const std::string& managerId) { |
| 587 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 588 | { |
| 589 | return; |
| 590 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 591 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 592 | if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) |
| 593 | { |
| 594 | messages::resourceNotFound(asyncResp->res, "Manager", |
| 595 | managerId); |
| 596 | return; |
| 597 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 598 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 599 | asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( |
| 600 | "/redfish/v1/Managers/{}", BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 601 | asyncResp->res.jsonValue["@odata.type"] = |
| 602 | "#Manager.v1_14_0.Manager"; |
| 603 | asyncResp->res.jsonValue["Id"] = BMCWEB_REDFISH_MANAGER_URI_NAME; |
| 604 | asyncResp->res.jsonValue["Name"] = "OpenBmc Manager"; |
| 605 | asyncResp->res.jsonValue["Description"] = |
| 606 | "Baseboard Management Controller"; |
| 607 | asyncResp->res.jsonValue["PowerState"] = resource::PowerState::On; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 608 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 609 | asyncResp->res.jsonValue["ManagerType"] = manager::ManagerType::BMC; |
| 610 | asyncResp->res.jsonValue["UUID"] = systemd_utils::getUuid(); |
| 611 | asyncResp->res.jsonValue["ServiceEntryPointUUID"] = uuid; |
| 612 | asyncResp->res.jsonValue["Model"] = |
| 613 | "OpenBmc"; // TODO(ed), get model |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 614 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 615 | asyncResp->res.jsonValue["LogServices"]["@odata.id"] = |
| 616 | boost::urls::format("/redfish/v1/Managers/{}/LogServices", |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 617 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 618 | asyncResp->res.jsonValue["NetworkProtocol"]["@odata.id"] = |
| 619 | boost::urls::format("/redfish/v1/Managers/{}/NetworkProtocol", |
| 620 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 621 | asyncResp->res.jsonValue["EthernetInterfaces"]["@odata.id"] = |
| 622 | boost::urls::format( |
| 623 | "/redfish/v1/Managers/{}/EthernetInterfaces", |
| 624 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 625 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 626 | if constexpr (BMCWEB_VM_NBDPROXY) |
Ed Tanous | 75815e5 | 2022-10-05 17:21:13 -0700 | [diff] [blame] | 627 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 628 | asyncResp->res.jsonValue["VirtualMedia"]["@odata.id"] = |
| 629 | boost::urls::format("/redfish/v1/Managers/{}/VirtualMedia", |
| 630 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 631 | } |
| 632 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 633 | // Manager.Reset (an action) can be many values, OpenBMC only |
| 634 | // supports BMC reboot. |
| 635 | nlohmann::json& managerReset = |
| 636 | asyncResp->res.jsonValue["Actions"]["#Manager.Reset"]; |
| 637 | managerReset["target"] = boost::urls::format( |
| 638 | "/redfish/v1/Managers/{}/Actions/Manager.Reset", |
| 639 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 640 | managerReset["@Redfish.ActionInfo"] = |
| 641 | boost::urls::format("/redfish/v1/Managers/{}/ResetActionInfo", |
| 642 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 643 | |
| 644 | // ResetToDefaults (Factory Reset) has values like |
| 645 | // PreserveNetworkAndUsers and PreserveNetwork that aren't supported |
| 646 | // on OpenBMC |
| 647 | nlohmann::json& resetToDefaults = |
| 648 | asyncResp->res.jsonValue["Actions"]["#Manager.ResetToDefaults"]; |
| 649 | resetToDefaults["target"] = boost::urls::format( |
| 650 | "/redfish/v1/Managers/{}/Actions/Manager.ResetToDefaults", |
| 651 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 652 | resetToDefaults["ResetType@Redfish.AllowableValues"] = |
| 653 | nlohmann::json::array_t({"ResetAll"}); |
| 654 | |
| 655 | std::pair<std::string, std::string> redfishDateTimeOffset = |
| 656 | redfish::time_utils::getDateTimeOffsetNow(); |
| 657 | |
| 658 | asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first; |
| 659 | asyncResp->res.jsonValue["DateTimeLocalOffset"] = |
| 660 | redfishDateTimeOffset.second; |
| 661 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 662 | if constexpr (BMCWEB_KVM) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 663 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 664 | // Fill in GraphicalConsole info |
| 665 | asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = |
| 666 | true; |
| 667 | asyncResp->res |
| 668 | .jsonValue["GraphicalConsole"]["MaxConcurrentSessions"] = 4; |
| 669 | asyncResp->res |
| 670 | .jsonValue["GraphicalConsole"]["ConnectTypesSupported"] = |
| 671 | nlohmann::json::array_t({"KVMIP"}); |
| 672 | } |
| 673 | if constexpr (!BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) |
| 674 | { |
| 675 | asyncResp->res |
| 676 | .jsonValue["Links"]["ManagerForServers@odata.count"] = 1; |
| 677 | |
| 678 | nlohmann::json::array_t managerForServers; |
| 679 | nlohmann::json::object_t manager; |
| 680 | manager["@odata.id"] = std::format( |
| 681 | "/redfish/v1/Systems/{}", BMCWEB_REDFISH_SYSTEM_URI_NAME); |
| 682 | managerForServers.emplace_back(std::move(manager)); |
| 683 | |
| 684 | asyncResp->res.jsonValue["Links"]["ManagerForServers"] = |
| 685 | std::move(managerForServers); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 686 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 687 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 688 | sw_util::populateSoftwareInformation(asyncResp, sw_util::bmcPurpose, |
| 689 | "FirmwareVersion", true); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 690 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 691 | managerGetLastResetTime(asyncResp); |
| 692 | |
| 693 | // ManagerDiagnosticData is added for all BMCs. |
| 694 | nlohmann::json& managerDiagnosticData = |
| 695 | asyncResp->res.jsonValue["ManagerDiagnosticData"]; |
| 696 | managerDiagnosticData["@odata.id"] = boost::urls::format( |
| 697 | "/redfish/v1/Managers/{}/ManagerDiagnosticData", |
| 698 | BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 699 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 700 | getMainChassisId(asyncResp, [](const std::string& chassisId, |
| 701 | const std::shared_ptr< |
| 702 | bmcweb::AsyncResp>& aRsp) { |
| 703 | aRsp->res.jsonValue["Links"]["ManagerForChassis@odata.count"] = |
| 704 | 1; |
| 705 | nlohmann::json::array_t managerForChassis; |
| 706 | nlohmann::json::object_t managerObj; |
| 707 | boost::urls::url chassiUrl = |
| 708 | boost::urls::format("/redfish/v1/Chassis/{}", chassisId); |
| 709 | managerObj["@odata.id"] = chassiUrl; |
| 710 | managerForChassis.emplace_back(std::move(managerObj)); |
| 711 | aRsp->res.jsonValue["Links"]["ManagerForChassis"] = |
| 712 | std::move(managerForChassis); |
| 713 | aRsp->res.jsonValue["Links"]["ManagerInChassis"]["@odata.id"] = |
| 714 | chassiUrl; |
| 715 | }); |
| 716 | |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 717 | dbus::utility::getProperty<double>( |
| 718 | "org.freedesktop.systemd1", "/org/freedesktop/systemd1", |
| 719 | "org.freedesktop.systemd1.Manager", "Progress", |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 720 | [asyncResp](const boost::system::error_code& ec, double val) { |
| 721 | if (ec) |
| 722 | { |
| 723 | BMCWEB_LOG_ERROR("Error while getting progress"); |
| 724 | messages::internalError(asyncResp->res); |
| 725 | return; |
| 726 | } |
| 727 | if (val < 1.0) |
| 728 | { |
| 729 | asyncResp->res.jsonValue["Status"]["Health"] = |
| 730 | resource::Health::OK; |
| 731 | asyncResp->res.jsonValue["Status"]["State"] = |
| 732 | resource::State::Starting; |
| 733 | return; |
| 734 | } |
| 735 | checkForQuiesced(asyncResp); |
| 736 | }); |
| 737 | |
| 738 | constexpr std::array<std::string_view, 1> interfaces = { |
| 739 | "xyz.openbmc_project.Inventory.Item.Bmc"}; |
| 740 | dbus::utility::getSubTree( |
| 741 | "/xyz/openbmc_project/inventory", 0, interfaces, |
| 742 | [asyncResp]( |
| 743 | const boost::system::error_code& ec, |
| 744 | const dbus::utility::MapperGetSubTreeResponse& subtree) { |
| 745 | if (ec) |
| 746 | { |
| 747 | BMCWEB_LOG_DEBUG( |
| 748 | "D-Bus response error on GetSubTree {}", ec); |
| 749 | return; |
| 750 | } |
| 751 | if (subtree.empty()) |
| 752 | { |
| 753 | BMCWEB_LOG_DEBUG("Can't find bmc D-Bus object!"); |
| 754 | return; |
| 755 | } |
| 756 | // Assume only 1 bmc D-Bus object |
| 757 | // Throw an error if there is more than 1 |
| 758 | if (subtree.size() > 1) |
| 759 | { |
| 760 | BMCWEB_LOG_DEBUG("Found more than 1 bmc D-Bus object!"); |
| 761 | messages::internalError(asyncResp->res); |
| 762 | return; |
| 763 | } |
| 764 | |
| 765 | if (subtree[0].first.empty() || |
| 766 | subtree[0].second.size() != 1) |
| 767 | { |
| 768 | BMCWEB_LOG_DEBUG("Error getting bmc D-Bus object!"); |
| 769 | messages::internalError(asyncResp->res); |
| 770 | return; |
| 771 | } |
| 772 | |
| 773 | const std::string& path = subtree[0].first; |
| 774 | const std::string& connectionName = |
| 775 | subtree[0].second[0].first; |
| 776 | |
| 777 | for (const auto& interfaceName : |
| 778 | subtree[0].second[0].second) |
| 779 | { |
| 780 | if (interfaceName == |
| 781 | "xyz.openbmc_project.Inventory.Decorator.Asset") |
| 782 | { |
Ed Tanous | deae6a7 | 2024-11-11 21:58:57 -0800 | [diff] [blame] | 783 | dbus::utility::getAllProperties( |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 784 | *crow::connections::systemBus, connectionName, |
| 785 | path, |
| 786 | "xyz.openbmc_project.Inventory.Decorator.Asset", |
| 787 | [asyncResp]( |
| 788 | const boost::system::error_code& ec2, |
Ed Tanous | b9d36b4 | 2022-02-26 21:42:46 -0800 | [diff] [blame] | 789 | const dbus::utility::DBusPropertiesMap& |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 790 | propertiesList) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 791 | if (ec2) |
| 792 | { |
| 793 | BMCWEB_LOG_DEBUG( |
| 794 | "Can't get bmc asset!"); |
| 795 | return; |
| 796 | } |
| 797 | |
| 798 | const std::string* partNumber = nullptr; |
| 799 | const std::string* serialNumber = nullptr; |
| 800 | const std::string* manufacturer = nullptr; |
| 801 | const std::string* model = nullptr; |
| 802 | const std::string* sparePartNumber = |
| 803 | nullptr; |
| 804 | |
| 805 | const bool success = |
| 806 | sdbusplus::unpackPropertiesNoThrow( |
| 807 | dbus_utils::UnpackErrorPrinter(), |
| 808 | propertiesList, "PartNumber", |
| 809 | partNumber, "SerialNumber", |
| 810 | serialNumber, "Manufacturer", |
| 811 | manufacturer, "Model", model, |
| 812 | "SparePartNumber", sparePartNumber); |
| 813 | |
| 814 | if (!success) |
| 815 | { |
| 816 | messages::internalError(asyncResp->res); |
| 817 | return; |
| 818 | } |
| 819 | |
| 820 | if (partNumber != nullptr) |
| 821 | { |
| 822 | asyncResp->res.jsonValue["PartNumber"] = |
| 823 | *partNumber; |
| 824 | } |
| 825 | |
| 826 | if (serialNumber != nullptr) |
| 827 | { |
| 828 | asyncResp->res |
| 829 | .jsonValue["SerialNumber"] = |
| 830 | *serialNumber; |
| 831 | } |
| 832 | |
| 833 | if (manufacturer != nullptr) |
| 834 | { |
| 835 | asyncResp->res |
| 836 | .jsonValue["Manufacturer"] = |
| 837 | *manufacturer; |
| 838 | } |
| 839 | |
| 840 | if (model != nullptr) |
| 841 | { |
| 842 | asyncResp->res.jsonValue["Model"] = |
| 843 | *model; |
| 844 | } |
| 845 | |
| 846 | if (sparePartNumber != nullptr) |
| 847 | { |
| 848 | asyncResp->res |
| 849 | .jsonValue["SparePartNumber"] = |
| 850 | *sparePartNumber; |
| 851 | } |
| 852 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 853 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 854 | else if ( |
| 855 | interfaceName == |
| 856 | "xyz.openbmc_project.Inventory.Decorator.LocationCode") |
Krzysztof Grobelny | fac6e53 | 2022-08-04 12:42:45 +0200 | [diff] [blame] | 857 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 858 | getLocation(asyncResp, connectionName, path); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 859 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 860 | } |
| 861 | }); |
rohitpai | c1a75eb | 2025-01-03 19:13:36 +0530 | [diff] [blame] | 862 | |
| 863 | RedfishService::getInstance(app).handleSubRoute(req, asyncResp); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 864 | }); |
| 865 | |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 866 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 867 | .privileges(redfish::privileges::patchManager) |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 868 | .methods(boost::beast::http::verb::patch)( |
| 869 | [&app](const crow::Request& req, |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 870 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 871 | const std::string& managerId) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 872 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 873 | { |
| 874 | return; |
| 875 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 876 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 877 | if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME) |
| 878 | { |
| 879 | messages::resourceNotFound(asyncResp->res, "Manager", |
| 880 | managerId); |
| 881 | return; |
| 882 | } |
Ed Tanous | 253f11b | 2024-05-16 09:38:31 -0700 | [diff] [blame] | 883 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 884 | std::optional<std::string> activeSoftwareImageOdataId; |
| 885 | std::optional<std::string> datetime; |
| 886 | std::optional<nlohmann::json::object_t> pidControllers; |
| 887 | std::optional<nlohmann::json::object_t> fanControllers; |
| 888 | std::optional<nlohmann::json::object_t> fanZones; |
| 889 | std::optional<nlohmann::json::object_t> stepwiseControllers; |
| 890 | std::optional<std::string> profile; |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 891 | |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 892 | if (!json_util::readJsonPatch( // |
| 893 | req, asyncResp->res, // |
| 894 | "DateTime", datetime, // |
Myung Bae | afc474a | 2024-10-09 00:53:29 -0700 | [diff] [blame] | 895 | "Links/ActiveSoftwareImage/@odata.id", |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 896 | activeSoftwareImageOdataId, // |
Myung Bae | afc474a | 2024-10-09 00:53:29 -0700 | [diff] [blame] | 897 | "Oem/OpenBmc/Fan/FanControllers", fanControllers, // |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 898 | "Oem/OpenBmc/Fan/FanZones", fanZones, // |
Myung Bae | afc474a | 2024-10-09 00:53:29 -0700 | [diff] [blame] | 899 | "Oem/OpenBmc/Fan/PidControllers", pidControllers, // |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 900 | "Oem/OpenBmc/Fan/Profile", profile, // |
Myung Bae | afc474a | 2024-10-09 00:53:29 -0700 | [diff] [blame] | 901 | "Oem/OpenBmc/Fan/StepwiseControllers", |
Patrick Williams | 504af5a | 2025-02-03 14:29:03 -0500 | [diff] [blame] | 902 | stepwiseControllers // |
Myung Bae | afc474a | 2024-10-09 00:53:29 -0700 | [diff] [blame] | 903 | )) |
| 904 | { |
| 905 | return; |
| 906 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 907 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 908 | if (activeSoftwareImageOdataId) |
| 909 | { |
| 910 | setActiveFirmwareImage(asyncResp, |
| 911 | *activeSoftwareImageOdataId); |
| 912 | } |
Ed Tanous | 9e9b604 | 2024-03-06 14:18:28 -0800 | [diff] [blame] | 913 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 914 | if (datetime) |
| 915 | { |
| 916 | setDateTime(asyncResp, *datetime); |
| 917 | } |
rohitpai | 84aad24 | 2025-01-28 09:23:53 +0530 | [diff] [blame] | 918 | |
| 919 | RedfishService::getInstance(app).handleSubRoute(req, asyncResp); |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 920 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 921 | } |
| 922 | |
| 923 | inline void requestRoutesManagerCollection(App& app) |
| 924 | { |
| 925 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 926 | .privileges(redfish::privileges::getManagerCollection) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 927 | .methods(boost::beast::http::verb::get)( |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 928 | [&app](const crow::Request& req, |
| 929 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 930 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 931 | { |
| 932 | return; |
| 933 | } |
| 934 | // Collections don't include the static data added by SubRoute |
| 935 | // because it has a duplicate entry for members |
| 936 | asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Managers"; |
| 937 | asyncResp->res.jsonValue["@odata.type"] = |
| 938 | "#ManagerCollection.ManagerCollection"; |
| 939 | asyncResp->res.jsonValue["Name"] = "Manager Collection"; |
| 940 | asyncResp->res.jsonValue["Members@odata.count"] = 1; |
| 941 | nlohmann::json::array_t members; |
| 942 | nlohmann::json& bmc = members.emplace_back(); |
| 943 | bmc["@odata.id"] = boost::urls::format( |
| 944 | "/redfish/v1/Managers/{}", BMCWEB_REDFISH_MANAGER_URI_NAME); |
| 945 | asyncResp->res.jsonValue["Members"] = std::move(members); |
| 946 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 947 | } |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 948 | } // namespace redfish |