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 |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 4 | #pragma once |
| 5 | |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 6 | #include "account_service.hpp" |
| 7 | #include "app.hpp" |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 8 | #include "async_resp.hpp" |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 9 | #include "credential_pipe.hpp" |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 10 | #include "dbus_utility.hpp" |
Ed Tanous | 739b87e | 2023-02-24 13:13:33 -0800 | [diff] [blame] | 11 | #include "generated/enums/virtual_media.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 12 | #include "query.hpp" |
| 13 | #include "registries/privilege_registry.hpp" |
| 14 | #include "utils/json_utils.hpp" |
| 15 | |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 16 | #include <boost/url/format.hpp> |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 17 | #include <boost/url/url_view.hpp> |
Ed Tanous | 4a7fbef | 2024-04-06 16:03:49 -0700 | [diff] [blame] | 18 | #include <boost/url/url_view_base.hpp> |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 19 | |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 20 | #include <array> |
Ed Tanous | 3544d2a | 2023-08-06 18:12:20 -0700 | [diff] [blame] | 21 | #include <ranges> |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 22 | #include <string_view> |
| 23 | |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 24 | namespace redfish |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 25 | { |
Ed Tanous | 365a73f | 2023-02-24 12:16:49 -0800 | [diff] [blame] | 26 | |
| 27 | enum class VmMode |
| 28 | { |
| 29 | Invalid, |
| 30 | Legacy, |
| 31 | Proxy |
| 32 | }; |
| 33 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 34 | inline VmMode parseObjectPathAndGetMode( |
| 35 | const sdbusplus::message::object_path& itemPath, const std::string& resName) |
Ed Tanous | 365a73f | 2023-02-24 12:16:49 -0800 | [diff] [blame] | 36 | { |
| 37 | std::string thisPath = itemPath.filename(); |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 38 | BMCWEB_LOG_DEBUG("Filename: {}, ThisPath: {}", itemPath.str, thisPath); |
Ed Tanous | 365a73f | 2023-02-24 12:16:49 -0800 | [diff] [blame] | 39 | |
| 40 | if (thisPath.empty()) |
| 41 | { |
| 42 | return VmMode::Invalid; |
| 43 | } |
| 44 | |
| 45 | if (thisPath != resName) |
| 46 | { |
| 47 | return VmMode::Invalid; |
| 48 | } |
| 49 | |
| 50 | auto mode = itemPath.parent_path(); |
| 51 | auto type = mode.parent_path(); |
| 52 | |
| 53 | if (mode.filename().empty() || type.filename().empty()) |
| 54 | { |
| 55 | return VmMode::Invalid; |
| 56 | } |
| 57 | |
| 58 | if (type.filename() != "VirtualMedia") |
| 59 | { |
| 60 | return VmMode::Invalid; |
| 61 | } |
| 62 | std::string modeStr = mode.filename(); |
| 63 | if (modeStr == "Legacy") |
| 64 | { |
| 65 | return VmMode::Legacy; |
| 66 | } |
| 67 | if (modeStr == "Proxy") |
| 68 | { |
| 69 | return VmMode::Proxy; |
| 70 | } |
| 71 | return VmMode::Invalid; |
| 72 | } |
| 73 | |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 74 | using CheckItemHandler = |
| 75 | std::function<void(const std::string& service, const std::string& resName, |
| 76 | const std::shared_ptr<bmcweb::AsyncResp>&, |
George Liu | 70cbdf5 | 2023-03-04 12:07:25 +0800 | [diff] [blame] | 77 | const std::pair<sdbusplus::message::object_path, |
Michael Shen | 80f79a4 | 2023-08-24 13:41:53 +0000 | [diff] [blame] | 78 | dbus::utility::DBusInterfacesMap>&)>; |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 79 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 80 | inline void |
| 81 | findAndParseObject(const std::string& service, const std::string& resName, |
| 82 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 83 | CheckItemHandler&& handler) |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 84 | { |
George Liu | 5eb468d | 2023-06-20 17:03:24 +0800 | [diff] [blame] | 85 | sdbusplus::message::object_path path("/xyz/openbmc_project/VirtualMedia"); |
| 86 | dbus::utility::getManagedObjects( |
| 87 | service, path, |
Ed Tanous | 8cb2c02 | 2024-03-27 16:31:46 -0700 | [diff] [blame] | 88 | [service, resName, asyncResp, handler = std::move(handler)]( |
| 89 | const boost::system::error_code& ec, |
| 90 | const dbus::utility::ManagedObjectType& subtree) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 91 | if (ec) |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 92 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 93 | BMCWEB_LOG_DEBUG("DBUS response error"); |
| 94 | |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 95 | return; |
| 96 | } |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 97 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 98 | for (const auto& item : subtree) |
| 99 | { |
| 100 | VmMode mode = parseObjectPathAndGetMode(item.first, resName); |
| 101 | if (mode != VmMode::Invalid) |
| 102 | { |
| 103 | handler(service, resName, asyncResp, item); |
| 104 | return; |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | BMCWEB_LOG_DEBUG("Parent item not found"); |
| 109 | asyncResp->res.result(boost::beast::http::status::not_found); |
| 110 | }); |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 111 | } |
| 112 | |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 113 | /** |
| 114 | * @brief Function extracts transfer protocol name from URI. |
| 115 | */ |
Ed Tanous | 67df073 | 2021-10-26 11:23:56 -0700 | [diff] [blame] | 116 | inline std::string getTransferProtocolTypeFromUri(const std::string& imageUri) |
| 117 | { |
Ed Tanous | 6fd2955 | 2023-10-04 09:40:14 -0700 | [diff] [blame] | 118 | boost::system::result<boost::urls::url_view> url = |
Ed Tanous | 079360a | 2022-06-29 10:05:19 -0700 | [diff] [blame] | 119 | boost::urls::parse_uri(imageUri); |
Ed Tanous | 67df073 | 2021-10-26 11:23:56 -0700 | [diff] [blame] | 120 | if (!url) |
| 121 | { |
| 122 | return "None"; |
| 123 | } |
Ed Tanous | 079360a | 2022-06-29 10:05:19 -0700 | [diff] [blame] | 124 | std::string_view scheme = url->scheme(); |
Ed Tanous | 67df073 | 2021-10-26 11:23:56 -0700 | [diff] [blame] | 125 | if (scheme == "smb") |
| 126 | { |
| 127 | return "CIFS"; |
| 128 | } |
| 129 | if (scheme == "https") |
| 130 | { |
| 131 | return "HTTPS"; |
| 132 | } |
| 133 | |
| 134 | return "None"; |
| 135 | } |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 136 | |
| 137 | /** |
| 138 | * @brief Read all known properties from VM object interfaces |
| 139 | */ |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 140 | inline void |
Michael Shen | 80f79a4 | 2023-08-24 13:41:53 +0000 | [diff] [blame] | 141 | vmParseInterfaceObject(const dbus::utility::DBusInterfacesMap& interfaces, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 142 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 143 | { |
Ed Tanous | 8a59281 | 2022-06-04 09:06:59 -0700 | [diff] [blame] | 144 | for (const auto& [interface, values] : interfaces) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 145 | { |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 146 | if (interface == "xyz.openbmc_project.VirtualMedia.MountPoint") |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 147 | { |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 148 | for (const auto& [property, value] : values) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 149 | { |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 150 | if (property == "EndpointId") |
| 151 | { |
| 152 | const std::string* endpointIdValue = |
| 153 | std::get_if<std::string>(&value); |
| 154 | if (endpointIdValue == nullptr) |
| 155 | { |
| 156 | continue; |
| 157 | } |
| 158 | if (!endpointIdValue->empty()) |
| 159 | { |
| 160 | // Proxy mode |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 161 | asyncResp->res |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 162 | .jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = |
| 163 | *endpointIdValue; |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 164 | asyncResp->res.jsonValue["TransferProtocolType"] = |
| 165 | "OEM"; |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 166 | } |
| 167 | } |
| 168 | if (property == "ImageURL") |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 169 | { |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 170 | const std::string* imageUrlValue = |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 171 | std::get_if<std::string>(&value); |
Ed Tanous | 26f6976 | 2022-01-25 09:49:11 -0800 | [diff] [blame] | 172 | if (imageUrlValue != nullptr && !imageUrlValue->empty()) |
Przemyslaw Czarnowski | da4784d | 2020-11-06 09:58:25 +0100 | [diff] [blame] | 173 | { |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 174 | std::filesystem::path filePath = *imageUrlValue; |
| 175 | if (!filePath.has_filename()) |
| 176 | { |
| 177 | // this will handle https share, which not |
| 178 | // necessarily has to have filename given. |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 179 | asyncResp->res.jsonValue["ImageName"] = ""; |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 180 | } |
| 181 | else |
| 182 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 183 | asyncResp->res.jsonValue["ImageName"] = |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 184 | filePath.filename(); |
| 185 | } |
Przemyslaw Czarnowski | da4784d | 2020-11-06 09:58:25 +0100 | [diff] [blame] | 186 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 187 | asyncResp->res.jsonValue["Image"] = *imageUrlValue; |
| 188 | asyncResp->res.jsonValue["TransferProtocolType"] = |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 189 | getTransferProtocolTypeFromUri(*imageUrlValue); |
| 190 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 191 | asyncResp->res.jsonValue["ConnectedVia"] = |
Ed Tanous | 739b87e | 2023-02-24 13:13:33 -0800 | [diff] [blame] | 192 | virtual_media::ConnectedVia::URI; |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 193 | } |
| 194 | } |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 195 | if (property == "WriteProtected") |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 196 | { |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 197 | const bool* writeProtectedValue = std::get_if<bool>(&value); |
Ed Tanous | e662eae | 2022-01-25 10:39:19 -0800 | [diff] [blame] | 198 | if (writeProtectedValue != nullptr) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 199 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 200 | asyncResp->res.jsonValue["WriteProtected"] = |
Anna Platash | 9e319cf | 2020-11-17 10:18:31 +0100 | [diff] [blame] | 201 | *writeProtectedValue; |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 202 | } |
| 203 | } |
| 204 | } |
| 205 | } |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 206 | if (interface == "xyz.openbmc_project.VirtualMedia.Process") |
| 207 | { |
| 208 | for (const auto& [property, value] : values) |
| 209 | { |
| 210 | if (property == "Active") |
| 211 | { |
| 212 | const bool* activeValue = std::get_if<bool>(&value); |
Ed Tanous | e662eae | 2022-01-25 10:39:19 -0800 | [diff] [blame] | 213 | if (activeValue == nullptr) |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 214 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 215 | BMCWEB_LOG_DEBUG("Value Active not found"); |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 216 | return; |
| 217 | } |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 218 | asyncResp->res.jsonValue["Inserted"] = *activeValue; |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 219 | |
Ed Tanous | e05aec5 | 2022-01-25 10:28:56 -0800 | [diff] [blame] | 220 | if (*activeValue) |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 221 | { |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 222 | asyncResp->res.jsonValue["ConnectedVia"] = |
Ed Tanous | 739b87e | 2023-02-24 13:13:33 -0800 | [diff] [blame] | 223 | virtual_media::ConnectedVia::Applet; |
Ed Tanous | 711ac7a | 2021-12-20 09:34:41 -0800 | [diff] [blame] | 224 | } |
| 225 | } |
| 226 | } |
| 227 | } |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 228 | } |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * @brief Fill template for Virtual Media Item. |
| 233 | */ |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 234 | inline nlohmann::json vmItemTemplate(const std::string& name, |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 235 | const std::string& resName) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 236 | { |
| 237 | nlohmann::json item; |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 238 | item["@odata.id"] = boost::urls::format( |
| 239 | "/redfish/v1/Managers/{}/VirtualMedia/{}", name, resName); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 240 | |
Przemyslaw Czarnowski | d04ba32 | 2020-01-21 12:41:56 +0100 | [diff] [blame] | 241 | item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia"; |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 242 | item["Name"] = "Virtual Removable Media"; |
| 243 | item["Id"] = resName; |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 244 | item["WriteProtected"] = true; |
Ed Tanous | 739b87e | 2023-02-24 13:13:33 -0800 | [diff] [blame] | 245 | item["ConnectedVia"] = virtual_media::ConnectedVia::NotConnected; |
Ed Tanous | 613dabe | 2022-07-09 11:17:36 -0700 | [diff] [blame] | 246 | item["MediaTypes"] = nlohmann::json::array_t({"CD", "USBStick"}); |
Ed Tanous | 539d8c6 | 2024-06-19 14:38:27 -0700 | [diff] [blame] | 247 | item["TransferMethod"] = virtual_media::TransferMethod::Stream; |
Przemyslaw Czarnowski | d04ba32 | 2020-01-21 12:41:56 +0100 | [diff] [blame] | 248 | item["Oem"]["OpenBMC"]["@odata.type"] = |
Ed Tanous | f958ed9 | 2024-07-12 11:16:59 -0700 | [diff] [blame] | 249 | "#OpenBMCVirtualMedia.v1_0_0.VirtualMedia"; |
V-Sanjana | 15b8972 | 2023-05-11 16:27:03 +0530 | [diff] [blame] | 250 | item["Oem"]["OpenBMC"]["@odata.id"] = boost::urls::format( |
| 251 | "/redfish/v1/Managers/{}/VirtualMedia/{}#/Oem/OpenBMC", name, resName); |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 252 | |
| 253 | return item; |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * @brief Fills collection data |
| 258 | */ |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 259 | inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> asyncResp, |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 260 | const std::string& service, |
| 261 | const std::string& name) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 262 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 263 | BMCWEB_LOG_DEBUG("Get available Virtual Media resources."); |
George Liu | 5eb468d | 2023-06-20 17:03:24 +0800 | [diff] [blame] | 264 | sdbusplus::message::object_path objPath( |
| 265 | "/xyz/openbmc_project/VirtualMedia"); |
| 266 | dbus::utility::getManagedObjects( |
| 267 | service, objPath, |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 268 | [name, asyncResp{std::move(asyncResp)}]( |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 269 | const boost::system::error_code& ec, |
Ed Tanous | 02cad96 | 2022-06-30 16:50:15 -0700 | [diff] [blame] | 270 | const dbus::utility::ManagedObjectType& subtree) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 271 | if (ec) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 272 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 273 | BMCWEB_LOG_DEBUG("DBUS response error"); |
| 274 | return; |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 275 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 276 | nlohmann::json& members = asyncResp->res.jsonValue["Members"]; |
| 277 | members = nlohmann::json::array(); |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 278 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 279 | for (const auto& object : subtree) |
| 280 | { |
| 281 | nlohmann::json item; |
| 282 | std::string path = object.first.filename(); |
| 283 | if (path.empty()) |
| 284 | { |
| 285 | continue; |
| 286 | } |
| 287 | |
| 288 | item["@odata.id"] = boost::urls::format( |
| 289 | "/redfish/v1/Managers/{}/VirtualMedia/{}", name, path); |
| 290 | members.emplace_back(std::move(item)); |
| 291 | } |
| 292 | asyncResp->res.jsonValue["Members@odata.count"] = members.size(); |
| 293 | }); |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 294 | } |
| 295 | |
George Liu | 70cbdf5 | 2023-03-04 12:07:25 +0800 | [diff] [blame] | 296 | inline void |
| 297 | afterGetVmData(const std::string& name, const std::string& /*service*/, |
| 298 | const std::string& resName, |
| 299 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 300 | const std::pair<sdbusplus::message::object_path, |
Michael Shen | 80f79a4 | 2023-08-24 13:41:53 +0000 | [diff] [blame] | 301 | dbus::utility::DBusInterfacesMap>& item) |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 302 | { |
| 303 | VmMode mode = parseObjectPathAndGetMode(item.first, resName); |
| 304 | if (mode == VmMode::Invalid) |
| 305 | { |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | asyncResp->res.jsonValue = vmItemTemplate(name, resName); |
| 310 | |
| 311 | // Check if dbus path is Legacy type |
| 312 | if (mode == VmMode::Legacy) |
| 313 | { |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 314 | asyncResp->res.jsonValue["Actions"]["#VirtualMedia.InsertMedia"] |
| 315 | ["target"] = boost::urls::format( |
| 316 | "/redfish/v1/Managers/{}/VirtualMedia/{}/Actions/VirtualMedia.InsertMedia", |
| 317 | name, resName); |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | vmParseInterfaceObject(item.second, asyncResp); |
| 321 | |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 322 | asyncResp->res.jsonValue["Actions"]["#VirtualMedia.EjectMedia"] |
| 323 | ["target"] = boost::urls::format( |
| 324 | "/redfish/v1/Managers/{}/VirtualMedia/{}/Actions/VirtualMedia.EjectMedia", |
| 325 | name, resName); |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 326 | } |
| 327 | |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 328 | /** |
| 329 | * @brief Fills data for specific resource |
| 330 | */ |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 331 | inline void getVmData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 332 | const std::string& service, const std::string& name, |
| 333 | const std::string& resName) |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 334 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 335 | BMCWEB_LOG_DEBUG("Get Virtual Media resource data."); |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 336 | |
Ed Tanous | ac106bf | 2023-06-07 09:24:59 -0700 | [diff] [blame] | 337 | findAndParseObject(service, resName, asyncResp, |
George Liu | 70cbdf5 | 2023-03-04 12:07:25 +0800 | [diff] [blame] | 338 | std::bind_front(afterGetVmData, name)); |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 339 | } |
| 340 | |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 341 | /** |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 342 | * @brief Transfer protocols supported for InsertMedia action. |
| 343 | * |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 344 | */ |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 345 | enum class TransferProtocol |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 346 | { |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 347 | https, |
| 348 | smb, |
| 349 | invalid |
| 350 | }; |
| 351 | |
| 352 | /** |
| 353 | * @brief Function extracts transfer protocol type from URI. |
| 354 | * |
| 355 | */ |
Ed Tanous | 67df073 | 2021-10-26 11:23:56 -0700 | [diff] [blame] | 356 | inline std::optional<TransferProtocol> |
Ed Tanous | 4a7fbef | 2024-04-06 16:03:49 -0700 | [diff] [blame] | 357 | getTransferProtocolFromUri(const boost::urls::url_view_base& imageUri) |
Ed Tanous | 67df073 | 2021-10-26 11:23:56 -0700 | [diff] [blame] | 358 | { |
Ed Tanous | 079360a | 2022-06-29 10:05:19 -0700 | [diff] [blame] | 359 | std::string_view scheme = imageUri.scheme(); |
Ed Tanous | 67df073 | 2021-10-26 11:23:56 -0700 | [diff] [blame] | 360 | if (scheme == "smb") |
| 361 | { |
| 362 | return TransferProtocol::smb; |
| 363 | } |
| 364 | if (scheme == "https") |
| 365 | { |
| 366 | return TransferProtocol::https; |
| 367 | } |
| 368 | if (!scheme.empty()) |
| 369 | { |
| 370 | return TransferProtocol::invalid; |
| 371 | } |
| 372 | |
| 373 | return {}; |
| 374 | } |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 375 | |
| 376 | /** |
| 377 | * @brief Function convert transfer protocol from string param. |
| 378 | * |
| 379 | */ |
| 380 | inline std::optional<TransferProtocol> getTransferProtocolFromParam( |
| 381 | const std::optional<std::string>& transferProtocolType) |
| 382 | { |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 383 | if (!transferProtocolType) |
Agata Olender | c6f4e01 | 2020-03-11 15:19:07 +0100 | [diff] [blame] | 384 | { |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 385 | return {}; |
Agata Olender | c6f4e01 | 2020-03-11 15:19:07 +0100 | [diff] [blame] | 386 | } |
| 387 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 388 | if (*transferProtocolType == "CIFS") |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 389 | { |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 390 | return TransferProtocol::smb; |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 391 | } |
| 392 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 393 | if (*transferProtocolType == "HTTPS") |
| 394 | { |
| 395 | return TransferProtocol::https; |
| 396 | } |
| 397 | |
| 398 | return TransferProtocol::invalid; |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * @brief Function extends URI with transfer protocol type. |
| 403 | * |
| 404 | */ |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 405 | inline std::string getUriWithTransferProtocol( |
| 406 | const std::string& imageUri, const TransferProtocol& transferProtocol) |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 407 | { |
| 408 | if (transferProtocol == TransferProtocol::smb) |
| 409 | { |
| 410 | return "smb://" + imageUri; |
| 411 | } |
| 412 | |
| 413 | if (transferProtocol == TransferProtocol::https) |
| 414 | { |
| 415 | return "https://" + imageUri; |
| 416 | } |
| 417 | |
| 418 | return imageUri; |
| 419 | } |
| 420 | |
Przemyslaw Czarnowski | 1f2a40c | 2022-06-24 13:47:08 +0200 | [diff] [blame] | 421 | struct InsertMediaActionParams |
| 422 | { |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 423 | std::optional<std::string> imageUrl; |
Przemyslaw Czarnowski | 1f2a40c | 2022-06-24 13:47:08 +0200 | [diff] [blame] | 424 | std::optional<std::string> userName; |
| 425 | std::optional<std::string> password; |
| 426 | std::optional<std::string> transferMethod; |
| 427 | std::optional<std::string> transferProtocolType; |
| 428 | std::optional<bool> writeProtected = true; |
| 429 | std::optional<bool> inserted; |
| 430 | }; |
| 431 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 432 | /** |
| 433 | * @brief Function transceives data with dbus directly. |
| 434 | * |
| 435 | * All BMC state properties will be retrieved before sending reset request. |
| 436 | */ |
| 437 | inline void doMountVmLegacy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 438 | const std::string& service, const std::string& name, |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 439 | const std::string& imageUrl, bool rw, |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 440 | std::string&& userName, std::string&& password) |
| 441 | { |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 442 | int fd = -1; |
| 443 | std::shared_ptr<CredentialsPipe> secretPipe; |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 444 | if (!userName.empty() || !password.empty()) |
| 445 | { |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 446 | // Payload must contain data + NULL delimiters |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 447 | constexpr const size_t secretLimit = 1024; |
| 448 | if (userName.size() + password.size() + 2 > secretLimit) |
Adrian Ambrożewicz | 988fb7b | 2020-01-13 18:52:46 +0100 | [diff] [blame] | 449 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 450 | BMCWEB_LOG_ERROR("Credentials too long to handle"); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 451 | messages::unrecognizedRequestBody(asyncResp->res); |
| 452 | return; |
| 453 | } |
Adrian Ambrożewicz | 988fb7b | 2020-01-13 18:52:46 +0100 | [diff] [blame] | 454 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 455 | // Open pipe |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 456 | secretPipe = std::make_shared<CredentialsPipe>( |
| 457 | crow::connections::systemBus->get_io_context()); |
Ed Tanous | 3bfa3b2 | 2024-01-31 12:18:03 -0800 | [diff] [blame] | 458 | fd = secretPipe->releaseFd(); |
Adrian Ambrożewicz | 988fb7b | 2020-01-13 18:52:46 +0100 | [diff] [blame] | 459 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 460 | // Pass secret over pipe |
| 461 | secretPipe->asyncWrite( |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 462 | std::move(userName), std::move(password), |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 463 | [asyncResp, |
| 464 | secretPipe](const boost::system::error_code& ec, std::size_t) { |
| 465 | if (ec) |
| 466 | { |
| 467 | BMCWEB_LOG_ERROR("Failed to pass secret: {}", ec); |
| 468 | messages::internalError(asyncResp->res); |
| 469 | } |
| 470 | }); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 471 | } |
Adrian Ambrożewicz | 988fb7b | 2020-01-13 18:52:46 +0100 | [diff] [blame] | 472 | |
Ed Tanous | e364803 | 2024-10-16 18:06:39 -0700 | [diff] [blame] | 473 | std::variant<sdbusplus::message::unix_fd> unixFd( |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 474 | std::in_place_type<sdbusplus::message::unix_fd>, fd); |
| 475 | |
| 476 | sdbusplus::message::object_path path( |
| 477 | "/xyz/openbmc_project/VirtualMedia/Legacy"); |
| 478 | path /= name; |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 479 | crow::connections::systemBus->async_method_call( |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 480 | [asyncResp, |
| 481 | secretPipe](const boost::system::error_code& ec, bool success) { |
| 482 | if (ec) |
| 483 | { |
| 484 | BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec); |
| 485 | messages::internalError(asyncResp->res); |
| 486 | return; |
| 487 | } |
| 488 | if (!success) |
| 489 | { |
| 490 | BMCWEB_LOG_ERROR("Service responded with error"); |
| 491 | messages::internalError(asyncResp->res); |
| 492 | } |
| 493 | }, |
Ed Tanous | 11e8f60 | 2023-08-24 14:25:18 -0700 | [diff] [blame] | 494 | service, path.str, "xyz.openbmc_project.VirtualMedia.Legacy", "Mount", |
| 495 | imageUrl, rw, unixFd); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | /** |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 499 | * @brief Function validate parameters of insert media request. |
| 500 | * |
| 501 | */ |
| 502 | inline void validateParams(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 503 | const std::string& service, |
| 504 | const std::string& resName, |
| 505 | InsertMediaActionParams& actionParams) |
| 506 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 507 | BMCWEB_LOG_DEBUG("Validation started"); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 508 | // required param imageUrl must not be empty |
| 509 | if (!actionParams.imageUrl) |
| 510 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 511 | BMCWEB_LOG_ERROR("Request action parameter Image is empty."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 512 | |
| 513 | messages::propertyValueFormatError(asyncResp->res, "<empty>", "Image"); |
| 514 | |
| 515 | return; |
| 516 | } |
| 517 | |
| 518 | // optional param inserted must be true |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 519 | if (actionParams.inserted && !*actionParams.inserted) |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 520 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 521 | BMCWEB_LOG_ERROR( |
| 522 | "Request action optional parameter Inserted must be true."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 523 | |
| 524 | messages::actionParameterNotSupported(asyncResp->res, "Inserted", |
| 525 | "InsertMedia"); |
| 526 | |
| 527 | return; |
| 528 | } |
| 529 | |
| 530 | // optional param transferMethod must be stream |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 531 | if (actionParams.transferMethod && |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 532 | (*actionParams.transferMethod != "Stream")) |
| 533 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 534 | BMCWEB_LOG_ERROR("Request action optional parameter " |
| 535 | "TransferMethod must be Stream."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 536 | |
| 537 | messages::actionParameterNotSupported(asyncResp->res, "TransferMethod", |
| 538 | "InsertMedia"); |
| 539 | |
| 540 | return; |
| 541 | } |
Ed Tanous | 6fd2955 | 2023-10-04 09:40:14 -0700 | [diff] [blame] | 542 | boost::system::result<boost::urls::url_view> url = |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 543 | boost::urls::parse_uri(*actionParams.imageUrl); |
| 544 | if (!url) |
| 545 | { |
| 546 | messages::actionParameterValueFormatError( |
| 547 | asyncResp->res, *actionParams.imageUrl, "Image", "InsertMedia"); |
| 548 | return; |
| 549 | } |
| 550 | std::optional<TransferProtocol> uriTransferProtocolType = |
| 551 | getTransferProtocolFromUri(*url); |
| 552 | |
| 553 | std::optional<TransferProtocol> paramTransferProtocolType = |
| 554 | getTransferProtocolFromParam(actionParams.transferProtocolType); |
| 555 | |
| 556 | // ImageUrl does not contain valid protocol type |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 557 | if (uriTransferProtocolType && |
| 558 | *uriTransferProtocolType == TransferProtocol::invalid) |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 559 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 560 | BMCWEB_LOG_ERROR("Request action parameter ImageUrl must " |
| 561 | "contain specified protocol type from list: " |
| 562 | "(smb, https)."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 563 | |
| 564 | messages::resourceAtUriInUnknownFormat(asyncResp->res, *url); |
| 565 | |
| 566 | return; |
| 567 | } |
| 568 | |
| 569 | // transferProtocolType should contain value from list |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 570 | if (paramTransferProtocolType && |
| 571 | *paramTransferProtocolType == TransferProtocol::invalid) |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 572 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 573 | BMCWEB_LOG_ERROR("Request action parameter TransferProtocolType " |
| 574 | "must be provided with value from list: " |
| 575 | "(CIFS, HTTPS)."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 576 | |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 577 | messages::propertyValueNotInList( |
| 578 | asyncResp->res, actionParams.transferProtocolType.value_or(""), |
| 579 | "TransferProtocolType"); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 580 | return; |
| 581 | } |
| 582 | |
| 583 | // valid transfer protocol not provided either with URI nor param |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 584 | if (!uriTransferProtocolType && !paramTransferProtocolType) |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 585 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 586 | BMCWEB_LOG_ERROR("Request action parameter ImageUrl must " |
| 587 | "contain specified protocol type or param " |
| 588 | "TransferProtocolType must be provided."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 589 | |
| 590 | messages::resourceAtUriInUnknownFormat(asyncResp->res, *url); |
| 591 | |
| 592 | return; |
| 593 | } |
| 594 | |
| 595 | // valid transfer protocol provided both with URI and param |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 596 | if (paramTransferProtocolType && uriTransferProtocolType) |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 597 | { |
| 598 | // check if protocol is the same for URI and param |
| 599 | if (*paramTransferProtocolType != *uriTransferProtocolType) |
| 600 | { |
Ed Tanous | 62598e3 | 2023-07-17 17:06:25 -0700 | [diff] [blame] | 601 | BMCWEB_LOG_ERROR("Request action parameter " |
| 602 | "TransferProtocolType must contain the " |
| 603 | "same protocol type as protocol type " |
| 604 | "provided with param imageUrl."); |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 605 | |
| 606 | messages::actionParameterValueTypeError( |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 607 | asyncResp->res, actionParams.transferProtocolType.value_or(""), |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 608 | "TransferProtocolType", "InsertMedia"); |
| 609 | |
| 610 | return; |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | // validation passed, add protocol to URI if needed |
Boleslaw Ogonczyk Makowski | 7ead48e | 2023-09-01 15:57:10 +0200 | [diff] [blame] | 615 | if (!uriTransferProtocolType && paramTransferProtocolType) |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 616 | { |
| 617 | actionParams.imageUrl = getUriWithTransferProtocol( |
| 618 | *actionParams.imageUrl, *paramTransferProtocolType); |
| 619 | } |
| 620 | |
Jayaprakash Mutyala | 452bd8d | 2023-04-18 12:28:38 +0000 | [diff] [blame] | 621 | if (!actionParams.userName) |
| 622 | { |
| 623 | actionParams.userName = ""; |
| 624 | } |
| 625 | |
| 626 | if (!actionParams.password) |
| 627 | { |
| 628 | actionParams.password = ""; |
| 629 | } |
| 630 | |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 631 | doMountVmLegacy(asyncResp, service, resName, *actionParams.imageUrl, |
Ed Tanous | e01d0c3 | 2023-06-30 13:21:32 -0700 | [diff] [blame] | 632 | !(actionParams.writeProtected.value_or(false)), |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 633 | std::move(*actionParams.userName), |
| 634 | std::move(*actionParams.password)); |
| 635 | } |
| 636 | |
| 637 | /** |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 638 | * @brief Function transceives data with dbus directly. |
| 639 | * |
| 640 | * All BMC state properties will be retrieved before sending reset request. |
| 641 | */ |
Ed Tanous | 24e740a | 2023-02-24 12:08:58 -0800 | [diff] [blame] | 642 | inline void doEjectAction(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 643 | const std::string& service, const std::string& name, |
| 644 | bool legacy) |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 645 | { |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 646 | // Legacy mount requires parameter with image |
| 647 | if (legacy) |
| 648 | { |
Adrian Ambrożewicz | d6da5be | 2020-01-13 18:31:01 +0100 | [diff] [blame] | 649 | crow::connections::systemBus->async_method_call( |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 650 | [asyncResp](const boost::system::error_code& ec) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 651 | if (ec) |
| 652 | { |
| 653 | BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 654 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 655 | messages::internalError(asyncResp->res); |
| 656 | return; |
| 657 | } |
| 658 | }, |
Adrian Ambrożewicz | d6da5be | 2020-01-13 18:31:01 +0100 | [diff] [blame] | 659 | service, "/xyz/openbmc_project/VirtualMedia/Legacy/" + name, |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 660 | "xyz.openbmc_project.VirtualMedia.Legacy", "Unmount"); |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 661 | } |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 662 | else // proxy |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 663 | { |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 664 | crow::connections::systemBus->async_method_call( |
Ed Tanous | 5e7e2dc | 2023-02-16 10:37:01 -0800 | [diff] [blame] | 665 | [asyncResp](const boost::system::error_code& ec) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 666 | if (ec) |
| 667 | { |
| 668 | BMCWEB_LOG_ERROR("Bad D-Bus request error: {}", ec); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 669 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 670 | messages::internalError(asyncResp->res); |
| 671 | return; |
| 672 | } |
| 673 | }, |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 674 | service, "/xyz/openbmc_project/VirtualMedia/Proxy/" + name, |
| 675 | "xyz.openbmc_project.VirtualMedia.Proxy", "Unmount"); |
| 676 | } |
| 677 | } |
| 678 | |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 679 | inline void handleManagersVirtualMediaActionInsertPost( |
| 680 | crow::App& app, const crow::Request& req, |
| 681 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 682 | const std::string& name, const std::string& resName) |
| 683 | { |
| 684 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 685 | { |
| 686 | return; |
| 687 | } |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 688 | |
| 689 | constexpr std::string_view action = "VirtualMedia.InsertMedia"; |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 690 | if (name != "bmc") |
| 691 | { |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 692 | messages::resourceNotFound(asyncResp->res, action, resName); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 693 | |
| 694 | return; |
| 695 | } |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 696 | InsertMediaActionParams actionParams; |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 697 | |
Przemyslaw Czarnowski | 120fa86 | 2022-06-24 15:10:48 +0200 | [diff] [blame] | 698 | // Read obligatory parameters (url of image) |
Myung Bae | afc474a | 2024-10-09 00:53:29 -0700 | [diff] [blame] | 699 | if (!json_util::readJsonAction( // |
| 700 | req, asyncResp->res, // |
| 701 | "Image", actionParams.imageUrl, // |
| 702 | "Inserted", actionParams.inserted, // |
| 703 | "Password", actionParams.password, // |
| 704 | "TransferMethod", actionParams.transferMethod, // |
| 705 | "TransferProtocolType", actionParams.transferProtocolType, // |
| 706 | "UserName", actionParams.userName, // |
| 707 | "WriteProtected", actionParams.writeProtected // |
| 708 | )) |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 709 | { |
| 710 | return; |
| 711 | } |
| 712 | |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 713 | dbus::utility::getDbusObject( |
| 714 | "/xyz/openbmc_project/VirtualMedia", {}, |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 715 | [asyncResp, action, actionParams, |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 716 | resName](const boost::system::error_code& ec, |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 717 | const dbus::utility::MapperGetObject& getObjectType) mutable { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 718 | if (ec) |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 719 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 720 | BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec); |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 721 | messages::resourceNotFound(asyncResp->res, action, resName); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 722 | |
| 723 | return; |
| 724 | } |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 725 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 726 | std::string service = getObjectType.begin()->first; |
| 727 | BMCWEB_LOG_DEBUG("GetObjectType: {}", service); |
| 728 | |
| 729 | sdbusplus::message::object_path path( |
| 730 | "/xyz/openbmc_project/VirtualMedia"); |
| 731 | dbus::utility::getManagedObjects( |
| 732 | service, path, |
| 733 | [service, resName, action, actionParams, asyncResp]( |
| 734 | const boost::system::error_code& ec2, |
| 735 | const dbus::utility::ManagedObjectType& subtree) mutable { |
| 736 | if (ec2) |
| 737 | { |
| 738 | // Not possible in proxy mode |
| 739 | BMCWEB_LOG_DEBUG("InsertMedia not " |
| 740 | "allowed in proxy mode"); |
| 741 | messages::resourceNotFound(asyncResp->res, action, |
| 742 | resName); |
| 743 | |
| 744 | return; |
| 745 | } |
| 746 | for (const auto& object : subtree) |
| 747 | { |
| 748 | VmMode mode = |
| 749 | parseObjectPathAndGetMode(object.first, resName); |
| 750 | if (mode == VmMode::Legacy) |
| 751 | { |
| 752 | validateParams(asyncResp, service, resName, |
| 753 | actionParams); |
| 754 | |
| 755 | return; |
| 756 | } |
| 757 | } |
| 758 | BMCWEB_LOG_DEBUG("Parent item not found"); |
| 759 | messages::resourceNotFound(asyncResp->res, "VirtualMedia", |
| 760 | resName); |
| 761 | }); |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 762 | }); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 763 | } |
| 764 | |
| 765 | inline void handleManagersVirtualMediaActionEject( |
| 766 | crow::App& app, const crow::Request& req, |
| 767 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 768 | const std::string& managerName, const std::string& resName) |
| 769 | { |
| 770 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 771 | { |
| 772 | return; |
| 773 | } |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 774 | |
| 775 | constexpr std::string_view action = "VirtualMedia.EjectMedia"; |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 776 | if (managerName != "bmc") |
| 777 | { |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 778 | messages::resourceNotFound(asyncResp->res, action, resName); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 779 | |
| 780 | return; |
| 781 | } |
| 782 | |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 783 | dbus::utility::getDbusObject( |
| 784 | "/xyz/openbmc_project/VirtualMedia", {}, |
Przemyslaw Czarnowski | 79fdf63 | 2022-06-28 18:11:59 +0200 | [diff] [blame] | 785 | [asyncResp, action, |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 786 | resName](const boost::system::error_code& ec2, |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 787 | const dbus::utility::MapperGetObject& getObjectType) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 788 | if (ec2) |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 789 | { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 790 | BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", |
| 791 | ec2); |
| 792 | messages::internalError(asyncResp->res); |
| 793 | |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 794 | return; |
| 795 | } |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 796 | std::string service = getObjectType.begin()->first; |
| 797 | BMCWEB_LOG_DEBUG("GetObjectType: {}", service); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 798 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 799 | sdbusplus::message::object_path path( |
| 800 | "/xyz/openbmc_project/VirtualMedia"); |
| 801 | dbus::utility::getManagedObjects( |
| 802 | service, path, |
| 803 | [resName, service, action, |
| 804 | asyncResp](const boost::system::error_code& ec, |
| 805 | const dbus::utility::ManagedObjectType& subtree) { |
| 806 | if (ec) |
| 807 | { |
| 808 | BMCWEB_LOG_ERROR("ObjectMapper : No Service found"); |
| 809 | messages::resourceNotFound(asyncResp->res, action, |
| 810 | resName); |
| 811 | return; |
| 812 | } |
| 813 | |
| 814 | for (const auto& object : subtree) |
| 815 | { |
| 816 | VmMode mode = |
| 817 | parseObjectPathAndGetMode(object.first, resName); |
| 818 | if (mode != VmMode::Invalid) |
| 819 | { |
| 820 | doEjectAction(asyncResp, service, resName, |
| 821 | mode == VmMode::Legacy); |
| 822 | return; |
| 823 | } |
| 824 | } |
| 825 | BMCWEB_LOG_DEBUG("Parent item not found"); |
| 826 | messages::resourceNotFound(asyncResp->res, "VirtualMedia", |
| 827 | resName); |
| 828 | }); |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 829 | }); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | inline void handleManagersVirtualMediaCollectionGet( |
| 833 | crow::App& app, const crow::Request& req, |
| 834 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 835 | const std::string& name) |
| 836 | { |
| 837 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 838 | { |
| 839 | return; |
| 840 | } |
| 841 | if (name != "bmc") |
| 842 | { |
| 843 | messages::resourceNotFound(asyncResp->res, "VirtualMedia", name); |
| 844 | |
| 845 | return; |
| 846 | } |
| 847 | |
| 848 | asyncResp->res.jsonValue["@odata.type"] = |
| 849 | "#VirtualMediaCollection.VirtualMediaCollection"; |
| 850 | asyncResp->res.jsonValue["Name"] = "Virtual Media Services"; |
Ed Tanous | ef4c65b | 2023-04-24 15:28:50 -0700 | [diff] [blame] | 851 | asyncResp->res.jsonValue["@odata.id"] = |
| 852 | boost::urls::format("/redfish/v1/Managers/{}/VirtualMedia", name); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 853 | |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 854 | dbus::utility::getDbusObject( |
| 855 | "/xyz/openbmc_project/VirtualMedia", {}, |
| 856 | [asyncResp, name](const boost::system::error_code& ec, |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 857 | const dbus::utility::MapperGetObject& getObjectType) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 858 | if (ec) |
| 859 | { |
| 860 | BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec); |
| 861 | messages::internalError(asyncResp->res); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 862 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 863 | return; |
| 864 | } |
| 865 | std::string service = getObjectType.begin()->first; |
| 866 | BMCWEB_LOG_DEBUG("GetObjectType: {}", service); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 867 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 868 | getVmResourceList(asyncResp, service, name); |
| 869 | }); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | inline void |
| 873 | handleVirtualMediaGet(crow::App& app, const crow::Request& req, |
| 874 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 875 | const std::string& name, const std::string& resName) |
| 876 | { |
| 877 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
| 878 | { |
| 879 | return; |
| 880 | } |
| 881 | if (name != "bmc") |
| 882 | { |
| 883 | messages::resourceNotFound(asyncResp->res, "VirtualMedia", resName); |
| 884 | |
| 885 | return; |
| 886 | } |
| 887 | |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 888 | dbus::utility::getDbusObject( |
| 889 | "/xyz/openbmc_project/VirtualMedia", {}, |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 890 | [asyncResp, name, |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 891 | resName](const boost::system::error_code& ec, |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 892 | const dbus::utility::MapperGetObject& getObjectType) { |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 893 | if (ec) |
| 894 | { |
| 895 | BMCWEB_LOG_ERROR("ObjectMapper::GetObject call failed: {}", ec); |
| 896 | messages::internalError(asyncResp->res); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 897 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 898 | return; |
| 899 | } |
| 900 | std::string service = getObjectType.begin()->first; |
| 901 | BMCWEB_LOG_DEBUG("GetObjectType: {}", service); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 902 | |
Patrick Williams | bd79bce | 2024-08-16 15:22:20 -0400 | [diff] [blame] | 903 | getVmData(asyncResp, service, name, resName); |
| 904 | }); |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 905 | } |
| 906 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 907 | inline void requestNBDVirtualMediaRoutes(App& app) |
| 908 | { |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 909 | BMCWEB_ROUTE( |
| 910 | app, |
| 911 | "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/VirtualMedia.InsertMedia") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 912 | .privileges(redfish::privileges::postVirtualMedia) |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 913 | .methods(boost::beast::http::verb::post)(std::bind_front( |
| 914 | handleManagersVirtualMediaActionInsertPost, std::ref(app))); |
Przemyslaw Czarnowski | e13c276 | 2019-09-02 17:32:43 +0200 | [diff] [blame] | 915 | |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 916 | BMCWEB_ROUTE( |
| 917 | app, |
| 918 | "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/VirtualMedia.EjectMedia") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 919 | .privileges(redfish::privileges::postVirtualMedia) |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 920 | .methods(boost::beast::http::verb::post)(std::bind_front( |
| 921 | handleManagersVirtualMediaActionEject, std::ref(app))); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 922 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 923 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/VirtualMedia/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 924 | .privileges(redfish::privileges::getVirtualMediaCollection) |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 925 | .methods(boost::beast::http::verb::get)(std::bind_front( |
| 926 | handleManagersVirtualMediaCollectionGet, std::ref(app))); |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 927 | |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 928 | BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/VirtualMedia/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 929 | .privileges(redfish::privileges::getVirtualMedia) |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 930 | .methods(boost::beast::http::verb::get)( |
Ed Tanous | 96825be | 2022-06-03 09:43:38 -0700 | [diff] [blame] | 931 | std::bind_front(handleVirtualMediaGet, std::ref(app))); |
Ed Tanous | 22db172 | 2021-06-09 10:53:51 -0700 | [diff] [blame] | 932 | } |
Przemyslaw Czarnowski | 107077d | 2019-07-11 10:16:43 +0200 | [diff] [blame] | 933 | |
| 934 | } // namespace redfish |