summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-EventService-Fix-type-mismatch-in-MetricReport.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-EventService-Fix-type-mismatch-in-MetricReport.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-EventService-Fix-type-mismatch-in-MetricReport.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-EventService-Fix-type-mismatch-in-MetricReport.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-EventService-Fix-type-mismatch-in-MetricReport.patch
new file mode 100644
index 000000000..378ce6c47
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/0016-EventService-Fix-type-mismatch-in-MetricReport.patch
@@ -0,0 +1,83 @@
+From cdfc5cfad41bcfa3fc0e53023bd62bdadf15ad86 Mon Sep 17 00:00:00 2001
+From: "Wludzik, Jozef" <jozef.wludzik@intel.com>
+Date: Fri, 24 Jul 2020 17:05:38 +0200
+Subject: [PATCH] EventService: Fix type mismatch in MetricReport
+
+Fix the type mismatch in MetricReport data which
+is sent to Event Subscribers. Change below properties
+type to match with MetricReport schema.
+ - Timestamp: It should be uint32_t type.
+ - MetricValue: It should be string type.
+
+Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
+Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
+Change-Id: I0a52b6963e7bedda89a216256f64764cd8799bf1
+---
+ redfish-core/include/event_service_manager.hpp | 23 +++++++++++++----------
+ 1 file changed, 13 insertions(+), 10 deletions(-)
+
+diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
+index 3e3058f..0f5c6b7 100644
+--- a/redfish-core/include/event_service_manager.hpp
++++ b/redfish-core/include/event_service_manager.hpp
+@@ -38,7 +38,7 @@ namespace redfish
+ {
+
+ using ReadingsObjType =
+- std::vector<std::tuple<std::string, std::string, double, std::string>>;
++ std::vector<std::tuple<std::string, std::string, double, int32_t>>;
+ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
+
+ static constexpr const char* eventFormatType = "Event";
+@@ -532,10 +532,12 @@ class Subscription
+ metricValuesArray.push_back({});
+ nlohmann::json& entry = metricValuesArray.back();
+
+- entry = {{"MetricId", std::get<0>(it)},
+- {"MetricProperty", std::get<1>(it)},
+- {"MetricValue", std::to_string(std::get<2>(it))},
+- {"Timestamp", std::get<3>(it)}};
++ auto& [id, property, value, timestamp] = it;
++
++ entry = {{"MetricId", id},
++ {"MetricProperty", property},
++ {"MetricValue", std::to_string(value)},
++ {"Timestamp", crow::utility::getDateTime(timestamp)}};
+ }
+
+ nlohmann::json msg = {
+@@ -1270,7 +1272,7 @@ class EventServiceManager
+ [idStr{std::move(idStr)}](
+ const boost::system::error_code ec,
+ boost::container::flat_map<
+- std::string, std::variant<std::string, ReadingsObjType>>&
++ std::string, std::variant<int32_t, ReadingsObjType>>&
+ resp) {
+ if (ec)
+ {
+@@ -1279,8 +1281,8 @@ class EventServiceManager
+ return;
+ }
+
+- const std::string* timestampPtr =
+- std::get_if<std::string>(&resp["Timestamp"]);
++ const int32_t* timestampPtr =
++ std::get_if<int32_t>(&resp["Timestamp"]);
+ if (!timestampPtr)
+ {
+ BMCWEB_LOG_DEBUG << "Failed to Get timestamp.";
+@@ -1307,8 +1309,9 @@ class EventServiceManager
+ std::shared_ptr<Subscription> entry = it.second;
+ if (entry->eventFormatType == metricReportFormatType)
+ {
+- entry->filterAndSendReports(idStr, *timestampPtr,
+- *readingsPtr);
++ entry->filterAndSendReports(
++ idStr, crow::utility::getDateTime(*timestampPtr),
++ *readingsPtr);
+ }
+ }
+ },
+--
+2.7.4
+