Jennifer Lee | 729dae7 | 2018-04-24 15:59:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | // Copyright (c) 2018 Intel Corporation |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
Tejas Patil | d61e519 | 2021-06-04 15:49:35 +0530 | [diff] [blame] | 18 | #include "bmcweb_config.h" |
| 19 | |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 20 | #include "app.hpp" |
| 21 | #include "dbus_utility.hpp" |
| 22 | #include "query.hpp" |
| 23 | #include "registries/privilege_registry.hpp" |
Ed Tanous | a8e884f | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 24 | #include "task.hpp" |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 25 | #include "utils/dbus_utils.hpp" |
| 26 | #include "utils/sw_utils.hpp" |
| 27 | |
Ed Tanous | d093c99 | 2023-01-19 19:01:49 -0800 | [diff] [blame] | 28 | #include <boost/algorithm/string/case_conv.hpp> |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 29 | #include <boost/system/error_code.hpp> |
Jonathan Doman | 1e1e598 | 2021-06-11 09:36:17 -0700 | [diff] [blame] | 30 | #include <sdbusplus/asio/property.hpp> |
Ed Tanous | 3ccb3ad | 2023-01-13 17:40:03 -0800 | [diff] [blame] | 31 | #include <sdbusplus/bus/match.hpp> |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 32 | #include <sdbusplus/unpack_properties.hpp> |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 33 | |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 34 | #include <array> |
| 35 | #include <string_view> |
| 36 | |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 37 | namespace redfish |
| 38 | { |
Ed Tanous | 27826b5 | 2018-10-29 11:40:58 -0700 | [diff] [blame] | 39 | |
Andrew Geissler | 0e7de46 | 2019-03-04 19:11:54 -0600 | [diff] [blame] | 40 | // Match signals added on software path |
Ed Tanous | cf9e417 | 2022-12-21 09:30:16 -0800 | [diff] [blame] | 41 | // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 42 | static std::unique_ptr<sdbusplus::bus::match_t> fwUpdateMatcher; |
Ed Tanous | cf9e417 | 2022-12-21 09:30:16 -0800 | [diff] [blame] | 43 | // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 44 | static std::unique_ptr<sdbusplus::bus::match_t> fwUpdateErrorMatcher; |
Andrew Geissler | 0e7de46 | 2019-03-04 19:11:54 -0600 | [diff] [blame] | 45 | // Only allow one update at a time |
Ed Tanous | cf9e417 | 2022-12-21 09:30:16 -0800 | [diff] [blame] | 46 | // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
Andrew Geissler | 0e7de46 | 2019-03-04 19:11:54 -0600 | [diff] [blame] | 47 | static bool fwUpdateInProgress = false; |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 48 | // Timer for software available |
Ed Tanous | cf9e417 | 2022-12-21 09:30:16 -0800 | [diff] [blame] | 49 | // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) |
Ed Tanous | 271584a | 2019-07-09 16:24:22 -0700 | [diff] [blame] | 50 | static std::unique_ptr<boost::asio::steady_timer> fwAvailableTimer; |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 51 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 52 | inline static void cleanUp() |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 53 | { |
| 54 | fwUpdateInProgress = false; |
| 55 | fwUpdateMatcher = nullptr; |
James Feist | 4cde5d9 | 2020-06-11 10:39:55 -0700 | [diff] [blame] | 56 | fwUpdateErrorMatcher = nullptr; |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 57 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 58 | inline static void activateImage(const std::string& objPath, |
| 59 | const std::string& service) |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 60 | { |
| 61 | BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service; |
| 62 | crow::connections::systemBus->async_method_call( |
Ed Tanous | 81ce609 | 2020-12-17 16:54:55 +0000 | [diff] [blame] | 63 | [](const boost::system::error_code errorCode) { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 64 | if (errorCode) |
| 65 | { |
| 66 | BMCWEB_LOG_DEBUG << "error_code = " << errorCode; |
| 67 | BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); |
| 68 | } |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 69 | }, |
| 70 | service, objPath, "org.freedesktop.DBus.Properties", "Set", |
| 71 | "xyz.openbmc_project.Software.Activation", "RequestedActivation", |
Ed Tanous | 168e20c | 2021-12-13 14:39:53 -0800 | [diff] [blame] | 72 | dbus::utility::DbusVariantType( |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 73 | "xyz.openbmc_project.Software.Activation.RequestedActivations.Active")); |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 74 | } |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 75 | |
| 76 | // Note that asyncResp can be either a valid pointer or nullptr. If nullptr |
| 77 | // then no asyncResp updates will occur |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 78 | static void |
| 79 | softwareInterfaceAdded(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 80 | sdbusplus::message_t& m, task::Payload&& payload) |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 81 | { |
Ed Tanous | b9d36b4 | 2022-02-26 21:42:46 -0800 | [diff] [blame] | 82 | dbus::utility::DBusInteracesMap interfacesProperties; |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 83 | |
| 84 | sdbusplus::message::object_path objPath; |
| 85 | |
| 86 | m.read(objPath, interfacesProperties); |
| 87 | |
| 88 | BMCWEB_LOG_DEBUG << "obj path = " << objPath.str; |
Ed Tanous | e3eb3d6 | 2022-12-21 11:56:07 -0800 | [diff] [blame] | 89 | for (const auto& interface : interfacesProperties) |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 90 | { |
| 91 | BMCWEB_LOG_DEBUG << "interface = " << interface.first; |
| 92 | |
| 93 | if (interface.first == "xyz.openbmc_project.Software.Activation") |
| 94 | { |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 95 | // Retrieve service and activate |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 96 | constexpr std::array<std::string_view, 1> interfaces = { |
| 97 | "xyz.openbmc_project.Software.Activation"}; |
| 98 | dbus::utility::getDbusObject( |
| 99 | objPath.str, interfaces, |
Ed Tanous | a3e6589 | 2021-09-16 14:13:20 -0700 | [diff] [blame] | 100 | [objPath, asyncResp, payload(std::move(payload))]( |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 101 | const boost::system::error_code& errorCode, |
Ed Tanous | a3e6589 | 2021-09-16 14:13:20 -0700 | [diff] [blame] | 102 | const std::vector< |
| 103 | std::pair<std::string, std::vector<std::string>>>& |
| 104 | objInfo) mutable { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 105 | if (errorCode) |
| 106 | { |
| 107 | BMCWEB_LOG_DEBUG << "error_code = " << errorCode; |
| 108 | BMCWEB_LOG_DEBUG << "error msg = " << errorCode.message(); |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 109 | if (asyncResp) |
| 110 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 111 | messages::internalError(asyncResp->res); |
| 112 | } |
| 113 | cleanUp(); |
| 114 | return; |
| 115 | } |
| 116 | // Ensure we only got one service back |
| 117 | if (objInfo.size() != 1) |
| 118 | { |
| 119 | BMCWEB_LOG_ERROR << "Invalid Object Size " |
| 120 | << objInfo.size(); |
| 121 | if (asyncResp) |
| 122 | { |
| 123 | messages::internalError(asyncResp->res); |
| 124 | } |
| 125 | cleanUp(); |
| 126 | return; |
| 127 | } |
| 128 | // cancel timer only when |
| 129 | // xyz.openbmc_project.Software.Activation interface |
| 130 | // is added |
| 131 | fwAvailableTimer = nullptr; |
| 132 | |
| 133 | activateImage(objPath.str, objInfo[0].first); |
| 134 | if (asyncResp) |
| 135 | { |
| 136 | std::shared_ptr<task::TaskData> task = |
| 137 | task::TaskData::createTask( |
| 138 | [](boost::system::error_code ec, |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 139 | sdbusplus::message_t& msg, |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 140 | const std::shared_ptr<task::TaskData>& |
| 141 | taskData) { |
| 142 | if (ec) |
| 143 | { |
| 144 | return task::completed; |
| 145 | } |
| 146 | |
| 147 | std::string iface; |
| 148 | dbus::utility::DBusPropertiesMap values; |
| 149 | |
| 150 | std::string index = std::to_string(taskData->index); |
| 151 | msg.read(iface, values); |
| 152 | |
| 153 | if (iface == "xyz.openbmc_project.Software.Activation") |
| 154 | { |
Gayathri Leburu | 0fb5b50 | 2022-11-17 04:51:55 +0000 | [diff] [blame] | 155 | const std::string* state = nullptr; |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 156 | for (const auto& property : values) |
| 157 | { |
| 158 | if (property.first == "Activation") |
| 159 | { |
Gayathri Leburu | 0fb5b50 | 2022-11-17 04:51:55 +0000 | [diff] [blame] | 160 | state = std::get_if<std::string>( |
| 161 | &property.second); |
| 162 | if (state == nullptr) |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 163 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 164 | taskData->messages.emplace_back( |
| 165 | messages::internalError()); |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 166 | return task::completed; |
| 167 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 168 | } |
| 169 | } |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 170 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 171 | if (state == nullptr) |
| 172 | { |
| 173 | return !task::completed; |
| 174 | } |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 175 | |
Ed Tanous | 11ba397 | 2022-07-11 09:50:41 -0700 | [diff] [blame] | 176 | if (state->ends_with("Invalid") || |
| 177 | state->ends_with("Failed")) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 178 | { |
| 179 | taskData->state = "Exception"; |
| 180 | taskData->status = "Warning"; |
| 181 | taskData->messages.emplace_back( |
| 182 | messages::taskAborted(index)); |
| 183 | return task::completed; |
| 184 | } |
James Feist | e5d5006 | 2020-05-11 17:29:00 -0700 | [diff] [blame] | 185 | |
Ed Tanous | 11ba397 | 2022-07-11 09:50:41 -0700 | [diff] [blame] | 186 | if (state->ends_with("Staged")) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 187 | { |
| 188 | taskData->state = "Stopping"; |
| 189 | taskData->messages.emplace_back( |
| 190 | messages::taskPaused(index)); |
| 191 | |
| 192 | // its staged, set a long timer to |
| 193 | // allow them time to complete the |
| 194 | // update (probably cycle the |
| 195 | // system) if this expires then |
| 196 | // task will be cancelled |
| 197 | taskData->extendTimer(std::chrono::hours(5)); |
| 198 | return !task::completed; |
| 199 | } |
| 200 | |
Ed Tanous | 11ba397 | 2022-07-11 09:50:41 -0700 | [diff] [blame] | 201 | if (state->ends_with("Active")) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 202 | { |
| 203 | taskData->messages.emplace_back( |
| 204 | messages::taskCompletedOK(index)); |
| 205 | taskData->state = "Completed"; |
| 206 | return task::completed; |
| 207 | } |
| 208 | } |
| 209 | else if ( |
| 210 | iface == |
| 211 | "xyz.openbmc_project.Software.ActivationProgress") |
| 212 | { |
| 213 | |
| 214 | const uint8_t* progress = nullptr; |
| 215 | for (const auto& property : values) |
| 216 | { |
| 217 | if (property.first == "Progress") |
| 218 | { |
Gayathri Leburu | 0fb5b50 | 2022-11-17 04:51:55 +0000 | [diff] [blame] | 219 | progress = |
| 220 | std::get_if<uint8_t>(&property.second); |
| 221 | if (progress == nullptr) |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 222 | { |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 223 | taskData->messages.emplace_back( |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 224 | messages::internalError()); |
| 225 | return task::completed; |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 226 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 227 | } |
| 228 | } |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 229 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 230 | if (progress == nullptr) |
| 231 | { |
| 232 | return !task::completed; |
| 233 | } |
Gayathri Leburu | 0fb5b50 | 2022-11-17 04:51:55 +0000 | [diff] [blame] | 234 | taskData->percentComplete = *progress; |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 235 | taskData->messages.emplace_back( |
Gayathri Leburu | 0fb5b50 | 2022-11-17 04:51:55 +0000 | [diff] [blame] | 236 | messages::taskProgressChanged(index, |
| 237 | *progress)); |
James Feist | 32898ce | 2020-03-10 16:16:52 -0700 | [diff] [blame] | 238 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 239 | // if we're getting status updates it's |
| 240 | // still alive, update timer |
| 241 | taskData->extendTimer(std::chrono::minutes(5)); |
| 242 | } |
| 243 | |
| 244 | // as firmware update often results in a |
| 245 | // reboot, the task may never "complete" |
| 246 | // unless it is an error |
| 247 | |
| 248 | return !task::completed; |
| 249 | }, |
| 250 | "type='signal',interface='org.freedesktop.DBus.Properties'," |
| 251 | "member='PropertiesChanged',path='" + |
| 252 | objPath.str + "'"); |
| 253 | task->startTimer(std::chrono::minutes(5)); |
| 254 | task->populateResp(asyncResp->res); |
| 255 | task->payload.emplace(std::move(payload)); |
| 256 | } |
| 257 | fwUpdateInProgress = false; |
George Liu | 2b73119 | 2023-01-11 16:27:13 +0800 | [diff] [blame] | 258 | }); |
Patrick Williams | 62bafc0 | 2022-09-08 17:35:35 -0500 | [diff] [blame] | 259 | |
| 260 | break; |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 261 | } |
| 262 | } |
| 263 | } |
| 264 | |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 265 | // Note that asyncResp can be either a valid pointer or nullptr. If nullptr |
| 266 | // then no asyncResp updates will occur |
Ed Tanous | b5a7693 | 2020-09-29 16:16:58 -0700 | [diff] [blame] | 267 | static void monitorForSoftwareAvailable( |
zhanghch05 | 8d1b46d | 2021-04-01 11:18:24 +0800 | [diff] [blame] | 268 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 269 | const crow::Request& req, const std::string& url, |
Gunnar Mills | 5d13894 | 2022-09-07 10:26:21 -0500 | [diff] [blame] | 270 | int timeoutTimeSeconds = 25) |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 271 | { |
| 272 | // Only allow one FW update at a time |
Ed Tanous | e05aec5 | 2022-01-25 10:28:56 -0800 | [diff] [blame] | 273 | if (fwUpdateInProgress) |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 274 | { |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 275 | if (asyncResp) |
| 276 | { |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 277 | messages::serviceTemporarilyUnavailable(asyncResp->res, "30"); |
| 278 | } |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 279 | return; |
| 280 | } |
| 281 | |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 282 | fwAvailableTimer = |
Ed Tanous | 271584a | 2019-07-09 16:24:22 -0700 | [diff] [blame] | 283 | std::make_unique<boost::asio::steady_timer>(*req.ioService); |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 284 | |
Ed Tanous | 271584a | 2019-07-09 16:24:22 -0700 | [diff] [blame] | 285 | fwAvailableTimer->expires_after(std::chrono::seconds(timeoutTimeSeconds)); |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 286 | |
| 287 | fwAvailableTimer->async_wait( |
Gunnar Mills | 1214b7e | 2020-06-04 10:11:30 -0500 | [diff] [blame] | 288 | [asyncResp](const boost::system::error_code& ec) { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 289 | cleanUp(); |
| 290 | if (ec == boost::asio::error::operation_aborted) |
| 291 | { |
| 292 | // expected, we were canceled before the timer completed. |
| 293 | return; |
| 294 | } |
| 295 | BMCWEB_LOG_ERROR |
| 296 | << "Timed out waiting for firmware object being created"; |
| 297 | BMCWEB_LOG_ERROR << "FW image may has already been uploaded to server"; |
| 298 | if (ec) |
| 299 | { |
| 300 | BMCWEB_LOG_ERROR << "Async_wait failed" << ec; |
| 301 | return; |
| 302 | } |
| 303 | if (asyncResp) |
| 304 | { |
| 305 | redfish::messages::internalError(asyncResp->res); |
| 306 | } |
| 307 | }); |
Ed Tanous | a3e6589 | 2021-09-16 14:13:20 -0700 | [diff] [blame] | 308 | task::Payload payload(req); |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 309 | auto callback = [asyncResp, payload](sdbusplus::message_t& m) mutable { |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 310 | BMCWEB_LOG_DEBUG << "Match fired"; |
Ed Tanous | a3e6589 | 2021-09-16 14:13:20 -0700 | [diff] [blame] | 311 | softwareInterfaceAdded(asyncResp, m, std::move(payload)); |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 312 | }; |
| 313 | |
| 314 | fwUpdateInProgress = true; |
| 315 | |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 316 | fwUpdateMatcher = std::make_unique<sdbusplus::bus::match_t>( |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 317 | *crow::connections::systemBus, |
| 318 | "interface='org.freedesktop.DBus.ObjectManager',type='signal'," |
| 319 | "member='InterfacesAdded',path='/xyz/openbmc_project/software'", |
| 320 | callback); |
James Feist | 4cde5d9 | 2020-06-11 10:39:55 -0700 | [diff] [blame] | 321 | |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 322 | fwUpdateErrorMatcher = std::make_unique<sdbusplus::bus::match_t>( |
James Feist | 4cde5d9 | 2020-06-11 10:39:55 -0700 | [diff] [blame] | 323 | *crow::connections::systemBus, |
Brian Ma | e1cc482 | 2021-12-01 17:05:54 +0800 | [diff] [blame] | 324 | "interface='org.freedesktop.DBus.ObjectManager',type='signal'," |
| 325 | "member='InterfacesAdded'," |
| 326 | "path='/xyz/openbmc_project/logging'", |
Patrick Williams | 59d494e | 2022-07-22 19:26:55 -0500 | [diff] [blame] | 327 | [asyncResp, url](sdbusplus::message_t& m) { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 328 | std::vector<std::pair<std::string, dbus::utility::DBusPropertiesMap>> |
| 329 | interfacesProperties; |
| 330 | sdbusplus::message::object_path objPath; |
| 331 | m.read(objPath, interfacesProperties); |
| 332 | BMCWEB_LOG_DEBUG << "obj path = " << objPath.str; |
| 333 | for (const std::pair<std::string, dbus::utility::DBusPropertiesMap>& |
| 334 | interface : interfacesProperties) |
| 335 | { |
| 336 | if (interface.first == "xyz.openbmc_project.Logging.Entry") |
James Feist | 4cde5d9 | 2020-06-11 10:39:55 -0700 | [diff] [blame] | 337 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 338 | for (const std::pair<std::string, |
| 339 | dbus::utility::DbusVariantType>& value : |
| 340 | interface.second) |
Brian Ma | e1cc482 | 2021-12-01 17:05:54 +0800 | [diff] [blame] | 341 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 342 | if (value.first != "Message") |
Brian Ma | e1cc482 | 2021-12-01 17:05:54 +0800 | [diff] [blame] | 343 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 344 | continue; |
| 345 | } |
| 346 | const std::string* type = |
| 347 | std::get_if<std::string>(&value.second); |
| 348 | if (type == nullptr) |
| 349 | { |
| 350 | // if this was our message, timeout will cover it |
| 351 | return; |
| 352 | } |
| 353 | fwAvailableTimer = nullptr; |
| 354 | if (*type == |
| 355 | "xyz.openbmc_project.Software.Image.Error.UnTarFailure") |
| 356 | { |
| 357 | redfish::messages::invalidUpload(asyncResp->res, url, |
| 358 | "Invalid archive"); |
| 359 | } |
| 360 | else if (*type == |
| 361 | "xyz.openbmc_project.Software.Image.Error." |
| 362 | "ManifestFileFailure") |
| 363 | { |
| 364 | redfish::messages::invalidUpload(asyncResp->res, url, |
| 365 | "Invalid manifest"); |
| 366 | } |
| 367 | else if ( |
| 368 | *type == |
| 369 | "xyz.openbmc_project.Software.Image.Error.ImageFailure") |
| 370 | { |
| 371 | redfish::messages::invalidUpload( |
| 372 | asyncResp->res, url, "Invalid image format"); |
| 373 | } |
| 374 | else if ( |
| 375 | *type == |
| 376 | "xyz.openbmc_project.Software.Version.Error.AlreadyExists") |
| 377 | { |
| 378 | redfish::messages::invalidUpload( |
| 379 | asyncResp->res, url, |
| 380 | "Image version already exists"); |
Gunnar Mills | 88b3dd1 | 2020-11-20 14:26:04 -0600 | [diff] [blame] | 381 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 382 | redfish::messages::resourceAlreadyExists( |
Jiaqing Zhao | d8a5d5d | 2022-08-05 16:21:51 +0800 | [diff] [blame] | 383 | asyncResp->res, "UpdateService", "Version", |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 384 | "uploaded version"); |
| 385 | } |
| 386 | else if ( |
| 387 | *type == |
| 388 | "xyz.openbmc_project.Software.Image.Error.BusyFailure") |
| 389 | { |
| 390 | redfish::messages::resourceExhaustion(asyncResp->res, |
| 391 | url); |
| 392 | } |
| 393 | else |
| 394 | { |
| 395 | redfish::messages::internalError(asyncResp->res); |
Brian Ma | e1cc482 | 2021-12-01 17:05:54 +0800 | [diff] [blame] | 396 | } |
| 397 | } |
Gunnar Mills | 88b3dd1 | 2020-11-20 14:26:04 -0600 | [diff] [blame] | 398 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 399 | } |
James Feist | 4cde5d9 | 2020-06-11 10:39:55 -0700 | [diff] [blame] | 400 | }); |
Andrew Geissler | 86adcd6 | 2019-04-18 10:58:05 -0500 | [diff] [blame] | 401 | } |
Jennifer Lee | 729dae7 | 2018-04-24 15:59:34 -0700 | [diff] [blame] | 402 | |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 403 | /** |
| 404 | * UpdateServiceActionsSimpleUpdate class supports handle POST method for |
| 405 | * SimpleUpdate action. |
| 406 | */ |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 407 | inline void requestRoutesUpdateServiceActionsSimpleUpdate(App& app) |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 408 | { |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 409 | BMCWEB_ROUTE( |
| 410 | app, "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 411 | .privileges(redfish::privileges::postUpdateService) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 412 | .methods(boost::beast::http::verb::post)( |
| 413 | [&app](const crow::Request& req, |
| 414 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
Carson Labrado | 3ba0007 | 2022-06-06 19:40:56 +0000 | [diff] [blame] | 415 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 416 | { |
| 417 | return; |
| 418 | } |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 419 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 420 | std::optional<std::string> transferProtocol; |
| 421 | std::string imageURI; |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 422 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 423 | BMCWEB_LOG_DEBUG << "Enter UpdateService.SimpleUpdate doPost"; |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 424 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 425 | // User can pass in both TransferProtocol and ImageURI parameters or |
| 426 | // they can pass in just the ImageURI with the transfer protocol |
| 427 | // embedded within it. |
| 428 | // 1) TransferProtocol:TFTP ImageURI:1.1.1.1/myfile.bin |
| 429 | // 2) ImageURI:tftp://1.1.1.1/myfile.bin |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 430 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 431 | if (!json_util::readJsonAction(req, asyncResp->res, "TransferProtocol", |
| 432 | transferProtocol, "ImageURI", imageURI)) |
| 433 | { |
| 434 | BMCWEB_LOG_DEBUG |
| 435 | << "Missing TransferProtocol or ImageURI parameter"; |
| 436 | return; |
| 437 | } |
| 438 | if (!transferProtocol) |
| 439 | { |
| 440 | // Must be option 2 |
| 441 | // Verify ImageURI has transfer protocol in it |
| 442 | size_t separator = imageURI.find(':'); |
Andrew Geissler | 0554c98 | 2019-04-23 14:40:12 -0500 | [diff] [blame] | 443 | if ((separator == std::string::npos) || |
| 444 | ((separator + 1) > imageURI.size())) |
| 445 | { |
| 446 | messages::actionParameterValueTypeError( |
| 447 | asyncResp->res, imageURI, "ImageURI", |
| 448 | "UpdateService.SimpleUpdate"); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 449 | BMCWEB_LOG_ERROR << "ImageURI missing transfer protocol: " |
| 450 | << imageURI; |
Jayashankar Padath | 274dfe6 | 2019-08-23 12:30:57 +0530 | [diff] [blame] | 451 | return; |
Jayashankar Padath | fa1a5a3 | 2019-05-28 23:54:37 +0530 | [diff] [blame] | 452 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 453 | transferProtocol = imageURI.substr(0, separator); |
| 454 | // Ensure protocol is upper case for a common comparison path |
| 455 | // below |
| 456 | boost::to_upper(*transferProtocol); |
| 457 | BMCWEB_LOG_DEBUG << "Encoded transfer protocol " |
| 458 | << *transferProtocol; |
Jayashankar Padath | fa1a5a3 | 2019-05-28 23:54:37 +0530 | [diff] [blame] | 459 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 460 | // Adjust imageURI to not have the protocol on it for parsing |
| 461 | // below |
| 462 | // ex. tftp://1.1.1.1/myfile.bin -> 1.1.1.1/myfile.bin |
| 463 | imageURI = imageURI.substr(separator + 3); |
| 464 | BMCWEB_LOG_DEBUG << "Adjusted imageUri " << imageURI; |
| 465 | } |
Jayashankar Padath | 274dfe6 | 2019-08-23 12:30:57 +0530 | [diff] [blame] | 466 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 467 | // OpenBMC currently only supports TFTP |
| 468 | if (*transferProtocol != "TFTP") |
| 469 | { |
| 470 | messages::actionParameterNotSupported(asyncResp->res, |
| 471 | "TransferProtocol", |
| 472 | "UpdateService.SimpleUpdate"); |
| 473 | BMCWEB_LOG_ERROR << "Request incorrect protocol parameter: " |
| 474 | << *transferProtocol; |
| 475 | return; |
| 476 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 477 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 478 | // Format should be <IP or Hostname>/<file> for imageURI |
| 479 | size_t separator = imageURI.find('/'); |
| 480 | if ((separator == std::string::npos) || |
| 481 | ((separator + 1) > imageURI.size())) |
| 482 | { |
| 483 | messages::actionParameterValueTypeError( |
| 484 | asyncResp->res, imageURI, "ImageURI", |
| 485 | "UpdateService.SimpleUpdate"); |
| 486 | BMCWEB_LOG_ERROR << "Invalid ImageURI: " << imageURI; |
| 487 | return; |
| 488 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 489 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 490 | std::string tftpServer = imageURI.substr(0, separator); |
| 491 | std::string fwFile = imageURI.substr(separator + 1); |
| 492 | BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile; |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 493 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 494 | // Setup callback for when new software detected |
| 495 | // Give TFTP 10 minutes to complete |
| 496 | monitorForSoftwareAvailable( |
| 497 | asyncResp, req, |
| 498 | "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate", |
| 499 | 600); |
| 500 | |
| 501 | // TFTP can take up to 10 minutes depending on image size and |
| 502 | // connection speed. Return to caller as soon as the TFTP operation |
| 503 | // has been started. The callback above will ensure the activate |
| 504 | // is started once the download has completed |
| 505 | redfish::messages::success(asyncResp->res); |
| 506 | |
| 507 | // Call TFTP service |
| 508 | crow::connections::systemBus->async_method_call( |
| 509 | [](const boost::system::error_code ec) { |
| 510 | if (ec) |
| 511 | { |
| 512 | // messages::internalError(asyncResp->res); |
| 513 | cleanUp(); |
| 514 | BMCWEB_LOG_DEBUG << "error_code = " << ec; |
| 515 | BMCWEB_LOG_DEBUG << "error msg = " << ec.message(); |
| 516 | } |
| 517 | else |
| 518 | { |
| 519 | BMCWEB_LOG_DEBUG << "Call to DownloaViaTFTP Success"; |
| 520 | } |
| 521 | }, |
| 522 | "xyz.openbmc_project.Software.Download", |
| 523 | "/xyz/openbmc_project/software", "xyz.openbmc_project.Common.TFTP", |
| 524 | "DownloadViaTFTP", fwFile, tftpServer); |
| 525 | |
| 526 | BMCWEB_LOG_DEBUG << "Exit UpdateService.SimpleUpdate doPost"; |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 527 | }); |
| 528 | } |
| 529 | |
Ed Tanous | c2051d1 | 2022-05-11 12:21:55 -0700 | [diff] [blame] | 530 | inline void |
| 531 | handleUpdateServicePost(App& app, const crow::Request& req, |
| 532 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) |
| 533 | { |
Carson Labrado | 3ba0007 | 2022-06-06 19:40:56 +0000 | [diff] [blame] | 534 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Ed Tanous | c2051d1 | 2022-05-11 12:21:55 -0700 | [diff] [blame] | 535 | { |
| 536 | return; |
| 537 | } |
| 538 | BMCWEB_LOG_DEBUG << "doPost..."; |
| 539 | |
| 540 | // Setup callback for when new software detected |
| 541 | monitorForSoftwareAvailable(asyncResp, req, "/redfish/v1/UpdateService"); |
| 542 | |
| 543 | std::string filepath( |
| 544 | "/tmp/images/" + |
| 545 | boost::uuids::to_string(boost::uuids::random_generator()())); |
| 546 | BMCWEB_LOG_DEBUG << "Writing file to " << filepath; |
| 547 | std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary | |
| 548 | std::ofstream::trunc); |
| 549 | out << req.body; |
| 550 | out.close(); |
| 551 | BMCWEB_LOG_DEBUG << "file upload complete!!"; |
| 552 | } |
| 553 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 554 | inline void requestRoutesUpdateService(App& app) |
| 555 | { |
| 556 | BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 557 | .privileges(redfish::privileges::getUpdateService) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 558 | .methods(boost::beast::http::verb::get)( |
| 559 | [&app](const crow::Request& req, |
| 560 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
Carson Labrado | 3ba0007 | 2022-06-06 19:40:56 +0000 | [diff] [blame] | 561 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 562 | { |
| 563 | return; |
| 564 | } |
| 565 | asyncResp->res.jsonValue["@odata.type"] = |
| 566 | "#UpdateService.v1_5_0.UpdateService"; |
| 567 | asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/UpdateService"; |
| 568 | asyncResp->res.jsonValue["Id"] = "UpdateService"; |
| 569 | asyncResp->res.jsonValue["Description"] = "Service for Software Update"; |
| 570 | asyncResp->res.jsonValue["Name"] = "Update Service"; |
Ed Tanous | 4dc23f3 | 2022-05-11 11:32:19 -0700 | [diff] [blame] | 571 | |
Ed Tanous | 32ca38a | 2022-05-11 12:36:59 -0700 | [diff] [blame] | 572 | #ifdef BMCWEB_ENABLE_REDFISH_UPDATESERVICE_OLD_POST_URL |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 573 | // See note about later on in this file about why this is neccesary |
| 574 | // This is "Wrong" per the standard, but is done temporarily to |
| 575 | // avoid noise in failing tests as people transition to having this |
| 576 | // option disabled |
| 577 | asyncResp->res.addHeader(boost::beast::http::field::allow, |
| 578 | "GET, PATCH, HEAD"); |
Ed Tanous | 32ca38a | 2022-05-11 12:36:59 -0700 | [diff] [blame] | 579 | #endif |
| 580 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 581 | asyncResp->res.jsonValue["HttpPushUri"] = |
| 582 | "/redfish/v1/UpdateService/update"; |
Ed Tanous | 4dc23f3 | 2022-05-11 11:32:19 -0700 | [diff] [blame] | 583 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 584 | // UpdateService cannot be disabled |
| 585 | asyncResp->res.jsonValue["ServiceEnabled"] = true; |
| 586 | asyncResp->res.jsonValue["FirmwareInventory"]["@odata.id"] = |
| 587 | "/redfish/v1/UpdateService/FirmwareInventory"; |
| 588 | // Get the MaxImageSizeBytes |
| 589 | asyncResp->res.jsonValue["MaxImageSizeBytes"] = |
| 590 | bmcwebHttpReqBodyLimitMb * 1024 * 1024; |
Tejas Patil | d61e519 | 2021-06-04 15:49:35 +0530 | [diff] [blame] | 591 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 592 | #ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 593 | // Update Actions object. |
| 594 | nlohmann::json& updateSvcSimpleUpdate = |
| 595 | asyncResp->res.jsonValue["Actions"]["#UpdateService.SimpleUpdate"]; |
| 596 | updateSvcSimpleUpdate["target"] = |
| 597 | "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate"; |
| 598 | updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] = { |
| 599 | "TFTP"}; |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 600 | #endif |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 601 | // Get the current ApplyTime value |
| 602 | sdbusplus::asio::getProperty<std::string>( |
| 603 | *crow::connections::systemBus, "xyz.openbmc_project.Settings", |
| 604 | "/xyz/openbmc_project/software/apply_time", |
| 605 | "xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime", |
| 606 | [asyncResp](const boost::system::error_code ec, |
| 607 | const std::string& applyTime) { |
| 608 | if (ec) |
| 609 | { |
| 610 | BMCWEB_LOG_DEBUG << "DBUS response error " << ec; |
| 611 | messages::internalError(asyncResp->res); |
| 612 | return; |
| 613 | } |
Jayashankar Padath | 274dfe6 | 2019-08-23 12:30:57 +0530 | [diff] [blame] | 614 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 615 | // Store the ApplyTime Value |
| 616 | if (applyTime == "xyz.openbmc_project.Software.ApplyTime." |
| 617 | "RequestedApplyTimes.Immediate") |
| 618 | { |
| 619 | asyncResp->res.jsonValue["HttpPushUriOptions"] |
| 620 | ["HttpPushUriApplyTime"]["ApplyTime"] = |
| 621 | "Immediate"; |
| 622 | } |
| 623 | else if (applyTime == "xyz.openbmc_project.Software.ApplyTime." |
| 624 | "RequestedApplyTimes.OnReset") |
| 625 | { |
| 626 | asyncResp->res.jsonValue["HttpPushUriOptions"] |
| 627 | ["HttpPushUriApplyTime"]["ApplyTime"] = |
| 628 | "OnReset"; |
| 629 | } |
| 630 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 631 | }); |
| 632 | BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 633 | .privileges(redfish::privileges::patchUpdateService) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 634 | .methods(boost::beast::http::verb::patch)( |
| 635 | [&app](const crow::Request& req, |
| 636 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
Carson Labrado | 3ba0007 | 2022-06-06 19:40:56 +0000 | [diff] [blame] | 637 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 638 | { |
| 639 | return; |
| 640 | } |
| 641 | BMCWEB_LOG_DEBUG << "doPatch..."; |
Jayashankar Padath | fa1a5a3 | 2019-05-28 23:54:37 +0530 | [diff] [blame] | 642 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 643 | std::optional<nlohmann::json> pushUriOptions; |
| 644 | if (!json_util::readJsonPatch(req, asyncResp->res, "HttpPushUriOptions", |
| 645 | pushUriOptions)) |
| 646 | { |
| 647 | return; |
| 648 | } |
| 649 | |
| 650 | if (pushUriOptions) |
| 651 | { |
| 652 | std::optional<nlohmann::json> pushUriApplyTime; |
| 653 | if (!json_util::readJson(*pushUriOptions, asyncResp->res, |
| 654 | "HttpPushUriApplyTime", pushUriApplyTime)) |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 655 | { |
| 656 | return; |
| 657 | } |
| 658 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 659 | if (pushUriApplyTime) |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 660 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 661 | std::optional<std::string> applyTime; |
| 662 | if (!json_util::readJson(*pushUriApplyTime, asyncResp->res, |
| 663 | "ApplyTime", applyTime)) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 664 | { |
Ed Tanous | c711bf8 | 2018-07-30 16:31:33 -0700 | [diff] [blame] | 665 | return; |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 666 | } |
Jennifer Lee | 6c4eb9d | 2018-05-22 10:58:31 -0700 | [diff] [blame] | 667 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 668 | if (applyTime) |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 669 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 670 | std::string applyTimeNewVal; |
| 671 | if (applyTime == "Immediate") |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 672 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 673 | applyTimeNewVal = |
| 674 | "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate"; |
| 675 | } |
| 676 | else if (applyTime == "OnReset") |
| 677 | { |
| 678 | applyTimeNewVal = |
| 679 | "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.OnReset"; |
| 680 | } |
| 681 | else |
| 682 | { |
| 683 | BMCWEB_LOG_INFO |
| 684 | << "ApplyTime value is not in the list of acceptable values"; |
| 685 | messages::propertyValueNotInList( |
| 686 | asyncResp->res, *applyTime, "ApplyTime"); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 687 | return; |
| 688 | } |
| 689 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 690 | // Set the requested image apply time value |
| 691 | crow::connections::systemBus->async_method_call( |
| 692 | [asyncResp](const boost::system::error_code ec) { |
| 693 | if (ec) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 694 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 695 | BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec; |
| 696 | messages::internalError(asyncResp->res); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 697 | return; |
| 698 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 699 | messages::success(asyncResp->res); |
| 700 | }, |
| 701 | "xyz.openbmc_project.Settings", |
| 702 | "/xyz/openbmc_project/software/apply_time", |
| 703 | "org.freedesktop.DBus.Properties", "Set", |
| 704 | "xyz.openbmc_project.Software.ApplyTime", |
| 705 | "RequestedApplyTime", |
| 706 | dbus::utility::DbusVariantType{applyTimeNewVal}); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 707 | } |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 708 | } |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 709 | } |
George Liu | 0fda0f1 | 2021-11-16 10:06:17 +0800 | [diff] [blame] | 710 | }); |
Ed Tanous | c2051d1 | 2022-05-11 12:21:55 -0700 | [diff] [blame] | 711 | |
Ed Tanous | 4dc23f3 | 2022-05-11 11:32:19 -0700 | [diff] [blame] | 712 | // The "old" behavior of the update service URI causes redfish-service validator |
| 713 | // failures when the Allow header is supported, given that in the spec, |
| 714 | // UpdateService does not allow POST. in openbmc, we unfortunately reused that |
| 715 | // resource as our HttpPushUri as well. A number of services, including the |
| 716 | // openbmc tests, and documentation have hardcoded that erroneous API, instead |
| 717 | // of relying on HttpPushUri as the spec requires. This option will exist |
| 718 | // temporarily to allow the old behavior until Q4 2022, at which time it will be |
| 719 | // removed. |
| 720 | #ifdef BMCWEB_ENABLE_REDFISH_UPDATESERVICE_OLD_POST_URL |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 721 | BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 722 | .privileges(redfish::privileges::postUpdateService) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 723 | .methods(boost::beast::http::verb::post)( |
| 724 | [&app](const crow::Request& req, |
| 725 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
| 726 | asyncResp->res.addHeader( |
| 727 | boost::beast::http::field::warning, |
| 728 | "299 - \"POST to /redfish/v1/UpdateService is deprecated. Use " |
| 729 | "the value contained within HttpPushUri.\""); |
| 730 | handleUpdateServicePost(app, req, asyncResp); |
Ed Tanous | 4dc23f3 | 2022-05-11 11:32:19 -0700 | [diff] [blame] | 731 | }); |
| 732 | #endif |
| 733 | BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/update/") |
| 734 | .privileges(redfish::privileges::postUpdateService) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 735 | .methods(boost::beast::http::verb::post)( |
Ed Tanous | c2051d1 | 2022-05-11 12:21:55 -0700 | [diff] [blame] | 736 | std::bind_front(handleUpdateServicePost, std::ref(app))); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | inline void requestRoutesSoftwareInventoryCollection(App& app) |
| 740 | { |
| 741 | BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/FirmwareInventory/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 742 | .privileges(redfish::privileges::getSoftwareInventoryCollection) |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 743 | .methods(boost::beast::http::verb::get)( |
| 744 | [&app](const crow::Request& req, |
| 745 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { |
Carson Labrado | 3ba0007 | 2022-06-06 19:40:56 +0000 | [diff] [blame] | 746 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 747 | { |
| 748 | return; |
| 749 | } |
| 750 | asyncResp->res.jsonValue["@odata.type"] = |
| 751 | "#SoftwareInventoryCollection.SoftwareInventoryCollection"; |
| 752 | asyncResp->res.jsonValue["@odata.id"] = |
| 753 | "/redfish/v1/UpdateService/FirmwareInventory"; |
| 754 | asyncResp->res.jsonValue["Name"] = "Software Inventory Collection"; |
| 755 | |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 756 | // Note that only firmware levels associated with a device |
| 757 | // are stored under /xyz/openbmc_project/software therefore |
| 758 | // to ensure only real FirmwareInventory items are returned, |
| 759 | // this full object path must be used here as input to |
| 760 | // mapper |
| 761 | constexpr std::array<std::string_view, 1> interfaces = { |
| 762 | "xyz.openbmc_project.Software.Version"}; |
| 763 | dbus::utility::getSubTree( |
| 764 | "/xyz/openbmc_project/software", 0, interfaces, |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 765 | [asyncResp]( |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 766 | const boost::system::error_code& ec, |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 767 | const dbus::utility::MapperGetSubTreeResponse& subtree) { |
| 768 | if (ec) |
| 769 | { |
| 770 | messages::internalError(asyncResp->res); |
| 771 | return; |
| 772 | } |
| 773 | asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); |
| 774 | asyncResp->res.jsonValue["Members@odata.count"] = 0; |
| 775 | |
| 776 | for (const auto& obj : subtree) |
| 777 | { |
| 778 | sdbusplus::message::object_path path(obj.first); |
| 779 | std::string swId = path.filename(); |
| 780 | if (swId.empty()) |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 781 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 782 | messages::internalError(asyncResp->res); |
| 783 | BMCWEB_LOG_DEBUG << "Can't parse firmware ID!!"; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 784 | return; |
| 785 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 786 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 787 | nlohmann::json& members = asyncResp->res.jsonValue["Members"]; |
| 788 | nlohmann::json::object_t member; |
| 789 | member["@odata.id"] = |
| 790 | "/redfish/v1/UpdateService/FirmwareInventory/" + swId; |
| 791 | members.push_back(std::move(member)); |
| 792 | asyncResp->res.jsonValue["Members@odata.count"] = |
| 793 | members.size(); |
| 794 | } |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 795 | }); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 796 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 797 | } |
| 798 | /* Fill related item links (i.e. bmc, bios) in for inventory */ |
| 799 | inline static void |
| 800 | getRelatedItems(const std::shared_ptr<bmcweb::AsyncResp>& aResp, |
| 801 | const std::string& purpose) |
| 802 | { |
Willy Tu | eee0013 | 2022-06-14 14:53:17 -0700 | [diff] [blame] | 803 | if (purpose == sw_util::bmcPurpose) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 804 | { |
| 805 | nlohmann::json& relatedItem = aResp->res.jsonValue["RelatedItem"]; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 806 | nlohmann::json::object_t item; |
| 807 | item["@odata.id"] = "/redfish/v1/Managers/bmc"; |
| 808 | relatedItem.push_back(std::move(item)); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 809 | aResp->res.jsonValue["RelatedItem@odata.count"] = relatedItem.size(); |
| 810 | } |
Willy Tu | eee0013 | 2022-06-14 14:53:17 -0700 | [diff] [blame] | 811 | else if (purpose == sw_util::biosPurpose) |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 812 | { |
| 813 | nlohmann::json& relatedItem = aResp->res.jsonValue["RelatedItem"]; |
Ed Tanous | 1476687 | 2022-03-15 10:44:42 -0700 | [diff] [blame] | 814 | nlohmann::json::object_t item; |
| 815 | item["@odata.id"] = "/redfish/v1/Systems/system/Bios"; |
| 816 | relatedItem.push_back(std::move(item)); |
Jiaqing Zhao | 1a6e51a | 2022-01-19 19:20:24 +0800 | [diff] [blame] | 817 | aResp->res.jsonValue["RelatedItem@odata.count"] = relatedItem.size(); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 818 | } |
| 819 | else |
| 820 | { |
| 821 | BMCWEB_LOG_ERROR << "Unknown software purpose " << purpose; |
| 822 | } |
| 823 | } |
| 824 | |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 825 | inline void |
| 826 | getSoftwareVersion(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 827 | const std::string& service, const std::string& path, |
| 828 | const std::string& swId) |
| 829 | { |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 830 | sdbusplus::asio::getAllProperties( |
| 831 | *crow::connections::systemBus, service, path, |
| 832 | "xyz.openbmc_project.Software.Version", |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 833 | [asyncResp, |
| 834 | swId](const boost::system::error_code errorCode, |
| 835 | const dbus::utility::DBusPropertiesMap& propertiesList) { |
| 836 | if (errorCode) |
| 837 | { |
| 838 | messages::internalError(asyncResp->res); |
| 839 | return; |
| 840 | } |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 841 | |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 842 | const std::string* swInvPurpose = nullptr; |
| 843 | const std::string* version = nullptr; |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 844 | |
| 845 | const bool success = sdbusplus::unpackPropertiesNoThrow( |
| 846 | dbus_utils::UnpackErrorPrinter(), propertiesList, "Purpose", |
| 847 | swInvPurpose, "Version", version); |
| 848 | |
| 849 | if (!success) |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 850 | { |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 851 | messages::internalError(asyncResp->res); |
| 852 | return; |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 853 | } |
| 854 | |
| 855 | if (swInvPurpose == nullptr) |
| 856 | { |
| 857 | BMCWEB_LOG_DEBUG << "Can't find property \"Purpose\"!"; |
| 858 | messages::internalError(asyncResp->res); |
| 859 | return; |
| 860 | } |
| 861 | |
| 862 | BMCWEB_LOG_DEBUG << "swInvPurpose = " << *swInvPurpose; |
| 863 | |
| 864 | if (version == nullptr) |
| 865 | { |
| 866 | BMCWEB_LOG_DEBUG << "Can't find property \"Version\"!"; |
| 867 | |
| 868 | messages::internalError(asyncResp->res); |
| 869 | |
| 870 | return; |
| 871 | } |
| 872 | asyncResp->res.jsonValue["Version"] = *version; |
| 873 | asyncResp->res.jsonValue["Id"] = swId; |
| 874 | |
| 875 | // swInvPurpose is of format: |
| 876 | // xyz.openbmc_project.Software.Version.VersionPurpose.ABC |
| 877 | // Translate this to "ABC image" |
| 878 | size_t endDesc = swInvPurpose->rfind('.'); |
| 879 | if (endDesc == std::string::npos) |
| 880 | { |
| 881 | messages::internalError(asyncResp->res); |
| 882 | return; |
| 883 | } |
| 884 | endDesc++; |
| 885 | if (endDesc >= swInvPurpose->size()) |
| 886 | { |
| 887 | messages::internalError(asyncResp->res); |
| 888 | return; |
| 889 | } |
| 890 | |
| 891 | std::string formatDesc = swInvPurpose->substr(endDesc); |
| 892 | asyncResp->res.jsonValue["Description"] = formatDesc + " image"; |
| 893 | getRelatedItems(asyncResp, *swInvPurpose); |
Krzysztof Grobelny | d1bde9e | 2022-09-07 10:40:51 +0200 | [diff] [blame] | 894 | }); |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 895 | } |
| 896 | |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 897 | inline void requestRoutesSoftwareInventory(App& app) |
| 898 | { |
| 899 | BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/FirmwareInventory/<str>/") |
Ed Tanous | ed39821 | 2021-06-09 17:05:54 -0700 | [diff] [blame] | 900 | .privileges(redfish::privileges::getSoftwareInventory) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 901 | .methods(boost::beast::http::verb::get)( |
| 902 | [&app](const crow::Request& req, |
| 903 | const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, |
| 904 | const std::string& param) { |
Carson Labrado | 3ba0007 | 2022-06-06 19:40:56 +0000 | [diff] [blame] | 905 | if (!redfish::setUpRedfishRoute(app, req, asyncResp)) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 906 | { |
| 907 | return; |
| 908 | } |
| 909 | std::shared_ptr<std::string> swId = |
| 910 | std::make_shared<std::string>(param); |
| 911 | |
| 912 | asyncResp->res.jsonValue["@odata.id"] = |
| 913 | "/redfish/v1/UpdateService/FirmwareInventory/" + *swId; |
| 914 | |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 915 | constexpr std::array<std::string_view, 1> interfaces = { |
| 916 | "xyz.openbmc_project.Software.Version"}; |
| 917 | dbus::utility::getSubTree( |
| 918 | "/", 0, interfaces, |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 919 | [asyncResp, |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 920 | swId](const boost::system::error_code& ec, |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 921 | const dbus::utility::MapperGetSubTreeResponse& subtree) { |
| 922 | BMCWEB_LOG_DEBUG << "doGet callback..."; |
| 923 | if (ec) |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 924 | { |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 925 | messages::internalError(asyncResp->res); |
Ed Tanous | 45ca1b8 | 2022-03-25 13:07:27 -0700 | [diff] [blame] | 926 | return; |
| 927 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 928 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 929 | // Ensure we find our input swId, otherwise return an error |
| 930 | bool found = false; |
| 931 | for (const std::pair<std::string, |
| 932 | std::vector<std::pair< |
| 933 | std::string, std::vector<std::string>>>>& |
| 934 | obj : subtree) |
| 935 | { |
Ed Tanous | 11ba397 | 2022-07-11 09:50:41 -0700 | [diff] [blame] | 936 | if (!obj.first.ends_with(*swId)) |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 937 | { |
| 938 | continue; |
| 939 | } |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 940 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 941 | if (obj.second.empty()) |
| 942 | { |
| 943 | continue; |
| 944 | } |
| 945 | |
| 946 | found = true; |
Willy Tu | eee0013 | 2022-06-14 14:53:17 -0700 | [diff] [blame] | 947 | sw_util::getSwStatus(asyncResp, swId, obj.second[0].first); |
Willy Tu | af24660 | 2022-06-14 15:51:53 -0700 | [diff] [blame] | 948 | getSoftwareVersion(asyncResp, obj.second[0].first, obj.first, |
| 949 | *swId); |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 950 | } |
| 951 | if (!found) |
| 952 | { |
| 953 | BMCWEB_LOG_ERROR << "Input swID " << *swId << " not found!"; |
| 954 | messages::resourceMissingAtURI( |
| 955 | asyncResp->res, crow::utility::urlFromPieces( |
| 956 | "redfish", "v1", "UpdateService", |
| 957 | "FirmwareInventory", *swId)); |
| 958 | return; |
| 959 | } |
| 960 | asyncResp->res.jsonValue["@odata.type"] = |
| 961 | "#SoftwareInventory.v1_1_0.SoftwareInventory"; |
| 962 | asyncResp->res.jsonValue["Name"] = "Software Inventory"; |
| 963 | asyncResp->res.jsonValue["Status"]["HealthRollup"] = "OK"; |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 964 | |
Ed Tanous | 002d39b | 2022-05-31 08:59:27 -0700 | [diff] [blame] | 965 | asyncResp->res.jsonValue["Updateable"] = false; |
Willy Tu | eee0013 | 2022-06-14 14:53:17 -0700 | [diff] [blame] | 966 | sw_util::getSwUpdatableStatus(asyncResp, swId); |
George Liu | e99073f | 2022-12-09 11:06:16 +0800 | [diff] [blame] | 967 | }); |
John Edward Broadbent | 7e860f1 | 2021-04-08 15:57:16 -0700 | [diff] [blame] | 968 | }); |
| 969 | } |
Ed Tanous | 1abe55e | 2018-09-05 08:30:59 -0700 | [diff] [blame] | 970 | |
| 971 | } // namespace redfish |