EventService: SubmitTestEvent initial support
This commit adds SubmitTestEvent initial support to
send out test events to subscribers.
URI:
/redfish/v1/EventService/Actions/EventService.SubmitTestEvent
Tested:
- Client subscribed to event listener via destination uri.
After sending POST request on SubmitTestEvent uri, could see
generated test event.
- Successfully ran the redfish validator.
Counter({'metadataNamespaces': 1739, 'pass': 26,
'skipOptional': 22, 'serviceNamespaces': 3, 'passGet': 3,
'passAction': 1})
Validation has succeeded.
Change-Id: I16e02c1977e99af39317070567196767ac7c7400
Signed-off-by: Ayushi Smriti <smriti.ayushi@linux.intel.com>
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index 43517dd..3e3435f 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -55,6 +55,10 @@
"/redfish/v1/EventService/Subscriptions/SSE"},
{"Subscriptions",
{{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}},
+ {"Actions",
+ {{"#EventService.SubmitTestEvent",
+ {{"target", "/redfish/v1/EventService/Actions/"
+ "EventService.SubmitTestEvent"}}}}},
{"@odata.id", "/redfish/v1/EventService"}};
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -125,6 +129,32 @@
}
};
+class SubmitTestEvent : public Node
+{
+ public:
+ SubmitTestEvent(CrowApp& app) :
+ Node(app,
+ "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent/")
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
+ {boost::beast::http::verb::head, {{"Login"}}},
+ {boost::beast::http::verb::patch, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::put, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::delete_, {{"ConfigureManager"}}},
+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
+ }
+
+ private:
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
+ {
+ EventServiceManager::getInstance().sendTestEventLog();
+ res.result(boost::beast::http::status::no_content);
+ res.end();
+ }
+};
+
class EventDestinationCollection : public Node
{
public: