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/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 57385a2..cf32bcf 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -189,7 +189,27 @@
{
return;
}
- if (!EventServiceManager::getInstance().sendTestEventLog())
+
+ TestEvent testEvent;
+ // clang-format off
+ if (!json_util::readJsonAction(
+ req, asyncResp->res,
+ "EventGroupId", testEvent.eventGroupId,
+ "EventId", testEvent.eventId,
+ "EventTimestamp", testEvent.eventTimestamp,
+ "Message", testEvent.message,
+ "MessageArgs", testEvent.messageArgs,
+ "MessageId", testEvent.messageId,
+ "OriginOfCondition", testEvent.originOfCondition,
+ "Resolution", testEvent.resolution,
+ "Severity", testEvent.severity))
+ {
+ return;
+ }
+ // clang-format on
+
+ if (!EventServiceManager::getInstance().sendTestEventLog(
+ testEvent))
{
messages::serviceDisabled(asyncResp->res,
"/redfish/v1/EventService/");