summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Change-InsertMedia-action-response-for-POST-in-proxy.patch30
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch182
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch44
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch32
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch135
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0012-Log-RedFish-event-for-Invalid-login-attempt.patch67
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch59
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch44
-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/eventservice/0003-Move-EventService-init-to-later-stage.patch50
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch32
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch8
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README3
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Sync_ReadingUnit_with_Redfish_Sensor_Schema.patch227
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch671
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README3
16 files changed, 634 insertions, 1004 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Change-InsertMedia-action-response-for-POST-in-proxy.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Change-InsertMedia-action-response-for-POST-in-proxy.patch
deleted file mode 100644
index d04220b89..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Change-InsertMedia-action-response-for-POST-in-proxy.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From dcc94627aac5b8e4ad181c8548391c53d27b8896 Mon Sep 17 00:00:00 2001
-From: Karol Wachowski <karol.wachowski@intel.com>
-Date: Tue, 16 Feb 2021 06:47:11 +0000
-Subject: [PATCH] Change InsertMedia action response for POST in proxy mode
-
-Set boost::beast::http::status::method_not_allowed as a response
-for POST request to Virtual Media Insert Media action to keep
-consistency with other non existing requests.
----
- redfish-core/lib/virtual_media.hpp | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
-index 80e7315..76e8c4a 100644
---- a/redfish-core/lib/virtual_media.hpp
-+++ b/redfish-core/lib/virtual_media.hpp
-@@ -611,10 +611,9 @@ class VirtualMediaActionInsertMedia : public Node
- // Not possible in proxy mode
- BMCWEB_LOG_DEBUG << "InsertMedia not "
- "allowed in proxy mode";
-- messages::resourceNotFound(
-- aResp->res, "VirtualMedia.InsertMedia",
-- resName);
--
-+ aResp->res.result(
-+ boost::beast::http::status::
-+ method_not_allowed);
- return;
- }
-
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/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch
new file mode 100644
index 000000000..c9a4119a1
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0002-Invalid-status-code-from-InsertMedia-REST-methods.patch
@@ -0,0 +1,182 @@
+
+From 1bbabe4ecdeea20da809b9f1d8e194683629517c 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
+
+Add handlers for GET, PUT, DELETE, PATCH method and function that
+checks which mode is used and set suitable status code:
+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(+)
+
+diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
+index 8353ce7..66bf220 100644
+--- a/redfish-core/lib/virtual_media.hpp
++++ b/redfish-core/lib/virtual_media.hpp
+@@ -530,6 +530,160 @@ class VirtualMediaActionInsertMedia : public Node
+ return true;
+ }
+
++ /**
++ * @brief Function checks if insert media request is Legacy or Proxy type
++ * and sets suitable response code for unsupported REST method.
++ *
++ */
++ void CheckProxyMode(crow::Response& res,
++ const crow::Request& req,
++ const std::vector<std::string>& params)
++ {
++ auto aResp = std::make_shared<AsyncResp>(res);
++
++ if (params.size() != 2)
++ {
++ messages::internalError(res);
++ return;
++ }
++
++ // take resource name from URL
++ const std::string& resName = params[1];
++
++ if (params[0] != "bmc")
++ {
++ messages::resourceNotFound(res, "VirtualMedia.Insert", resName);
++
++ return;
++ }
++
++ crow::connections::systemBus->async_method_call(
++ [this, aResp{std::move(aResp)}, req,
++ resName](const boost::system::error_code ec,
++ const GetObjectType& getObjectType) {
++ if (ec)
++ {
++ BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
++ << ec;
++ aResp->res.result(
++ boost::beast::http::status::not_found);
++
++ return;
++ }
++ std::string service = getObjectType.begin()->first;
++ BMCWEB_LOG_DEBUG << "GetObjectType: " << service;
++
++ crow::connections::systemBus->async_method_call(
++ [this, service, resName, req,
++ aResp{aResp}](const boost::system::error_code ec,
++ ManagedObjectType& subtree) {
++ if (ec)
++ {
++ BMCWEB_LOG_DEBUG << "DBUS response error";
++
++ return;
++ }
++
++ for (auto& item : subtree)
++ {
++ std::string thispath = item.first.filename();
++ if (thispath.empty())
++ {
++ continue;
++ }
++
++ if (thispath != resName)
++ {
++ 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;
++ }
++
++ // Check if dbus path is Legacy type
++ if (mode.filename() == "Legacy")
++ {
++ BMCWEB_LOG_DEBUG << "InsertMedia only allowed "
++ "with POST method "
++ "in legacy mode";
++ aResp->res.result(
++ boost::beast::http::status::
++ method_not_allowed);
++
++ return;
++ }
++ // Check if dbus path is Proxy type
++ if (mode.filename() == "Proxy")
++ {
++ // Not possible in proxy mode
++ BMCWEB_LOG_DEBUG << "InsertMedia not "
++ "allowed in proxy mode";
++ aResp->res.result(
++ boost::beast::http::status::not_found);
++
++ return;
++ }
++ }
++
++ BMCWEB_LOG_DEBUG << "Parent item not found";
++ aResp->res.result(
++ boost::beast::http::status::not_found);
++ },
++ service, "/xyz/openbmc_project/VirtualMedia",
++ "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
++ },
++ "xyz.openbmc_project.ObjectMapper",
++ "/xyz/openbmc_project/object_mapper",
++ "xyz.openbmc_project.ObjectMapper", "GetObject",
++ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
++ }
++
++ /**
++ * @brief Function handles GET method request.
++ */
++ void doGet(crow::Response& res, const crow::Request& req,
++ const std::vector<std::string>& params) override
++ {
++ CheckProxyMode(res, req, params);
++ }
++
++ /**
++ * @brief Function handles PATCH method request.
++ */
++ void doPatch(crow::Response& res, const crow::Request& req,
++ const std::vector<std::string>& params) override
++ {
++ CheckProxyMode(res, req, params);
++ }
++
++ /**
++ * @brief Function handles PUT method request.
++ */
++ void doPut(crow::Response& res, const crow::Request& req,
++ const std::vector<std::string>& params) override
++ {
++ CheckProxyMode(res, req, params);
++ }
++
++ /**
++ * @brief Function handles DELETE method request.
++ */
++ void doDelete(crow::Response& res, const crow::Request& req,
++ const std::vector<std::string>& params) override
++ {
++ CheckProxyMode(res, req, params);
++ }
++
+ /**
+ * @brief Function handles POST method request.
+ *
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/0004-Bmcweb-handle-permission-denied-exception.patch
new file mode 100644
index 000000000..074718349
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0004-Bmcweb-handle-permission-denied-exception.patch
@@ -0,0 +1,44 @@
+From 81f2c022b22ef75990f30e5ba5bfd4ba5bd41754 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
+
+Add handling of permission denied exception (EPERM) that
+can be thrown by VirtualMedia service during Mount/Unmount dbus operations.
+
+Tested:
+Verified that after mounting/unmounting HTTPS resource twice in a row in legacy mode,
+VirtualMedia returns EPERM, which bmcweb handles as 403 status code.
+
+Change-Id: Ibc18d5ec822c5072605b1fc4651389982002798b
+Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
+---
+ redfish-core/lib/virtual_media.hpp | 8 ++++++++
+ 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
+--- a/redfish-core/lib/virtual_media.hpp
++++ b/redfish-core/lib/virtual_media.hpp
+@@ -900,6 +900,10 @@ class VirtualMediaActionInsertMedia : public Node
+ {
+ messages::resourceInUse(asyncResp->res);
+ }
++ else if (ec == boost::system::errc::permission_denied)
++ {
++ messages::accessDenied(asyncResp->res, "VirtualMedia.Insert");
++ }
+ else
+ {
+ messages::internalError(asyncResp->res);
+@@ -1092,6 +1096,10 @@ class VirtualMediaActionEjectMedia : public Node
+ {
+ messages::resourceInUse(asyncResp->res);
+ }
++ else if (ec == boost::system::errc::permission_denied)
++ {
++ messages::accessDenied(asyncResp->res, "VirtualMedia.Eject");
++ }
+ else
+ {
+ messages::internalError(asyncResp->res);
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/0005-Fix-unmounting-image-in-proxy-mode.patch
new file mode 100644
index 000000000..acfd9225b
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0005-Fix-unmounting-image-in-proxy-mode.patch
@@ -0,0 +1,32 @@
+From 9493bb8e2f5c708e187313c86e6033de5f103c51 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.
+
+Sometimes Slot0 got higher key than Slot1 and erase function for Slot1
+invalidates elements with keys not less than the erased element.
+In that case invalid slot0 will be unmounted.
+Change order of calling close() and erase() functions to
+unmount correct device.
+
+Change-Id: I7a40a4518982f697d3eed635cde6d06978149cf0
+Signed-off-by: Alicja Rybak <alicja.rybak@intel.com>
+---
+ include/nbd_proxy.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
+index 7b90e90..fa7f647 100644
+--- a/include/nbd_proxy.hpp
++++ b/include/nbd_proxy.hpp
+@@ -428,9 +428,9 @@ inline void requestRoutes(App& app)
+ BMCWEB_LOG_DEBUG << "No session to close";
+ return;
+ }
++ session->second->close();
+ // Remove reference to session in global map
+ sessions.erase(session);
+- session->second->close();
+ })
+ .onmessage([](crow::websocket::Connection& conn,
+ const std::string& data, bool) {
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch
new file mode 100644
index 000000000..e52dff3f4
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0011-bmcweb-Add-PhysicalContext-to-Thermal-resources.patch
@@ -0,0 +1,135 @@
+From b9747ecfce682f15dce0bb6e41e0c894f29419f3 Mon Sep 17 00:00:00 2001
+From: Snehalatha Venkatesh <snehalathax.v@intel.com>
+Date: Thu, 8 Apr 2021 14:42:07 +0000
+Subject: [PATCH] bmcweb: Add PhysicalContext to Thermal resources
+
+Adding PhysicalContext to make redfish data compliance with OCP
+Server Mgmt Interface v0.2.1.pdf and specific to Thermal resources.
+https://github.com/opencomputeproject/OCP-Profiles/blob/master/
+OCPServerHardwareManagement.v0_2_4.json
+
+Tested:
+1. Redfish validator - passed for this new change
+2. GET - https://<bmc.ip>/redfish/v1/Chassis/<Board>/Thermal
+Response:
+{
+ "@odata.id": "/redfish/v1/Chassis/<Board>/Thermal#/Temperatures/0",
+ "@odata.type": "#Thermal.v1_3_0.Temperature",
+ "LowerThresholdCritical": 0.0,
+ "LowerThresholdNonCritical": 5.0,
+ "MaxReadingRangeTemp": 127.0,
+ "MemberId": "BMC_Temp",
+ "MinReadingRangeTemp": -128.0,
+ "Name": "BMC Temp",
+ "PhysicalContext": "SystemBoard",
+ "ReadingCelsius": 25.75,
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "UpperThresholdCritical": 115.0,
+ "UpperThresholdNonCritical": 110.0
+},
+{
+ "@odata.id": "/redfish/v1/Chassis/<Board>/Thermal#/Temperatures/1",
+ "@odata.type": "#Thermal.v1_3_0.Temperature",
+ "LowerThresholdCritical": 0.0,
+ "LowerThresholdNonCritical": 5.0,
+ "MaxReadingRangeTemp": 255.0,
+ "MemberId": "CPU1_P12V_PVCCIN_VR_Temp",
+ "MinReadingRangeTemp": 0.0,
+ "Name": "CPU1 P12V PVCCIN VR Temp",
+ "PhysicalContext": "CPU",
+ "ReadingCelsius": 41.0,
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "UpperThresholdCritical": 115.0,
+ "UpperThresholdNonCritical": 110.0
+},
+{
+ "@odata.id": "/redfish/v1/Chassis/<Board>/Thermal#/Temperatures/28",
+ "@odata.type": "#Thermal.v1_3_0.Temperature",
+ "LowerThresholdCritical": 0.0,
+ "LowerThresholdNonCritical": 5.0,
+ "MaxReadingRangeTemp": 127.0,
+ "MemberId": "Inlet_BRD_Temp",
+ "MinReadingRangeTemp": -128.0,
+ "Name": "Inlet BRD Temp",
+ "PhysicalContext": "Intake",
+ "ReadingCelsius": 23.187,
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "UpperThresholdCritical": 115.0,
+ "UpperThresholdNonCritical": 110.0
+}
+3. GET - https://<bmc.ip>/redfish/v1/Chassis/<Board>/Power
+Response:
+{
+ "@odata.id": "/redfish/v1/Chassis/<Board>/Power#/Voltages/3",
+ "@odata.type": "#Power.v1_0_0.Voltage",
+ "LowerThresholdCritical": 1.648,
+ "LowerThresholdNonCritical": 1.699,
+ "MaxReadingRange": 2.3984009912875566,
+ "MemberId": "P1V8_PCH",
+ "MinReadingRange": 0.0,
+ "Name": "P1V8 PCH",
+ "ReadingVolts": 1.8055,
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ },
+ "UpperThresholdCritical": 1.961,
+ "UpperThresholdNonCritical": 1.904
+}
+4. GET - https://<bmc.ip>/redfish/v1/Chassis/<Board>/Sensors/PSU1_Input_Current
+Response:
+{
+ "@odata.id": "/redfish/v1/Chassis/<Board>/Sensors/PSU1_Input_Current",
+ "@odata.type": "#Sensor.v1_0_0.Sensor",
+ "Id": "PSU1_Input_Current",
+ "Name": "PSU1 Input Current",
+ "Reading": 0.947,
+ "ReadingRangeMax": 12.0,
+ "ReadingRangeMin": 0.0,
+ "ReadingType": "Current",
+ "ReadingUnits": "A",
+ "Status": {
+ "Health": "OK",
+ "State": "Enabled"
+ }
+}
+Signed-off-by: Snehalatha Venkatesh <snehalathax.v@intel.com>
+---
+ redfish-core/lib/sensors.hpp | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
+index 9f06d2f..40fcdf8 100644
+--- a/redfish-core/lib/sensors.hpp
++++ b/redfish-core/lib/sensors.hpp
+@@ -964,6 +964,18 @@ inline void objectInterfacesToJson(
+ {
+ unit = "/ReadingCelsius"_json_pointer;
+ sensorJson["@odata.type"] = "#Thermal.v1_3_0.Temperature";
++ if (sensorName.find("CPU") != std::string::npos)
++ {
++ sensorJson["PhysicalContext"] = "CPU";
++ }
++ else if (sensorName.find("Inlet") != std::string::npos)
++ {
++ sensorJson["PhysicalContext"] = "Intake";
++ }
++ else
++ {
++ sensorJson["PhysicalContext"] = "SystemBoard";
++ }
+ // TODO(ed) Documentation says that path should be type fan_tach,
+ // implementation seems to implement fan
+ }
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0012-Log-RedFish-event-for-Invalid-login-attempt.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0012-Log-RedFish-event-for-Invalid-login-attempt.patch
new file mode 100644
index 000000000..3ef4ee2de
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0012-Log-RedFish-event-for-Invalid-login-attempt.patch
@@ -0,0 +1,67 @@
+From 1f572a1991fc8d9b08689aa6e3470080467977a7 Mon Sep 17 00:00:00 2001
+From: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
+Date: Thu, 15 Apr 2021 10:59:42 +0000
+Subject: [PATCH] Log RedFish event for Invalid login attempt
+
+This commit adds support for logging RedFish event log while user tries
+to attempt login with invalid credentials.
+When user trying to login with invalid credentials on HTTPS interface
+like WebUI and RedFish, event should be logged in RedFish event log.
+This event log is useful for further analysis to debug the root-cause
+for failure.
+
+Tested:
+1. Verified RedFish validator passed
+2. Login with wrong credentials on HTTPS interface.
+3. Verified for RedFish/WebUI events. RedFish event logged successfully.
+GET: https://BMC-IP/redfish/v1/Systems/system/LogServices/
+ EventLog/Entries
+Response:
+"Members": [
+{
+ "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/
+ Entries/1618466128",
+ "@odata.type": "#LogEntry.v1_4_0.LogEntry",
+ "Created": "2021-04-15T05:55:28+00:00",
+ "EntryType": "Event",
+ "Id": "1618466128",
+ "Message": "Invalid username or password attempted on HTTPS.",
+ "MessageArgs": [
+ "HTTPS"
+ ],
+ "MessageId": "OpenBMC.0.1.InvalidLoginAttempted",
+ "Name": "System Event Log Entry",
+ "Severity": "Warning"
+}
+
+Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
+---
+ include/pam_authenticate.hpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/include/pam_authenticate.hpp b/include/pam_authenticate.hpp
+index 12f19c0..01bf301 100644
+--- a/include/pam_authenticate.hpp
++++ b/include/pam_authenticate.hpp
+@@ -1,6 +1,7 @@
+ #pragma once
+
+ #include <security/pam_appl.h>
++#include <systemd/sd-journal.h>
+
+ #include <boost/utility/string_view.hpp>
+
+@@ -75,6 +76,10 @@ inline int pamAuthenticateUser(const std::string_view username,
+ PAM_SILENT | PAM_DISALLOW_NULL_AUTHTOK);
+ if (retval != PAM_SUCCESS)
+ {
++ sd_journal_send("MESSAGE= %s", "Invalid login attempted on HTTPS",
++ "PRIORITY=%i", LOG_WARNING, "REDFISH_MESSAGE_ID=%s",
++ "OpenBMC.0.1.InvalidLoginAttempted",
++ "REDFISH_MESSAGE_ARGS=%s", "HTTPS", NULL);
+ pam_end(localAuthHandle, PAM_SUCCESS); // ignore retval
+ return retval;
+ }
+--
+2.17.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch
new file mode 100644
index 000000000..8b0d90fe0
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0013-Add-UART-routing-logic-into-host-console-connection-.patch
@@ -0,0 +1,59 @@
+From 6c10adb53d3247f65e5d9399290e6b8e7962cdef Mon Sep 17 00:00:00 2001
+From: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+Date: Wed, 28 Apr 2021 17:19:50 -0700
+Subject: [PATCH] Add UART routing logic into host console connection flow
+
+Switching UART routing when starting obmc-service introduces garbled
+character printing out on physical host serial output and it's
+inevitable so this commit moves the routing logic into host console
+connection flow in bmcweb to avoid the issue until SOL is actually
+activated.
+
+Tested: The garbled character printing out was not observed during
+BMC booting. SOL worked well.
+
+Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@intel.com>
+---
+ include/obmc_console.hpp | 19 +++++++++++++++++++
+ 1 file changed, 19 insertions(+)
+
+diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
+index cdb19901e82d..9c4ae8821074 100644
+--- a/include/obmc_console.hpp
++++ b/include/obmc_console.hpp
+@@ -22,6 +22,9 @@ static boost::container::flat_set<crow::websocket::Connection*> sessions;
+
+ static bool doingWrite = false;
+
++constexpr char const* uartMuxCtrlPath = "/sys/bus/platform/drivers/aspeed-uart-routing/1e78909c.uart_routing/raw";
++constexpr char const* uartMuxCtrlVal = "0x03450003";
++
+ inline void doWrite()
+ {
+ if (doingWrite)
+@@ -110,6 +113,22 @@ inline void connectHandler(const boost::system::error_code& ec)
+ return;
+ }
+
++ FILE* file = fopen(uartMuxCtrlPath, "w");
++ if (file != nullptr)
++ {
++ int rc = fputs(uartMuxCtrlVal, file);
++ fclose(file);
++ if (rc < 0)
++ {
++ BMCWEB_LOG_ERROR << "Couldn't change UART routing: " << rc;
++ for (crow::websocket::Connection* session : sessions)
++ {
++ session->close("Error in connecting to host port");
++ }
++ return;
++ }
++ }
++
+ doWrite();
+ doRead();
+ }
+--
+2.17.1
+
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/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch
new file mode 100644
index 000000000..bc023839f
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-bmcweb-crashes-if-socket-directory-not-present.patch
@@ -0,0 +1,44 @@
+From 48fe2a68d634970795f9ff13903afbedca801088 Mon Sep 17 00:00:00 2001
+From: Nidhin MS <nidhin.ms@intel.com>
+Date: Wed, 14 Apr 2021 11:28:44 +0530
+Subject: [PATCH] Fix: bmcweb crashes if socket directory not present
+
+When trying to mount virtual media image bmcweb tries to create unix
+socket and if the parent directory does not exist
+stream_protocol::acceptor throws error and bmcweb crashes. Fix the same
+
+Tested:
+Removed directory and mounted the vm image. bmcweb crash was not
+observed
+
+Change-Id: I3aea1d8e197c06238f425a97435c01d3c80552a9
+Signed-off-by: Nidhin MS <nidhin.ms@intel.com>
+---
+ include/nbd_proxy.hpp | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
+index 7b90e90..3b28823 100644
+--- a/include/nbd_proxy.hpp
++++ b/include/nbd_proxy.hpp
+@@ -397,6 +397,17 @@ inline void requestRoutes(App& app)
+ // If the socket file exists (i.e. after bmcweb crash),
+ // we cannot reuse it.
+ std::remove((*socketValue).c_str());
++ std::filesystem::path socketPath(*socketValue);
++ std::error_code fsErr;
++ if (!std::filesystem::exists(socketPath.parent_path(),
++ fsErr))
++ {
++ BMCWEB_LOG_ERROR
++ << "VirtualMedia socket directory not present. "
++ << socketPath.parent_path();
++ conn.close("Unable to create unix socket");
++ return;
++ }
+
+ sessions[&conn] = std::make_shared<NbdProxyServer>(
+ conn, *socketValue, *endpointValue,
+--
+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
new file mode 100644
index 000000000..f02e5e1a4
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0039-Fix-comparison-for-proxy-legacy-mode.patch
@@ -0,0 +1,51 @@
+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/eventservice/0003-Move-EventService-init-to-later-stage.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0003-Move-EventService-init-to-later-stage.patch
deleted file mode 100644
index f910915ce..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0003-Move-EventService-init-to-later-stage.patch
+++ /dev/null
@@ -1,50 +0,0 @@
-From 2dcfef0170ca5ba1f934de6934db64b545ab3b55 Mon Sep 17 00:00:00 2001
-From: AppaRao Puli <apparao.puli@linux.intel.com>
-Date: Tue, 23 Mar 2021 23:36:40 +0000
-Subject: [PATCH] Move EventService init to later stage
-
-The bmcweb crash issue seen when there is eventservice
-config with subscriptions in persistent file.
-
-During EventService instantiation, it uses the "get_io_context()"
-from systemBus, so it should be called after systemBus init. So
-moved the EventService instantiation after systemBus initialization.
-
-Tested:
- - bmcweb crash issue resolved.
-
-Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
-Change-Id: Iab52f0e89478e306af475066fb5691153a05677d
----
- src/webserver_main.cpp | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
-index 3b9631a..f0e2207 100644
---- a/src/webserver_main.cpp
-+++ b/src/webserver_main.cpp
-@@ -80,9 +80,6 @@ int main(int /*argc*/, char** /*argv*/)
- #ifdef BMCWEB_ENABLE_REDFISH
- crow::redfish::requestRoutes(app);
- redfish::RedfishService redfish(app);
--
-- // Create EventServiceManager instance and initialize Config
-- redfish::EventServiceManager::getInstance();
- #endif
-
- #ifdef BMCWEB_ENABLE_DBUS_REST
-@@ -116,6 +113,11 @@ int main(int /*argc*/, char** /*argv*/)
- crow::connections::systemBus =
- std::make_shared<sdbusplus::asio::connection>(*io);
-
-+#ifdef BMCWEB_ENABLE_REDFISH
-+ // Create EventServiceManager instance and initialize Config
-+ redfish::EventServiceManager::getInstance();
-+#endif
-+
- #ifdef BMCWEB_ENABLE_VM_NBDPROXY
- crow::nbd_proxy::requestRoutes(app);
- #endif
---
-2.17.1
-
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 e2eaf1761..02d28833f 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,4 +1,4 @@
-From dbaf8c1dc402da97fec723d050e063cd283d8736 Mon Sep 17 00:00:00 2001
+From 698d2615c5bc30ab7f89f11ed5659df8bf248ea0 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
@@ -126,10 +126,10 @@ 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 148c703..e3eba86 100644
+index 5821e2e..f4d57c2 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -22,13 +22,15 @@
+@@ -23,13 +23,15 @@
#include <sys/inotify.h>
#include <boost/asio/io_context.hpp>
@@ -146,7 +146,7 @@ index 148c703..e3eba86 100644
#include <cstdlib>
#include <ctime>
#include <fstream>
-@@ -45,9 +47,13 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
+@@ -46,9 +48,13 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
static constexpr const char* eventFormatType = "Event";
static constexpr const char* metricReportFormatType = "MetricReport";
@@ -160,8 +160,8 @@ index 148c703..e3eba86 100644
#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
static constexpr const char* redfishEventLogDir = "/var/log";
-@@ -390,11 +396,9 @@ class Subscription
- path);
+@@ -391,11 +397,9 @@ class Subscription
+ path, uriProto);
}
- Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) :
@@ -175,7 +175,7 @@ index 148c703..e3eba86 100644
~Subscription() = default;
-@@ -419,7 +423,7 @@ class Subscription
+@@ -420,7 +424,7 @@ class Subscription
if (sseConn != nullptr)
{
@@ -184,7 +184,7 @@ index 148c703..e3eba86 100644
}
}
-@@ -509,6 +513,7 @@ class Subscription
+@@ -510,6 +514,7 @@ class Subscription
this->sendEvent(
msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
@@ -192,7 +192,7 @@ index 148c703..e3eba86 100644
}
#endif
-@@ -579,14 +584,39 @@ class Subscription
+@@ -565,14 +570,39 @@ class Subscription
return eventSeqNum;
}
@@ -233,7 +233,7 @@ index 148c703..e3eba86 100644
};
static constexpr const bool defaultEnabledState = true;
-@@ -977,6 +1007,8 @@ class EventServiceManager
+@@ -963,6 +993,8 @@ class EventServiceManager
subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval);
subValue->updateRetryPolicy();
@@ -242,7 +242,7 @@ index 148c703..e3eba86 100644
return id;
}
-@@ -1001,11 +1033,40 @@ class EventServiceManager
+@@ -987,11 +1019,40 @@ class EventServiceManager
}
}
@@ -603,7 +603,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 3b9631a..bf8e705 100644
+index 902c32b..c871faa 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -5,6 +5,7 @@
@@ -614,14 +614,14 @@ index 3b9631a..bf8e705 100644
#include <hostname_monitor.hpp>
#include <ibm/management_console_rest.hpp>
#include <image_upload.hpp>
-@@ -79,6 +80,7 @@ int main(int /*argc*/, char** /*argv*/)
-
+@@ -83,6 +84,7 @@ int main(int /*argc*/, char** /*argv*/)
#ifdef BMCWEB_ENABLE_REDFISH
- crow::redfish::requestRoutes(app);
-+ 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 e83e05c96..4d99b2754 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,4 +1,4 @@
-From 693de7b901e7618585e0e8d848fc37fa0cccd18e Mon Sep 17 00:00:00 2001
+From 82185c52ae6e27cc1e086654a3b7d10e63ecc783 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
@@ -171,10 +171,10 @@ 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 e3eba86..8f120b1 100644
+index f4d57c2..567fb9c 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -54,6 +54,11 @@ static constexpr const char* eventServiceFile =
+@@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile =
static constexpr const uint8_t maxNoOfSubscriptions = 20;
static constexpr const uint8_t maxNoOfSSESubscriptions = 10;
@@ -202,7 +202,7 @@ index 1875ec9..4d1ac9f 100644
"TerminateAfterRetries", "SuspendRetries", "RetryForever"};
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
-index cfbc9c2..3493132 100644
+index 7059a38..1e3ef2f 100644
--- a/redfish-core/src/error_messages.cpp
+++ b/redfish-core/src/error_messages.cpp
@@ -2147,6 +2147,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1,
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 55340bb5c..3954e89c1 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
@@ -9,9 +9,6 @@ Upstream revision information:
- EventService: https client support
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/38
- - Move EventService init to later stage
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41516
-
- Add Server-Sent-Events support
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/5
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Sync_ReadingUnit_with_Redfish_Sensor_Schema.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Sync_ReadingUnit_with_Redfish_Sensor_Schema.patch
deleted file mode 100644
index e3b25da90..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Sync_ReadingUnit_with_Redfish_Sensor_Schema.patch
+++ /dev/null
@@ -1,227 +0,0 @@
-From 4b7e67d7200c0aba1b27478968d4f71449f1406a Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Mon, 8 Mar 2021 14:35:54 +0000
-Subject: [PATCH] Sync ReadingUnit with Redfish Sensor Schema
-
-Actual attribute "ReadingUnits" does not match with Redfish Sensor
-Schema. This change match "ReadingUnits" with Redfish Sensor Scheme
-1.0.0 and add missing "ReadingType" attribute. This change affect all
-users that depends on old units that does not match with Redfish
-standard. Added toReadingType and toReadingUnit function that uses
-values taken from Redfish Sensor Scheme 1.0.0. Latest version 1.2.0 of
-Sensor scheme defines units same units.
-
-Tested:
- - RedfishServiceValidator pass
-
-Change-Id: I0c8820eba7271022c427cd25dec321db36aa0176
-Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
-Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
----
- redfish-core/lib/power.hpp | 4 +-
- redfish-core/lib/sensors.hpp | 107 +++++++++++++++++++++++++++++------
- redfish-core/lib/thermal.hpp | 4 +-
- 3 files changed, 94 insertions(+), 21 deletions(-)
-
-diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
-index 1c7a009..99c45ef 100644
---- a/redfish-core/lib/power.hpp
-+++ b/redfish-core/lib/power.hpp
-@@ -153,7 +153,7 @@ class Power : public Node
- res.jsonValue["PowerControl"] = nlohmann::json::array();
-
- auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
-- res, chassisName, sensors::dbus::types.at(sensors::node::power),
-+ res, chassisName, sensors::dbus::paths.at(sensors::node::power),
- sensors::node::power);
-
- getChassisData(sensorAsyncResp);
-@@ -336,7 +336,7 @@ class Power : public Node
-
- const std::string& chassisName = params[0];
- auto asyncResp = std::make_shared<SensorsAsyncResp>(
-- res, chassisName, sensors::dbus::types.at(sensors::node::power),
-+ res, chassisName, sensors::dbus::paths.at(sensors::node::power),
- sensors::node::power);
-
- std::optional<std::vector<nlohmann::json>> voltageCollections;
-diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
-index 35114bf..af030f0 100644
---- a/redfish-core/lib/sensors.hpp
-+++ b/redfish-core/lib/sensors.hpp
-@@ -54,9 +54,10 @@ static constexpr std::string_view thermal = "Thermal";
-
- namespace dbus
- {
-+
- static const boost::container::flat_map<std::string_view,
- std::vector<const char*>>
-- types = {{node::power,
-+ paths = {{node::power,
- {"/xyz/openbmc_project/sensors/voltage",
- "/xyz/openbmc_project/sensors/power"}},
- {node::sensors,
-@@ -67,6 +68,88 @@ static const boost::container::flat_map<std::string_view,
- {"/xyz/openbmc_project/sensors/fan_tach",
- "/xyz/openbmc_project/sensors/temperature",
- "/xyz/openbmc_project/sensors/fan_pwm"}}};
-+} // namespace dbus
-+
-+inline const char* toReadingType(const std::string& sensorType)
-+{
-+ if (sensorType == "voltage")
-+ {
-+ return "Voltage";
-+ }
-+ if (sensorType == "power")
-+ {
-+ return "Power";
-+ }
-+ if (sensorType == "current")
-+ {
-+ return "Current";
-+ }
-+ if (sensorType == "fan_tach")
-+ {
-+ return "Rotational";
-+ }
-+ if (sensorType == "temperature")
-+ {
-+ return "Temperature";
-+ }
-+ if (sensorType == "fan_pwm" || sensorType == "utilization")
-+ {
-+ return "Percent";
-+ }
-+ if (sensorType == "altitude")
-+ {
-+ return "Altitude";
-+ }
-+ if (sensorType == "airflow")
-+ {
-+ return "AirFlow";
-+ }
-+ if (sensorType == "energy")
-+ {
-+ return "EnergyJoules";
-+ }
-+ return "";
-+}
-+
-+inline const char* toReadingUnits(const std::string& sensorType)
-+{
-+ if (sensorType == "voltage")
-+ {
-+ return "V";
-+ }
-+ if (sensorType == "power")
-+ {
-+ return "W";
-+ }
-+ if (sensorType == "current")
-+ {
-+ return "A";
-+ }
-+ if (sensorType == "fan_tach")
-+ {
-+ return "RPM";
-+ }
-+ if (sensorType == "temperature")
-+ {
-+ return "Cel";
-+ }
-+ if (sensorType == "fan_pwm" || sensorType == "utilization")
-+ {
-+ return "%";
-+ }
-+ if (sensorType == "altitude")
-+ {
-+ return "m";
-+ }
-+ if (sensorType == "airflow")
-+ {
-+ return "cft_i/min";
-+ }
-+ if (sensorType == "energy")
-+ {
-+ return "J";
-+ }
-+ return "";
- }
- } // namespace sensors
-
-@@ -854,18 +937,8 @@ inline void objectInterfacesToJson(
- if (sensorsAsyncResp->chassisSubNode == sensors::node::sensors)
- {
- sensorJson["@odata.type"] = "#Sensor.v1_0_0.Sensor";
-- if (sensorType == "power")
-- {
-- sensorJson["ReadingUnits"] = "Watts";
-- }
-- else if (sensorType == "current")
-- {
-- sensorJson["ReadingUnits"] = "Amperes";
-- }
-- else if (sensorType == "utilization")
-- {
-- sensorJson["ReadingUnits"] = "Percent";
-- }
-+ sensorJson["ReadingType"] = sensors::toReadingType(sensorType);
-+ sensorJson["ReadingUnits"] = sensors::toReadingUnits(sensorType);
- }
- else if (sensorType == "temperature")
- {
-@@ -2979,8 +3052,8 @@ inline void retrieveUriToDbusMap(const std::string& chassis,
- const std::string& node,
- SensorsAsyncResp::DataCompleteCb&& mapComplete)
- {
-- auto typesIt = sensors::dbus::types.find(node);
-- if (typesIt == sensors::dbus::types.end())
-+ auto pathIt = sensors::dbus::paths.find(node);
-+ if (pathIt == sensors::dbus::paths.end())
- {
- BMCWEB_LOG_ERROR << "Wrong node provided : " << node;
- mapComplete(boost::beast::http::status::bad_request, {});
-@@ -2995,7 +3068,7 @@ inline void retrieveUriToDbusMap(const std::string& chassis,
- uriToDbus) { mapCompleteCb(status, uriToDbus); };
-
- auto resp = std::make_shared<SensorsAsyncResp>(
-- *respBuffer, chassis, typesIt->second, node, std::move(callback));
-+ *respBuffer, chassis, pathIt->second, node, std::move(callback));
- getChassisData(resp);
- }
-
-@@ -3030,7 +3103,7 @@ class SensorCollection : public Node
- const std::string& chassisId = params[0];
- std::shared_ptr<SensorsAsyncResp> asyncResp =
- std::make_shared<SensorsAsyncResp>(
-- res, chassisId, sensors::dbus::types.at(sensors::node::sensors),
-+ res, chassisId, sensors::dbus::paths.at(sensors::node::sensors),
- sensors::node::sensors);
-
- auto getChassisCb =
-diff --git a/redfish-core/lib/thermal.hpp b/redfish-core/lib/thermal.hpp
-index 8e01bee..00acdf9 100644
---- a/redfish-core/lib/thermal.hpp
-+++ b/redfish-core/lib/thermal.hpp
-@@ -48,7 +48,7 @@ class Thermal : public Node
- }
- const std::string& chassisName = params[0];
- auto sensorAsyncResp = std::make_shared<SensorsAsyncResp>(
-- res, chassisName, sensors::dbus::types.at(sensors::node::thermal),
-+ res, chassisName, sensors::dbus::paths.at(sensors::node::thermal),
- sensors::node::thermal);
-
- // TODO Need to get Chassis Redundancy information.
-@@ -71,7 +71,7 @@ class Thermal : public Node
- allCollections;
-
- auto asyncResp = std::make_shared<SensorsAsyncResp>(
-- res, chassisName, sensors::dbus::types.at(sensors::node::thermal),
-+ res, chassisName, sensors::dbus::paths.at(sensors::node::thermal),
- sensors::node::thermal);
-
- if (!json_util::readJson(req, asyncResp->res, "Temperatures",
---
-2.25.1
-
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch
deleted file mode 100644
index aaf3f17c7..000000000
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Add-POST-and-DELETE-in-MetricReportDefinitions.patch
+++ /dev/null
@@ -1,671 +0,0 @@
-From 03c4ece83b58b954323111a1a7b2bf2b61402d7e Mon Sep 17 00:00:00 2001
-From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
-Date: Mon, 18 May 2020 11:56:57 +0200
-Subject: [PATCH 2/4] Add POST and DELETE in MetricReportDefinitions
-
-Added POST action in MetricReportDefinitions node to allow user
-to add new MetricReportDefinition. Using minimal set of
-MetricReportDefinition parameters from user bmcweb converts it to
-DBus call "AddReport" to Telemetry that serves as a backend
-for Redfish TelemetryService.
-Added DELETE request in MetricReportDefinitions node to allow user
-to remove report from Telemetry.
-Added conversion from string that represents duration format into
-its numeric equivalent.
-Added unit tests for conversion from and to Duration format.
-
-Tested:
- - Tested using witherspoon image on QEMU
- - Verified POST action in different cases:
- - all parameters are provided, new report is added to collection
- - some parameters are missing or invalid, user gets response with
- description of the issue
- - Verified that reports are removed on DELETE request
- - Verified that on invalid DELETE request user receives response
- with error
- - Verified time_utils::fromDurationString()
- - Succesfully passed RedfishServiceValidator.py
-
-Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
-Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
-Change-Id: I2fed96848594451e22fde686f8c066d7770cc65a
----
- meson.build | 1 +
- .../include/utils/telemetry_utils.hpp | 2 +
- redfish-core/include/utils/time_utils.hpp | 138 +++++++-
- redfish-core/lib/metric_report_definition.hpp | 328 ++++++++++++++++++
- redfish-core/ut/time_utils_test.cpp | 63 ++++
- 5 files changed, 530 insertions(+), 2 deletions(-)
- create mode 100644 redfish-core/ut/time_utils_test.cpp
-
-diff --git a/meson.build b/meson.build
-index 66a066b..22a8c4a 100644
---- a/meson.build
-+++ b/meson.build
-@@ -345,6 +345,7 @@ srcfiles_unittest = ['include/ut/dbus_utility_test.cpp',
- 'redfish-core/ut/privileges_test.cpp',
- 'redfish-core/ut/lock_test.cpp',
- 'redfish-core/ut/configfile_test.cpp',
-+ 'redfish-core/ut/time_utils_test.cpp',
- 'http/ut/utility_test.cpp']
-
- # Gather the Configuration data
-diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
-index a3a8156..0a3af5f 100644
---- a/redfish-core/include/utils/telemetry_utils.hpp
-+++ b/redfish-core/include/utils/telemetry_utils.hpp
-@@ -1,5 +1,7 @@
- #pragma once
-
-+#include "dbus_utility.hpp"
-+
- namespace redfish
- {
-
-diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp
-index 4a87ba0..9965d4d 100644
---- a/redfish-core/include/utils/time_utils.hpp
-+++ b/redfish-core/include/utils/time_utils.hpp
-@@ -1,7 +1,13 @@
- #pragma once
-
-+#include "logging.hpp"
-+
-+#include <charconv>
- #include <chrono>
-+#include <cmath>
-+#include <optional>
- #include <string>
-+#include <system_error>
-
- namespace redfish
- {
-@@ -12,6 +18,8 @@ namespace time_utils
- namespace details
- {
-
-+using Days = std::chrono::duration<long long, std::ratio<24 * 60 * 60>>;
-+
- inline void leftZeroPadding(std::string& str, const std::size_t padding)
- {
- if (str.size() < padding)
-@@ -19,8 +27,135 @@ inline void leftZeroPadding(std::string& str, const std::size_t padding)
- str.insert(0, padding - str.size(), '0');
- }
- }
-+
-+template <typename FromTime>
-+bool fromDurationItem(std::string_view& fmt, const char postfix,
-+ std::chrono::milliseconds& out)
-+{
-+ const size_t pos = fmt.find(postfix);
-+ if (pos == std::string::npos)
-+ {
-+ return true;
-+ }
-+ if ((pos + 1U) > fmt.size())
-+ {
-+ return false;
-+ }
-+
-+ const char* end;
-+ std::chrono::milliseconds::rep ticks = 0;
-+ if constexpr (std::is_same_v<FromTime, std::chrono::milliseconds>)
-+ {
-+ end = fmt.data() + std::min<size_t>(pos, 3U);
-+ }
-+ else
-+ {
-+ end = fmt.data() + pos;
-+ }
-+
-+ auto [ptr, ec] = std::from_chars(fmt.data(), end, ticks);
-+ if (ptr != end || ec != std::errc())
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to convert string to decimal with err: "
-+ << static_cast<int>(ec) << "("
-+ << std::make_error_code(ec).message() << "), ptr{"
-+ << static_cast<const void*>(ptr) << "} != end{"
-+ << static_cast<const void*>(end) << "})";
-+ return false;
-+ }
-+
-+ if constexpr (std::is_same_v<FromTime, std::chrono::milliseconds>)
-+ {
-+ ticks *= static_cast<std::chrono::milliseconds::rep>(
-+ std::pow(10, 3 - std::min<size_t>(pos, 3U)));
-+ }
-+ if (ticks < 0)
-+ {
-+ return false;
-+ }
-+
-+ out += FromTime(ticks);
-+ const auto maxConversionRange =
-+ std::chrono::duration_cast<FromTime>(std::chrono::milliseconds::max())
-+ .count();
-+ if (out < FromTime(ticks) || maxConversionRange < ticks)
-+ {
-+ return false;
-+ }
-+
-+ fmt.remove_prefix(pos + 1U);
-+ return true;
-+}
- } // namespace details
-
-+/**
-+ * @brief Convert string that represents value in Duration Format to its numeric
-+ * equivalent.
-+ */
-+std::optional<std::chrono::milliseconds>
-+ fromDurationString(const std::string& str)
-+{
-+ std::chrono::milliseconds out = std::chrono::milliseconds::zero();
-+ std::string_view v = str;
-+
-+ if (v.empty())
-+ {
-+ return out;
-+ }
-+ if (v.front() != 'P')
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+
-+ v.remove_prefix(1);
-+ if (!details::fromDurationItem<details::Days>(v, 'D', out))
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+
-+ if (v.empty())
-+ {
-+ return out;
-+ }
-+ if (v.front() != 'T')
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+
-+ v.remove_prefix(1);
-+ if (!details::fromDurationItem<std::chrono::hours>(v, 'H', out) ||
-+ !details::fromDurationItem<std::chrono::minutes>(v, 'M', out))
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+
-+ if (v.find('.') != std::string::npos && v.find('S') != std::string::npos)
-+ {
-+ if (!details::fromDurationItem<std::chrono::seconds>(v, '.', out) ||
-+ !details::fromDurationItem<std::chrono::milliseconds>(v, 'S', out))
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+ }
-+ else if (!details::fromDurationItem<std::chrono::seconds>(v, 'S', out))
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+
-+ if (!v.empty())
-+ {
-+ BMCWEB_LOG_ERROR << "Invalid duration format: " << str;
-+ return std::nullopt;
-+ }
-+ return out;
-+}
-+
- /**
- * @brief Convert time value into duration format that is based on ISO 8601.
- * Example output: "P12DT1M5.5S"
-@@ -36,8 +171,7 @@ inline std::string toDurationString(std::chrono::milliseconds ms)
- std::string fmt;
- fmt.reserve(sizeof("PxxxxxxxxxxxxDTxxHxxMxx.xxxxxxS"));
-
-- using Days = std::chrono::duration<long, std::ratio<24 * 60 * 60>>;
-- Days days = std::chrono::floor<Days>(ms);
-+ details::Days days = std::chrono::floor<details::Days>(ms);
- ms -= days;
-
- std::chrono::hours hours = std::chrono::floor<std::chrono::hours>(ms);
-diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
-index 59025d9..fcbc99c 100644
---- a/redfish-core/lib/metric_report_definition.hpp
-+++ b/redfish-core/lib/metric_report_definition.hpp
-@@ -1,9 +1,12 @@
- #pragma once
-
- #include "node.hpp"
-+#include "sensors.hpp"
- #include "utils/telemetry_utils.hpp"
- #include "utils/time_utils.hpp"
-
-+#include <boost/container/flat_map.hpp>
-+
- #include <tuple>
- #include <variant>
-
-@@ -95,6 +98,252 @@ inline void fillReportDefinition(
- asyncResp->res.jsonValue["Schedule"]["RecurrenceInterval"] =
- time_utils::toDurationString(std::chrono::milliseconds(*interval));
- }
-+
-+struct AddReportArgs
-+{
-+ std::string name;
-+ std::string reportingType;
-+ bool emitsReadingsUpdate = false;
-+ bool logToMetricReportsCollection = false;
-+ uint64_t interval = 0;
-+ std::vector<std::pair<std::string, std::vector<std::string>>> metrics;
-+};
-+
-+inline bool toDbusReportActions(crow::Response& res,
-+ std::vector<std::string>& actions,
-+ AddReportArgs& args)
-+{
-+ size_t index = 0;
-+ for (auto& action : actions)
-+ {
-+ if (action == "RedfishEvent")
-+ {
-+ args.emitsReadingsUpdate = true;
-+ }
-+ else if (action == "LogToMetricReportsCollection")
-+ {
-+ args.logToMetricReportsCollection = true;
-+ }
-+ else
-+ {
-+ messages::propertyValueNotInList(
-+ res, action, "ReportActions/" + std::to_string(index));
-+ return false;
-+ }
-+ index++;
-+ }
-+ return true;
-+}
-+
-+inline bool getUserParameters(crow::Response& res, const crow::Request& req,
-+ AddReportArgs& args)
-+{
-+ std::vector<nlohmann::json> metrics;
-+ std::vector<std::string> reportActions;
-+ std::optional<nlohmann::json> schedule;
-+ if (!json_util::readJson(req, res, "Id", args.name, "Metrics", metrics,
-+ "MetricReportDefinitionType", args.reportingType,
-+ "ReportActions", reportActions, "Schedule",
-+ schedule))
-+ {
-+ return false;
-+ }
-+
-+ constexpr const char* allowedCharactersInName =
-+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
-+ if (args.name.empty() || args.name.find_first_not_of(
-+ allowedCharactersInName) != std::string::npos)
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to match " << args.name
-+ << " with allowed character "
-+ << allowedCharactersInName;
-+ messages::propertyValueIncorrect(res, "Id", args.name);
-+ return false;
-+ }
-+
-+ if (args.reportingType != "Periodic" && args.reportingType != "OnRequest")
-+ {
-+ messages::propertyValueNotInList(res, args.reportingType,
-+ "MetricReportDefinitionType");
-+ return false;
-+ }
-+
-+ if (!toDbusReportActions(res, reportActions, args))
-+ {
-+ return false;
-+ }
-+
-+ if (args.reportingType == "Periodic")
-+ {
-+ if (!schedule)
-+ {
-+ messages::createFailedMissingReqProperties(res, "Schedule");
-+ return false;
-+ }
-+
-+ std::string durationStr;
-+ if (!json_util::readJson(*schedule, res, "RecurrenceInterval",
-+ durationStr))
-+ {
-+ return false;
-+ }
-+
-+ std::optional<std::chrono::milliseconds> durationNum =
-+ time_utils::fromDurationString(durationStr);
-+ if (!durationNum)
-+ {
-+ messages::propertyValueIncorrect(res, "RecurrenceInterval",
-+ durationStr);
-+ return false;
-+ }
-+ args.interval = static_cast<uint64_t>(durationNum->count());
-+ }
-+
-+ args.metrics.reserve(metrics.size());
-+ for (auto& m : metrics)
-+ {
-+ std::string id;
-+ std::vector<std::string> uris;
-+ if (!json_util::readJson(m, res, "MetricId", id, "MetricProperties",
-+ uris))
-+ {
-+ return false;
-+ }
-+
-+ args.metrics.emplace_back(std::move(id), std::move(uris));
-+ }
-+
-+ return true;
-+}
-+
-+inline bool getChassisSensorNode(
-+ const std::shared_ptr<AsyncResp>& asyncResp,
-+ const std::vector<std::pair<std::string, std::vector<std::string>>>&
-+ metrics,
-+ boost::container::flat_set<std::pair<std::string, std::string>>& matched)
-+{
-+ for (const auto& [id, uris] : metrics)
-+ {
-+ for (size_t i = 0; i < uris.size(); i++)
-+ {
-+ const std::string& uri = uris[i];
-+ std::string chassis;
-+ std::string node;
-+
-+ if (!boost::starts_with(uri, "/redfish/v1/Chassis/") ||
-+ !dbus::utility::getNthStringFromPath(uri, 3, chassis) ||
-+ !dbus::utility::getNthStringFromPath(uri, 4, node))
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
-+ "from "
-+ << uri;
-+ messages::propertyValueIncorrect(asyncResp->res, uri,
-+ "MetricProperties/" +
-+ std::to_string(i));
-+ return false;
-+ }
-+
-+ if (boost::ends_with(node, "#"))
-+ {
-+ node.pop_back();
-+ }
-+
-+ matched.emplace(std::move(chassis), std::move(node));
-+ }
-+ }
-+ return true;
-+}
-+
-+class AddReport
-+{
-+ public:
-+ AddReport(AddReportArgs argsIn, std::shared_ptr<AsyncResp> asyncResp) :
-+ asyncResp{std::move(asyncResp)}, args{std::move(argsIn)}
-+ {}
-+ ~AddReport()
-+ {
-+ if (asyncResp->res.result() != boost::beast::http::status::ok)
-+ {
-+ return;
-+ }
-+
-+ telemetry::ReadingParameters readingParams;
-+ readingParams.reserve(args.metrics.size());
-+
-+ for (const auto& [id, uris] : args.metrics)
-+ {
-+ for (size_t i = 0; i < uris.size(); i++)
-+ {
-+ const std::string& uri = uris[i];
-+ auto el = uriToDbus.find(uri);
-+ if (el == uriToDbus.end())
-+ {
-+ BMCWEB_LOG_ERROR << "Failed to find DBus sensor "
-+ "corresponding to URI "
-+ << uri;
-+ messages::propertyValueNotInList(asyncResp->res, uri,
-+ "MetricProperties/" +
-+ std::to_string(i));
-+ return;
-+ }
-+
-+ const std::string& dbusPath = el->second;
-+ readingParams.emplace_back(dbusPath, "SINGLE", id, uri);
-+ }
-+ }
-+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp = std::move(asyncResp), name = args.name,
-+ uriToDbus = std::move(uriToDbus)](
-+ const boost::system::error_code ec, const std::string&) {
-+ if (ec == boost::system::errc::file_exists)
-+ {
-+ messages::resourceAlreadyExists(
-+ asyncResp->res, "MetricReportDefinition", "Id", name);
-+ return;
-+ }
-+ if (ec == boost::system::errc::too_many_files_open)
-+ {
-+ messages::createLimitReachedForResource(asyncResp->res);
-+ return;
-+ }
-+ if (ec == boost::system::errc::argument_list_too_long)
-+ {
-+ nlohmann::json metricProperties = nlohmann::json::array();
-+ for (const auto& [uri, _] : uriToDbus)
-+ {
-+ metricProperties.emplace_back(uri);
-+ }
-+ messages::propertyValueIncorrect(
-+ asyncResp->res, metricProperties, "MetricProperties");
-+ return;
-+ }
-+ if (ec)
-+ {
-+ messages::internalError(asyncResp->res);
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ return;
-+ }
-+
-+ messages::created(asyncResp->res);
-+ },
-+ telemetry::service, "/xyz/openbmc_project/Telemetry/Reports",
-+ "xyz.openbmc_project.Telemetry.ReportManager", "AddReport",
-+ "TelemetryService/" + args.name, args.reportingType,
-+ args.emitsReadingsUpdate, args.logToMetricReportsCollection,
-+ args.interval, readingParams);
-+ }
-+
-+ void insert(const boost::container::flat_map<std::string, std::string>& el)
-+ {
-+ uriToDbus.insert(el.begin(), el.end());
-+ }
-+
-+ private:
-+ std::shared_ptr<AsyncResp> asyncResp;
-+ AddReportArgs args;
-+ boost::container::flat_map<std::string, std::string> uriToDbus{};
-+};
- } // namespace telemetry
-
- class MetricReportDefinitionCollection : public Node
-@@ -126,6 +375,46 @@ class MetricReportDefinitionCollection : public Node
- telemetry::getReportCollection(asyncResp,
- telemetry::metricReportDefinitionUri);
- }
-+
-+ void doPost(crow::Response& res, const crow::Request& req,
-+ const std::vector<std::string>&) override
-+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ telemetry::AddReportArgs args;
-+ if (!telemetry::getUserParameters(res, req, args))
-+ {
-+ return;
-+ }
-+
-+ boost::container::flat_set<std::pair<std::string, std::string>>
-+ chassisSensors;
-+ if (!telemetry::getChassisSensorNode(asyncResp, args.metrics,
-+ chassisSensors))
-+ {
-+ return;
-+ }
-+
-+ auto addReportReq =
-+ std::make_shared<telemetry::AddReport>(std::move(args), asyncResp);
-+ for (const auto& [chassis, sensorType] : chassisSensors)
-+ {
-+ retrieveUriToDbusMap(
-+ chassis, sensorType,
-+ [asyncResp, addReportReq](
-+ 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);
-+ return;
-+ }
-+ addReportReq->insert(uriToDbus);
-+ });
-+ }
-+ }
- };
-
- class MetricReportDefinition : public Node
-@@ -184,5 +473,44 @@ class MetricReportDefinition : public Node
- "org.freedesktop.DBus.Properties", "GetAll",
- telemetry::reportInterface);
- }
-+
-+ void doDelete(crow::Response& res, const crow::Request&,
-+ const std::vector<std::string>& params) override
-+ {
-+ auto asyncResp = std::make_shared<AsyncResp>(res);
-+ if (params.size() != 1)
-+ {
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ const std::string& id = params[0];
-+ const std::string reportPath = telemetry::getDbusReportPath(id);
-+
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp, id](const boost::system::error_code ec) {
-+ /*
-+ * boost::system::errc and std::errc are missing value for
-+ * EBADR error that is defined in Linux.
-+ */
-+ if (ec.value() == EBADR)
-+ {
-+ messages::resourceNotFound(asyncResp->res,
-+ "MetricReportDefinition", id);
-+ return;
-+ }
-+
-+ if (ec)
-+ {
-+ BMCWEB_LOG_ERROR << "respHandler DBus error " << ec;
-+ messages::internalError(asyncResp->res);
-+ return;
-+ }
-+
-+ asyncResp->res.result(boost::beast::http::status::no_content);
-+ },
-+ telemetry::service, reportPath, "xyz.openbmc_project.Object.Delete",
-+ "Delete");
-+ }
- };
- } // namespace redfish
-diff --git a/redfish-core/ut/time_utils_test.cpp b/redfish-core/ut/time_utils_test.cpp
-new file mode 100644
-index 0000000..70999ce
---- /dev/null
-+++ b/redfish-core/ut/time_utils_test.cpp
-@@ -0,0 +1,63 @@
-+#include "utils/time_utils.hpp"
-+
-+#include <gmock/gmock.h>
-+
-+using namespace testing;
-+
-+class FromDurationTest :
-+ public Test,
-+ public WithParamInterface<
-+ std::pair<std::string, std::optional<std::chrono::milliseconds>>>
-+{};
-+
-+INSTANTIATE_TEST_SUITE_P(
-+ _, FromDurationTest,
-+ Values(std::make_pair("PT12S", std::chrono::milliseconds(12000)),
-+ std::make_pair("PT0.204S", std::chrono::milliseconds(204)),
-+ std::make_pair("PT0.2S", std::chrono::milliseconds(200)),
-+ std::make_pair("PT50M", std::chrono::milliseconds(3000000)),
-+ std::make_pair("PT23H", std::chrono::milliseconds(82800000)),
-+ std::make_pair("P51D", std::chrono::milliseconds(4406400000)),
-+ std::make_pair("PT2H40M10.1S", std::chrono::milliseconds(9610100)),
-+ std::make_pair("P20DT2H40M10.1S",
-+ std::chrono::milliseconds(1737610100)),
-+ std::make_pair("", std::chrono::milliseconds(0)),
-+ std::make_pair("PTS", std::nullopt),
-+ std::make_pair("P1T", std::nullopt),
-+ std::make_pair("PT100M1000S100", std::nullopt),
-+ std::make_pair("PDTHMS", std::nullopt),
-+ std::make_pair("P99999999999999999DT", std::nullopt),
-+ std::make_pair("PD222T222H222M222.222S", std::nullopt),
-+ std::make_pair("PT99999H9999999999999999999999M99999999999S",
-+ std::nullopt),
-+ std::make_pair("PT-9H", std::nullopt)));
-+
-+TEST_P(FromDurationTest, convertToMilliseconds)
-+{
-+ const auto& [str, expected] = GetParam();
-+ EXPECT_THAT(redfish::time_utils::fromDurationString(str), Eq(expected));
-+}
-+
-+class ToDurationTest :
-+ public Test,
-+ public WithParamInterface<std::pair<std::chrono::milliseconds, std::string>>
-+{};
-+
-+INSTANTIATE_TEST_SUITE_P(
-+ _, ToDurationTest,
-+ Values(std::make_pair(std::chrono::milliseconds(12000), "PT12.000S"),
-+ std::make_pair(std::chrono::milliseconds(204), "PT0.204S"),
-+ std::make_pair(std::chrono::milliseconds(200), "PT0.200S"),
-+ std::make_pair(std::chrono::milliseconds(3000000), "PT50M"),
-+ std::make_pair(std::chrono::milliseconds(82800000), "PT23H"),
-+ std::make_pair(std::chrono::milliseconds(4406400000), "P51DT"),
-+ std::make_pair(std::chrono::milliseconds(9610100), "PT2H40M10.100S"),
-+ std::make_pair(std::chrono::milliseconds(1737610100),
-+ "P20DT2H40M10.100S"),
-+ std::make_pair(std::chrono::milliseconds(-250), "")));
-+
-+TEST_P(ToDurationTest, convertToDuration)
-+{
-+ const auto& [ms, expected] = GetParam();
-+ EXPECT_THAT(redfish::time_utils::toDurationString(ms), Eq(expected));
-+}
---
-2.17.1
-
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 cfb47a49b..46128f7ae 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
@@ -2,9 +2,6 @@ These patches are mirror of upstream TelemetryService implementation.
Until change is integrated they will be manually merged here to enable feature in Intel builds.
Current revisions:
-- Add POST and DELETE in MetricReportDefinitions
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/32536/63
-
- Add support for MetricDefinition scheme
https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/60