summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice
diff options
context:
space:
mode:
authorJason M. Bills <jason.m.bills@linux.intel.com>2021-08-26 23:18:00 +0300
committerJason M. Bills <jason.m.bills@linux.intel.com>2021-08-27 19:05:02 +0300
commit6f106a0a4ce15fe0678d4ffefd572e6978c72597 (patch)
treed98626c9763ad9048ac9bfd8269e12eced18d496 /meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice
parentae908254d22318b9e27acf6e5e28d1a4ab5e2195 (diff)
downloadopenbmc-6f106a0a4ce15fe0678d4ffefd572e6978c72597.tar.xz
Update to internal 0.70
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch9
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch9
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch15
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch86
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0006-Add-EventService-SSE-filter-support.patch30
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch42
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch92
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch225
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README19
9 files changed, 387 insertions, 140 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch
index bda893a81..7a6818008 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0001-EventService-Fix-retry-handling-for-http-client.patch
@@ -1,4 +1,4 @@
-From 3d6c3b3e91c04ff8f10bff49bcf2a7d7206c53df Mon Sep 17 00:00:00 2001
+From f74393a9bca899e353be3d0e2dc5c224539fe432 Mon Sep 17 00:00:00 2001
From: Sunitha Harish <sunithaharish04@gmail.com>
Date: Fri, 19 Feb 2021 13:38:31 +0530
Subject: [PATCH] EventService : Fix retry handling for http-client
@@ -530,10 +530,10 @@ index 992ac2b..feabbba 100644
void setRetryConfig(const uint32_t retryAttempts,
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index fa4e41a..c999121 100644
+index 11190ef..a8f7517 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -423,7 +423,7 @@ class Subscription
+@@ -422,7 +422,7 @@ class Subscription
reqHeaders.emplace_back(std::pair(key, val));
}
}
@@ -543,5 +543,4 @@ index fa4e41a..c999121 100644
this->eventSeqNum++;
}
--
-2.17.1
-
+2.25.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch
index 7cbb406a5..eef0ff065 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0002-EventService-https-client-support.patch
@@ -1,4 +1,4 @@
-From 5f19e5c8ebc5cb0ce331e4ef841526995b6bdb2e Mon Sep 17 00:00:00 2001
+From 4df4a36d6d2cc11c51cc9d53cd441178cc97e39b Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Mon, 22 Feb 2021 17:07:47 +0000
Subject: [PATCH] EventService: https client support
@@ -385,10 +385,10 @@ index feabbba..aaf1b2d 100644
{
if ((state == ConnState::suspended) || (state == ConnState::terminated))
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index c999121..267c857 100644
+index a8f7517..d4a5bc5 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -398,7 +398,7 @@ class Subscription
+@@ -397,7 +397,7 @@ class Subscription
{
conn = std::make_shared<crow::HttpClient>(
crow::connections::systemBus->get_io_context(), id, host, port,
@@ -398,5 +398,4 @@ index c999121..267c857 100644
Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) :
--
-2.17.1
-
+2.25.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch
index cd59ed94d..64948ca0c 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0004-Add-Server-Sent-Events-support.patch
@@ -1,4 +1,4 @@
-From 0c531d959364192697290c1489d5f7b1bdd7a665 Mon Sep 17 00:00:00 2001
+From 882dc7755083eea32f3d14f7e6c7330d5a9ac66f Mon Sep 17 00:00:00 2001
From: AppaRao Puli <apparao.puli@linux.intel.com>
Date: Fri, 12 Mar 2021 18:53:25 +0000
Subject: [PATCH] Add Server-Sent-Events support
@@ -30,7 +30,7 @@ Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
create mode 100644 http/server_sent_event.hpp
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
-index 6172b3a..fc9fc60 100644
+index fb64014..45b1a68 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -326,7 +326,7 @@ class Connection :
@@ -63,10 +63,10 @@ index 6172b3a..fc9fc60 100644
// delete lambda with self shared_ptr
// to enable connection destruction
diff --git a/http/http_response.hpp b/http/http_response.hpp
-index 7965704..29c56e1 100644
+index 72ff9e9..6bb3aa5 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
-@@ -13,10 +13,15 @@ namespace crow
+@@ -15,10 +15,15 @@ namespace crow
template <typename Adaptor, typename Handler>
class Connection;
@@ -82,7 +82,7 @@ index 7965704..29c56e1 100644
using response_type =
boost::beast::http::response<boost::beast::http::string_body>;
-@@ -136,8 +141,8 @@ struct Response
+@@ -138,8 +143,8 @@ struct Response
private:
bool completed{};
@@ -93,7 +93,7 @@ index 7965704..29c56e1 100644
// In case of a JSON object, set the Content-Type header
void jsonMode()
diff --git a/http/routing.hpp b/http/routing.hpp
-index dd07523..7ddc6b0 100644
+index af6269e..318fcfe 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -6,6 +6,7 @@
@@ -474,5 +474,4 @@ index 0000000..41d18ed
+};
+} // namespace crow
--
-2.17.1
-
+2.25.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 37609c154..78b52eea1 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 bcb80fc9a86555c74b56b5b37615601d3fbfae31 Mon Sep 17 00:00:00 2001
+From a9d994919b677a2650b80fb449cf96baad4f04dd 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] Add SSE style subscription support to eventservice
@@ -24,15 +24,15 @@ Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de
http/http_connection.hpp | 2 +-
include/eventservice_sse.hpp | 75 +++++
.../include/event_service_manager.hpp | 109 +++++--
- redfish-core/include/server_sent_events.hpp | 291 ------------------
- redfish-core/lib/event_service.hpp | 4 +-
+ redfish-core/include/server_sent_events.hpp | 290 ------------------
+ redfish-core/lib/event_service.hpp | 8 +-
src/webserver_main.cpp | 2 +
- 6 files changed, 163 insertions(+), 320 deletions(-)
+ 6 files changed, 164 insertions(+), 322 deletions(-)
create mode 100644 include/eventservice_sse.hpp
delete mode 100644 redfish-core/include/server_sent_events.hpp
diff --git a/http/http_connection.hpp b/http/http_connection.hpp
-index fc9fc60..3afb4da 100644
+index 45b1a68bf015..ccc2d6a753b7 100644
--- a/http/http_connection.hpp
+++ b/http/http_connection.hpp
@@ -350,7 +350,7 @@ class Connection :
@@ -46,7 +46,7 @@ index fc9fc60..3afb4da 100644
<< " is getting upgraded";
diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp
new file mode 100644
-index 0000000..6c98e6e
+index 000000000000..14daf00852f5
--- /dev/null
+++ b/include/eventservice_sse.hpp
@@ -0,0 +1,75 @@
@@ -107,7 +107,7 @@ index 0000000..6c98e6e
+inline void requestRoutes(App& app)
+{
+ BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/SSE")
-+ .privileges({"ConfigureComponents", "ConfigureManager"})
++ .privileges({{"ConfigureComponents", "ConfigureManager"}})
+ .serverSentEvent()
+ .onopen([](std::shared_ptr<crow::SseConnection>& conn,
+ const crow::Request& req, crow::Response& res) {
@@ -126,17 +126,19 @@ 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 fa4e41a..ac644c1 100644
+index ca46aa7dc62f..098134a3a259 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -23,13 +23,15 @@
+@@ -22,15 +22,17 @@
#include <sys/inotify.h>
#include <boost/asio/io_context.hpp>
+#include <boost/beast/core/span.hpp>
#include <boost/container/flat_map.hpp>
#include <error_messages.hpp>
+ #include <event_service_store.hpp>
#include <http_client.hpp>
+ #include <persistent_data.hpp>
#include <random.hpp>
-#include <server_sent_events.hpp>
+#include <server_sent_event.hpp>
@@ -146,7 +148,7 @@ index fa4e41a..ac644c1 100644
#include <cstdlib>
#include <ctime>
#include <fstream>
-@@ -46,9 +48,27 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>;
+@@ -46,9 +48,27 @@ using ReadingsObjType =
static constexpr const char* eventFormatType = "Event";
static constexpr const char* metricReportFormatType = "MetricReport";
@@ -199,8 +201,8 @@ index fa4e41a..ac644c1 100644
static const Message*
getMsgFromRegistry(const std::string& messageKey,
const boost::beast::span<const MessageEntry>& registry)
-@@ -401,11 +403,9 @@ class Subscription
- path);
+@@ -388,11 +390,9 @@ class Subscription : public persistent_data::UserSubscription
+ path, uriProto);
}
- Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) :
@@ -214,7 +216,7 @@ index fa4e41a..ac644c1 100644
~Subscription() = default;
-@@ -430,7 +430,7 @@ class Subscription
+@@ -417,7 +417,7 @@ class Subscription : public persistent_data::UserSubscription
if (sseConn != nullptr)
{
@@ -223,7 +225,7 @@ index fa4e41a..ac644c1 100644
}
}
-@@ -520,6 +520,7 @@ class Subscription
+@@ -508,6 +508,7 @@ class Subscription : public persistent_data::UserSubscription
this->sendEvent(
msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
@@ -231,7 +233,7 @@ index fa4e41a..ac644c1 100644
}
#endif
-@@ -590,14 +591,39 @@ class Subscription
+@@ -578,14 +579,39 @@ class Subscription : public persistent_data::UserSubscription
return eventSeqNum;
}
@@ -271,8 +273,8 @@ index fa4e41a..ac644c1 100644
+ std::string subId;
};
- static constexpr const bool defaultEnabledState = true;
-@@ -988,6 +1014,8 @@ class EventServiceManager
+ class EventServiceManager
+@@ -942,6 +968,8 @@ class EventServiceManager
subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval);
subValue->updateRetryPolicy();
@@ -281,7 +283,7 @@ index fa4e41a..ac644c1 100644
return id;
}
-@@ -1012,11 +1040,40 @@ class EventServiceManager
+@@ -970,11 +998,40 @@ class EventServiceManager
}
}
@@ -324,10 +326,10 @@ index fa4e41a..ac644c1 100644
std::vector<std::string> idList;
diff --git a/redfish-core/include/server_sent_events.hpp b/redfish-core/include/server_sent_events.hpp
deleted file mode 100644
-index 578fa19..0000000
+index 7613d7ba6427..000000000000
--- a/redfish-core/include/server_sent_events.hpp
+++ /dev/null
-@@ -1,291 +0,0 @@
+@@ -1,290 +0,0 @@
-
-/*
-// Copyright (c) 2020 Intel Corporation
@@ -345,7 +347,6 @@ index 578fa19..0000000
-// limitations under the License.
-*/
-#pragma once
--#include "node.hpp"
-
-#include <boost/asio/strand.hpp>
-#include <boost/beast/core/span.hpp>
@@ -620,32 +621,43 @@ index 578fa19..0000000
-
-} // namespace crow
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
-index 64a2009..7c9bb7a 100644
+index f1d6f5007d79..4a2d58a2f1dd 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
-@@ -34,8 +34,6 @@ static constexpr const std::array<const char*, 1> supportedResourceTypes = {
+@@ -37,8 +37,6 @@ static constexpr const std::array<const char*, 1> supportedResourceTypes = {
"Task"};
#endif
-static constexpr const uint8_t maxNoOfSubscriptions = 20;
-
- class EventService : public Node
+ inline void requestRoutesEventService(App& app)
{
- public:
-@@ -59,6 +57,8 @@ class EventService : public Node
- {"@odata.type", "#EventService.v1_5_0.EventService"},
- {"Id", "EventService"},
- {"Name", "Event Service"},
-+ {"ServerSentEventUri",
-+ "/redfish/v1/EventService/Subscriptions/SSE"},
- {"Subscriptions",
- {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}},
- {"Actions",
+ BMCWEB_ROUTE(app, "/redfish/v1/EventService/")
+@@ -50,6 +48,8 @@ inline void requestRoutesEventService(App& app)
+ {"@odata.type", "#EventService.v1_5_0.EventService"},
+ {"Id", "EventService"},
+ {"Name", "Event Service"},
++ {"ServerSentEventUri",
++ "/redfish/v1/EventService/Subscriptions/SSE"},
+ {"Subscriptions",
+ {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}},
+ {"Actions",
+@@ -90,9 +90,7 @@ inline void requestRoutesEventService(App& app)
+ .privileges(redfish::privileges::patchEventService)
+ .methods(boost::beast::http::verb::patch)(
+ [](const crow::Request& req,
+- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+-
+- {
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ std::optional<bool> serviceEnabled;
+ std::optional<uint32_t> retryAttemps;
+ std::optional<uint32_t> retryInterval;
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
-index 902c32b..d4bd48c 100644
+index c01accd2e93e..363005105d18 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
-@@ -5,6 +5,7 @@
+@@ -6,6 +6,7 @@
#include <cors_preflight.hpp>
#include <dbus_monitor.hpp>
#include <dbus_singleton.hpp>
@@ -653,7 +665,7 @@ index 902c32b..d4bd48c 100644
#include <hostname_monitor.hpp>
#include <ibm/management_console_rest.hpp>
#include <image_upload.hpp>
-@@ -81,6 +82,7 @@ int main(int /*argc*/, char** /*argv*/)
+@@ -82,6 +83,7 @@ int main(int /*argc*/, char** /*argv*/)
#endif
#ifdef BMCWEB_ENABLE_REDFISH
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 c3e3acbca..79b6e42d7 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 3dc6f6d807060cf3b38486e4190fd1ba9c66c66b Mon Sep 17 00:00:00 2001
+From e8bf93f1cc374a986896174489719065d0cc49a0 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] Add EventService SSE filter support
@@ -33,18 +33,18 @@ Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
Change-Id: I55c6f53bb5e57aa1f2d1601f1a16525a33b13bd2
---
- include/eventservice_sse.hpp | 141 +++++++++++++++++-
+ include/eventservice_sse.hpp | 145 +++++++++++++++++-
redfish-core/include/error_messages.hpp | 9 ++
.../include/event_service_manager.hpp | 5 +
redfish-core/lib/event_service.hpp | 5 -
redfish-core/src/error_messages.cpp | 26 ++++
- 5 files changed, 177 insertions(+), 9 deletions(-)
+ 5 files changed, 181 insertions(+), 9 deletions(-)
diff --git a/include/eventservice_sse.hpp b/include/eventservice_sse.hpp
-index 6c98e6e..01e4126 100644
+index 14daf00..2f22f98 100644
--- a/include/eventservice_sse.hpp
+++ b/include/eventservice_sse.hpp
-@@ -23,16 +23,149 @@ static bool createSubscription(std::shared_ptr<crow::SseConnection>& conn,
+@@ -23,16 +23,153 @@ static bool createSubscription(std::shared_ptr<crow::SseConnection>& conn,
}
BMCWEB_LOG_DEBUG << "Request query param size: " << req.urlParams.size();
@@ -143,6 +143,10 @@ index 6c98e6e..01e4126 100644
+ registryPrefix.assign(supportedRegPrefixes.begin(),
+ supportedRegPrefixes.end());
+ }
++ else
++ {
++ registryPrefix = regPrefixes;
++ }
+
+ for (const std::string& id : msgIds)
+ {
@@ -172,7 +176,7 @@ index 6c98e6e..01e4126 100644
+
+ if (!validId)
+ {
-+ messages::propertyValueNotInList(res, id, "MessageId");
++ messages::propertyValueNotInList(res, id, "MessageIds");
+ res.end();
+ return false;
+ }
@@ -199,10 +203,10 @@ index 6c98e6e..01e4126 100644
std::string id =
redfish::EventServiceManager::getInstance().addSubscription(subValue,
diff --git a/redfish-core/include/error_messages.hpp b/redfish-core/include/error_messages.hpp
-index 7dfdc80..922dae9 100644
+index 10567d1..f29e326 100644
--- a/redfish-core/include/error_messages.hpp
+++ b/redfish-core/include/error_messages.hpp
-@@ -959,6 +959,15 @@ nlohmann::json mutualExclusiveProperties(const std::string& arg1,
+@@ -971,6 +971,15 @@ nlohmann::json mutualExclusiveProperties(const std::string& arg1,
void mutualExclusiveProperties(crow::Response& res, const std::string& arg1,
const std::string& arg2);
@@ -219,7 +223,7 @@ index 7dfdc80..922dae9 100644
} // namespace redfish
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index e826207..f201134 100644
+index 098134a..c8fcb33 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -55,6 +55,11 @@ static constexpr const char* eventServiceFile =
@@ -235,10 +239,10 @@ index e826207..f201134 100644
static std::optional<boost::asio::posix::stream_descriptor> inotifyConn;
static constexpr const char* redfishEventLogDir = "/var/log";
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
-index 7c9bb7a..297a4ea 100644
+index 4a2d58a..67abb95 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
-@@ -18,11 +18,6 @@
+@@ -21,11 +21,6 @@
namespace redfish
{
@@ -251,10 +255,10 @@ index 7c9bb7a..297a4ea 100644
"TerminateAfterRetries", "SuspendRetries", "RetryForever"};
diff --git a/redfish-core/src/error_messages.cpp b/redfish-core/src/error_messages.cpp
-index ad5f819..409adb1 100644
+index 48edaf1..bebb6d8 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,
+@@ -2174,6 +2174,32 @@ void mutualExclusiveProperties(crow::Response& res, const std::string& arg1,
addMessageToErrorJson(res.jsonValue, mutualExclusiveProperties(arg1, arg2));
}
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch
index 0b12671e5..7749ddb72 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0007-EventService-Log-events-for-subscription-actions.patch
@@ -1,6 +1,6 @@
-From 0a1390428fd6f5651669f4306f6105d33a24453c Mon Sep 17 00:00:00 2001
-From: Ayushi Smriti <smriti.ayushi@intel.com>
-Date: Mon, 10 May 2021 13:03:37 +0530
+From dad35d6e6736f1c4ab6d739c62b22923ad749ad7 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Tue, 13 Jul 2021 12:30:08 +0000
Subject: [PATCH] EventService: Log events for subscription actions
Log redfish event for below 3 actions
@@ -27,10 +27,10 @@ Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com>
2 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
-index 9952ef1..2b957ea 100644
+index a5b37e5..75f5615 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
-@@ -22,6 +22,7 @@
+@@ -20,6 +20,7 @@
#include "registries/task_event_message_registry.hpp"
#include <sys/inotify.h>
@@ -38,7 +38,7 @@ index 9952ef1..2b957ea 100644
#include <boost/asio/io_context.hpp>
#include <boost/beast/core/span.hpp>
-@@ -800,7 +801,7 @@ class EventServiceManager
+@@ -813,7 +814,7 @@ class EventServiceManager
return;
}
@@ -47,7 +47,7 @@ index 9952ef1..2b957ea 100644
{
// Persist the config and subscription data.
nlohmann::json jsonData;
-@@ -897,7 +898,7 @@ class EventServiceManager
+@@ -910,7 +911,7 @@ class EventServiceManager
if (updateConfig)
{
@@ -56,7 +56,7 @@ index 9952ef1..2b957ea 100644
}
if (updateRetryCfg)
-@@ -992,7 +993,7 @@ class EventServiceManager
+@@ -1005,7 +1006,7 @@ class EventServiceManager
if (updateFile)
{
@@ -65,7 +65,7 @@ index 9952ef1..2b957ea 100644
}
#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
-@@ -1007,6 +1008,13 @@ class EventServiceManager
+@@ -1020,6 +1021,13 @@ class EventServiceManager
// Set Subscription ID for back trace
subValue->setSubscriptionId(id);
@@ -79,7 +79,7 @@ index 9952ef1..2b957ea 100644
return id;
}
-@@ -1027,7 +1035,14 @@ class EventServiceManager
+@@ -1040,7 +1048,14 @@ class EventServiceManager
{
subscriptionsMap.erase(obj);
updateNoOfSubscribersCount();
@@ -95,7 +95,7 @@ index 9952ef1..2b957ea 100644
}
}
-@@ -1049,6 +1064,18 @@ class EventServiceManager
+@@ -1062,6 +1077,18 @@ class EventServiceManager
}
}
@@ -115,18 +115,18 @@ index 9952ef1..2b957ea 100644
{
return subscriptionsMap.size();
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
-index 297a4ea..ed4955e 100644
+index 53a60d3..435c93d 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
-@@ -616,7 +616,7 @@ class EventDestination : public Node
- subValue->updateRetryPolicy();
- }
-
-- EventServiceManager::getInstance().updateSubscriptionData();
-+ EventServiceManager::getInstance().updateSubscription(params[0]);
- }
+@@ -579,7 +579,7 @@ inline void requestRoutesEventDestination(App& app)
+ subValue->updateRetryPolicy();
+ }
- void doDelete(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+- EventServiceManager::getInstance().updateSubscriptionData();
++ EventServiceManager::getInstance().updateSubscription(param);
+ });
+ BMCWEB_ROUTE(app, "/redfish/v1/EventService/Subscriptions/<str>/")
+ .privileges({{"ConfigureManager"}})
--
-2.17.1
+2.25.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch
index 874c82e2f..84ceb4ba8 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0008-Add-checks-on-Event-Subscription-input-parameters.patch
@@ -1,4 +1,4 @@
-From b43da33c7bc9ad4d5eea35c9ba68efdd6ed6d34d Mon Sep 17 00:00:00 2001
+From 05fdea2bb8e486b058d137a067ce1f5c885d2a96 Mon Sep 17 00:00:00 2001
From: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com>
Date: Mon, 28 Jun 2021 19:59:57 +0000
Subject: [PATCH] Add checks on Event Subscription input parameters
@@ -17,16 +17,16 @@ Tested
Change-Id: Iec2cd766c0e137b72706fc2da468d4fefd8fbaae
Signed-off-by: Nitin Wankhade <nitinx.arunrao.wankhade@intel.com>
---
- redfish-core/lib/event_service.hpp | 30 +++++++++++++++++++++++++++++-
- 1 file changed, 29 insertions(+), 1 deletion(-)
+ redfish-core/lib/event_service.hpp | 30 ++++++++++++++++++++++++++++++
+ 1 file changed, 30 insertions(+)
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
-index ed4955e..0cb0f00 100644
+index 52b01e5..f8a1671 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
-@@ -16,6 +16,10 @@
- #pragma once
- #include "event_service_manager.hpp"
+@@ -19,6 +19,10 @@
+ #include <app.hpp>
+ #include <registries/privilege_registry.hpp>
+#define MAX_CONTEXT_SIZE 256
+#define MAX_DESTINATION_SIZE 1024
@@ -35,50 +35,50 @@ index ed4955e..0cb0f00 100644
namespace redfish
{
static constexpr const std::array<const char*, 3> supportedRetryPolicies = {
-@@ -243,7 +247,11 @@ class EventDestinationCollection : public Node
- {
- return;
- }
--
-+ if (destUrl.size() > MAX_DESTINATION_SIZE)
-+ {
-+ messages::propertySizeExceeded(asyncResp->res, "Destination");
-+ return;
-+ }
- if (regPrefixes && msgIds)
- {
- if (regPrefixes->size() && msgIds->size())
-@@ -350,11 +358,31 @@ class EventDestinationCollection : public Node
+@@ -220,6 +224,12 @@ inline void requestRoutesEventDestinationCollection(App& app)
+ return;
+ }
- if (context)
- {
-+ if (context->size() > MAX_CONTEXT_SIZE)
-+ {
-+ messages::propertySizeExceeded(asyncResp->res, "Context");
-+ return;
-+ }
- subValue->customText = *context;
- }
++ if (destUrl.size() > MAX_DESTINATION_SIZE)
++ {
++ messages::propertySizeExceeded(asyncResp->res, "Destination");
++ return;
++ }
++
+ if (regPrefixes && msgIds)
+ {
+ if (regPrefixes->size() && msgIds->size())
+@@ -330,11 +340,31 @@ inline void requestRoutesEventDestinationCollection(App& app)
- if (headers)
- {
-+ size_t cumulativeLen = 0;
+ if (context)
+ {
++ if (context->size() > MAX_CONTEXT_SIZE)
++ {
++ messages::propertySizeExceeded(asyncResp->res, "Context");
++ return;
++ }
+ subValue->customText = *context;
+ }
+
+ if (headers)
+ {
++ size_t cumulativeLen = 0;
+
-+ for (nlohmann::json& itr : *headers)
-+ {
-+ std::string hdr{itr.dump(
-+ -1, ' ', true, nlohmann::json::error_handler_t::replace)};
-+ cumulativeLen += hdr.length();
++ for (nlohmann::json& itr : *headers)
++ {
++ std::string hdr{itr.dump(
++ -1, ' ', true, nlohmann::json::error_handler_t::replace)};
++ cumulativeLen += hdr.length();
+
-+ if (cumulativeLen > MAX_HEADER_SIZE)
-+ {
-+ messages::propertySizeExceeded(asyncResp->res,
++ if (cumulativeLen > MAX_HEADER_SIZE)
++ {
++ messages::propertySizeExceeded(asyncResp->res,
+ "HttpHeaders");
-+ return;
-+ }
-+ }
- subValue->httpHeaders = *headers;
- }
++ return;
++ }
++ }
+ subValue->httpHeaders = *headers;
+ }
--
2.17.1
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch
new file mode 100644
index 000000000..6e635a828
--- /dev/null
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch
@@ -0,0 +1,225 @@
+From 7f45c83c0b3acb08461461c23e0d7add46d9191c Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 14 Jul 2021 14:13:11 +0000
+Subject: [PATCH] Restructure Redfish EventLog Transmit code flow
+
+In the current implementation:
+ 1. When Event service is disabled and enabled back after a while,
+ all the logs during this time span between disable to enable
+ are dumped to the Event listener.
+ 2. When two events occur very close (in terms of microseconds)
+ and they trigger two different iNotify events, the listener
+ receives both of these events with the same Event ID.
+
+This occurs as the last log time stamp read from redfish file
+and previous time stamp used to generate Event ID's are not
+being updated continuously.
+
+This commit fixes this issue by tweaking the logic to continuously
+update the time stamp values (even during when Event Service is
+disabled), and also replaces multiple string operations with file
+operations. i.e. Instead of looping through the entire Redfish file
+until last time stamp read is reached, this fix makes use of
+fseek to get to the last read position.
+
+Tested:
+ - Subscribed to an event and successfully received Event Logs.
+ - No Event Logs were received when Event Service was disabled.
+ - No Dump of past Events after Event Service was enabled.
+ - Redfish Validator passed
+
+Change-Id: I87136bee78076b1b3219930813702b3b9d20c157
+Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
+---
+ .../include/event_service_manager.hpp | 108 ++++++++++++------
+ 1 file changed, 76 insertions(+), 32 deletions(-)
+
+diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
+index 430767a..53ed3f6 100644
+--- a/redfish-core/include/event_service_manager.hpp
++++ b/redfish-core/include/event_service_manager.hpp
+@@ -133,15 +133,10 @@ static const Message* formatMessage(const std::string_view& messageID)
+
+ namespace event_log
+ {
+-inline bool getUniqueEntryID(const std::string& logEntry, std::string& entryID,
+- const bool firstEntry = true)
++inline bool getUniqueEntryID(const std::string& logEntry, std::string& entryID)
+ {
+ static time_t prevTs = 0;
+ static int index = 0;
+- if (firstEntry)
+- {
+- prevTs = 0;
+- }
+
+ // Get the entry timestamp
+ std::time_t curTs = 0;
+@@ -639,6 +634,7 @@ class EventServiceManager
+ }
+
+ std::string lastEventTStr;
++ std::streampos redfishLogFilePosition{0};
+ size_t noOfEventLogSubscribers{0};
+ size_t noOfMetricReportSubscribers{0};
+ std::shared_ptr<sdbusplus::bus::match::match> matchTelemetryMonitor;
+@@ -1204,7 +1200,22 @@ class EventServiceManager
+ #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
+ void cacheLastEventTimestamp()
+ {
+- lastEventTStr.clear();
++ // Control comes here when :
++ // 1. Subscription is added and lastEventTStr is empty
++ // 2. lastEventTStr is empty
++ // 3. When a new Redfish file is created
++
++ if (!lastEventTStr.empty())
++ {
++ // Control would be here when Redfish file is created.
++ // Reset File Position as new file is created
++ redfishLogFilePosition = 0;
++ return;
++ }
++
++ // Open the redfish file and read till the last record to get the
++ // last event's time stamp.
++
+ std::ifstream logStream(redfishEventLogFile);
+ if (!logStream.good())
+ {
+@@ -1212,27 +1223,44 @@ class EventServiceManager
+ return;
+ }
+ std::string logEntry;
++ std::string prev_logEntry;
+ while (std::getline(logStream, logEntry))
+ {
+- size_t space = logEntry.find_first_of(' ');
+- if (space == std::string::npos)
+- {
+- // Shouldn't enter here but lets skip it.
+- BMCWEB_LOG_DEBUG << "Invalid log entry found.";
+- continue;
+- }
+- lastEventTStr = logEntry.substr(0, space);
++ prev_logEntry = logEntry;
++ redfishLogFilePosition = logStream.tellg();
++ }
++
++ if (prev_logEntry.empty())
++ {
++ BMCWEB_LOG_ERROR
++ << "Last Event Time Stamp Caching Failed : No Records";
++ redfishLogFilePosition = 0;
++ return;
++ }
++
++ size_t space = prev_logEntry.find_first_of(' ');
++ if (space == std::string::npos)
++ {
++ // Shouldn't enter here but lets skip it.
++ BMCWEB_LOG_DEBUG << "Invalid log entry found.";
++ BMCWEB_LOG_ERROR << "Last Event Time Stamp Caching Failed";
++ return;
+ }
++ lastEventTStr = prev_logEntry.substr(0, space);
+ BMCWEB_LOG_DEBUG << "Last Event time stamp set: " << lastEventTStr;
++ BMCWEB_LOG_DEBUG << "Next Log Position : " << redfishLogFilePosition;
+ }
+
+ void readEventLogsFromFile()
+ {
+- if (!serviceEnabled || !noOfEventLogSubscribers)
++ if (lastEventTStr.empty())
+ {
+- BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
+- return;
++ // Shouldn't ideally enter here.
++ // Last event Time stamp would be set by now.
++ // Just incase of any failures before.
++ cacheLastEventTimestamp();
+ }
++
+ std::ifstream logStream(redfishEventLogFile);
+ if (!logStream.good())
+ {
+@@ -1242,27 +1270,21 @@ class EventServiceManager
+
+ std::vector<EventLogObjectsType> eventRecords;
+
+- bool startLogCollection = false;
+- bool firstEntry = true;
+-
+ std::string logEntry;
++
++ // Get the read pointer to the next log to be read.
++ logStream.seekg(redfishLogFilePosition);
++
+ while (std::getline(logStream, logEntry))
+ {
+- if (!startLogCollection && !lastEventTStr.empty())
+- {
+- if (boost::starts_with(logEntry, lastEventTStr))
+- {
+- startLogCollection = true;
+- }
+- continue;
+- }
++ // Update Pointer position
++ redfishLogFilePosition = logStream.tellg();
+
+ std::string idStr;
+- if (!event_log::getUniqueEntryID(logEntry, idStr, firstEntry))
++ if (!event_log::getUniqueEntryID(logEntry, idStr))
+ {
+ continue;
+ }
+- firstEntry = false;
+
+ std::string timestamp;
+ std::string messageID;
+@@ -1274,6 +1296,16 @@ class EventServiceManager
+ continue;
+ }
+
++ lastEventTStr = timestamp;
++
++ if (!serviceEnabled || !noOfEventLogSubscribers)
++ {
++ // If Service is not enabled, no need to compute
++ // the remaining items below.
++ // But, Loop must continue to keep track of Timestamp
++ continue;
++ }
++
+ std::string registryName;
+ std::string messageKey;
+ event_log::getRegistryAndMessageKey(messageID, registryName,
+@@ -1283,11 +1315,23 @@ class EventServiceManager
+ continue;
+ }
+
+- lastEventTStr = timestamp;
+ eventRecords.emplace_back(idStr, timestamp, messageID, registryName,
+ messageKey, messageArgs);
+ }
+
++ if (!serviceEnabled || !noOfEventLogSubscribers)
++ {
++ BMCWEB_LOG_DEBUG << "EventService disabled or no Subscriptions.";
++ return;
++ }
++
++ if (eventRecords.empty())
++ {
++ // No Records to send
++ BMCWEB_LOG_DEBUG << "No log entries available to be transferred.";
++ return;
++ }
++
+ for (const auto& it : this->subscriptionsMap)
+ {
+ std::shared_ptr<Subscription> entry = it.second;
+--
+2.25.1
+
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README
index ae010dafb..cd2e1c2bc 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/README
@@ -4,16 +4,25 @@ thee gets merged upstream.
Upstream revision information:
- EventService : Fix retry handling for http-client
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/20
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/40731/21
- EventService: https client support
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/39
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/31735/40
- Add Server-Sent-Events support
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/6
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41258/7
- Add SSE style subscription support to eventservice
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/6
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41319/8
- Add EventService SSE filter support
- https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/3
+ https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/41349/5
+
+ - EventService Log events for subscription actions
+ file://telemetry/0007-EventService-Log-events-for-subscription-actions.patch
+
+ - Add checks on Event-Subscription input parameters
+ file://telemetry/0008-Add-checks-on-Event-Subscription-input-parameters.patch
+
+ - Restructure Redifsh EventLog Transmit code flow
+ file://telemetry/0009-Restructure-Redifsh-EventLog-Transmit-code-flow.patch