diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch')
-rw-r--r-- | meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/eventservice/0005-Add-SSE-style-subscription-support-to-eventservice.patch | 86 |
1 files changed, 49 insertions, 37 deletions
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 |