Redfish: Download action support for system dump entry
Tested By:
POST https://${IP}/redfish/v1/Systems/system/LogServices/SystemDump/Entries/<id>/Actions/Oem/OpenBmc/LogEntry.DownloadLog
Change-Id: I06262cf0799920aeb065a065886320b20c04aa7c
Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
index ce5e5fb..2fa5e00 100644
--- a/redfish-core/include/redfish.hpp
+++ b/redfish-core/include/redfish.hpp
@@ -104,6 +104,7 @@
nodes.emplace_back(std::make_unique<SystemDumpService>(app));
nodes.emplace_back(std::make_unique<SystemDumpEntryCollection>(app));
nodes.emplace_back(std::make_unique<SystemDumpEntry>(app));
+ nodes.emplace_back(std::make_unique<SystemDumpEntryDownload>(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 79433b9..8590373 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -27,6 +27,7 @@
#include <boost/beast/core/span.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/system/linux_error.hpp>
+#include <dump_offload.hpp>
#include <error_messages.hpp>
#include <filesystem>
#include <string_view>
@@ -1849,6 +1850,36 @@
}
};
+class SystemDumpEntryDownload : public Node
+{
+ public:
+ SystemDumpEntryDownload(CrowApp &app) :
+ Node(app,
+ "/redfish/v1/Systems/system/LogServices/System/Entries/<str>/"
+ "Actions/"
+ "LogEntry.DownloadLog/",
+ std::string())
+ {
+ 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> ¶ms) override
+ {
+ if (params.size() != 1)
+ {
+ messages::internalError(res);
+ return;
+ }
+ const std::string &entryID = params[0];
+ crow::obmc_dump::handleDumpOffloadUrl(req, res, entryID);
+ }
+};
+
class CrashdumpService : public Node
{
public: