summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces')
-rwxr-xr-xmeta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch137
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch547
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch36
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch)0
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch)0
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch)0
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch81
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch51
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch)32
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch)17
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch)19
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch)26
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch44
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch46
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch35
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch25
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch85
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch23
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch132
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README10
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch400
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch22
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README4
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch)0
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch)0
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch)9
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch)63
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch)13
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch)11
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch)9
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch37
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend51
32 files changed, 889 insertions, 1076 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch
index 193461baf..a76990262 100755
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Firmware-update-configuration-changes.patch
@@ -1,4 +1,4 @@
-From 10cb7cb14974725a29b3ead4c543ca5e58234c07 Mon Sep 17 00:00:00 2001
+From d5f2e8b00bc5f8a727a1ef678941c4993c3ea7a6 Mon Sep 17 00:00:00 2001
From: Vikram Bodireddy <vikram.bodireddy@intel.com>
Date: Wed, 18 Nov 2020 17:14:41 +0530
Subject: [PATCH] Firmware update configuration changes
@@ -39,23 +39,21 @@ Tested:
- Successfully ran redfish validater with no new errors.
-Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com>
-
-%% original patch: 0001-Firmware-update-configuration-changes.patch
-
Change-Id: I44e1743fd76aa37c7b8affa49a3e05f808187037
+Signed-off-by: Vikram Bodireddy <vikram.bodireddy@intel.com>
Signed-off-by: Helen Huang <he.huang@intel.com>
+Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
---
- redfish-core/lib/update_service.hpp | 339 ++++++++++++++++--
+ redfish-core/lib/update_service.hpp | 338 ++++++++++++++++--
static/redfish/v1/$metadata/index.xml | 3 +
.../JsonSchemas/OemUpdateService/index.json | 69 ++++
.../redfish/v1/schema/OemUpdateService_v1.xml | 40 +++
- 4 files changed, 421 insertions(+), 30 deletions(-)
+ 4 files changed, 421 insertions(+), 29 deletions(-)
create mode 100644 static/redfish/v1/JsonSchemas/OemUpdateService/index.json
create mode 100644 static/redfish/v1/schema/OemUpdateService_v1.xml
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
-index 6d44171..8eda265 100644
+index ca1234f..0a9f81a 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -32,6 +32,17 @@ static std::unique_ptr<sdbusplus::bus::match::match> fwUpdateErrorMatcher;
@@ -76,7 +74,7 @@ index 6d44171..8eda265 100644
static void cleanUp()
{
-@@ -40,27 +51,119 @@ static void cleanUp()
+@@ -40,28 +51,120 @@ static void cleanUp()
fwUpdateErrorMatcher = nullptr;
}
static void activateImage(const std::string& objPath,
@@ -201,12 +199,13 @@ index 6d44171..8eda265 100644
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
// then no asyncResp updates will occur
- static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::vector<std::string> imgUriTargets,
- sdbusplus::message::message& m,
- const crow::Request& req)
+ static void
+ softwareInterfaceAdded(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const std::vector<std::string> imgUriTargets,
+ sdbusplus::message::message& m,
+ const crow::Request& req)
{
-@@ -73,22 +176,24 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp,
+@@ -74,22 +177,24 @@ static void
m.read(objPath, interfacesProperties);
@@ -235,7 +234,7 @@ index 6d44171..8eda265 100644
BMCWEB_LOG_DEBUG << "error msg = "
<< errorCode.message();
if (asyncResp)
-@@ -115,7 +220,7 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp,
+@@ -116,7 +221,7 @@ static void
// is added
fwAvailableTimer = nullptr;
@@ -244,7 +243,7 @@ index 6d44171..8eda265 100644
if (asyncResp)
{
std::shared_ptr<task::TaskData> task =
-@@ -247,8 +352,7 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp,
+@@ -248,8 +353,7 @@ static void
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str,
@@ -254,17 +253,16 @@ index 6d44171..8eda265 100644
}
}
}
-@@ -257,7 +361,8 @@ static void softwareInterfaceAdded(const std::shared_ptr<AsyncResp>& asyncResp,
- // then no asyncResp updates will occur
+@@ -259,7 +363,7 @@ static void
static void monitorForSoftwareAvailable(
- const std::shared_ptr<AsyncResp>& asyncResp, const crow::Request& req,
-- const std::string& url, int timeoutTimeSeconds = 10)
-+ const std::string& url, const std::vector<std::string>& imgUriTargets,
-+ int timeoutTimeSeconds = 10)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const crow::Request& req, const std::string& url,
+- int timeoutTimeSeconds = 10)
++ const std::vector<std::string>& imgUriTargets, int timeoutTimeSeconds = 10)
{
// Only allow one FW update at a time
if (fwUpdateInProgress != false)
-@@ -297,9 +402,10 @@ static void monitorForSoftwareAvailable(
+@@ -299,9 +403,10 @@ static void monitorForSoftwareAvailable(
}
});
@@ -277,7 +275,7 @@ index 6d44171..8eda265 100644
};
fwUpdateInProgress = true;
-@@ -475,12 +581,15 @@ class UpdateServiceActionsSimpleUpdate : public Node
+@@ -477,12 +582,15 @@ class UpdateServiceActionsSimpleUpdate : public Node
std::string fwFile = imageURI.substr(separator + 1);
BMCWEB_LOG_DEBUG << "Server: " << tftpServer + " File: " << fwFile;
@@ -294,7 +292,7 @@ index 6d44171..8eda265 100644
// TFTP can take up to 10 minutes depending on image size and
// connection speed. Return to caller as soon as the TFTP operation
-@@ -514,7 +623,8 @@ class UpdateServiceActionsSimpleUpdate : public Node
+@@ -516,7 +624,8 @@ class UpdateServiceActionsSimpleUpdate : public Node
class UpdateService : public Node
{
public:
@@ -304,37 +302,38 @@ index 6d44171..8eda265 100644
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
-@@ -526,6 +636,8 @@ class UpdateService : public Node
+@@ -528,6 +637,8 @@ class UpdateService : public Node
}
private:
+ std::vector<std::string> httpPushUriTargets;
+ bool httpPushUriTargetBusy;
- void doGet(crow::Response& res, const crow::Request&,
- const std::vector<std::string>&) override
+ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const crow::Request&, const std::vector<std::string>&) override
{
-@@ -536,6 +648,8 @@ class UpdateService : public Node
- res.jsonValue["Description"] = "Service for Software Update";
- res.jsonValue["Name"] = "Update Service";
- res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService";
-+ res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets;
-+ res.jsonValue["HttpPushUriTargetsBusy"] = httpPushUriTargetBusy;
+@@ -538,6 +649,9 @@ class UpdateService : public Node
+ asyncResp->res.jsonValue["Description"] = "Service for Software Update";
+ asyncResp->res.jsonValue["Name"] = "Update Service";
+ asyncResp->res.jsonValue["HttpPushUri"] = "/redfish/v1/UpdateService";
++ asyncResp->res.jsonValue["HttpPushUriTargets"] = httpPushUriTargets;
++ asyncResp->res.jsonValue["HttpPushUriTargetsBusy"] =
++ httpPushUriTargetBusy;
// UpdateService cannot be disabled
- res.jsonValue["ServiceEnabled"] = true;
- res.jsonValue["FirmwareInventory"] = {
-@@ -585,6 +699,31 @@ class UpdateService : public Node
+ asyncResp->res.jsonValue["ServiceEnabled"] = true;
+ asyncResp->res.jsonValue["FirmwareInventory"] = {
+@@ -587,6 +701,32 @@ class UpdateService : public Node
"/xyz/openbmc_project/software/apply_time",
"org.freedesktop.DBus.Properties", "Get",
"xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime");
+
+ // Get the ApplyOptions value
+ crow::connections::systemBus->async_method_call(
-+ [aResp](const boost::system::error_code ec,
-+ const std::variant<bool> applyOption) {
++ [asyncResp](const boost::system::error_code ec,
++ const std::variant<bool> applyOption) {
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
-+ messages::internalError(aResp->res);
++ messages::internalError(asyncResp->res);
+ return;
+ }
+
@@ -342,10 +341,11 @@ index 6d44171..8eda265 100644
+
+ if (b)
+ {
-+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["@odata.type"] =
++ asyncResp->res
++ .jsonValue["Oem"]["ApplyOptions"]["@odata.type"] =
+ "#OemUpdateService.ApplyOptions";
-+ aResp->res.jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] =
-+ *b;
++ asyncResp->res
++ .jsonValue["Oem"]["ApplyOptions"]["ClearConfig"] = *b;
+ }
+ },
+ "xyz.openbmc_project.Software.BMC.Updater",
@@ -353,21 +353,20 @@ index 6d44171..8eda265 100644
+ "Get", "xyz.openbmc_project.Software.ApplyOptions", "ClearConfig");
}
- void doPatch(crow::Response& res, const crow::Request& req,
-@@ -595,12 +734,61 @@ class UpdateService : public Node
- std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
+ void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+@@ -596,12 +736,61 @@ class UpdateService : public Node
+ BMCWEB_LOG_DEBUG << "doPatch...";
std::optional<nlohmann::json> pushUriOptions;
-- if (!json_util::readJson(req, res, "HttpPushUriOptions",
-- pushUriOptions))
+ std::optional<std::vector<std::string>> imgTargets;
+ std::optional<bool> imgTargetBusy;
+ std::optional<nlohmann::json> oemProps;
+
-+ if (!json_util::readJson(req, res, "HttpPushUriOptions", pushUriOptions,
-+ "HttpPushUriTargets", imgTargets,
-+ "HttpPushUriTargetsBusy", imgTargetBusy, "Oem",
-+ oemProps))
+ if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions",
+- pushUriOptions))
++ pushUriOptions, "HttpPushUriTargets",
++ imgTargets, "HttpPushUriTargetsBusy",
++ imgTargetBusy, "Oem", oemProps))
{
+ BMCWEB_LOG_DEBUG << "UpdateService doPatch: Invalid request body";
return;
@@ -377,7 +376,7 @@ index 6d44171..8eda265 100644
+ {
+ std::optional<nlohmann::json> applyOptions;
+
-+ if (!json_util::readJson(*oemProps, res, "ApplyOptions",
++ if (!json_util::readJson(*oemProps, asyncResp->res, "ApplyOptions",
+ applyOptions))
+ {
+ return;
@@ -386,8 +385,8 @@ index 6d44171..8eda265 100644
+ if (applyOptions)
+ {
+ std::optional<bool> clearConfig;
-+ if (!json_util::readJson(*applyOptions, res, "ClearConfig",
-+ clearConfig))
++ if (!json_util::readJson(*applyOptions, asyncResp->res,
++ "ClearConfig", clearConfig))
+ {
+ return;
+ }
@@ -418,7 +417,7 @@ index 6d44171..8eda265 100644
if (pushUriOptions)
{
std::optional<nlohmann::json> pushUriApplyTime;
-@@ -665,6 +853,98 @@ class UpdateService : public Node
+@@ -666,6 +855,98 @@ class UpdateService : public Node
}
}
}
@@ -516,9 +515,9 @@ index 6d44171..8eda265 100644
+ }
}
- void doPost(crow::Response& res, const crow::Request& req,
-@@ -675,8 +955,8 @@ class UpdateService : public Node
- std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
+ void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+@@ -675,8 +956,8 @@ class UpdateService : public Node
+ BMCWEB_LOG_DEBUG << "doPost...";
// Setup callback for when new software detected
- monitorForSoftwareAvailable(asyncResp, req,
@@ -528,7 +527,7 @@ index 6d44171..8eda265 100644
std::string filepath(
"/tmp/images/" +
-@@ -761,7 +1041,7 @@ class SoftwareInventoryCollection : public Node
+@@ -759,7 +1040,7 @@ class SoftwareInventoryCollection : public Node
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/software", static_cast<int32_t>(0),
@@ -537,7 +536,7 @@ index 6d44171..8eda265 100644
}
};
-@@ -943,7 +1223,7 @@ class SoftwareInventory : public Node
+@@ -940,7 +1221,7 @@ class SoftwareInventory : public Node
},
obj.second[0].first, obj.first,
"org.freedesktop.DBus.Properties", "GetAll",
@@ -546,7 +545,7 @@ index 6d44171..8eda265 100644
}
if (!found)
{
-@@ -964,8 +1244,7 @@ class SoftwareInventory : public Node
+@@ -961,8 +1242,7 @@ class SoftwareInventory : public Node
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree", "/",
@@ -557,19 +556,19 @@ index 6d44171..8eda265 100644
};
diff --git a/static/redfish/v1/$metadata/index.xml b/static/redfish/v1/$metadata/index.xml
-index 514f3dd..c068d4f 100644
+index 9d9fd1f..6cbc0d1 100644
--- a/static/redfish/v1/$metadata/index.xml
+++ b/static/redfish/v1/$metadata/index.xml
-@@ -2142,6 +2142,9 @@
- <edmx:Reference Uri="/redfish/v1/schema/OemManager_v1.xml">
- <edmx:Include Namespace="OemManager"/>
+@@ -2145,6 +2145,9 @@
+ <edmx:Reference Uri="/redfish/v1/schema/OemComputerSystem_v1.xml">
+ <edmx:Include Namespace="OemComputerSystem"/>
</edmx:Reference>
+ <edmx:Reference Uri="/redfish/v1/schema/OemUpdateService_v1.xml">
+ <edmx:Include Namespace="OemUpdateService"/>
+ </edmx:Reference>
- <edmx:Reference Uri="/redfish/v1/schema/OemCrashdump_v1.xml">
- <edmx:Include Namespace="OemCrashdump.v1_0_0"/>
- </edmx:Reference>
+ <edmx:Reference Uri="/redfish/v1/schema/OemVirtualMedia_v1.xml">
+ <edmx:Include Namespace="OemVirtualMedia"/>
+ <edmx:Include Namespace="OemVirtualMedia.v1_0_0"/>
diff --git a/static/redfish/v1/JsonSchemas/OemUpdateService/index.json b/static/redfish/v1/JsonSchemas/OemUpdateService/index.json
new file mode 100644
index 0000000..74e39cd
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch
deleted file mode 100644
index 54f00aa39..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-EventService-https-client-support.patch
+++ /dev/null
@@ -1,547 +0,0 @@
-From d340953bc925ff8535c5a8fac54db24b243ba8ad Mon Sep 17 00:00:00 2001
-From: AppaRao Puli <apparao.puli@linux.intel.com>
-Date: Mon, 19 Oct 2020 13:21:42 +0530
-Subject: [PATCH] EventService: https client support
-
-Add https client support for push style
-eventing. Using this BMC can push the event
-logs/telemetry data to event listener over
-secure http channel.
-
-Tested:
- - Created subscription with https destination
- url. Using SubmitTestEvent action set the
- event and can see event on event listener.
- - Validator passed.
-
-Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a
-Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
-Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
----
- http/http_client.hpp | 370 +++++++++++++-----
- .../include/event_service_manager.hpp | 2 +-
- 2 files changed, 267 insertions(+), 105 deletions(-)
-
-diff --git a/http/http_client.hpp b/http/http_client.hpp
-index 5c7b13f..d782dee 100644
---- a/http/http_client.hpp
-+++ b/http/http_client.hpp
-@@ -31,12 +31,17 @@ namespace crow
- {
-
- static constexpr uint8_t maxRequestQueueSize = 50;
-+static constexpr unsigned int httpReadBodyLimit = 1024;
-
- enum class ConnState
- {
- initialized,
-+ resolveInProgress,
-+ resolveFailed,
-+ resolved,
- connectInProgress,
- connectFailed,
-+ sslHandshakeInProgress,
- connected,
- sendInProgress,
- sendFailed,
-@@ -50,53 +55,124 @@ enum class ConnState
- class HttpClient : public std::enable_shared_from_this<HttpClient>
- {
- private:
-+ boost::asio::ip::tcp::resolver resolver;
-+ boost::asio::ssl::context ctx{boost::asio::ssl::context::tlsv12_client};
- boost::beast::tcp_stream conn;
-+ std::optional<boost::beast::ssl_stream<boost::beast::tcp_stream&>> sslConn;
- boost::asio::steady_timer timer;
-- boost::beast::flat_buffer buffer;
-+ boost::beast::flat_static_buffer<httpReadBodyLimit> buffer;
-+ std::optional<
-+ boost::beast::http::response_parser<boost::beast::http::string_body>>
-+ parser;
- boost::beast::http::request<boost::beast::http::string_body> req;
-- boost::beast::http::response<boost::beast::http::string_body> res;
- boost::asio::ip::tcp::resolver::results_type endpoint;
-- std::vector<std::pair<std::string, std::string>> headers;
-+ boost::beast::http::fields fields;
- std::queue<std::string> requestDataQueue;
-- ConnState state;
- std::string subId;
- std::string host;
- std::string port;
- std::string uri;
-+ bool useSsl;
- uint32_t retryCount;
- uint32_t maxRetryAttempts;
- uint32_t retryIntervalSecs;
- std::string retryPolicyAction;
- bool runningTimer;
-+ ConnState state;
-+
-+ void doResolve()
-+ {
-+ BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port;
-+ if (state == ConnState::resolveInProgress)
-+ {
-+ return;
-+ }
-+ state = ConnState::resolveInProgress;
-+ // TODO: Use async_resolver. boost asio example
-+ // code as is crashing with async_resolve().
-+ try
-+ {
-+ endpoint = resolver.resolve(host, port);
-+ }
-+ catch (const std::exception& e)
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to resolve hostname: " << host << " - "
-+ << e.what();
-+ state = ConnState::resolveFailed;
-+ checkQueue();
-+ return;
-+ }
-+ state = ConnState::resolved;
-+ checkQueue();
-+ }
-
- void doConnect()
- {
-- if (state == ConnState::connectInProgress)
-+ if (useSsl)
-+ {
-+ sslConn.emplace(conn, ctx);
-+ }
-+
-+ if ((state == ConnState::connectInProgress) ||
-+ (state == ConnState::sslHandshakeInProgress))
- {
- return;
- }
- state = ConnState::connectInProgress;
-
- BMCWEB_LOG_DEBUG << "Trying to connect to: " << host << ":" << port;
-- // Set a timeout on the operation
-+
-+ auto respHandler =
-+ [self(shared_from_this())](const boost::beast::error_code ec,
-+ const boost::asio::ip::tcp::resolver::
-+ results_type::endpoint_type& ep) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "Connect " << ep
-+ << " failed: " << ec.message();
-+ self->state = ConnState::connectFailed;
-+ self->checkQueue();
-+ return;
-+ }
-+ BMCWEB_LOG_DEBUG << "Connected to: " << ep;
-+ if (self->sslConn)
-+ {
-+ self->performHandshake();
-+ }
-+ else
-+ {
-+ self->state = ConnState::connected;
-+ self->checkQueue();
-+ }
-+ };
-+
- conn.expires_after(std::chrono::seconds(30));
-- conn.async_connect(endpoint, [self(shared_from_this())](
-- const boost::beast::error_code& ec,
-- const boost::asio::ip::tcp::resolver::
-- results_type::endpoint_type& ep) {
-- if (ec)
-- {
-- BMCWEB_LOG_ERROR << "Connect " << ep
-- << " failed: " << ec.message();
-- self->state = ConnState::connectFailed;
-- self->checkQueue();
-- return;
-- }
-- self->state = ConnState::connected;
-- BMCWEB_LOG_DEBUG << "Connected to: " << ep;
-+ conn.async_connect(endpoint, std::move(respHandler));
-+ }
-+
-+ void performHandshake()
-+ {
-+ if (state == ConnState::sslHandshakeInProgress)
-+ {
-+ return;
-+ }
-+ state = ConnState::sslHandshakeInProgress;
-+
-+ sslConn->async_handshake(
-+ boost::asio::ssl::stream_base::client,
-+ [self(shared_from_this())](const boost::beast::error_code ec) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "SSL handshake failed: "
-+ << ec.message();
-+ self->doCloseAndCheckQueue(ConnState::connectFailed);
-+ return;
-+ }
-+ self->state = ConnState::connected;
-+ BMCWEB_LOG_DEBUG << "SSL Handshake successfull";
-
-- self->checkQueue();
-- });
-+ self->checkQueue();
-+ });
- }
-
- void sendMessage(const std::string& data)
-@@ -107,100 +183,170 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
- }
- state = ConnState::sendInProgress;
-
-- BMCWEB_LOG_DEBUG << __FUNCTION__ << "(): " << host << ":" << port;
-+ BMCWEB_LOG_DEBUG << host << ":" << port;
-
-- req.version(static_cast<int>(11)); // HTTP 1.1
-- req.target(uri);
-- req.method(boost::beast::http::verb::post);
--
-- // Set headers
-- for (const auto& [key, value] : headers)
-+ req = {};
-+ for (const auto& field : fields)
- {
-- req.set(key, value);
-+ req.set(field.name_string(), field.value());
- }
- req.set(boost::beast::http::field::host, host);
-+ req.set(boost::beast::http::field::content_type, "text/plain");
-+
-+ req.version(static_cast<int>(11)); // HTTP 1.1
-+ req.target(uri);
-+ req.method(boost::beast::http::verb::post);
- req.keep_alive(true);
-
- req.body() = data;
- req.prepare_payload();
-
-- // Set a timeout on the operation
-- conn.expires_after(std::chrono::seconds(30));
-+ auto respHandler = [self(shared_from_this())](
-+ const boost::beast::error_code ec,
-+ const std::size_t& bytesTransferred) {
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "sendMessage() failed: " << ec.message();
-+ self->doCloseAndCheckQueue(ConnState::sendFailed);
-+ return;
-+ }
-+ BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: "
-+ << bytesTransferred;
-+ boost::ignore_unused(bytesTransferred);
-
-- // Send the HTTP request to the remote host
-- boost::beast::http::async_write(
-- conn, req,
-- [self(shared_from_this())](const boost::beast::error_code& ec,
-- const std::size_t& bytesTransferred) {
-- if (ec)
-- {
-- BMCWEB_LOG_ERROR << "sendMessage() failed: "
-- << ec.message();
-- self->state = ConnState::sendFailed;
-- self->checkQueue();
-- return;
-- }
-- BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: "
-- << bytesTransferred;
-- boost::ignore_unused(bytesTransferred);
-+ self->recvMessage();
-+ };
-
-- self->recvMessage();
-- });
-+ conn.expires_after(std::chrono::seconds(30));
-+ if (sslConn)
-+ {
-+ boost::beast::http::async_write(*sslConn, req,
-+ std::move(respHandler));
-+ }
-+ else
-+ {
-+ boost::beast::http::async_write(conn, req, std::move(respHandler));
-+ }
- }
-
- void recvMessage()
- {
-- // Receive the HTTP response
-- boost::beast::http::async_read(
-- conn, buffer, res,
-- [self(shared_from_this())](const boost::beast::error_code& ec,
-- const std::size_t& bytesTransferred) {
-+ auto respHandler = [self(shared_from_this())](
-+ const boost::beast::error_code ec,
-+ const std::size_t& bytesTransferred) {
-+ if (ec && ec != boost::beast::http::error::partial_message)
-+ {
-+ BMCWEB_LOG_ERROR << "recvMessage() failed: " << ec.message();
-+ self->doCloseAndCheckQueue(ConnState::recvFailed);
-+ return;
-+ }
-+ BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: "
-+ << bytesTransferred;
-+ boost::ignore_unused(bytesTransferred);
-+
-+ // TODO: check for return status code and perform
-+ // retry if fails(Ex: 40x). Take action depending on
-+ // retry policy.
-+ BMCWEB_LOG_DEBUG << "recvMessage() data: "
-+ << self->parser->get().body();
-+
-+ // Send is successful, Lets remove data from queue
-+ // check for next request data in queue.
-+ self->requestDataQueue.pop();
-+
-+ // Transfer ownership of the response
-+ self->parser->release();
-+
-+ // TODO: Implement the keep-alive connections.
-+ // Most of the web servers close connection abruptly
-+ // and might be reason due to which its observed that
-+ // stream_truncated(Next read) or partial_message
-+ // errors. So for now, closing connection and re-open
-+ // for all cases.
-+ self->doCloseAndCheckQueue(ConnState::closed);
-+ };
-+
-+ parser.emplace(std::piecewise_construct, std::make_tuple());
-+ parser->body_limit(httpReadBodyLimit);
-+ // Since these are all push style eventing, we are not
-+ // bothered about response parsing.
-+ parser->skip(true);
-+ buffer.consume(buffer.size());
-+
-+ conn.expires_after(std::chrono::seconds(30));
-+ if (sslConn)
-+ {
-+ boost::beast::http::async_read(*sslConn, buffer, *parser,
-+ std::move(respHandler));
-+ }
-+ else
-+ {
-+ boost::beast::http::async_read(conn, buffer, *parser,
-+ std::move(respHandler));
-+ }
-+ }
-+
-+ void doCloseAndCheckQueue(const ConnState setState = ConnState::closed)
-+ {
-+ if (sslConn)
-+ {
-+ conn.expires_after(std::chrono::seconds(30));
-+ sslConn->async_shutdown([self = shared_from_this(),
-+ setState{std::move(setState)}](
-+ const boost::system::error_code ec) {
- if (ec)
- {
-- BMCWEB_LOG_ERROR << "recvMessage() failed: "
-- << ec.message();
-- self->state = ConnState::recvFailed;
-- self->checkQueue();
-- return;
-+ // Many https server closes connection abruptly
-+ // i.e witnout close_notify. More details are at
-+ // https://github.com/boostorg/beast/issues/824
-+ if (ec == boost::asio::ssl::error::stream_truncated)
-+ {
-+ BMCWEB_LOG_ERROR
-+ << "doCloseAndCheckQueue(): Connection "
-+ "closed by server. ";
-+ }
-+ else
-+ {
-+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: "
-+ << ec.message();
-+ }
- }
-- BMCWEB_LOG_DEBUG << "recvMessage() bytes transferred: "
-- << bytesTransferred;
-- boost::ignore_unused(bytesTransferred);
--
-- // Discard received data. We are not interested.
-- BMCWEB_LOG_DEBUG << "recvMessage() data: " << self->res;
--
-- // Send is successful, Lets remove data from queue
-- // check for next request data in queue.
-- self->requestDataQueue.pop();
-- self->state = ConnState::idle;
-+ else
-+ {
-+ BMCWEB_LOG_DEBUG << "Connection closed gracefully...";
-+ }
-+ self->conn.cancel();
-+ self->state = setState;
- self->checkQueue();
- });
-- }
--
-- void doClose()
-- {
-- boost::beast::error_code ec;
-- conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
--
-- state = ConnState::closed;
-- // not_connected happens sometimes so don't bother reporting it.
-- if (ec && ec != boost::beast::errc::not_connected)
-+ }
-+ else
- {
-- BMCWEB_LOG_ERROR << "shutdown failed: " << ec.message();
-- return;
-+ boost::beast::error_code ec;
-+ conn.expires_after(std::chrono::seconds(30));
-+ conn.socket().shutdown(boost::asio::ip::tcp::socket::shutdown_both,
-+ ec);
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "doCloseAndCheckQueue() failed: "
-+ << ec.message();
-+ }
-+ else
-+ {
-+ BMCWEB_LOG_DEBUG << "Connection closed gracefully...";
-+ }
-+
-+ conn.close();
-+ state = setState;
-+ checkQueue();
- }
-- BMCWEB_LOG_DEBUG << "Connection closed gracefully";
-+ return;
- }
-
- void checkQueue(const bool newRecord = false)
- {
- if (requestDataQueue.empty())
- {
-- // TODO: Having issue in keeping connection alive. So lets close if
-- // nothing to be transferred.
-- doClose();
--
- BMCWEB_LOG_DEBUG << "requestDataQueue is empty\n";
- return;
- }
-@@ -232,6 +378,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
- }
-
- if ((state == ConnState::connectFailed) ||
-+ (state == ConnState::resolveFailed) ||
- (state == ConnState::sendFailed) ||
- (state == ConnState::recvFailed))
- {
-@@ -256,14 +403,18 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
- << " seconds. RetryCount = " << retryCount;
- timer.expires_after(std::chrono::seconds(retryIntervalSecs));
- timer.async_wait(
-- [self = shared_from_this()](const boost::system::error_code&) {
-+ [self = shared_from_this()](boost::system::error_code) {
- self->runningTimer = false;
- self->connStateCheck();
- });
- return;
- }
-- // reset retry count.
-- retryCount = 0;
-+
-+ if (state == ConnState::idle)
-+ {
-+ // State idle means, previous attempt is successful.
-+ retryCount = 0;
-+ }
- connStateCheck();
-
- return;
-@@ -273,15 +424,21 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
- {
- switch (state)
- {
-+ case ConnState::initialized:
-+ case ConnState::resolveFailed:
-+ case ConnState::connectFailed:
-+ doResolve();
-+ break;
- case ConnState::connectInProgress:
-+ case ConnState::resolveInProgress:
-+ case ConnState::sslHandshakeInProgress:
- case ConnState::sendInProgress:
- case ConnState::suspended:
- case ConnState::terminated:
- // do nothing
- break;
-- case ConnState::initialized:
- case ConnState::closed:
-- case ConnState::connectFailed:
-+ case ConnState::resolved:
- case ConnState::sendFailed:
- case ConnState::recvFailed:
- {
-@@ -297,22 +454,22 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
- sendMessage(data);
- break;
- }
-+ default:
-+ break;
- }
- }
-
- public:
- explicit HttpClient(boost::asio::io_context& ioc, const std::string& id,
- const std::string& destIP, const std::string& destPort,
-- const std::string& destUri) :
-- conn(ioc),
-- timer(ioc), subId(id), host(destIP), port(destPort), uri(destUri),
-- retryCount(0), maxRetryAttempts(5), retryIntervalSecs(0),
-- retryPolicyAction("TerminateAfterRetries"), runningTimer(false)
-- {
-- boost::asio::ip::tcp::resolver resolver(ioc);
-- endpoint = resolver.resolve(host, port);
-- state = ConnState::initialized;
-- }
-+ const std::string& destUri,
-+ const bool inUseSsl = true) :
-+ resolver(ioc),
-+ conn(ioc), timer(ioc), subId(id), host(destIP), port(destPort),
-+ uri(destUri), useSsl(inUseSsl), retryCount(0), maxRetryAttempts(5),
-+ retryPolicyAction("TerminateAfterRetries"), runningTimer(false),
-+ state(ConnState::initialized)
-+ {}
-
- void sendData(const std::string& data)
- {
-@@ -337,7 +494,12 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
- void setHeaders(
- const std::vector<std::pair<std::string, std::string>>& httpHeaders)
- {
-- headers = httpHeaders;
-+ // Set headers
-+ for (const auto& [key, value] : httpHeaders)
-+ {
-+ // TODO: Validate the header fileds before assign.
-+ fields.set(key, value);
-+ }
- }
-
- void setRetryConfig(const uint32_t retryAttempts,
-diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index 54dafb4..f68ae1d 100644
---- a/redfish-core/include/event_service_manager.hpp
-+++ b/redfish-core/include/event_service_manager.hpp
-@@ -387,7 +387,7 @@ class Subscription
- {
- conn = std::make_shared<crow::HttpClient>(
- crow::connections::systemBus->get_io_context(), id, host, port,
-- path);
-+ path, (uriProto == "https" ? true : false));
- }
-
- Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) :
---
-2.17.1
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch
index a9c46f487..d962d3872 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0010-managers-add-attributes-for-Manager.CommandShell.patch
@@ -1,4 +1,4 @@
-From a76314cd29f5cbcf19142b7120c5bf83358910fd Mon Sep 17 00:00:00 2001
+From b5e4edfc26eec245427d3435de9acaa9363ae836 Mon Sep 17 00:00:00 2001
From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Date: Mon, 28 Dec 2020 18:55:57 +0000
Subject: [PATCH] managers: add attributes for Manager.CommandShell
@@ -32,26 +32,36 @@ Response:
Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
---
- redfish-core/lib/managers.hpp | 6 ++++++
- 1 file changed, 6 insertions(+)
+ redfish-core/lib/managers.hpp | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
-index 6347caf..c401ca9 100644
+index 67f8d99..dcbc347 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
-@@ -1767,6 +1767,12 @@ class Manager : public Node
- res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15;
- res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = {"IPMI",
- "SSH"};
+@@ -1830,6 +1830,13 @@ class Manager : public Node
+ asyncResp->res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15;
+ asyncResp->res.jsonValue["SerialConsole"]["ConnectTypesSupported"] = {
+ "IPMI", "SSH"};
++
+ // Fill in CommandShell info
-+ res.jsonValue["CommandShell"]["ServiceEnabled"] = true;
-+ res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4;
-+ res.jsonValue["CommandShell"]["ConnectTypesSupported"] = {"SSH",
-+ "IPMI"};
++ asyncResp->res.jsonValue["CommandShell"]["ServiceEnabled"] = true;
++ asyncResp->res.jsonValue["CommandShell"]["MaxConcurrentSessions"] = 4;
++ asyncResp->res.jsonValue["CommandShell"]["ConnectTypesSupported"] = {
++ "SSH", "IPMI"};
+
#ifdef BMCWEB_ENABLE_KVM
// Fill in GraphicalConsole info
- res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true;
+ asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true;
+@@ -2272,7 +2279,7 @@ class Manager : public Node
+ }
+
+ std::string uuid;
+-};
++}; // namespace redfish
+
+ class ManagerCollection : public Node
+ {
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch
index 5ffc259c0..5ffc259c0 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0034-recommended-fixes-by-crypto-review-team.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0014-recommended-fixes-by-crypto-review-team.patch
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch
index b171a8b2c..b171a8b2c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0037-Add-state-sensor-messages-to-the-registry.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0015-Add-state-sensor-messages-to-the-registry.patch
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch
index bc023839f..bc023839f 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch
new file mode 100644
index 000000000..d0cfd1c44
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0017-Add-msg-registry-for-subscription-related-actions.patch
@@ -0,0 +1,81 @@
+From 7282ab7756cdb8c844bef9affd8a8e894828678c Mon Sep 17 00:00:00 2001
+From: Ayushi Smriti <smriti.ayushi@intel.com>
+Date: Mon, 10 May 2021 12:32:30 +0530
+Subject: [PATCH] Add msg registry for subscription related actions
+
+For subscription event message log purpose, added message registry
+entry for event service subscription related actions- add, update
+and delete.
+
+Tested:
+ - Message registry entry appears in the log for the corresponding
+ subscription action.
+
+Signed-off-by: AppaRao Puli <apparao.puli@intel.com>
+Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
+---
+ .../registries/openbmc_message_registry.hpp | 41 ++++++++++++++++++-
+ 1 file changed, 40 insertions(+), 1 deletion(-)
+
+diff --git a/redfish-core/include/registries/openbmc_message_registry.hpp b/redfish-core/include/registries/openbmc_message_registry.hpp
+index e12a138..2f981db 100644
+--- a/redfish-core/include/registries/openbmc_message_registry.hpp
++++ b/redfish-core/include/registries/openbmc_message_registry.hpp
+@@ -29,7 +29,7 @@ const Header header = {
+ "0.2.0",
+ "OpenBMC",
+ };
+-constexpr std::array<MessageEntry, 190> registry = {
++constexpr std::array<MessageEntry, 193> registry = {
+ MessageEntry{
+ "ADDDCCorrectable",
+ {
+@@ -417,6 +417,45 @@ constexpr std::array<MessageEntry, 190> registry = {
+ {},
+ "None.",
+ }},
++ MessageEntry{"EventSubscriptionAdded",
++ {
++ "Indicates that an Event subscription with specific "
++ "id was added.",
++ "Event subscription with id %1 was added.",
++ "OK",
++ "OK",
++ 1,
++ {
++ "string",
++ },
++ "None.",
++ }},
++ MessageEntry{"EventSubscriptionRemoved",
++ {
++ "Indicates that an Event subscription with specific "
++ "id was removed.",
++ "Event subscription with id %1 was removed.",
++ "OK",
++ "OK",
++ 1,
++ {
++ "string",
++ },
++ "None.",
++ }},
++ MessageEntry{"EventSubscriptionUpdated",
++ {
++ "Indicates that an Event subscription with specific "
++ " id was updated.",
++ "Event subscription with id %1 was updated.",
++ "OK",
++ "OK",
++ 1,
++ {
++ "string",
++ },
++ "None.",
++ }},
+ MessageEntry{"FanInserted",
+ {
+ "Indicates that a system fan has been inserted.",
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch
deleted file mode 100644
index f02e5e1a4..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch
+++ /dev/null
@@ -1,51 +0,0 @@
-From 7cde56820505a4f750cc67caa0dc9300688f3fd9 Mon Sep 17 00:00:00 2001
-From: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
-Date: Tue, 13 Apr 2021 15:16:43 +0200
-Subject: [PATCH] Fix comparison for proxy/legacy mode
-
-After sdbusplus made available string path wrapper VM code has been
-updated to use it. This makes legacy mode unusable as appropriate
-change introduced a problem with comparison of DBus object path, which
-is now fixed.
-
-Tested:
-After applying this fix, legacy mode has InsertMedia action enabled
-again.
-
-Change-Id: I062994f23b77cb7ab9c4421f296a65a80b9ce896
-Signed-off-by: Przemyslaw Czarnowski <przemyslaw.hawrylewicz.czarnowski@intel.com>
----
- redfish-core/lib/virtual_media.hpp | 14 +++++++++++++-
- 1 file changed, 13 insertions(+), 1 deletion(-)
-
-diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
-index 365290b..dda73d8 100644
---- a/redfish-core/lib/virtual_media.hpp
-+++ b/redfish-core/lib/virtual_media.hpp
-@@ -274,10 +274,22 @@ static void getVmData(const std::shared_ptr<AsyncResp>& aResp,
- continue;
- }
-
-+ auto mode = item.first.parent_path();
-+ auto type = mode.parent_path();
-+ if (mode.filename().empty() || type.filename().empty())
-+ {
-+ continue;
-+ }
-+
-+ if (type.filename() != "VirtualMedia")
-+ {
-+ continue;
-+ }
-+
- aResp->res.jsonValue = vmItemTemplate(name, resName);
-
- // Check if dbus path is Legacy type
-- if (thispath.find("VirtualMedia/Legacy") != std::string::npos)
-+ if (mode.filename() == "Legacy")
- {
- aResp->res.jsonValue["Actions"]["#VirtualMedia.InsertMedia"]
- ["target"] =
---
-2.26.2
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch
index b2627644b..9cf4653d6 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0006-Define-Redfish-interface-Registries-Bios.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch
@@ -1,4 +1,4 @@
-From c645c011bb3ea2a2aaf52560cb9fcc461d048cae Mon Sep 17 00:00:00 2001
+From 72c273ae74bb6add062b89f59ebeee4d4eb7e523 Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Fri, 4 Sep 2020 19:24:25 +0800
Subject: [PATCH] Define Redfish interface "/Registries/Bios" and enable
@@ -228,16 +228,16 @@ Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
redfish-core/include/redfish.hpp | 2 +
.../include/registries/bios_registry.hpp | 31 ++
- redfish-core/lib/bios.hpp | 503 ++++++++++++++++++
+ redfish-core/lib/bios.hpp | 501 ++++++++++++++++++
redfish-core/lib/message_registries.hpp | 9 +-
- 4 files changed, 544 insertions(+), 1 deletion(-)
+ 4 files changed, 542 insertions(+), 1 deletion(-)
create mode 100644 redfish-core/include/registries/bios_registry.hpp
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 5d5eb7b..a8e5cf2 100644
+index db58d60..298ebb8 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
-@@ -157,6 +157,8 @@ class RedfishService
+@@ -156,6 +156,8 @@ class RedfishService
nodes.emplace_back(std::make_unique<SystemActionsReset>(app));
nodes.emplace_back(std::make_unique<SystemResetActionInfo>(app));
nodes.emplace_back(std::make_unique<BiosService>(app));
@@ -285,7 +285,7 @@ index 0000000..88ef782
+} // namespace redfish::message_registries::bios
\ No newline at end of file
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 2c31077..5f8c91b 100644
+index 0917cc7..cb2b74d 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -3,8 +3,140 @@
@@ -429,7 +429,7 @@ index 2c31077..5f8c91b 100644
/**
* BiosService class supports handle get method for bios.
*/
-@@ -35,6 +167,377 @@ class BiosService : public Node
+@@ -33,6 +165,375 @@ class BiosService : public Node
// Get the ActiveSoftwareImage and SoftwareImages
fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose,
"", true);
@@ -532,10 +532,9 @@ index 2c31077..5f8c91b 100644
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>&) override
++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request&, const std::vector<std::string>&) override
+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Systems/system/Bios/Settings";
+ asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios";
@@ -641,10 +640,9 @@ index 2c31077..5f8c91b 100644
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>&) override
++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request&, const std::vector<std::string>&) override
+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Registries/BiosAttributeRegistry/"
+ "BiosAttributeRegistry";
@@ -808,7 +806,7 @@ index 2c31077..5f8c91b 100644
};
/**
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
-index 77fc10e..0caf01c 100644
+index 455bf70..7afbfc2 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -18,6 +18,7 @@
@@ -831,9 +829,9 @@ index 77fc10e..0caf01c 100644
{{"@odata.id", "/redfish/v1/Registries/ResourceEvent"}},
+ {{"@odata.id", "/redfish/v1/Registries/BiosAttributeRegistry"}},
{{"@odata.id", "/redfish/v1/Registries/OpenBMC"}}}}};
-
- res.end();
-@@ -118,6 +120,11 @@ class MessageRegistryFile : public Node
+ }
+ };
+@@ -116,6 +118,11 @@ class MessageRegistryFile : public Node
header = &message_registries::resource_event::header;
url = message_registries::resource_event::url;
}
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch
index 6f3794478..21a21e8db 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0007-BIOS-config-Add-support-for-PATCH-operation.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch
@@ -1,4 +1,4 @@
-From ad2b1c83bd9cb1bb6eb86bebd1867b0172e5a7a8 Mon Sep 17 00:00:00 2001
+From 9c498d683be59ce25dd0124ba7ec5e026c59bbbf Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Wed, 23 Dec 2020 16:50:45 +0800
Subject: [PATCH] BaseBiosTable: Add support for PATCH operation
@@ -26,11 +26,11 @@ backend and that updates the BaseBiosTable.
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
- redfish-core/lib/bios.hpp | 94 ++++++++++++++++++++++++++++++++++++++-
- 1 file changed, 93 insertions(+), 1 deletion(-)
+ redfish-core/lib/bios.hpp | 93 ++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 92 insertions(+), 1 deletion(-)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 5f8c91b..cf76fe0 100644
+index cb2b74d..860a643 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -96,6 +96,29 @@ static std::string mapAttrTypeToRedfish(const std::string_view typeDbus)
@@ -63,7 +63,7 @@ index 5f8c91b..cf76fe0 100644
static std::string mapBoundTypeToRedfish(const std::string_view typeDbus)
{
std::string ret;
-@@ -262,7 +285,9 @@ class BiosSettings : public Node
+@@ -260,7 +283,9 @@ class BiosSettings : public Node
BiosSettings(App& app) :
Node(app, "/redfish/v1/Systems/system/Bios/Settings")
{
@@ -74,16 +74,15 @@ index 5f8c91b..cf76fe0 100644
}
private:
-@@ -359,6 +384,73 @@ class BiosSettings : public Node
+@@ -356,6 +381,72 @@ class BiosSettings : public Node
"/xyz/openbmc_project/bios_config/manager",
std::array<const char*, 0>());
}
+
-+ void doPatch(crow::Response& res, const crow::Request& req,
++ void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request& req,
+ const std::vector<std::string>&) override
+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+
+ nlohmann::json inpJson;
+
+ if (!redfish::json_util::readJson(req, asyncResp->res, "data", inpJson))
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch
index 7e4e2e8d8..5a24996a0 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0008-Add-support-to-ResetBios-action.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0003-Add-support-to-ResetBios-action.patch
@@ -1,4 +1,4 @@
-From a78eecb032eefeb84da3ec042700a40f55ae8f10 Mon Sep 17 00:00:00 2001
+From 4e85ce8a5f34038c289504855d21ebfa3d6b94f0 Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Wed, 23 Dec 2020 22:47:56 +0800
Subject: [PATCH] Add support to ResetBios action
@@ -10,16 +10,15 @@ POST https://IP_ADDR/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios
Change-Id: I5e5fbdd70d4a3ce3b976cc2eb0a7d9a2a3adb124
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
-
---
- redfish-core/lib/bios.hpp | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
+ redfish-core/lib/bios.hpp | 15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index cf76fe0..7b6fc3d 100644
+index 860a643..1eb7bef 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
-@@ -643,7 +643,7 @@ class BiosReset : public Node
+@@ -638,7 +638,7 @@ class BiosReset : public Node
Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/")
{
entityPrivileges = {
@@ -28,13 +27,13 @@ index cf76fe0..7b6fc3d 100644
}
private:
-@@ -655,19 +655,23 @@ class BiosReset : public Node
- const std::vector<std::string>&) override
+@@ -649,19 +649,24 @@ class BiosReset : public Node
+ void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const crow::Request&, const std::vector<std::string>&) override
{
- auto asyncResp = std::make_shared<AsyncResp>(res);
--
+ std::string resetFlag =
+ "xyz.openbmc_project.BIOSConfig.Manager.ResetFlag.FactoryDefaults";
+
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
if (ec)
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
index 976292197..e87995aca 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0009-Add-support-to-ChangePassword-action.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
@@ -1,4 +1,4 @@
-From ede8454491b554c2494a61f42993fa2e39b4d865 Mon Sep 17 00:00:00 2001
+From 0ce94f6caf5d76d7f1abc71f6f8f7dc320517984 Mon Sep 17 00:00:00 2001
From: Kuiying Wang <kuiying.wang@intel.com>
Date: Wed, 23 Dec 2020 14:41:23 +0800
Subject: [PATCH] Add support to ChangePassword action
@@ -37,10 +37,10 @@ Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
2 files changed, 71 insertions(+)
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index a8e5cf2..dabf78e 100644
+index 298ebb8..4418c3d 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
-@@ -160,6 +160,7 @@ class RedfishService
+@@ -159,6 +159,7 @@ class RedfishService
nodes.emplace_back(std::make_unique<BiosSettings>(app));
nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app));
nodes.emplace_back(std::make_unique<BiosReset>(app));
@@ -49,10 +49,10 @@ index a8e5cf2..dabf78e 100644
nodes.emplace_back(std::make_unique<VirtualMedia>(app));
nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app));
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 7b6fc3d..61b396b 100644
+index 1eb7bef..12ec472 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
-@@ -186,6 +186,9 @@ class BiosService : public Node
+@@ -184,6 +184,9 @@ class BiosService : public Node
asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = {
{"target",
"/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}};
@@ -62,7 +62,7 @@ index 7b6fc3d..61b396b 100644
// Get the ActiveSoftwareImage and SoftwareImages
fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose,
-@@ -674,4 +677,71 @@ class BiosReset : public Node
+@@ -669,4 +672,71 @@ class BiosReset : public Node
std::variant<std::string>(resetFlag));
}
};
@@ -87,14 +87,14 @@ index 7b6fc3d..61b396b 100644
+ * Function handles POST method request.
+ * Analyzes POST body message before sends Reset request data to D-Bus.
+ */
-+ void doPost(crow::Response& res, const crow::Request& req,
++ void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request& req,
+ const std::vector<std::string>&) override
+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ std::string currentPassword, newPassword, userName;
-+ if (!json_util::readJson(req, res, "NewPassword", newPassword,
-+ "OldPassword", currentPassword, "PasswordName",
-+ userName))
++ if (!json_util::readJson(req, asyncResp->res, "NewPassword",
++ newPassword, "OldPassword", currentPassword,
++ "PasswordName", userName))
+ {
+ return;
+ }
@@ -120,8 +120,8 @@ index 7b6fc3d..61b396b 100644
+ [asyncResp](const boost::system::error_code ec) {
+ if (ec)
+ {
-+ BMCWEB_LOG_CRITICAL << "Failed in doPost(BiosChangePassword) "
-+ << ec;
++ BMCWEB_LOG_CRITICAL
++ << "Failed in doPost(BiosChangePassword) " << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch
new file mode 100644
index 000000000..75a78abb4
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch
@@ -0,0 +1,44 @@
+From fedcdb7887b4d934ee763d75f7988825300c5cef Mon Sep 17 00:00:00 2001
+From: Ayushi Smriti <smriti.ayushi@intel.com>
+Date: Thu, 6 May 2021 11:56:38 +0530
+Subject: [PATCH] Fix:remove bios user pwd change option via Redfish
+
+BMC should not provide user bios setup password change option via
+Redfish as per bios security requirements. Only Admin BIOS setup
+password is supported.
+
+Added check for the password name action parameter and
+do not allow if it has User Password value from redfish side.
+
+Tested: sent POST query in redfish on URI:
+https://<ip>/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword
+error occurs for UserPassword parameter and allows for AdminPassword.
+
+Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
+---
+ redfish-core/lib/bios.hpp | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
+index 12ec472..0416934 100644
+--- a/redfish-core/lib/bios.hpp
++++ b/redfish-core/lib/bios.hpp
+@@ -722,6 +722,15 @@ class BiosChangePassword : public Node
+ "PasswordName");
+ return;
+ }
++
++ // In Intel BIOS, we are not supporting user password in BIOS setup
++ if (userName == "UserPassword")
++ {
++ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
++ "PasswordName");
++ return;
++ }
++
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec) {
+ if (ec)
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch
index b46d30149..bda893a81 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch
@@ -1,7 +1,7 @@
-From ae55e89c14ea5abef0895409c956f5f4c38f330f Mon Sep 17 00:00:00 2001
+From 3d6c3b3e91c04ff8f10bff49bcf2a7d7206c53df Mon Sep 17 00:00:00 2001
From: Sunitha Harish <sunithaharish04@gmail.com>
Date: Fri, 19 Feb 2021 13:38:31 +0530
-Subject: [PATCH 1/2] EventService : Fix retry handling for http-client
+Subject: [PATCH] EventService : Fix retry handling for http-client
When the event send/receive is failed, the bmcweb does not handle
the failure to tear-down the complete connection and start a fresh
@@ -23,17 +23,22 @@ Tested by:
- Generate an event and see the same is received at the listener's console
- Update the listner to change the keep-alive to true/false and
observe the http-client connection states at bmcweb
+ - Changed listener client to return non success HTTP status code
+ and observed retry logic gets trigrred in http-client.
+ - Gave wrong fqdn and observed async resolve failure and retry logc.
+ - Stopped listener after connect and verified timeouts on http-client
+ side.
Change-Id: Ibb45691f139916ba2954da37beda9d4f91c7cef3
Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
---
- http/http_client.hpp | 289 ++++++++++--------
+ http/http_client.hpp | 288 ++++++++++--------
.../include/event_service_manager.hpp | 2 +-
- 2 files changed, 163 insertions(+), 128 deletions(-)
+ 2 files changed, 162 insertions(+), 128 deletions(-)
diff --git a/http/http_client.hpp b/http/http_client.hpp
-index 992ac2b..d116f6d 100644
+index 992ac2b..feabbba 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -34,22 +34,28 @@ namespace crow
@@ -67,7 +72,7 @@ index 992ac2b..d116f6d 100644
};
class HttpClient : public std::enable_shared_from_this<HttpClient>
-@@ -58,11 +64,14 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -58,11 +64,13 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
crow::async_resolve::Resolver resolver;
boost::beast::tcp_stream conn;
boost::asio::steady_timer timer;
@@ -80,13 +85,12 @@ index 992ac2b..d116f6d 100644
+ std::optional<
+ boost::beast::http::response_parser<boost::beast::http::string_body>>
+ parser;
-+ boost::asio::ip::tcp::endpoint endpoint;
+ boost::circular_buffer_space_optimized<std::string> requestDataQueue{};
+ std::vector<boost::asio::ip::tcp::endpoint> endPoints;
ConnState state;
std::string subId;
std::string host;
-@@ -76,12 +85,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -76,12 +84,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
void doResolve()
{
@@ -99,7 +103,7 @@ index 992ac2b..d116f6d 100644
BMCWEB_LOG_DEBUG << "Trying to resolve: " << host << ":" << port;
auto respHandler =
-@@ -89,78 +93,56 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -89,78 +92,56 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
const boost::beast::error_code ec,
const std::vector<boost::asio::ip::tcp::endpoint>&
endpointList) {
@@ -191,7 +195,7 @@ index 992ac2b..d116f6d 100644
// Send the HTTP request to the remote host
boost::beast::http::async_write(
conn, req,
-@@ -171,7 +153,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -171,7 +152,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
BMCWEB_LOG_ERROR << "sendMessage() failed: "
<< ec.message();
self->state = ConnState::sendFailed;
@@ -200,7 +204,7 @@ index 992ac2b..d116f6d 100644
return;
}
BMCWEB_LOG_DEBUG << "sendMessage() bytes transferred: "
-@@ -184,9 +166,18 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -184,9 +165,17 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
void recvMessage()
{
@@ -208,8 +212,7 @@ index 992ac2b..d116f6d 100644
+
+ parser.emplace(std::piecewise_construct, std::make_tuple());
+ parser->body_limit(httpReadBodyLimit);
-+ // Since these are all push style eventing, we are not
-+ // bothered about response body parsing.
++
+ // Check only for the response header
+ parser->skip(true);
+
@@ -220,7 +223,7 @@ index 992ac2b..d116f6d 100644
[self(shared_from_this())](const boost::beast::error_code& ec,
const std::size_t& bytesTransferred) {
if (ec)
-@@ -194,30 +185,46 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -194,30 +183,47 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
BMCWEB_LOG_ERROR << "recvMessage() failed: "
<< ec.message();
self->state = ConnState::recvFailed;
@@ -257,7 +260,8 @@ index 992ac2b..d116f6d 100644
+ // enabled
+ self->state = ConnState::abortConnection;
+ }
-+ // Transfer ownership of the response
++
++ // Returns ownership of the parsed message
+ self->parser->release();
+
+ self->handleConnState();
@@ -275,7 +279,7 @@ index 992ac2b..d116f6d 100644
// not_connected happens sometimes so don't bother reporting it.
if (ec && ec != boost::beast::errc::not_connected)
{
-@@ -225,112 +232,139 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -225,112 +231,139 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
return;
}
BMCWEB_LOG_DEBUG << "Connection closed gracefully";
@@ -369,7 +373,7 @@ index 992ac2b..d116f6d 100644
- retryCount = 0;
- connStateCheck();
+ runningTimer = true;
-
++
+ retryCount++;
+
+ BMCWEB_LOG_DEBUG << "Attempt retry after " << retryIntervalSecs
@@ -384,7 +388,7 @@ index 992ac2b..d116f6d 100644
+ // sending the event as per the retry policy
+ }
+ self->runningTimer = false;
-+
+
+ // Lets close connection and start from resolve.
+ self->doClose();
+ });
@@ -469,7 +473,7 @@ index 992ac2b..d116f6d 100644
}
}
-@@ -339,37 +373,38 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -339,37 +372,38 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
const std::string& destIP, const std::string& destPort,
const std::string& destUri) :
conn(ioc),
@@ -526,10 +530,10 @@ index 992ac2b..d116f6d 100644
void setRetryConfig(const uint32_t retryAttempts,
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index 148c703..bffa68f 100644
+index fa4e41a..c999121 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -412,7 +412,7 @@ class Subscription
+@@ -423,7 +423,7 @@ class Subscription
reqHeaders.emplace_back(std::pair(key, val));
}
}
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch
index b1f61c6fd..7cbb406a5 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch
@@ -1,7 +1,7 @@
-From 579fda953ec991b4e7f9d7194b08f6aa103fa0ec Mon Sep 17 00:00:00 2001
+From 5f19e5c8ebc5cb0ce331e4ef841526995b6bdb2e Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Mon, 22 Feb 2021 17:07:47 +0000
-Subject: [PATCH 2/2] EventService: https client support
+Subject: [PATCH] EventService: https client support
Add https client support for push style
eventing. Using this BMC can push the event
@@ -17,12 +17,12 @@ Tested:
Change-Id: I44c3918b39baa2eb5fddda9d635f99aa280a422a
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
---
- http/http_client.hpp | 255 ++++++++++++------
+ http/http_client.hpp | 257 ++++++++++++------
.../include/event_service_manager.hpp | 2 +-
- 2 files changed, 175 insertions(+), 82 deletions(-)
+ 2 files changed, 176 insertions(+), 83 deletions(-)
diff --git a/http/http_client.hpp b/http/http_client.hpp
-index d116f6d..cebc857 100644
+index feabbba..aaf1b2d 100644
--- a/http/http_client.hpp
+++ b/http/http_client.hpp
@@ -20,6 +20,7 @@
@@ -52,7 +52,7 @@ index d116f6d..cebc857 100644
boost::asio::steady_timer timer;
boost::beast::flat_static_buffer<httpReadBodyLimit> buffer;
boost::beast::http::request<boost::beast::http::string_body> req;
-@@ -112,23 +117,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -111,23 +116,52 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
void doConnect()
{
state = ConnState::connectInProgress;
@@ -113,7 +113,7 @@ index d116f6d..cebc857 100644
self->state = ConnState::connected;
self->handleConnState();
});
-@@ -136,106 +170,159 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -135,106 +169,159 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
void sendMessage(const std::string& data)
{
@@ -207,15 +207,15 @@ index d116f6d..cebc857 100644
+ // Abort the connection since server is not keep-alive enabled
+ self->state = ConnState::abortConnection;
+ }
-+ // Transfer ownership of the response
++
++ // Returns ownership of the parsed message
+ self->parser->release();
+
+ self->handleConnState();
+ };
parser.emplace(std::piecewise_construct, std::make_tuple());
parser->body_limit(httpReadBodyLimit);
- // Since these are all push style eventing, we are not
- // bothered about response body parsing.
+
// Check only for the response header
parser->skip(true);
+ conn.expires_after(std::chrono::seconds(30));
@@ -296,7 +296,8 @@ index d116f6d..cebc857 100644
+ self->state = ConnState::closed;
+ self->handleConnState();
}
-- // Transfer ownership of the response
+-
+- // Returns ownership of the parsed message
- self->parser->release();
-
- self->handleConnState();
@@ -344,7 +345,7 @@ index d116f6d..cebc857 100644
}
}
-@@ -302,6 +389,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -301,6 +388,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
{
case ConnState::resolveInProgress:
case ConnState::connectInProgress:
@@ -352,7 +353,7 @@ index d116f6d..cebc857 100644
case ConnState::sendInProgress:
case ConnState::recvInProgress:
case ConnState::closeInProgress:
-@@ -333,6 +421,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -332,6 +420,7 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
}
case ConnState::resolveFailed:
case ConnState::connectFailed:
@@ -360,7 +361,7 @@ index d116f6d..cebc857 100644
case ConnState::sendFailed:
case ConnState::recvFailed:
case ConnState::retry:
-@@ -371,7 +460,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -370,7 +459,8 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
public:
explicit HttpClient(boost::asio::io_context& ioc, const std::string& id,
const std::string& destIP, const std::string& destPort,
@@ -370,7 +371,7 @@ index d116f6d..cebc857 100644
conn(ioc),
timer(ioc), req(boost::beast::http::verb::post, destUri, 11),
state(ConnState::initialized), subId(id), host(destIP), port(destPort),
-@@ -384,8 +474,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
+@@ -383,8 +473,11 @@ class HttpClient : public std::enable_shared_from_this<HttpClient>
req.keep_alive(true);
requestDataQueue.set_capacity(maxRequestQueueSize);
@@ -384,10 +385,10 @@ index d116f6d..cebc857 100644
{
if ((state == ConnState::suspended) || (state == ConnState::terminated))
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index bffa68f..1e6f496 100644
+index c999121..267c857 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -387,7 +387,7 @@ class Subscription
+@@ -398,7 +398,7 @@ class Subscription
{
conn = std::make_shared<crow::HttpClient>(
crow::connections::systemBus->get_io_context(), id, host, port,
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch
index 0d31fbc72..cd59ed94d 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch
@@ -1,7 +1,7 @@
-From e93a6a02b0fba3371144d474422fadacc3f25fde Mon Sep 17 00:00:00 2001
+From 0c531d959364192697290c1489d5f7b1bdd7a665 Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Fri, 12 Mar 2021 18:53:25 +0000
-Subject: [PATCH 4/6] Add Server-Sent-Events support
+Subject: [PATCH] Add Server-Sent-Events support
Server-Sent Events is a standard describing how servers can
initiate data transmission towards clients once an initial
@@ -24,13 +24,13 @@ Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
---
http/http_connection.hpp | 14 +-
http/http_response.hpp | 7 +-
- http/routing.hpp | 70 ++++++++++
+ http/routing.hpp | 71 ++++++++++
http/server_sent_event.hpp | 279 +++++++++++++++++++++++++++++++++++++
- 4 files changed, 364 insertions(+), 6 deletions(-)
+ 4 files changed, 365 insertions(+), 6 deletions(-)
create mode 100644 http/server_sent_event.hpp
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
-index 4482f8d..2c8bf40 100644
+index 6172b3a..fc9fc60 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -326,7 +326,7 @@ class Connection :
@@ -63,7 +63,7 @@ index 4482f8d..2c8bf40 100644
// delete lambda with self shared_ptr
// to enable connection destruction
diff --git a/http/http_response.hpp b/http/http_response.hpp
-index cd00ec8..ffd6dda 100644
+index 7965704..29c56e1 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -13,10 +13,15 @@ namespace crow
@@ -93,7 +93,7 @@ index cd00ec8..ffd6dda 100644
// In case of a JSON object, set the Content-Type header
void jsonMode()
diff --git a/http/routing.hpp b/http/routing.hpp
-index 65c7b70..0824939 100644
+index dd07523..7ddc6b0 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -6,6 +6,7 @@
@@ -104,7 +104,7 @@ index 65c7b70..0824939 100644
#include "sessions.hpp"
#include "utility.hpp"
#include "websocket.hpp"
-@@ -390,6 +391,67 @@ class WebSocketRule : public BaseRule
+@@ -398,6 +399,68 @@ class WebSocketRule : public BaseRule
std::function<void(crow::websocket::Connection&)> errorHandler;
};
@@ -119,10 +119,11 @@ index 65c7b70..0824939 100644
+ void validate() override
+ {}
+
-+ void handle(const Request&, Response& res, const RoutingParams&) override
++ void handle(const Request&,
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const RoutingParams&) override
+ {
-+ res.result(boost::beast::http::status::not_found);
-+ res.end();
++ asyncResp->res.result(boost::beast::http::status::not_found);
+ }
+
+ void handleUpgrade(const Request& req, Response&,
@@ -172,7 +173,7 @@ index 65c7b70..0824939 100644
template <typename T>
struct RuleParameterTraits
{
-@@ -402,6 +464,14 @@ struct RuleParameterTraits
+@@ -410,6 +473,14 @@ struct RuleParameterTraits
return *p;
}
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch
index 02d28833f..37609c154 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch
@@ -1,7 +1,7 @@
-From 698d2615c5bc30ab7f89f11ed5659df8bf248ea0 Mon Sep 17 00:00:00 2001
+From bcb80fc9a86555c74b56b5b37615601d3fbfae31 Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Tue, 16 Mar 2021 15:37:24 +0000
-Subject: [PATCH 5/6] Add SSE style subscription support to eventservice
+Subject: [PATCH] Add SSE style subscription support to eventservice
This commit adds the SSE style eventservice subscription
style event. Using this, end user can subscribe for
@@ -23,16 +23,16 @@ Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de
---
http/http_connection.hpp | 2 +-
include/eventservice_sse.hpp | 75 +++++
- .../include/event_service_manager.hpp | 77 ++++-
+ .../include/event_service_manager.hpp | 109 +++++--
redfish-core/include/server_sent_events.hpp | 291 ------------------
redfish-core/lib/event_service.hpp | 4 +-
src/webserver_main.cpp | 2 +
- 6 files changed, 149 insertions(+), 302 deletions(-)
+ 6 files changed, 163 insertions(+), 320 deletions(-)
create mode 100644 include/eventservice_sse.hpp
delete mode 100644 redfish-core/include/server_sent_events.hpp
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
-index 2c8bf40..1ab776c 100644
+index fc9fc60..3afb4da 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -350,7 +350,7 @@ class Connection :
@@ -126,7 +126,7 @@ index 0000000..6c98e6e
+} // namespace eventservice_sse
+} // namespace redfish
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index 5821e2e..f4d57c2 100644
+index fa4e41a..ac644c1 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -23,13 +23,15 @@
@@ -146,7 +146,7 @@ index 5821e2e..f4d57c2 100644
#include <cstdlib>
#include <ctime>
#include <fstream>
-@@ -46,9 +48,13 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
+@@ -46,9 +48,27 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
static constexpr const char* eventFormatType = "Event";
static constexpr const char* metricReportFormatType = "MetricReport";
@@ -157,11 +157,50 @@ index 5821e2e..f4d57c2 100644
+static constexpr const uint8_t maxNoOfSubscriptions = 20;
+static constexpr const uint8_t maxNoOfSSESubscriptions = 10;
+
- #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
- static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
- static constexpr const char* redfishEventLogDir = "/var/log";
-@@ -391,11 +397,9 @@ class Subscription
- path, uriProto);
++#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
++static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
++static constexpr const char* redfishEventLogDir = "/var/log";
++static constexpr const char* redfishEventLogFile = "/var/log/redfish";
++static constexpr const size_t iEventSize = sizeof(inotify_event);
++static int inotifyFd = -1;
++static int dirWatchDesc = -1;
++static int fileWatchDesc = -1;
++
++// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs>
++using EventLogObjectsType =
++ std::tuple<std::string, std::string, std::string, std::string, std::string,
++ std::vector<std::string>>;
++
+ namespace message_registries
+ {
+ inline boost::beast::span<const MessageEntry>
+@@ -68,24 +88,6 @@ inline boost::beast::span<const MessageEntry>
+ }
+ return boost::beast::span<const MessageEntry>(openbmc::registry);
+ }
+-} // namespace message_registries
+-
+-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
+-static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
+-static constexpr const char* redfishEventLogDir = "/var/log";
+-static constexpr const char* redfishEventLogFile = "/var/log/redfish";
+-static constexpr const size_t iEventSize = sizeof(inotify_event);
+-static int inotifyFd = -1;
+-static int dirWatchDesc = -1;
+-static int fileWatchDesc = -1;
+-
+-// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs>
+-using EventLogObjectsType =
+- std::tuple<std::string, std::string, std::string, std::string, std::string,
+- std::vector<std::string>>;
+-
+-namespace message_registries
+-{
+ static const Message*
+ getMsgFromRegistry(const std::string& messageKey,
+ const boost::beast::span<const MessageEntry>& registry)
+@@ -401,11 +403,9 @@ class Subscription
+ path);
}
- Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) :
@@ -175,7 +214,7 @@ index 5821e2e..f4d57c2 100644
~Subscription() = default;
-@@ -420,7 +424,7 @@ class Subscription
+@@ -430,7 +430,7 @@ class Subscription
if (sseConn != nullptr)
{
@@ -184,7 +223,7 @@ index 5821e2e..f4d57c2 100644
}
}
-@@ -510,6 +514,7 @@ class Subscription
+@@ -520,6 +520,7 @@ class Subscription
this->sendEvent(
msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
@@ -192,7 +231,7 @@ index 5821e2e..f4d57c2 100644
}
#endif
-@@ -565,14 +570,39 @@ class Subscription
+@@ -590,14 +591,39 @@ class Subscription
return eventSeqNum;
}
@@ -233,7 +272,7 @@ index 5821e2e..f4d57c2 100644
};
static constexpr const bool defaultEnabledState = true;
-@@ -963,6 +993,8 @@ class EventServiceManager
+@@ -988,6 +1014,8 @@ class EventServiceManager
subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval);
subValue->updateRetryPolicy();
@@ -242,7 +281,7 @@ index 5821e2e..f4d57c2 100644
return id;
}
-@@ -987,11 +1019,40 @@ class EventServiceManager
+@@ -1012,11 +1040,40 @@ class EventServiceManager
}
}
@@ -581,7 +620,7 @@ index 578fa19..0000000
-
-} // namespace crow
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
-index be6f04d..1875ec9 100644
+index 64a2009..7c9bb7a 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -34,8 +34,6 @@ static constexpr const std::array<const char*, 1> supportedResourceTypes = {
@@ -603,7 +642,7 @@ index be6f04d..1875ec9 100644
{{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}},
{"Actions",
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
-index 902c32b..c871faa 100644
+index 902c32b..d4bd48c 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -5,6 +5,7 @@
@@ -614,14 +653,14 @@ index 902c32b..c871faa 100644
#include <hostname_monitor.hpp>
#include <ibm/management_console_rest.hpp>
#include <image_upload.hpp>
-@@ -83,6 +84,7 @@ int main(int /*argc*/, char** /*argv*/)
+@@ -81,6 +82,7 @@ int main(int /*argc*/, char** /*argv*/)
+ #endif
+
#ifdef BMCWEB_ENABLE_REDFISH
++ redfish::eventservice_sse::requestRoutes(app);
redfish::requestRoutes(app);
redfish::RedfishService redfish(app);
-+ redfish::eventservice_sse::requestRoutes(app);
- // Create EventServiceManager instance and initialize Config
- redfish::EventServiceManager::getInstance();
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch
index 4d99b2754..16e8affa5 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch
@@ -1,7 +1,7 @@
-From 82185c52ae6e27cc1e086654a3b7d10e63ecc783 Mon Sep 17 00:00:00 2001
+From dda3c7a46391ef88e7c6a6f61fba7fe9133336bf Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Wed, 17 Mar 2021 01:16:50 +0000
-Subject: [PATCH 6/6] Add EventService SSE filter support
+Subject: [PATCH] Add EventService SSE filter support
This commit implements the Event Service SSE stream
filters support. As per redfish specification:
@@ -35,9 +35,9 @@ Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2
include/eventservice_sse.hpp | 94 ++++++++++++++++++-
redfish-core/include/error_messages.hpp | 9 ++
.../include/event_service_manager.hpp | 5 +
- redfish-core/lib/event_service.hpp | 4 -
+ redfish-core/lib/event_service.hpp | 5 -
redfish-core/src/error_messages.cpp | 26 +++++
- 5 files changed, 130 insertions(+), 8 deletions(-)
+ 5 files changed, 130 insertions(+), 9 deletions(-)
diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp
index 6c98e6e..ff72c4d 100644
@@ -171,7 +171,7 @@ index 7dfdc80..922dae9 100644
} // namespace redfish
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index f4d57c2..567fb9c 100644
+index ac644c1..3661fed 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile =
@@ -180,24 +180,25 @@ index f4d57c2..567fb9c 100644
+static constexpr const std::array<const char*, 2> supportedEvtFormatTypes = {
+ eventFormatType, metricReportFormatType};
-+static constexpr const std::array<const char*, 3> supportedRegPrefixes = {
-+ "Base", "OpenBMC", "Task"};
++static constexpr const std::array<const char*, 2> supportedRegPrefixes = {
++ "OpenBMC", "TaskEvent"};
+
#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
static constexpr const char* redfishEventLogDir = "/var/log";
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
-index 1875ec9..4d1ac9f 100644
+index 7c9bb7a..297a4ea 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
-@@ -19,10 +19,6 @@
+@@ -18,11 +18,6 @@
+
namespace redfish
{
-
+-
-static constexpr const std::array<const char*, 2> supportedEvtFormatTypes = {
- eventFormatType, metricReportFormatType};
-static constexpr const std::array<const char*, 3> supportedRegPrefixes = {
-- "Base", "OpenBMC", "Task"};
+- "Base", "OpenBMC", "TaskEvent"};
static constexpr const std::array<const char*, 3> supportedRetryPolicies = {
"TerminateAfterRetries", "SuspendRetries", "RetryForever"};
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch
new file mode 100644
index 000000000..0b12671e5
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch
@@ -0,0 +1,132 @@
+From 0a1390428fd6f5651669f4306f6105d33a24453c Mon Sep 17 00:00:00 2001
+From: Ayushi Smriti <smriti.ayushi@intel.com>
+Date: Mon, 10 May 2021 13:03:37 +0530
+Subject: [PATCH] EventService: Log events for subscription actions
+
+Log redfish event for below 3 actions
+ - Add new subscription
+ - Update existing subscription properties
+ - Delete existing subscription
+in order to notify the subscribed clients on the subscription related
+information.
+
+Modified method name accordingly to indicate the clear purpose and
+added updateSubscription method with subscription id param
+to log event for subscription update.
+
+Tested:
+ - Performed all the above actions and verified the redfish event
+ messages are logged.
+
+Change-Id: I528293e55b1f3401bc2bb09c11c63ae985fbfedb
+Signed-off-by: AppaRao Puli <apparao.puli@intel.com>
+Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
+---
+ .../include/event_service_manager.hpp | 35 ++++++++++++++++---
+ redfish-core/lib/event_service.hpp | 2 +-
+ 2 files changed, 32 insertions(+), 5 deletions(-)
+
+diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
+index 9952ef1..2b957ea 100644
+--- a/redfish-core/include/event_service_manager.hpp
++++ b/redfish-core/include/event_service_manager.hpp
+@@ -22,6 +22,7 @@
+ #include "registries/task_event_message_registry.hpp"
+
+ #include <sys/inotify.h>
++#include <systemd/sd-journal.h>
+
+ #include <boost/asio/io_context.hpp>
+ #include <boost/beast/core/span.hpp>
+@@ -800,7 +801,7 @@ class EventServiceManager
+ return;
+ }
+
+- void updateSubscriptionData()
++ void persistSubscriptionData()
+ {
+ // Persist the config and subscription data.
+ nlohmann::json jsonData;
+@@ -897,7 +898,7 @@ class EventServiceManager
+
+ if (updateConfig)
+ {
+- updateSubscriptionData();
++ persistSubscriptionData();
+ }
+
+ if (updateRetryCfg)
+@@ -992,7 +993,7 @@ class EventServiceManager
+
+ if (updateFile)
+ {
+- updateSubscriptionData();
++ persistSubscriptionData();
+ }
+
+ #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
+@@ -1007,6 +1008,13 @@ class EventServiceManager
+
+ // Set Subscription ID for back trace
+ subValue->setSubscriptionId(id);
++
++ /* Log event for subscription addition */
++ sd_journal_send("MESSAGE=Event subscription added(Id: %s)", id.c_str(),
++ "PRIORITY=%i", LOG_INFO, "REDFISH_MESSAGE_ID=%s",
++ "OpenBMC.0.1.EventSubscriptionAdded",
++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL);
++
+ return id;
+ }
+
+@@ -1027,7 +1035,14 @@ class EventServiceManager
+ {
+ subscriptionsMap.erase(obj);
+ updateNoOfSubscribersCount();
+- updateSubscriptionData();
++
++ persistSubscriptionData();
++ /* Log event for subscription delete. */
++ sd_journal_send("MESSAGE=Event subscription removed.(Id = %s)",
++ id.c_str(), "PRIORITY=%i", LOG_INFO,
++ "REDFISH_MESSAGE_ID=%s",
++ "OpenBMC.0.1.EventSubscriptionRemoved",
++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL);
+ }
+ }
+
+@@ -1049,6 +1064,18 @@ class EventServiceManager
+ }
+ }
+
++ void updateSubscription(const std::string& id)
++ {
++ persistSubscriptionData();
++
++ /* Log event for subscription update. */
++ sd_journal_send("MESSAGE=Event subscription updated.(Id = %s)",
++ id.c_str(), "PRIORITY=%i", LOG_INFO,
++ "REDFISH_MESSAGE_ID=%s",
++ "OpenBMC.0.1.EventSubscriptionUpdated",
++ "REDFISH_MESSAGE_ARGS=%s", id.c_str(), NULL);
++ }
++
+ size_t getNumberOfSubscriptions()
+ {
+ return subscriptionsMap.size();
+diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
+index 297a4ea..ed4955e 100644
+--- a/redfish-core/lib/event_service.hpp
++++ b/redfish-core/lib/event_service.hpp
+@@ -616,7 +616,7 @@ class EventDestination : public Node
+ subValue->updateRetryPolicy();
+ }
+
+- EventServiceManager::getInstance().updateSubscriptionData();
++ EventServiceManager::getInstance().updateSubscription(params[0]);
+ }
+
+ void doDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README
index 3954e89c1..ae010dafb 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README
@@ -4,16 +4,16 @@ thee gets merged upstream.
Upstream revision information:
- EventService : Fix retry handling for http-client
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/18
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/20
- EventService: https client support
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/38
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/39
- Add Server-Sent-Events support
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/5
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/6
- Add SSE style subscription support to eventservice
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/5
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/6
- Add EventService SSE filter support
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/2
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/3
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch
index 03feec633..8b08c6c5e 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch
@@ -1,7 +1,7 @@
-From b6ccf463b4cfb8df4a904f06c5f4852029a96c50 Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Tue, 15 Dec 2020 12:28:17 +0100
-Subject: [PATCH 3/4] Add support for MetricDefinition scheme
+From d664a145a96a642597c74819c183410d4a04fce0 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Tue, 13 Apr 2021 13:00:18 +0000
+Subject: [PATCH] Add support for MetricDefinition scheme
Added MetricDefinition node to Redfish code. Now user is able
to list all available metrics in OpenBMC that are supported
@@ -23,16 +23,16 @@ Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00
---
redfish-core/include/redfish.hpp | 3 +
.../include/utils/telemetry_utils.hpp | 2 +
- redfish-core/lib/metric_definition.hpp | 283 ++++++++++++++++++
+ redfish-core/lib/metric_definition.hpp | 335 ++++++++++++++++++
redfish-core/lib/telemetry_service.hpp | 2 +
- 4 files changed, 290 insertions(+)
+ 4 files changed, 342 insertions(+)
create mode 100644 redfish-core/lib/metric_definition.hpp
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index aad28ac..dfcb8cd 100644
+index 7a14969..d280a86 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
-@@ -25,6 +25,7 @@
+@@ -26,6 +26,7 @@
#include "../lib/managers.hpp"
#include "../lib/memory.hpp"
#include "../lib/message_registries.hpp"
@@ -40,7 +40,7 @@ index aad28ac..dfcb8cd 100644
#include "../lib/metric_report.hpp"
#include "../lib/metric_report_definition.hpp"
#include "../lib/network_protocol.hpp"
-@@ -215,6 +216,8 @@ class RedfishService
+@@ -219,6 +220,8 @@ class RedfishService
nodes.emplace_back(std::make_unique<HypervisorResetActionInfo>(app));
nodes.emplace_back(std::make_unique<TelemetryService>(app));
@@ -50,7 +50,7 @@ index aad28ac..dfcb8cd 100644
std::make_unique<MetricReportDefinitionCollection>(app));
nodes.emplace_back(std::make_unique<MetricReportDefinition>(app));
diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
-index 0a3af5f..54b5133 100644
+index 5872350..1b4f75d 100644
--- a/redfish-core/include/utils/telemetry_utils.hpp
+++ b/redfish-core/include/utils/telemetry_utils.hpp
@@ -10,6 +10,8 @@ namespace telemetry
@@ -64,12 +64,13 @@ index 0a3af5f..54b5133 100644
constexpr const char* metricReportUri =
diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp
new file mode 100644
-index 0000000..f9c7779
+index 0000000..515fe86
--- /dev/null
+++ b/redfish-core/lib/metric_definition.hpp
-@@ -0,0 +1,283 @@
+@@ -0,0 +1,335 @@
+#pragma once
+
++#include "async_resp.hpp"
+#include "node.hpp"
+#include "sensors.hpp"
+#include "utils/telemetry_utils.hpp"
@@ -80,150 +81,138 @@ index 0000000..f9c7779
+namespace utils
+{
+
++class AsyncRespWithFinalizer
++{
++ public:
++ AsyncRespWithFinalizer(
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) :
++ asyncResp(asyncResp)
++ {}
++
++ AsyncRespWithFinalizer(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ std::function<void(crow::Response&)> finalizer) :
++ asyncResp(asyncResp),
++ finalizer(std::move(finalizer))
++ {}
++
++ AsyncRespWithFinalizer(const AsyncRespWithFinalizer&) = delete;
++ AsyncRespWithFinalizer(AsyncRespWithFinalizer&&) = delete;
++
++ ~AsyncRespWithFinalizer()
++ {
++ if (finalizer)
++ {
++ try
++ {
++ finalizer(asyncResp->res);
++ }
++ catch (const std::exception& e)
++ {
++ BMCWEB_LOG_ERROR << "Executing finalizer failed: " << e.what();
++ messages::internalError(asyncResp->res);
++ }
++ }
++ }
++
++ void setFinalizer(std::function<void(crow::Response&)> newFinalizer)
++ {
++ finalizer = std::move(newFinalizer);
++ }
++
++ private:
++ std::shared_ptr<bmcweb::AsyncResp> asyncResp;
++ std::function<void(crow::Response&)> finalizer;
++
++ public:
++ crow::Response& res = asyncResp->res;
++};
++
+template <typename F>
-+inline void getChassisNames(F&& cb, const std::shared_ptr<AsyncResp>& asyncResp)
++inline void getChassisNames(F&& cb)
+{
+ const std::array<const char*, 2> interfaces = {
+ "xyz.openbmc_project.Inventory.Item.Board",
+ "xyz.openbmc_project.Inventory.Item.Chassis"};
+
+ crow::connections::systemBus->async_method_call(
-+ [asyncResp,
-+ callback = std::move(cb)](const boost::system::error_code ec,
-+ std::vector<std::string>& chassis) {
++ [callback = std::move(cb)](const boost::system::error_code ec,
++ const std::vector<std::string>& chassis) {
++ std::vector<std::string> chassisNames;
++
+ if (ec)
+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_DEBUG << "DBus call error: " << ec.value();
++ callback(ec, chassisNames);
+ return;
+ }
+
-+ std::vector<std::string> chassisNames;
+ chassisNames.reserve(chassis.size());
-+ for (const auto& path : chassis)
++ for (const std::string& path : chassis)
+ {
+ sdbusplus::message::object_path dbusPath = path;
+ std::string name = dbusPath.filename();
+ if (name.empty())
+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "Invalid chassis: " << dbusPath.str;
++ callback(boost::system::errc::make_error_code(
++ boost::system::errc::invalid_argument),
++ chassisNames);
+ return;
+ }
+ chassisNames.emplace_back(std::move(name));
+ }
+
-+ callback(chassisNames);
++ callback(ec, chassisNames);
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ "/xyz/openbmc_project/inventory", 0, interfaces);
+}
++
+} // namespace utils
+
+namespace telemetry
+{
+
-+class MetricDefinitionCollectionReduce
++void addMembers(crow::Response& res,
++ const boost::container::flat_map<std::string, std::string>& el)
+{
-+ public:
-+ MetricDefinitionCollectionReduce(
-+ const std::shared_ptr<AsyncResp>& asyncResp) :
-+ asyncResp{asyncResp}
-+ {}
-+
-+ ~MetricDefinitionCollectionReduce()
++ for (const auto& [_, dbusSensor] : el)
+ {
-+ if (asyncResp->res.result() != boost::beast::http::status::ok)
++ sdbusplus::message::object_path path(dbusSensor);
++ sdbusplus::message::object_path parentPath = path.parent_path();
++ std::string type = parentPath.filename();
++ if (type.empty())
+ {
-+ return;
++ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = "
++ << dbusSensor;
++ continue;
+ }
+
-+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
-+ members = nlohmann::json::array();
++ nlohmann::json& members = res.jsonValue["Members"];
+
-+ for (const std::string& type : dbusTypes)
-+ {
-+ members.push_back(
-+ {{"@odata.id", telemetry::metricDefinitionUri + type}});
-+ }
-+ asyncResp->res.jsonValue["Members@odata.count"] = members.size();
-+ }
++ const std::string odataId =
++ telemetry::metricDefinitionUri + std::move(type);
+
-+ void insert(const boost::container::flat_map<std::string, std::string>& el)
-+ {
-+ for (const auto& [_, dbusSensor] : el)
-+ {
-+ sdbusplus::message::object_path path(dbusSensor);
-+ sdbusplus::message::object_path parentPath = path.parent_path();
-+ std::string type = parentPath.filename();
-+ if (type.empty())
-+ {
-+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = "
-+ << dbusSensor;
-+ continue;
-+ }
++ const auto it =
++ std::find_if(members.begin(), members.end(),
++ [&odataId](const nlohmann::json& item) {
++ auto kt = item.find("@odata.id");
++ if (kt == item.end())
++ {
++ return false;
++ }
++ return kt->get<std::string>() == odataId;
++ });
+
-+ dbusTypes.insert(std::move(type));
-+ }
-+ }
-+
-+ private:
-+ const std::shared_ptr<AsyncResp> asyncResp;
-+ boost::container::flat_set<std::string> dbusTypes;
-+};
-+
-+class MetricDefinitionReduce
-+{
-+ public:
-+ MetricDefinitionReduce(const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::string& id) :
-+ id(id),
-+ pattern{'/' + id + '/'}, asyncResp{asyncResp}
-+ {}
-+ ~MetricDefinitionReduce()
-+ {
-+ if (asyncResp->res.result() != boost::beast::http::status::ok)
-+ {
-+ return;
-+ }
-+ if (redfishSensors.empty())
++ if (it == members.end())
+ {
-+ messages::resourceNotFound(asyncResp->res, "MetricDefinition", id);
-+ return;
++ members.push_back({{"@odata.id", odataId}});
+ }
+
-+ asyncResp->res.jsonValue["MetricProperties"] = redfishSensors;
-+ asyncResp->res.jsonValue["Id"] = id;
-+ asyncResp->res.jsonValue["Name"] = id;
-+ asyncResp->res.jsonValue["@odata.id"] =
-+ telemetry::metricDefinitionUri + id;
-+ asyncResp->res.jsonValue["@odata.type"] =
-+ "#MetricDefinition.v1_0_3.MetricDefinition";
-+ asyncResp->res.jsonValue["MetricDataType"] = "Decimal";
-+ asyncResp->res.jsonValue["MetricType"] = "Numeric";
-+ asyncResp->res.jsonValue["IsLinear"] = true;
-+ asyncResp->res.jsonValue["Units"] = sensors::toReadingUnits(id);
-+ }
-+
-+ void insert(const boost::container::flat_map<std::string, std::string>& el)
-+ {
-+ for (const auto& [redfishSensor, dbusSensor] : el)
-+ {
-+ if (dbusSensor.find(pattern) != std::string::npos)
-+ {
-+ redfishSensors.push_back(redfishSensor);
-+ }
-+ }
++ res.jsonValue["Members@odata.count"] = members.size();
+ }
++}
+
-+ private:
-+ const std::string id;
-+ const std::string pattern;
-+ const std::shared_ptr<AsyncResp> asyncResp;
-+ std::vector<std::string> redfishSensors;
-+};
+} // namespace telemetry
+
+class MetricDefinitionCollection : public Node
@@ -242,52 +231,83 @@ index 0000000..f9c7779
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>&) override
++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request&, const std::vector<std::string>&) override
+ {
-+ res.jsonValue["@odata.type"] = "#MetricDefinitionCollection."
-+ "MetricDefinitionCollection";
-+ res.jsonValue["@odata.id"] =
++ asyncResp->res.jsonValue["@odata.type"] = "#MetricDefinitionCollection."
++ "MetricDefinitionCollection";
++ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/TelemetryService/MetricDefinitions";
-+ res.jsonValue["Name"] = "Metric Definition Collection";
-+ res.jsonValue["Members"] = nlohmann::json::array();
-+ res.jsonValue["Members@odata.count"] = 0;
++ asyncResp->res.jsonValue["Name"] = "Metric Definition Collection";
++ asyncResp->res.jsonValue["Members"] = nlohmann::json::array();
++ asyncResp->res.jsonValue["Members@odata.count"] = 0;
++
++ auto handleRetrieveUriToDbusMap =
++ [asyncResp](
++ const boost::beast::http::status status,
++ const boost::container::flat_map<std::string, std::string>&
++ uriToDbus) {
++ if (status != boost::beast::http::status::ok)
++ {
++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus "
++ "sensors map with err "
++ << static_cast<unsigned>(status);
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ telemetry::addMembers(asyncResp->res, uriToDbus);
++ };
+
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ utils::getChassisNames(
-+ [asyncResp](const std::vector<std::string>& chassisNames) {
-+ auto collectionReduce = std::make_shared<
-+ telemetry::MetricDefinitionCollectionReduce>(asyncResp);
++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap),
++ asyncResp](boost::system::error_code ec,
++ const std::vector<std::string>& chassisNames) {
++ if (ec)
++ {
++ messages::internalError(asyncResp->res);
++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value();
++ return;
++ }
++
+ for (const std::string& chassisName : chassisNames)
+ {
+ for (const auto& [sensorNode, _] : sensors::dbus::paths)
+ {
-+ BMCWEB_LOG_INFO << "Chassis: " << chassisName
-+ << " sensor: " << sensorNode;
-+ retrieveUriToDbusMap(
-+ chassisName, sensorNode.data(),
-+ [asyncResp, collectionReduce](
-+ const boost::beast::http::status status,
-+ const boost::container::flat_map<
-+ std::string, std::string>& uriToDbus) {
-+ if (status != boost::beast::http::status::ok)
-+ {
-+ BMCWEB_LOG_ERROR
-+ << "Failed to retrieve URI to dbus "
-+ "sensors map with err "
-+ << static_cast<unsigned>(status);
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+ collectionReduce->insert(uriToDbus);
-+ });
++ BMCWEB_LOG_DEBUG << "Chassis: " << chassisName
++ << " sensor: " << sensorNode;
++ retrieveUriToDbusMap(chassisName, sensorNode.data(),
++ handleRetrieveUriToDbusMap);
+ }
+ }
-+ },
-+ asyncResp);
++ });
+ }
+};
+
++namespace telemetry
++{
++
++void addMetricProperty(
++ utils::AsyncRespWithFinalizer& asyncResp, const std::string& id,
++ const boost::container::flat_map<std::string, std::string>& el)
++{
++ nlohmann::json& metricProperties =
++ asyncResp.res.jsonValue["MetricProperties"];
++
++ for (const auto& [redfishSensor, dbusSensor] : el)
++ {
++ std::string sensorId;
++ if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId))
++ {
++ if (sensorId == id)
++ {
++ metricProperties.push_back(redfishSensor);
++ }
++ }
++ }
++}
++
++} // namespace telemetry
++
+class MetricDefinition : public Node
+{
+ public:
@@ -305,65 +325,97 @@ index 0000000..f9c7779
+ }
+
+ private:
-+ void doGet(crow::Response& res, const crow::Request&,
++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
++ auto telemetryAsyncResp =
++ std::make_shared<utils::AsyncRespWithFinalizer>(asyncResp);
++
+ if (params.size() != 1)
+ {
-+ messages::internalError(asyncResp->res);
++ messages::internalError(telemetryAsyncResp->res);
+ return;
+ }
+
+ const std::string& id = params[0];
++ telemetryAsyncResp->setFinalizer([id](crow::Response& res) {
++ if (res.jsonValue["MetricProperties"].empty())
++ {
++ messages::resourceNotFound(res, "MetricDefinition", id);
++ }
++ });
++
++ telemetryAsyncResp->res.jsonValue["MetricProperties"] =
++ nlohmann::json::array();
++ telemetryAsyncResp->res.jsonValue["Id"] = id;
++ telemetryAsyncResp->res.jsonValue["Name"] = id;
++ telemetryAsyncResp->res.jsonValue["@odata.id"] =
++ telemetry::metricDefinitionUri + id;
++ telemetryAsyncResp->res.jsonValue["@odata.type"] =
++ "#MetricDefinition.v1_0_3.MetricDefinition";
++ telemetryAsyncResp->res.jsonValue["MetricDataType"] = "Decimal";
++ telemetryAsyncResp->res.jsonValue["MetricType"] = "Numeric";
++ telemetryAsyncResp->res.jsonValue["IsLinear"] = true;
++ telemetryAsyncResp->res.jsonValue["Units"] =
++ sensors::toReadingUnits(id);
++
++ auto handleRetrieveUriToDbusMap =
++ [telemetryAsyncResp,
++ id](const boost::beast::http::status status,
++ const boost::container::flat_map<std::string, std::string>&
++ uriToDbus) {
++ if (status != boost::beast::http::status::ok)
++ {
++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus "
++ "sensors map with err "
++ << static_cast<unsigned>(status);
++ messages::internalError(telemetryAsyncResp->res);
++ return;
++ }
++ telemetry::addMetricProperty(*telemetryAsyncResp, id,
++ uriToDbus);
++ };
++
+ utils::getChassisNames(
-+ [asyncResp, id](const std::vector<std::string>& chassisNames) {
-+ auto definitionGather =
-+ std::make_shared<telemetry::MetricDefinitionReduce>(
-+ asyncResp, id);
++ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap),
++ telemetryAsyncResp,
++ id](boost::system::error_code ec,
++ const std::vector<std::string>& chassisNames) {
++ if (ec)
++ {
++ messages::internalError(telemetryAsyncResp->res);
++ BMCWEB_LOG_ERROR << "getChassisNames error: " << ec.value();
++ return;
++ }
++
+ for (const std::string& chassisName : chassisNames)
+ {
+ for (const auto& [sensorNode, dbusPaths] :
+ sensors::dbus::paths)
+ {
-+ retrieveUriToDbusMap(
-+ chassisName, sensorNode.data(),
-+ [asyncResp, definitionGather](
-+ const boost::beast::http::status status,
-+ const boost::container::flat_map<
-+ std::string, std::string>& uriToDbus) {
-+ if (status != boost::beast::http::status::ok)
-+ {
-+ BMCWEB_LOG_ERROR
-+ << "Failed to retrieve URI to dbus "
-+ "sensors map with err "
-+ << static_cast<unsigned>(status);
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+ definitionGather->insert(uriToDbus);
-+ });
++ retrieveUriToDbusMap(chassisName, sensorNode.data(),
++ handleRetrieveUriToDbusMap);
+ }
+ }
-+ },
-+ asyncResp);
++ });
+ }
+};
+
+} // namespace redfish
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
-index 61ca891..a8c8b03 100644
+index 9ec0737..de9c800 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -32,6 +32,8 @@ class TelemetryService : public Node
- res.jsonValue["Id"] = "TelemetryService";
- res.jsonValue["Name"] = "Telemetry Service";
+ asyncResp->res.jsonValue["Id"] = "TelemetryService";
+ asyncResp->res.jsonValue["Name"] = "Telemetry Service";
-+ res.jsonValue["MetricDefinitions"]["@odata.id"] =
++ asyncResp->res.jsonValue["MetricDefinitions"]["@odata.id"] =
+ "/redfish/v1/TelemetryService/MetricDefinitions";
- res.jsonValue["MetricReportDefinitions"]["@odata.id"] =
+ asyncResp->res.jsonValue["MetricReportDefinitions"]["@odata.id"] =
"/redfish/v1/TelemetryService/MetricReportDefinitions";
- res.jsonValue["MetricReports"]["@odata.id"] =
+ asyncResp->res.jsonValue["MetricReports"]["@odata.id"] =
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch
index f2ebce6e3..4119045f1 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch
@@ -1,7 +1,7 @@
-From efcd128a3d66fce33200fd4211ba5abf13a81375 Mon Sep 17 00:00:00 2001
+From 0ed9ff4f37e7d3ea81073ad35acd530730104033 Mon Sep 17 00:00:00 2001
From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
Date: Tue, 15 Dec 2020 12:30:31 +0100
-Subject: [PATCH 4/4] Sync Telmetry service with EventService
+Subject: [PATCH] Sync Telmetry service with EventService
Synced the latest changes in Telemetry service with Event Service
code. Now assembling MetricReport is covered in single place in
@@ -22,7 +22,7 @@ Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2 files changed, 69 insertions(+), 115 deletions(-)
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index 148c703..27e41e3 100644
+index c3c110a..dc99cda 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -14,6 +14,7 @@
@@ -33,7 +33,7 @@ index 148c703..27e41e3 100644
#include "node.hpp"
#include "registries.hpp"
#include "registries/base_message_registry.hpp"
-@@ -512,47 +513,32 @@ class Subscription
+@@ -529,47 +530,32 @@ class Subscription
}
#endif
@@ -92,7 +92,7 @@ index 148c703..27e41e3 100644
this->sendEvent(
msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
}
-@@ -1348,75 +1334,6 @@ class EventServiceManager
+@@ -1421,75 +1407,6 @@ class EventServiceManager
}
#endif
@@ -168,7 +168,7 @@ index 148c703..27e41e3 100644
void unregisterMetricReportSignal()
{
if (matchTelemetryMonitor)
-@@ -1436,9 +1353,11 @@ class EventServiceManager
+@@ -1509,9 +1426,11 @@ class EventServiceManager
}
BMCWEB_LOG_DEBUG << "Metrics report signal - Register";
@@ -183,7 +183,7 @@ index 148c703..27e41e3 100644
matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>(
*crow::connections::systemBus, matchStr,
-@@ -1449,10 +1368,43 @@ class EventServiceManager
+@@ -1522,10 +1441,43 @@ class EventServiceManager
return;
}
@@ -232,14 +232,14 @@ index 148c703..27e41e3 100644
}
diff --git a/redfish-core/lib/metric_report.hpp b/redfish-core/lib/metric_report.hpp
-index 9caf4a3..e79a41c 100644
+index ad15a05..18a6dcc 100644
--- a/redfish-core/lib/metric_report.hpp
+++ b/redfish-core/lib/metric_report.hpp
@@ -31,16 +31,14 @@ inline nlohmann::json toMetricValues(const Readings& readings)
return metricValues;
}
--inline void fillReport(const std::shared_ptr<AsyncResp>& asyncResp,
+-inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& id,
+inline bool fillReport(nlohmann::json& json, const std::string& id,
const std::variant<TimestampReadings>& var)
@@ -258,7 +258,7 @@ index 9caf4a3..e79a41c 100644
telemetry::metricReportDefinitionUri + id;
const TimestampReadings* timestampReadings =
-@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr<AsyncResp>& asyncResp,
+@@ -48,14 +46,14 @@ inline void fillReport(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
if (!timestampReadings)
{
BMCWEB_LOG_ERROR << "Property type mismatch or property is missing";
@@ -277,7 +277,7 @@ index 9caf4a3..e79a41c 100644
}
} // namespace telemetry
-@@ -146,7 +144,11 @@ class MetricReport : public Node
+@@ -145,7 +143,11 @@ class MetricReport : public Node
return;
}
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README
index 46128f7ae..20c93c08e 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README
@@ -3,8 +3,8 @@ Until change is integrated they will be manually merged here to enable feature i
Current revisions:
- Add support for MetricDefinition scheme
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/60
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/72
- Sync Telmetry service with EventService
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/26
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/30
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch
index 3e3f69d1c..3e3f69d1c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0038-Revert-Disable-nbd-proxy-from-the-build.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch
index 01c1c858c..01c1c858c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-bmcweb-handle-device-or-resource-busy-exception.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch
index ec6d70df1..41c1c9836 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch
@@ -1,4 +1,4 @@
-From 4af788655c5b5a5fae4d85b365a70dc619810fe0 Mon Sep 17 00:00:00 2001
+From d303bfdd6778c43096401ff78fab70f9041cd4cf Mon Sep 17 00:00:00 2001
From: Karol Wachowski <karol.wachowski@intel.com>
Date: Thu, 11 Feb 2021 08:35:41 +0000
Subject: [PATCH] Add ConnectedVia property to virtual media item template
@@ -12,10 +12,10 @@ Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
1 file changed, 1 insertion(+)
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
-index 188248a..80e7315 100644
+index c45fed2..aa7c639 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
-@@ -192,6 +192,7 @@ static nlohmann::json vmItemTemplate(const std::string& name,
+@@ -193,6 +193,7 @@ static nlohmann::json vmItemTemplate(const std::string& name,
item["@odata.id"] =
"/redfish/v1/Managers/" + name + "/VirtualMedia/" + resName;
item["@odata.type"] = "#VirtualMedia.v1_3_0.VirtualMedia";
@@ -23,3 +23,6 @@ index 188248a..80e7315 100644
item["Name"] = "Virtual Removable Media";
item["Id"] = resName;
item["WriteProtected"] = true;
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch
index c9a4119a1..3a9e67217 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch
@@ -1,9 +1,8 @@
-
-From 1bbabe4ecdeea20da809b9f1d8e194683629517c Mon Sep 17 00:00:00 2001
+From 805641a2d189da9befc05168f51cef76da1ba326 Mon Sep 17 00:00:00 2001
From: Alicja Rybak <alicja.rybak@intel.com>
Date: Tue, 20 Apr 2021 16:32:37 +0200
-Subject: [PATCH] Invalid status code from InsertMedia REST methods GET, PUT,
- DELETE, PATCH in proxy mode
+Subject: [PATCH] Invalid status code from InsertMedia REST methods GET,
+ PUT, DELETE, PATCH in proxy mode
Add handlers for GET, PUT, DELETE, PATCH method and function that
checks which mode is used and set suitable status code:
@@ -12,14 +11,14 @@ Not allowed for Legacy and Not found for Proxy.
Change-Id: Ib4c0a3e9a2a8853caa74c59239d9fcfed99c5e8b
Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
---
- redfish-core/lib/virtual_media.hpp | 154 +++++++++++++++++++++++++++++
- 1 file changed, 154 insertions(+)
+ redfish-core/lib/virtual_media.hpp | 155 +++++++++++++++++++++++++++++
+ 1 file changed, 155 insertions(+)
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
-index 8353ce7..66bf220 100644
+index aa7c639..3e28164 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
-@@ -530,6 +530,160 @@ class VirtualMediaActionInsertMedia : public Node
+@@ -548,6 +548,161 @@ class VirtualMediaActionInsertMedia : public Node
return true;
}
@@ -28,15 +27,13 @@ index 8353ce7..66bf220 100644
+ * and sets suitable response code for unsupported REST method.
+ *
+ */
-+ void CheckProxyMode(crow::Response& res,
++ void CheckProxyMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+ const crow::Request& req,
+ const std::vector<std::string>& params)
+ {
-+ auto aResp = std::make_shared<AsyncResp>(res);
-+
+ if (params.size() != 2)
+ {
-+ messages::internalError(res);
++ messages::internalError(aResp->res);
+ return;
+ }
+
@@ -45,7 +42,8 @@ index 8353ce7..66bf220 100644
+
+ if (params[0] != "bmc")
+ {
-+ messages::resourceNotFound(res, "VirtualMedia.Insert", resName);
++ messages::resourceNotFound(aResp->res, "VirtualMedia.Insert",
++ resName);
+
+ return;
+ }
@@ -58,8 +56,7 @@ index 8353ce7..66bf220 100644
+ {
+ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
+ << ec;
-+ aResp->res.result(
-+ boost::beast::http::status::not_found);
++ aResp->res.result(boost::beast::http::status::not_found);
+
+ return;
+ }
@@ -109,9 +106,8 @@ index 8353ce7..66bf220 100644
+ BMCWEB_LOG_DEBUG << "InsertMedia only allowed "
+ "with POST method "
+ "in legacy mode";
-+ aResp->res.result(
-+ boost::beast::http::status::
-+ method_not_allowed);
++ aResp->res.result(boost::beast::http::status::
++ method_not_allowed);
+
+ return;
+ }
@@ -144,39 +140,46 @@ index 8353ce7..66bf220 100644
+ /**
+ * @brief Function handles GET method request.
+ */
-+ void doGet(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request& req,
++ const std::vector<std::string>& params) override
+ {
-+ CheckProxyMode(res, req, params);
++ CheckProxyMode(asyncResp, req, params);
+ }
+
+ /**
+ * @brief Function handles PATCH method request.
+ */
-+ void doPatch(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doPatch(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request& req,
++ const std::vector<std::string>& params) override
+ {
-+ CheckProxyMode(res, req, params);
++ CheckProxyMode(asyncResp, req, params);
+ }
+
+ /**
+ * @brief Function handles PUT method request.
+ */
-+ void doPut(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doPut(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request& req,
++ const std::vector<std::string>& params) override
+ {
-+ CheckProxyMode(res, req, params);
++ CheckProxyMode(asyncResp, req, params);
+ }
+
+ /**
+ * @brief Function handles DELETE method request.
+ */
-+ void doDelete(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>& params) override
++ void doDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
++ const crow::Request& req,
++ const std::vector<std::string>& params) override
+ {
-+ CheckProxyMode(res, req, params);
++ CheckProxyMode(asyncResp, req, params);
+ }
+
/**
* @brief Function handles POST method request.
*
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch
index eaba041d5..3d80aeb20 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch
@@ -1,4 +1,4 @@
-From dab4adbf211b6867f86fcf6080b34a0e41f6f4a1 Mon Sep 17 00:00:00 2001
+From 89ca38dbc3433b3b734a20068e599809f3bd7b90 Mon Sep 17 00:00:00 2001
From: Karol Wachowski <karol.wachowski@intel.com>
Date: Tue, 23 Feb 2021 15:53:16 +0000
Subject: [PATCH] Set Inserted redfish property for not inserted resources
@@ -11,10 +11,10 @@ Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
-index 188248a..f477f63 100644
+index 3e28164..4c475b7 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
-@@ -95,6 +95,7 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface,
+@@ -96,6 +96,7 @@ static void
BMCWEB_LOG_DEBUG << "Value Active not found";
return;
}
@@ -22,7 +22,7 @@ index 188248a..f477f63 100644
const std::string* endpointIdValue =
std::get_if<std::string>(&endpointIdProperty->second);
-@@ -106,7 +107,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface,
+@@ -107,7 +108,6 @@ static void
aResp->res.jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] =
*endpointIdValue;
aResp->res.jsonValue["TransferProtocolType"] = "OEM";
@@ -30,7 +30,7 @@ index 188248a..f477f63 100644
if (*activeValue == true)
{
aResp->res.jsonValue["ConnectedVia"] = "Applet";
-@@ -137,7 +137,6 @@ static void vmParseInterfaceObject(const DbusInterfaceType& interface,
+@@ -138,7 +138,6 @@ static void
}
aResp->res.jsonValue["Image"] = *imageUrlValue;
@@ -38,3 +38,6 @@ index 188248a..f477f63 100644
aResp->res.jsonValue["TransferProtocolType"] =
getTransferProtocolTypeFromUri(*imageUrlValue);
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch
index 074718349..efce3e72c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0006-Bmcweb-handle-permission-denied-exception.patch
@@ -1,4 +1,4 @@
-From 81f2c022b22ef75990f30e5ba5bfd4ba5bd41754 Mon Sep 17 00:00:00 2001
+From e7018ea9e3ad1a17e096aec3717a4764c3feac2e Mon Sep 17 00:00:00 2001
From: Alicja Rybak <alicja.rybak@intel.com>
Date: Wed, 14 Apr 2021 16:26:59 +0200
Subject: [PATCH] Bmcweb handle permission denied exception
@@ -17,10 +17,10 @@ Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
1 file changed, 8 insertions(+)
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
-index 365290b..bbdc91b 100644
+index 4c475b7..8151ac0 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
-@@ -900,6 +900,10 @@ class VirtualMediaActionInsertMedia : public Node
+@@ -1073,6 +1073,10 @@ class VirtualMediaActionInsertMedia : public Node
{
messages::resourceInUse(asyncResp->res);
}
@@ -31,7 +31,7 @@ index 365290b..bbdc91b 100644
else
{
messages::internalError(asyncResp->res);
-@@ -1092,6 +1096,10 @@ class VirtualMediaActionEjectMedia : public Node
+@@ -1267,6 +1271,10 @@ class VirtualMediaActionEjectMedia : public Node
{
messages::resourceInUse(asyncResp->res);
}
@@ -42,3 +42,6 @@ index 365290b..bbdc91b 100644
else
{
messages::internalError(asyncResp->res);
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch
index acfd9225b..88fa89465 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0007-Fix-unmounting-image-in-proxy-mode.patch
@@ -1,4 +1,4 @@
-From 9493bb8e2f5c708e187313c86e6033de5f103c51 Mon Sep 17 00:00:00 2001
+From 6f4b5fc1879f39b0f5fee0838f0ecbc481275d5e Mon Sep 17 00:00:00 2001
From: Alicja Rybak <alicja.rybak@intel.com>
Date: Fri, 23 Apr 2021 17:35:52 +0200
Subject: [PATCH] Fix unmounting image in proxy mode.
@@ -16,10 +16,10 @@ Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
-index 7b90e90..fa7f647 100644
+index 3b28823..897bcf2 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
-@@ -428,9 +428,9 @@ inline void requestRoutes(App& app)
+@@ -439,9 +439,9 @@ inline void requestRoutes(App& app)
BMCWEB_LOG_DEBUG << "No session to close";
return;
}
@@ -30,3 +30,6 @@ index 7b90e90..fa7f647 100644
})
.onmessage([](crow::websocket::Connection& conn,
const std::string& data, bool) {
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch
new file mode 100644
index 000000000..c188b2105
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch
@@ -0,0 +1,37 @@
+From d31d913a8c5dbacf6a36407532cf777852099ced Mon Sep 17 00:00:00 2001
+From: AppaRao Puli <apparao.puli@linux.intel.com>
+Date: Sun, 2 May 2021 11:07:16 +0000
+Subject: [PATCH] Fix VM NBDPROXY build issue with AsyncResp
+
+8d1b46d7 moves bmcweb to using AsyncResp everywhere, and not have
+each individual handler creating its own object.
+
+This commit fixes the build failure when enabling virtual media
+compile flag(BMCWEB_ENABLE_VM_NBDPROXY). This is caused by above
+mentioned recent change.
+
+Tested:
+ - Build is successful with enabled virtual media flag.
+
+Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
+Change-Id: I363a41a08fae9dc05b3553695b96ffd26948f696
+---
+ redfish-core/lib/virtual_media.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
+index 685ee5c..99542c4 100644
+--- a/redfish-core/lib/virtual_media.hpp
++++ b/redfish-core/lib/virtual_media.hpp
+@@ -635,7 +635,7 @@ class VirtualMediaActionInsertMedia : public Node
+ }
+
+ bool paramsValid = validateParams(
+- asyncResp->res, imageUrl, inserted,
++ asyncResp, imageUrl, inserted,
+ transferMethod, transferProtocolType);
+
+ if (paramsValid == false)
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend
index d9b32f5ae..7e9d42228 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb_%.bbappend
@@ -1,5 +1,5 @@
SRC_URI = "git://github.com/openbmc/bmcweb.git"
-SRCREV = "dab0604af234bdd5010407031a01343d6c242edf"
+SRCREV = "2ebb9683287cf6b1a2f2cc3c077bd99aceefa8dd"
DEPENDS += "boost-url"
RDEPENDS_${PN} += "phosphor-nslcd-authority-cert-config"
@@ -14,20 +14,33 @@ GROUPADD_PARAM_${PN} = "web; redfish "
SRC_URI += "file://0001-Firmware-update-configuration-changes.patch \
file://0002-Use-chip-id-based-UUID-for-Service-Root.patch \
- file://0004-bmcweb-handle-device-or-resource-busy-exception.patch \
- file://0006-Define-Redfish-interface-Registries-Bios.patch \
- file://0007-BIOS-config-Add-support-for-PATCH-operation.patch \
- file://0008-Add-support-to-ResetBios-action.patch \
- file://0009-Add-support-to-ChangePassword-action.patch \
file://0010-managers-add-attributes-for-Manager.CommandShell.patch \
- file://0034-recommended-fixes-by-crypto-review-team.patch \
file://0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch \
file://0012-Log-RedFish-event-for-Invalid-login-attempt.patch \
file://0013-Add-UART-routing-logic-into-host-console-connection-.patch \
+ file://0014-recommended-fixes-by-crypto-review-team.patch \
+ file://0015-Add-state-sensor-messages-to-the-registry.patch \
+ file://0016-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \
+ file://0017-Add-msg-registry-for-subscription-related-actions.patch \
"
-# Temporary downstream mirror of upstream patch to enable feature in Intel builds.
-SRC_URI += "file://0037-Add-state-sensor-messages-to-the-registry.patch \
+# OOB Bios Config:
+SRC_URI += "file://biosconfig/0001-Define-Redfish-interface-Registries-Bios.patch \
+ file://biosconfig/0002-BaseBiosTable-Add-support-for-PATCH-operation.patch \
+ file://biosconfig/0003-Add-support-to-ResetBios-action.patch \
+ file://biosconfig/0004-Add-support-to-ChangePassword-action.patch \
+ file://biosconfig/0005-Fix-remove-bios-user-pwd-change-option-via-Redfish.patch \
+"
+
+# Virtual Media: Backend code is not upstreamed so downstream only patches.
+SRC_URI += "file://vm/0001-Revert-Disable-nbd-proxy-from-the-build.patch \
+ file://vm/0002-bmcweb-handle-device-or-resource-busy-exception.patch \
+ file://vm/0003-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \
+ file://vm/0004-Invalid-status-code-from-InsertMedia-REST-methods.patch \
+ file://vm/0005-Set-Inserted-redfish-property-for-not-inserted-resou.patch \
+ file://vm/0006-Bmcweb-handle-permission-denied-exception.patch \
+ file://vm/0007-Fix-unmounting-image-in-proxy-mode.patch \
+ file://vm/0008-Fix-VM-NBDPROXY-build-issue-with-AsyncResp.patch \
"
# EventService: Temporary pulled to downstream. See eventservice\README for details
@@ -36,26 +49,12 @@ SRC_URI += "file://eventservice/0001-EventService-Fix-retry-handling-for-http-cl
file://eventservice/0004-Add-Server-Sent-Events-support.patch \
file://eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch \
file://eventservice/0006-Add-EventService-SSE-filter-support.patch \
+ file://eventservice/0007-EventService-Log-events-for-subscription-actions.patch \
"
# Temporary downstream mirror of upstream patches, see telemetry\README for details
-SRC_URI += "file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \
- file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \
-"
-
-SRC_URI += "file://0001-Add-ConnectedVia-property-to-virtual-media-item-temp.patch \
- file://0002-Invalid-status-code-from-InsertMedia-REST-methods.patch \
- file://0003-Set-Inserted-redfish-property-for-not-inserted-resou.patch \
- file://0004-Bmcweb-handle-permission-denied-exception.patch \
- file://0005-Fix-unmounting-image-in-proxy-mode.patch \
-"
-
-SRC_URI += "file://0038-Revert-Disable-nbd-proxy-from-the-build.patch \
- file://0039-Fix-comparison-for-proxy-legacy-mode.patch \
-"
-
-# Fix to avoid bmcweb crash on VM mount
-SRC_URI += "file://0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch \
+SRC_URI += " file://telemetry/0003-Add-support-for-MetricDefinition-scheme.patch \
+ file://telemetry/0004-Sync-Telmetry-service-with-EventService.patch \
"
# Temporary fix: Move it to service file