Update Submit Test event feature to send custom data
Changes Added : Updated the submit test event feature to send test
data as per spec
https://www.dmtf.org/sites/default/files/standards/documents/
DSP2046_2019.1.pdf
Testing :
Tested sending custom test data
and same data received at the event listener
Change-Id: I2c2363a676aafd39c121c9fe4e16402c0f5961e2
Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
diff --git a/redfish-core/include/subscription.hpp b/redfish-core/include/subscription.hpp
index d1c3ab8..2f93f74 100644
--- a/redfish-core/include/subscription.hpp
+++ b/redfish-core/include/subscription.hpp
@@ -33,6 +33,30 @@
static constexpr const uint8_t maxNoOfSubscriptions = 20;
static constexpr const uint8_t maxNoOfSSESubscriptions = 10;
+struct TestEvent
+{
+ std::optional<int64_t> eventGroupId;
+ std::optional<std::string> eventId;
+ std::optional<std::string> eventTimestamp;
+ std::optional<std::string> message;
+ std::optional<std::vector<std::string>> messageArgs;
+ std::optional<std::string> messageId;
+ std::optional<std::string> originOfCondition;
+ std::optional<std::string> resolution;
+ std::optional<std::string> severity;
+ // default constructor
+ TestEvent() = default;
+ // default assignment operator
+ TestEvent& operator=(const TestEvent&) = default;
+ // default copy constructor
+ TestEvent(const TestEvent&) = default;
+ // default move constructor
+ TestEvent(TestEvent&&) = default;
+ // default move assignment operator
+ TestEvent& operator=(TestEvent&&) = default;
+ // default destructor
+ ~TestEvent() = default;
+};
class Subscription : public std::enable_shared_from_this<Subscription>
{
@@ -62,7 +86,7 @@
bool sendEventToSubscriber(std::string&& msg);
- bool sendTestEventLog();
+ bool sendTestEventLog(TestEvent& testEvent);
void filterAndSendEventLogs(
const std::vector<EventLogObjectsType>& eventRecords);