summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2021-07-30 01:23:08 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2021-07-30 02:21:22 +0300
commit67327ddc580cb9a85219a534844832a1682780d4 (patch)
tree307cedb87f4c0a329740c55ac364ed489d1d8fc2 /meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry
parentbb6a14e2f317abf60677c6ad8de9c33d5760bf36 (diff)
downloadopenbmc-67327ddc580cb9a85219a534844832a1682780d4.tar.xz
Update to internal 0.63
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0001-Add-support-for-MetricDefinition-scheme.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Add-support-for-MetricDefinition-scheme.patch)422
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0002-Sync-Telmetry-service-with-EventService.patch (renamed from meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-Sync-Telmetry-service-with-EventService.patch)15
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch26
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch29
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/README9
5 files changed, 315 insertions, 186 deletions
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/0001-Add-support-for-MetricDefinition-scheme.patch
index 8b08c6c5e..f03e49223 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/0001-Add-support-for-MetricDefinition-scheme.patch
@@ -1,38 +1,39 @@
-From d664a145a96a642597c74819c183410d4a04fce0 Mon Sep 17 00:00:00 2001
+From 6acffea563905c00f4b6d00c738fe7516e03c724 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
-by Telemetry service. Metrics are grouped by following
-categories: temperature, power, voltage, current, fan_tach,
-fan_pwm, utilization.
+Added MetricDefinition node to Redfish code. Now user is able to list
+all available metrics in OpenBMC that are supported by Telemetry
+service. Metrics are grouped by following categories: temperature,
+power, voltage, current, fan_tach, fan_pwm, utilization.
Tested:
- - MetricDefinitions response is filled with existing sensors,
- it works with and without Telemetry service
- - Validated a presence of MetricDefinition members and it
- attributes
- - Succesfully passed RedfishServiceValidator.py using
- witherspoon image on QEMU
+ - MetricDefinitions response is filled with existing sensors, it works
+ with and without Telemetry service
+ - Validated a presence of MetricDefinition members and its attributes
+ - Successfully passed RedfishServiceValidator.py using witherspoon image
+ on QEMU
Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
Change-Id: I3086e1302e1ba2e5442d1367939fd5507a0cbc00
---
redfish-core/include/redfish.hpp | 3 +
+ .../include/utils/get_chassis_names.hpp | 58 ++++
.../include/utils/telemetry_utils.hpp | 2 +
- redfish-core/lib/metric_definition.hpp | 335 ++++++++++++++++++
+ redfish-core/lib/metric_definition.hpp | 264 ++++++++++++++++++
+ redfish-core/lib/sensors.hpp | 25 +-
redfish-core/lib/telemetry_service.hpp | 2 +
- 4 files changed, 342 insertions(+)
+ 6 files changed, 342 insertions(+), 12 deletions(-)
+ create mode 100644 redfish-core/include/utils/get_chassis_names.hpp
create mode 100644 redfish-core/lib/metric_definition.hpp
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 7a14969..d280a86 100644
+index 4418c3d..594520d 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
-@@ -26,6 +26,7 @@
+@@ -25,6 +25,7 @@
#include "../lib/managers.hpp"
#include "../lib/memory.hpp"
#include "../lib/message_registries.hpp"
@@ -40,7 +41,7 @@ index 7a14969..d280a86 100644
#include "../lib/metric_report.hpp"
#include "../lib/metric_report_definition.hpp"
#include "../lib/network_protocol.hpp"
-@@ -219,6 +220,8 @@ class RedfishService
+@@ -215,6 +216,8 @@ class RedfishService
nodes.emplace_back(std::make_unique<HypervisorResetActionInfo>(app));
nodes.emplace_back(std::make_unique<TelemetryService>(app));
@@ -49,31 +50,19 @@ index 7a14969..d280a86 100644
nodes.emplace_back(
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 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
-
- constexpr const char* service = "xyz.openbmc_project.Telemetry";
- constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report";
-+constexpr const char* metricDefinitionUri =
-+ "/redfish/v1/TelemetryService/MetricDefinitions/";
- constexpr const char* metricReportDefinitionUri =
- "/redfish/v1/TelemetryService/MetricReportDefinitions/";
- constexpr const char* metricReportUri =
-diff --git a/redfish-core/lib/metric_definition.hpp b/redfish-core/lib/metric_definition.hpp
+diff --git a/redfish-core/include/utils/get_chassis_names.hpp b/redfish-core/include/utils/get_chassis_names.hpp
new file mode 100644
-index 0000000..515fe86
+index 0000000..0276b6f
--- /dev/null
-+++ b/redfish-core/lib/metric_definition.hpp
-@@ -0,0 +1,335 @@
++++ b/redfish-core/include/utils/get_chassis_names.hpp
+@@ -0,0 +1,58 @@
+#pragma once
+
-+#include "async_resp.hpp"
-+#include "node.hpp"
-+#include "sensors.hpp"
-+#include "utils/telemetry_utils.hpp"
++#include <include/dbus_singleton.hpp>
++
++#include <array>
++#include <string>
++#include <vector>
+
+namespace redfish
+{
@@ -81,52 +70,6 @@ index 0000000..515fe86
+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)
+{
@@ -170,6 +113,37 @@ index 0000000..515fe86
+
+} // namespace utils
+
++} // namespace redfish
+diff --git a/redfish-core/include/utils/telemetry_utils.hpp b/redfish-core/include/utils/telemetry_utils.hpp
+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
+
+ constexpr const char* service = "xyz.openbmc_project.Telemetry";
+ constexpr const char* reportInterface = "xyz.openbmc_project.Telemetry.Report";
++constexpr const char* metricDefinitionUri =
++ "/redfish/v1/TelemetryService/MetricDefinitions/";
+ constexpr const char* metricReportDefinitionUri =
+ "/redfish/v1/TelemetryService/MetricReportDefinitions/";
+ 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..072fe20
+--- /dev/null
++++ b/redfish-core/lib/metric_definition.hpp
+@@ -0,0 +1,264 @@
++#pragma once
++
++#include "async_resp.hpp"
++#include "node.hpp"
++#include "sensors.hpp"
++#include "utils/get_chassis_names.hpp"
++#include "utils/telemetry_utils.hpp"
++
++namespace redfish
++{
++
+namespace telemetry
+{
+
@@ -180,7 +154,8 @@ index 0000000..515fe86
+ {
+ sdbusplus::message::object_path path(dbusSensor);
+ sdbusplus::message::object_path parentPath = path.parent_path();
-+ std::string type = parentPath.filename();
++ const std::string type = parentPath.filename();
++
+ if (type.empty())
+ {
+ BMCWEB_LOG_ERROR << "Received invalid DBus Sensor Path = "
@@ -191,18 +166,24 @@ index 0000000..515fe86
+ nlohmann::json& members = res.jsonValue["Members"];
+
+ const std::string odataId =
-+ telemetry::metricDefinitionUri + std::move(type);
-+
-+ 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;
-+ });
++ std::string(telemetry::metricDefinitionUri) +
++ sensors::toReadingType(type);
++
++ 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;
++ }
++ const std::string* value =
++ kt->get_ptr<const std::string*>();
++ if (!value)
++ {
++ return false;
++ }
++ return *value == odataId;
++ });
+
+ if (it == members.end())
+ {
@@ -242,25 +223,8 @@ index 0000000..515fe86
+ 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);
-+ };
-+
+ utils::getChassisNames(
-+ [handleRetrieveUriToDbusMap = std::move(handleRetrieveUriToDbusMap),
-+ asyncResp](boost::system::error_code ec,
++ [asyncResp](boost::system::error_code ec,
+ const std::vector<std::string>& chassisNames) {
+ if (ec)
+ {
@@ -269,6 +233,22 @@ index 0000000..515fe86
+ return;
+ }
+
++ 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);
++ };
++
+ for (const std::string& chassisName : chassisNames)
+ {
+ for (const auto& [sensorNode, _] : sensors::dbus::paths)
@@ -286,8 +266,26 @@ index 0000000..515fe86
+namespace telemetry
+{
+
++bool isSensorIdSupported(std::string_view readingType)
++{
++ for (const std::pair<std::string_view, std::vector<const char*>>&
++ typeToPaths : sensors::dbus::paths)
++ {
++ for (const char* supportedPath : typeToPaths.second)
++ {
++ if (readingType ==
++ sensors::toReadingType(
++ sdbusplus::message::object_path(supportedPath).filename()))
++ {
++ return true;
++ }
++ }
++ }
++ return false;
++}
++
+void addMetricProperty(
-+ utils::AsyncRespWithFinalizer& asyncResp, const std::string& id,
++ bmcweb::AsyncResp& asyncResp, const std::string& readingType,
+ const boost::container::flat_map<std::string, std::string>& el)
+{
+ nlohmann::json& metricProperties =
@@ -298,7 +296,7 @@ index 0000000..515fe86
+ std::string sensorId;
+ if (dbus::utility::getNthStringFromPath(dbusSensor, 3, sensorId))
+ {
-+ if (sensorId == id)
++ if (sensors::toReadingType(sensorId) == readingType)
+ {
+ metricProperties.push_back(redfishSensor);
+ }
@@ -329,80 +327,152 @@ index 0000000..515fe86
+ const crow::Request&,
+ const std::vector<std::string>& params) override
+ {
-+ auto telemetryAsyncResp =
-+ std::make_shared<utils::AsyncRespWithFinalizer>(asyncResp);
-+
+ if (params.size() != 1)
+ {
-+ messages::internalError(telemetryAsyncResp->res);
++ messages::internalError(asyncResp->res);
+ return;
+ }
+
-+ const std::string& id = params[0];
-+ telemetryAsyncResp->setFinalizer([id](crow::Response& res) {
-+ if (res.jsonValue["MetricProperties"].empty())
-+ {
-+ messages::resourceNotFound(res, "MetricDefinition", id);
-+ }
-+ });
++ const std::string& readingType = params[0];
+
-+ 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);
-+ };
++ if (!telemetry::isSensorIdSupported(readingType))
++ {
++ messages::resourceNotFound(asyncResp->res, "MetricDefinition",
++ readingType);
++ return;
++ }
+
-+ utils::getChassisNames(
-+ [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;
-+ }
++ asyncResp->res.jsonValue["MetricProperties"] = nlohmann::json::array();
++ asyncResp->res.jsonValue["Id"] = readingType;
++ asyncResp->res.jsonValue["Name"] = readingType;
++ asyncResp->res.jsonValue["@odata.id"] =
++ telemetry::metricDefinitionUri + readingType;
++ 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["Implementation"] = "PhysicalSensor";
++ asyncResp->res.jsonValue["Units"] =
++ sensors::toReadingUnits(readingType);
++
++ utils::getChassisNames([asyncResp,
++ readingType](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, dbusPaths] :
-+ sensors::dbus::paths)
++ auto handleRetrieveUriToDbusMap =
++ [asyncResp, readingType](
++ const boost::beast::http::status status,
++ const boost::container::flat_map<std::string, std::string>&
++ uriToDbus) {
++ if (status != boost::beast::http::status::ok)
+ {
-+ retrieveUriToDbusMap(chassisName, sensorNode.data(),
-+ handleRetrieveUriToDbusMap);
++ BMCWEB_LOG_ERROR << "Failed to retrieve URI to dbus "
++ "sensors map with err "
++ << static_cast<unsigned>(status);
++ messages::internalError(asyncResp->res);
++ return;
+ }
++ telemetry::addMetricProperty(*asyncResp, readingType,
++ uriToDbus);
++ };
++
++ for (const std::string& chassisName : chassisNames)
++ {
++ for (const auto& [sensorNode, dbusPaths] : sensors::dbus::paths)
++ {
++ retrieveUriToDbusMap(chassisName, sensorNode.data(),
++ handleRetrieveUriToDbusMap);
+ }
-+ });
++ }
++ });
+ }
+};
+
+} // namespace redfish
+diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
+index e7f4cde..b16b014 100644
+--- a/redfish-core/lib/sensors.hpp
++++ b/redfish-core/lib/sensors.hpp
+@@ -111,46 +111,47 @@ inline const char* toReadingType(const std::string& sensorType)
+ return "";
+ }
+
+-inline const char* toReadingUnits(const std::string& sensorType)
++inline const char* toReadingUnits(const std::string& readingType)
+ {
+- if (sensorType == "voltage")
++ if (readingType == "Voltage")
+ {
+ return "V";
+ }
+- if (sensorType == "power")
++ if (readingType == "Power")
+ {
+ return "W";
+ }
+- if (sensorType == "current")
++ if (readingType == "Current")
+ {
+ return "A";
+ }
+- if (sensorType == "fan_tach")
++ if (readingType == "Rotational")
+ {
+ return "RPM";
+ }
+- if (sensorType == "temperature")
++ if (readingType == "Temperature")
+ {
+ return "Cel";
+ }
+- if (sensorType == "fan_pwm" || sensorType == "utilization")
++ if (readingType == "Percent")
+ {
+ return "%";
+ }
+- if (sensorType == "altitude")
++ if (readingType == "Altitude")
+ {
+ return "m";
+ }
+- if (sensorType == "airflow")
++ if (readingType == "AirFlow")
+ {
+ return "cft_i/min";
+ }
+- if (sensorType == "energy")
++ if (readingType == "EnergyJoules")
+ {
+ return "J";
+ }
+ return "";
+ }
++
+ } // namespace sensors
+
+ /**
+@@ -953,11 +954,11 @@ inline void objectInterfacesToJson(
+ sensorJson["ReadingType"] = readingType;
+ }
+
+- const std::string& readingUnits = sensors::toReadingUnits(sensorType);
++ const std::string& readingUnits = sensors::toReadingUnits(readingType);
+ if (readingUnits.empty())
+ {
+ BMCWEB_LOG_ERROR << "Redfish cannot map reading unit for "
+- << sensorType;
++ << readingType;
+ }
+ else
+ {
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 9ec0737..de9c800 100644
--- a/redfish-core/lib/telemetry_service.hpp
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/0002-Sync-Telmetry-service-with-EventService.patch
index 4119045f1..9b77c29df 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/0002-Sync-Telmetry-service-with-EventService.patch
@@ -1,4 +1,4 @@
-From 0ed9ff4f37e7d3ea81073ad35acd530730104033 Mon Sep 17 00:00:00 2001
+From 206411b4c9b603e7b0edf63e03c0ef7bf10b09b2 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] Sync Telmetry service with EventService
@@ -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 c3c110a..dc99cda 100644
+index a1761bb..0e2ebfd 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 c3c110a..dc99cda 100644
#include "node.hpp"
#include "registries.hpp"
#include "registries/base_message_registry.hpp"
-@@ -529,47 +530,32 @@ class Subscription
+@@ -523,47 +524,32 @@ class Subscription
}
#endif
@@ -92,7 +92,7 @@ index c3c110a..dc99cda 100644
this->sendEvent(
msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
}
-@@ -1421,75 +1407,6 @@ class EventServiceManager
+@@ -1359,75 +1345,6 @@ class EventServiceManager
}
#endif
@@ -168,7 +168,7 @@ index c3c110a..dc99cda 100644
void unregisterMetricReportSignal()
{
if (matchTelemetryMonitor)
-@@ -1509,9 +1426,11 @@ class EventServiceManager
+@@ -1447,9 +1364,11 @@ class EventServiceManager
}
BMCWEB_LOG_DEBUG << "Metrics report signal - Register";
@@ -183,7 +183,7 @@ index c3c110a..dc99cda 100644
matchTelemetryMonitor = std::make_shared<sdbusplus::bus::match::match>(
*crow::connections::systemBus, matchStr,
-@@ -1522,10 +1441,43 @@ class EventServiceManager
+@@ -1460,10 +1379,43 @@ class EventServiceManager
return;
}
@@ -291,5 +291,4 @@ index ad15a05..18a6dcc 100644
telemetry::service, reportPath,
"org.freedesktop.DBus.Properties", "Get",
--
-2.17.1
-
+2.25.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch
new file mode 100644
index 000000000..645351a51
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch
@@ -0,0 +1,26 @@
+From dc7e43c70285596195efd9d328b303091794278c Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Mon, 31 May 2021 10:08:57 +0000
+Subject: [PATCH] Revert "Remove LogService from TelemetryService"
+
+This reverts commit 2b3da45876aac57a36d3093379a992d699e7e396.
+---
+ redfish-core/lib/telemetry_service.hpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
+index de9c800..f05bf6d 100644
+--- a/redfish-core/lib/telemetry_service.hpp
++++ b/redfish-core/lib/telemetry_service.hpp
+@@ -38,6 +38,8 @@ class TelemetryService : public Node
+ "/redfish/v1/TelemetryService/MetricReportDefinitions";
+ asyncResp->res.jsonValue["MetricReports"]["@odata.id"] =
+ "/redfish/v1/TelemetryService/MetricReports";
++ asyncResp->res.jsonValue["LogService"]["@odata.id"] =
++ "/redfish/v1/Managers/bmc/LogServices/Journal";
+
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](
+--
+2.25.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch
new file mode 100644
index 000000000..ffab743f6
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/telemetry/0004-event-service-fix-added-Context-field-to-response.patch
@@ -0,0 +1,29 @@
+From 0ca8c383db8c9afbce63380955a20ada0acc20b7 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 2 Jun 2021 12:44:43 +0000
+Subject: [PATCH] event service fix, added Context field to response
+
+Tested:
+ - Context field is present
+ - No regression detected
+
+Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+---
+ redfish-core/include/event_service_manager.hpp | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
+index 2b957ea..289886b 100644
+--- a/redfish-core/include/event_service_manager.hpp
++++ b/redfish-core/include/event_service_manager.hpp
+@@ -556,6 +556,7 @@ class Subscription
+ << id;
+ return;
+ }
++ msg["Context"] = customText;
+
+ this->sendEvent(
+ msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
+--
+2.25.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 20c93c08e..ea6ac73bd 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,13 @@ 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/72
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/33363/80
- Sync Telmetry service with EventService
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/30
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/38798/31
+- LogService field, actual implementation will be upstreamed with triggers feature
+ file://telemetry/0003-Revert-Remove-LogService-from-TelemetryService.patch
+
+- Event service fix for Context field
+ file://telemetry/0004-event-service-fix-added-Context-field-to-response.patch