summaryrefslogtreecommitdiff
path: root/redfish-core/lib/event_service.hpp
diff options
context:
space:
mode:
authorAppaRao Puli <apparao.puli@linux.intel.com>2020-04-25 03:34:05 +0300
committerAppaRao Puli <apparao.puli@linux.intel.com>2020-05-14 04:09:21 +0300
commit156d6b00a9dc06ac9f618ecd8d5fc6b1b49d5be4 (patch)
tree874fd69b33be5f9da033b10b01b340b74595b1e2 /redfish-core/lib/event_service.hpp
parente46946ac9e5c72dbd63d36e420dba417243346bb (diff)
downloadbmcweb-156d6b00a9dc06ac9f618ecd8d5fc6b1b49d5be4.tar.xz
EventService: Add MetricReport support
Add Telemetry metric report support to EventService. - Adding MetricReport support to schema implemenation. - Dynamically register and unregister the metric report signal. - Reads Telemtry data using D-Bus calls. - Filter the metric reports depending on user configured MetricReportDefinition. - Format the Telemetry readings as per MetricReport schema. - Send the formatted data to the client. Tested: - HTTP client successfully received asynchronous metric reports data. - valdiated the register and unregister by adding and deleting subscriptions. - Ran Redfish validator successfully. Change-Id: I7b59ac3ecad169a7959a800730dbc2fe85baf068 Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Diffstat (limited to 'redfish-core/lib/event_service.hpp')
-rw-r--r--redfish-core/lib/event_service.hpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 3e3435ff49..63302d6072 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -19,8 +19,8 @@
namespace redfish
{
-static constexpr const std::array<const char*, 1> supportedEvtFormatTypes = {
- "Event"};
+static constexpr const std::array<const char*, 2> supportedEvtFormatTypes = {
+ eventFormatType, metricReportFormatType};
static constexpr const std::array<const char*, 3> supportedRegPrefixes = {
"Base", "OpenBMC", "Task"};
static constexpr const std::array<const char*, 3> supportedRetryPolicies = {
@@ -217,13 +217,15 @@ class EventDestinationCollection : public Node
std::optional<std::vector<std::string>> msgIds;
std::optional<std::vector<std::string>> regPrefixes;
std::optional<std::vector<nlohmann::json>> headers;
+ std::optional<std::vector<nlohmann::json>> metricReportDefinitions;
if (!json_util::readJson(
req, res, "Destination", destUrl, "Context", context,
"Protocol", protocol, "SubscriptionType", subscriptionType,
"EventFormatType", eventFormatType, "HttpHeaders", headers,
"RegistryPrefixes", regPrefixes, "MessageIds", msgIds,
- "DeliveryRetryPolicy", retryPolicy))
+ "DeliveryRetryPolicy", retryPolicy, "MetricReportDefinitions",
+ metricReportDefinitions))
{
return;
}
@@ -373,6 +375,11 @@ class EventDestinationCollection : public Node
subValue->retryPolicy = "TerminateAfterRetries";
}
+ if (metricReportDefinitions)
+ {
+ subValue->metricReportDefinitions = *metricReportDefinitions;
+ }
+
std::string id =
EventServiceManager::getInstance().addSubscription(subValue);
if (id.empty())
@@ -441,6 +448,8 @@ class EventDestination : public Node
subValue->registryPrefixes;
asyncResp->res.jsonValue["MessageIds"] = subValue->registryMsgIds;
asyncResp->res.jsonValue["DeliveryRetryPolicy"] = subValue->retryPolicy;
+ asyncResp->res.jsonValue["MetricReportDefinitions"] =
+ subValue->metricReportDefinitions;
}
void doPatch(crow::Response& res, const crow::Request& req,