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 | 85 |
1 files changed, 62 insertions, 23 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 02d28833f..37609c154 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,7 +1,7 @@ -From 698d2615c5bc30ab7f89f11ed5659df8bf248ea0 Mon Sep 17 00:00:00 2001 +From bcb80fc9a86555c74b56b5b37615601d3fbfae31 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 5/6] Add SSE style subscription support to eventservice +Subject: [PATCH] Add SSE style subscription support to eventservice This commit adds the SSE style eventservice subscription style event. Using this, end user can subscribe for @@ -23,16 +23,16 @@ Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de --- http/http_connection.hpp | 2 +- include/eventservice_sse.hpp | 75 +++++ - .../include/event_service_manager.hpp | 77 ++++- + .../include/event_service_manager.hpp | 109 +++++-- redfish-core/include/server_sent_events.hpp | 291 ------------------ redfish-core/lib/event_service.hpp | 4 +- src/webserver_main.cpp | 2 + - 6 files changed, 149 insertions(+), 302 deletions(-) + 6 files changed, 163 insertions(+), 320 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 2c8bf40..1ab776c 100644 +index fc9fc60..3afb4da 100644 --- a/http/http_connection.hpp +++ b/http/http_connection.hpp @@ -350,7 +350,7 @@ class Connection : @@ -126,7 +126,7 @@ 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 5821e2e..f4d57c2 100644 +index fa4e41a..ac644c1 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -23,13 +23,15 @@ @@ -146,7 +146,7 @@ index 5821e2e..f4d57c2 100644 #include <cstdlib> #include <ctime> #include <fstream> -@@ -46,9 +48,13 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>; +@@ -46,9 +48,27 @@ using EventServiceConfig = std::tuple<bool, uint32_t, uint32_t>; static constexpr const char* eventFormatType = "Event"; static constexpr const char* metricReportFormatType = "MetricReport"; @@ -157,11 +157,50 @@ index 5821e2e..f4d57c2 100644 +static constexpr const uint8_t maxNoOfSubscriptions = 20; +static constexpr const uint8_t maxNoOfSSESubscriptions = 10; + - #ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES - static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; - static constexpr const char* redfishEventLogDir = "/var/log"; -@@ -391,11 +397,9 @@ class Subscription - path, uriProto); ++#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES ++static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; ++static constexpr const char* redfishEventLogDir = "/var/log"; ++static constexpr const char* redfishEventLogFile = "/var/log/redfish"; ++static constexpr const size_t iEventSize = sizeof(inotify_event); ++static int inotifyFd = -1; ++static int dirWatchDesc = -1; ++static int fileWatchDesc = -1; ++ ++// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs> ++using EventLogObjectsType = ++ std::tuple<std::string, std::string, std::string, std::string, std::string, ++ std::vector<std::string>>; ++ + namespace message_registries + { + inline boost::beast::span<const MessageEntry> +@@ -68,24 +88,6 @@ inline boost::beast::span<const MessageEntry> + } + return boost::beast::span<const MessageEntry>(openbmc::registry); + } +-} // namespace message_registries +- +-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES +-static std::optional<boost::asio::posix::stream_descriptor> inotifyConn; +-static constexpr const char* redfishEventLogDir = "/var/log"; +-static constexpr const char* redfishEventLogFile = "/var/log/redfish"; +-static constexpr const size_t iEventSize = sizeof(inotify_event); +-static int inotifyFd = -1; +-static int dirWatchDesc = -1; +-static int fileWatchDesc = -1; +- +-// <ID, timestamp, RedfishLogId, registryPrefix, MessageId, MessageArgs> +-using EventLogObjectsType = +- std::tuple<std::string, std::string, std::string, std::string, std::string, +- std::vector<std::string>>; +- +-namespace message_registries +-{ + static const Message* + getMsgFromRegistry(const std::string& messageKey, + const boost::beast::span<const MessageEntry>& registry) +@@ -401,11 +403,9 @@ class Subscription + path); } - Subscription(const std::shared_ptr<boost::beast::tcp_stream>& adaptor) : @@ -175,7 +214,7 @@ index 5821e2e..f4d57c2 100644 ~Subscription() = default; -@@ -420,7 +424,7 @@ class Subscription +@@ -430,7 +430,7 @@ class Subscription if (sseConn != nullptr) { @@ -184,7 +223,7 @@ index 5821e2e..f4d57c2 100644 } } -@@ -510,6 +514,7 @@ class Subscription +@@ -520,6 +520,7 @@ class Subscription this->sendEvent( msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace)); @@ -192,7 +231,7 @@ index 5821e2e..f4d57c2 100644 } #endif -@@ -565,14 +570,39 @@ class Subscription +@@ -590,14 +591,39 @@ class Subscription return eventSeqNum; } @@ -233,7 +272,7 @@ index 5821e2e..f4d57c2 100644 }; static constexpr const bool defaultEnabledState = true; -@@ -963,6 +993,8 @@ class EventServiceManager +@@ -988,6 +1014,8 @@ class EventServiceManager subValue->updateRetryConfig(retryAttempts, retryTimeoutInterval); subValue->updateRetryPolicy(); @@ -242,7 +281,7 @@ index 5821e2e..f4d57c2 100644 return id; } -@@ -987,11 +1019,40 @@ class EventServiceManager +@@ -1012,11 +1040,40 @@ class EventServiceManager } } @@ -581,7 +620,7 @@ index 578fa19..0000000 - -} // namespace crow diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp -index be6f04d..1875ec9 100644 +index 64a2009..7c9bb7a 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 = { @@ -603,7 +642,7 @@ index be6f04d..1875ec9 100644 {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}}, {"Actions", diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp -index 902c32b..c871faa 100644 +index 902c32b..d4bd48c 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -5,6 +5,7 @@ @@ -614,14 +653,14 @@ index 902c32b..c871faa 100644 #include <hostname_monitor.hpp> #include <ibm/management_console_rest.hpp> #include <image_upload.hpp> -@@ -83,6 +84,7 @@ int main(int /*argc*/, char** /*argv*/) +@@ -81,6 +82,7 @@ int main(int /*argc*/, char** /*argv*/) + #endif + #ifdef BMCWEB_ENABLE_REDFISH ++ redfish::eventservice_sse::requestRoutes(app); redfish::requestRoutes(app); redfish::RedfishService redfish(app); -+ redfish::eventservice_sse::requestRoutes(app); - // Create EventServiceManager instance and initialize Config - redfish::EventServiceManager::getInstance(); -- 2.17.1 |