summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorraviteja-b <raviteja28031990@gmail.com>2020-03-03 12:20:48 +0300
committerRavi Teja <raviteja28031990@gmail.com>2020-05-28 03:33:01 +0300
commit013487e5d56e4e7964e85a38d6c3044f081a753b (patch)
treefc14a3f33cff56861a0dd3a288f23917443c98a7 /redfish-core
parent0657843a00da62c3a076dacbf6203867a4fb5eb5 (diff)
downloadbmcweb-013487e5d56e4e7964e85a38d6c3044f081a753b.tar.xz
Redfish: ClearLog action support for system dump log entries
Tested By: POST https://${IP}/redfish/v1/Systems/system/LogServices/SystemDump/Actions/LogService.ClearLog Change-Id: I28af3ccc1d7bd54c521e79d93e6ccb1436eefc4f Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/redfish.hpp1
-rw-r--r--redfish-core/lib/log_services.hpp50
2 files changed, 49 insertions, 2 deletions
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index 2fa5e004d6..48cca29f46 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -105,6 +105,7 @@ class RedfishService
nodes.emplace_back(std::make_unique<SystemDumpEntryCollection>(app));
nodes.emplace_back(std::make_unique<SystemDumpEntry>(app));
nodes.emplace_back(std::make_unique<SystemDumpEntryDownload>(app));
+ nodes.emplace_back(std::make_unique<SystemDumpClear>(app));
#endif
#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 8590373267..df6e210f03 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -156,8 +156,6 @@ inline void deleteSystemDumpEntry(crow::Response &res,
boost::beast::http::status::internal_server_error);
return;
}
-
- asyncResp->res.result(boost::beast::http::status::ok);
};
crow::connections::systemBus->async_method_call(
respHandler, "xyz.openbmc_project.Dump.Manager",
@@ -1880,6 +1878,54 @@ class SystemDumpEntryDownload : public Node
}
};
+class SystemDumpClear : public Node
+{
+ public:
+ SystemDumpClear(CrowApp &app) :
+ Node(app, "/redfish/v1/Systems/system/LogServices/System/"
+ "Actions/"
+ "LogService.ClearLog/")
+ {
+ entityPrivileges = {
+ {boost::beast::http::verb::get, {{"Login"}}},
+ {boost::beast::http::verb::head, {{"Login"}}},
+ {boost::beast::http::verb::post, {{"ConfigureManager"}}}};
+ }
+
+ private:
+ void doPost(crow::Response &res, const crow::Request &req,
+ const std::vector<std::string> &params) override
+ {
+
+ auto asyncResp = std::make_shared<AsyncResp>(res);
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const std::vector<std::string> &dumpList) {
+ if (ec)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ for (const std::string &objectPath : dumpList)
+ {
+ std::size_t pos = objectPath.rfind("/");
+ if (pos != std::string::npos)
+ {
+ std::string logID = objectPath.substr(pos + 1);
+ deleteSystemDumpEntry(asyncResp->res, logID);
+ }
+ }
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ "/xyz/openbmc_project/dump", 0,
+ std::array<const char *, 1>{
+ "xyz.openbmc_project.Dump.Entry.System"});
+ }
+};
+
class CrashdumpService : public Node
{
public: