Extract DBus EventLog common code
Extract all functions, that are either for utility purposes or
will be called by both ComputerSystem EventLog and Managers EventLog in
a follow-up patch.
These functions now reside in the eventlog utility header.
Tested: Only code extraction. Code compiles.
Change-Id: I42632790d152ecdf71a769662a2a9eec2041879d
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
diff --git a/redfish-core/include/utils/eventlog_utils.hpp b/redfish-core/include/utils/eventlog_utils.hpp
index 9456939..38bdb6a 100644
--- a/redfish-core/include/utils/eventlog_utils.hpp
+++ b/redfish-core/include/utils/eventlog_utils.hpp
@@ -11,7 +11,9 @@
#include "logging.hpp"
#include "registries.hpp"
#include "str_utility.hpp"
+#include "utils/dbus_event_log_entry.hpp"
#include "utils/etag_utils.hpp"
+#include "utils/log_services_utils.hpp"
#include "utils/query_param.hpp"
#include "utils/time_utils.hpp"
@@ -32,6 +34,8 @@
#include <ctime>
#include <fstream>
#include <iomanip>
+#include <memory>
+#include <optional>
#include <sstream>
#include <string>
#include <utility>
@@ -509,5 +513,304 @@
"org.freedesktop.systemd1.Manager", "ReloadUnit", "rsyslog.service",
"replace");
}
+
+/*
+ * DBus EventLog utilities
+ * */
+
+inline std::optional<bool> getProviderNotifyAction(const std::string& notify)
+{
+ std::optional<bool> notifyAction;
+ if (notify == "xyz.openbmc_project.Logging.Entry.Notify.Notify")
+ {
+ notifyAction = true;
+ }
+ else if (notify == "xyz.openbmc_project.Logging.Entry.Notify.Inhibit")
+ {
+ notifyAction = false;
+ }
+
+ return notifyAction;
+}
+
+inline std::string translateSeverityDbusToRedfish(const std::string& s)
+{
+ if ((s == "xyz.openbmc_project.Logging.Entry.Level.Alert") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Critical") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Emergency") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Error"))
+ {
+ return "Critical";
+ }
+ if ((s == "xyz.openbmc_project.Logging.Entry.Level.Debug") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Informational") ||
+ (s == "xyz.openbmc_project.Logging.Entry.Level.Notice"))
+ {
+ return "OK";
+ }
+ if (s == "xyz.openbmc_project.Logging.Entry.Level.Warning")
+ {
+ return "Warning";
+ }
+ return "";
+}
+
+inline void fillEventLogLogEntryFromDbusLogEntry(
+ const DbusEventLogEntry& entry, nlohmann::json& objectToFillOut)
+{
+ objectToFillOut["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
+ objectToFillOut["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(entry.Id));
+ objectToFillOut["Name"] = "System Event Log Entry";
+ objectToFillOut["Id"] = std::to_string(entry.Id);
+ objectToFillOut["Message"] = entry.Message;
+ objectToFillOut["Resolved"] = entry.Resolved;
+ std::optional<bool> notifyAction =
+ getProviderNotifyAction(entry.ServiceProviderNotify);
+ if (notifyAction)
+ {
+ objectToFillOut["ServiceProviderNotified"] = *notifyAction;
+ }
+ if ((entry.Resolution != nullptr) && !entry.Resolution->empty())
+ {
+ objectToFillOut["Resolution"] = *entry.Resolution;
+ }
+ objectToFillOut["EntryType"] = "Event";
+ objectToFillOut["Severity"] =
+ translateSeverityDbusToRedfish(entry.Severity);
+ objectToFillOut["Created"] =
+ redfish::time_utils::getDateTimeUintMs(entry.Timestamp);
+ objectToFillOut["Modified"] =
+ redfish::time_utils::getDateTimeUintMs(entry.UpdateTimestamp);
+ if (entry.Path != nullptr)
+ {
+ objectToFillOut["AdditionalDataURI"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}/attachment",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(entry.Id));
+ }
+}
+
+inline void afterLogEntriesGetManagedObjects(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const boost::system::error_code& ec,
+ const dbus::utility::ManagedObjectType& resp)
+{
+ if (ec)
+ {
+ // TODO Handle for specific error code
+ BMCWEB_LOG_ERROR("getLogEntriesIfaceData resp_handler got error {}",
+ ec);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ nlohmann::json::array_t entriesArray;
+ for (const auto& objectPath : resp)
+ {
+ dbus::utility::DBusPropertiesMap propsFlattened;
+ auto isEntry =
+ std::ranges::find_if(objectPath.second, [](const auto& object) {
+ return object.first == "xyz.openbmc_project.Logging.Entry";
+ });
+ if (isEntry == objectPath.second.end())
+ {
+ continue;
+ }
+
+ for (const auto& interfaceMap : objectPath.second)
+ {
+ for (const auto& propertyMap : interfaceMap.second)
+ {
+ propsFlattened.emplace_back(propertyMap.first,
+ propertyMap.second);
+ }
+ }
+ std::optional<DbusEventLogEntry> optEntry =
+ fillDbusEventLogEntryFromPropertyMap(propsFlattened);
+
+ if (!optEntry.has_value())
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ fillEventLogLogEntryFromDbusLogEntry(*optEntry,
+ entriesArray.emplace_back());
+ }
+
+ redfish::json_util::sortJsonArrayByKey(entriesArray, "Id");
+ asyncResp->res.jsonValue["Members@odata.count"] = entriesArray.size();
+ asyncResp->res.jsonValue["Members"] = std::move(entriesArray);
+}
+
+inline void dBusEventLogEntryCollection(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+ // Collections don't include the static data added by SubRoute
+ // because it has a duplicate entry for members
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#LogEntryCollection.LogEntryCollection";
+ asyncResp->res.jsonValue["@odata.id"] =
+ std::format("/redfish/v1/Systems/{}/LogServices/EventLog/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
+ asyncResp->res.jsonValue["Name"] = "System Event Log Entries";
+ asyncResp->res.jsonValue["Description"] =
+ "Collection of System Event Log Entries";
+
+ // DBus implementation of EventLog/Entries
+ // Make call to Logging Service to find all log entry objects
+ sdbusplus::message::object_path path("/xyz/openbmc_project/logging");
+ dbus::utility::getManagedObjects(
+ "xyz.openbmc_project.Logging", path,
+ [asyncResp](const boost::system::error_code& ec,
+ const dbus::utility::ManagedObjectType& resp) {
+ afterLogEntriesGetManagedObjects(asyncResp, ec, resp);
+ });
+}
+
+inline void afterDBusEventLogEntryGet(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& entryID, const boost::system::error_code& ec,
+ const dbus::utility::DBusPropertiesMap& resp)
+{
+ if (ec.value() == EBADR)
+ {
+ messages::resourceNotFound(asyncResp->res, "EventLogEntry", entryID);
+ return;
+ }
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR("EventLogEntry (DBus) resp_handler got error {}", ec);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ std::optional<DbusEventLogEntry> optEntry =
+ fillDbusEventLogEntryFromPropertyMap(resp);
+
+ if (!optEntry.has_value())
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ fillEventLogLogEntryFromDbusLogEntry(*optEntry, asyncResp->res.jsonValue);
+}
+
+inline void dBusEventLogEntryGet(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, std::string entryID)
+{
+ dbus::utility::escapePathForDbus(entryID);
+
+ // DBus implementation of EventLog/Entries
+ // Make call to Logging Service to find all log entry objects
+ dbus::utility::getAllProperties(
+ "xyz.openbmc_project.Logging",
+ "/xyz/openbmc_project/logging/entry/" + entryID, "",
+ std::bind_front(afterDBusEventLogEntryGet, asyncResp, entryID));
+}
+
+inline void dBusEventLogEntryPatch(
+ const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& entryId)
+{
+ std::optional<bool> resolved;
+
+ if (!json_util::readJsonPatch(req, asyncResp->res, "Resolved", resolved))
+ {
+ return;
+ }
+ BMCWEB_LOG_DEBUG("Set Resolved");
+
+ setDbusProperty(asyncResp, "Resolved", "xyz.openbmc_project.Logging",
+ "/xyz/openbmc_project/logging/entry/" + entryId,
+ "xyz.openbmc_project.Logging.Entry", "Resolved",
+ resolved.value_or(false));
+}
+
+inline void dBusEventLogEntryDelete(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, std::string entryID)
+{
+ BMCWEB_LOG_DEBUG("Do delete single event entries.");
+
+ dbus::utility::escapePathForDbus(entryID);
+
+ // Process response from Logging service.
+ auto respHandler = [asyncResp,
+ entryID](const boost::system::error_code& ec) {
+ BMCWEB_LOG_DEBUG("EventLogEntry (DBus) doDelete callback: Done");
+ if (ec)
+ {
+ if (ec.value() == EBADR)
+ {
+ messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
+ return;
+ }
+ // TODO Handle for specific error code
+ BMCWEB_LOG_ERROR(
+ "EventLogEntry (DBus) doDelete respHandler got error {}", ec);
+ asyncResp->res.result(
+ boost::beast::http::status::internal_server_error);
+ return;
+ }
+
+ messages::success(asyncResp->res);
+ };
+
+ // Make call to Logging service to request Delete Log
+ dbus::utility::async_method_call(
+ asyncResp, respHandler, "xyz.openbmc_project.Logging",
+ "/xyz/openbmc_project/logging/entry/" + entryID,
+ "xyz.openbmc_project.Object.Delete", "Delete");
+}
+
+inline void dBusLogServiceActionsClear(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+ BMCWEB_LOG_DEBUG("Do delete all entries.");
+
+ // Process response from Logging service.
+ auto respHandler = [asyncResp](const boost::system::error_code& ec) {
+ BMCWEB_LOG_DEBUG("doClearLog resp_handler callback: Done");
+ if (ec)
+ {
+ // TODO Handle for specific error code
+ BMCWEB_LOG_ERROR("doClearLog resp_handler got error {}", ec);
+ asyncResp->res.result(
+ boost::beast::http::status::internal_server_error);
+ return;
+ }
+
+ messages::success(asyncResp->res);
+ };
+
+ // Make call to Logging service to request Clear Log
+ dbus::utility::async_method_call(
+ asyncResp, respHandler, "xyz.openbmc_project.Logging",
+ "/xyz/openbmc_project/logging",
+ "xyz.openbmc_project.Collection.DeleteAll", "DeleteAll");
+}
+
+inline void downloadEventLogEntry(
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& entryID, const std::string& downloadEntryType)
+{
+ std::string entryPath =
+ sdbusplus::message::object_path("/xyz/openbmc_project/logging/entry") /
+ entryID;
+
+ auto downloadEventLogEntryHandler =
+ [asyncResp, entryID,
+ downloadEntryType](const boost::system::error_code& ec,
+ const sdbusplus::message::unix_fd& unixfd) {
+ log_services_utils::downloadEntryCallback(
+ asyncResp, entryID, downloadEntryType, ec, unixfd);
+ };
+
+ dbus::utility::async_method_call(
+ asyncResp, std::move(downloadEventLogEntryHandler),
+ "xyz.openbmc_project.Logging", entryPath,
+ "xyz.openbmc_project.Logging.Entry", "GetEntry");
+}
} // namespace eventlog_utils
} // namespace redfish
diff --git a/redfish-core/lib/systems_logservices_dbus_eventlog.hpp b/redfish-core/lib/systems_logservices_dbus_eventlog.hpp
index 584608a..e087a57 100644
--- a/redfish-core/lib/systems_logservices_dbus_eventlog.hpp
+++ b/redfish-core/lib/systems_logservices_dbus_eventlog.hpp
@@ -7,24 +7,11 @@
#include "app.hpp"
#include "async_resp.hpp"
-#include "dbus_utility.hpp"
#include "error_messages.hpp"
-#include "http_body.hpp"
#include "http_request.hpp"
-#include "http_response.hpp"
-#include "http_utility.hpp"
-#include "logging.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
-#include "utils/dbus_event_log_entry.hpp"
-#include "utils/dbus_utils.hpp"
-#include "utils/json_utils.hpp"
-#include "utils/log_services_utils.hpp"
-#include "utils/time_utils.hpp"
-
-#include <asm-generic/errno.h>
-#include <systemd/sd-bus.h>
-#include <unistd.h>
+#include "utils/eventlog_utils.hpp"
#include <boost/beast/http/field.hpp>
#include <boost/beast/http/status.hpp>
@@ -36,314 +23,11 @@
#include <sdbusplus/message/native_types.hpp>
#include <sdbusplus/unpack_properties.hpp>
-#include <algorithm>
-#include <format>
-#include <functional>
-#include <memory>
-#include <optional>
#include <string>
-#include <string_view>
-#include <utility>
-#include <vector>
namespace redfish
{
-inline std::optional<bool> getProviderNotifyAction(const std::string& notify)
-{
- std::optional<bool> notifyAction;
- if (notify == "xyz.openbmc_project.Logging.Entry.Notify.Notify")
- {
- notifyAction = true;
- }
- else if (notify == "xyz.openbmc_project.Logging.Entry.Notify.Inhibit")
- {
- notifyAction = false;
- }
-
- return notifyAction;
-}
-
-inline std::string translateSeverityDbusToRedfish(const std::string& s)
-{
- if ((s == "xyz.openbmc_project.Logging.Entry.Level.Alert") ||
- (s == "xyz.openbmc_project.Logging.Entry.Level.Critical") ||
- (s == "xyz.openbmc_project.Logging.Entry.Level.Emergency") ||
- (s == "xyz.openbmc_project.Logging.Entry.Level.Error"))
- {
- return "Critical";
- }
- if ((s == "xyz.openbmc_project.Logging.Entry.Level.Debug") ||
- (s == "xyz.openbmc_project.Logging.Entry.Level.Informational") ||
- (s == "xyz.openbmc_project.Logging.Entry.Level.Notice"))
- {
- return "OK";
- }
- if (s == "xyz.openbmc_project.Logging.Entry.Level.Warning")
- {
- return "Warning";
- }
- return "";
-}
-
-inline void fillEventLogLogEntryFromDbusLogEntry(
- const DbusEventLogEntry& entry, nlohmann::json& objectToFillOut)
-{
- objectToFillOut["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
- objectToFillOut["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}",
- BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(entry.Id));
- objectToFillOut["Name"] = "System Event Log Entry";
- objectToFillOut["Id"] = std::to_string(entry.Id);
- objectToFillOut["Message"] = entry.Message;
- objectToFillOut["Resolved"] = entry.Resolved;
- std::optional<bool> notifyAction =
- getProviderNotifyAction(entry.ServiceProviderNotify);
- if (notifyAction)
- {
- objectToFillOut["ServiceProviderNotified"] = *notifyAction;
- }
- if ((entry.Resolution != nullptr) && !entry.Resolution->empty())
- {
- objectToFillOut["Resolution"] = *entry.Resolution;
- }
- objectToFillOut["EntryType"] = "Event";
- objectToFillOut["Severity"] =
- translateSeverityDbusToRedfish(entry.Severity);
- objectToFillOut["Created"] =
- redfish::time_utils::getDateTimeUintMs(entry.Timestamp);
- objectToFillOut["Modified"] =
- redfish::time_utils::getDateTimeUintMs(entry.UpdateTimestamp);
- if (entry.Path != nullptr)
- {
- objectToFillOut["AdditionalDataURI"] = boost::urls::format(
- "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}/attachment",
- BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(entry.Id));
- }
-}
-
-inline void afterLogEntriesGetManagedObjects(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const boost::system::error_code& ec,
- const dbus::utility::ManagedObjectType& resp)
-{
- if (ec)
- {
- // TODO Handle for specific error code
- BMCWEB_LOG_ERROR("getLogEntriesIfaceData resp_handler got error {}",
- ec);
- messages::internalError(asyncResp->res);
- return;
- }
- nlohmann::json::array_t entriesArray;
- for (const auto& objectPath : resp)
- {
- dbus::utility::DBusPropertiesMap propsFlattened;
- auto isEntry =
- std::ranges::find_if(objectPath.second, [](const auto& object) {
- return object.first == "xyz.openbmc_project.Logging.Entry";
- });
- if (isEntry == objectPath.second.end())
- {
- continue;
- }
-
- for (const auto& interfaceMap : objectPath.second)
- {
- for (const auto& propertyMap : interfaceMap.second)
- {
- propsFlattened.emplace_back(propertyMap.first,
- propertyMap.second);
- }
- }
- std::optional<DbusEventLogEntry> optEntry =
- fillDbusEventLogEntryFromPropertyMap(propsFlattened);
-
- if (!optEntry.has_value())
- {
- messages::internalError(asyncResp->res);
- return;
- }
- fillEventLogLogEntryFromDbusLogEntry(*optEntry,
- entriesArray.emplace_back());
- }
-
- redfish::json_util::sortJsonArrayByKey(entriesArray, "Id");
- asyncResp->res.jsonValue["Members@odata.count"] = entriesArray.size();
- asyncResp->res.jsonValue["Members"] = std::move(entriesArray);
-}
-
-inline void dBusEventLogEntryCollection(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
-{
- // Collections don't include the static data added by SubRoute
- // because it has a duplicate entry for members
- asyncResp->res.jsonValue["@odata.type"] =
- "#LogEntryCollection.LogEntryCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- std::format("/redfish/v1/Systems/{}/LogServices/EventLog/Entries",
- BMCWEB_REDFISH_SYSTEM_URI_NAME);
- asyncResp->res.jsonValue["Name"] = "System Event Log Entries";
- asyncResp->res.jsonValue["Description"] =
- "Collection of System Event Log Entries";
-
- // DBus implementation of EventLog/Entries
- // Make call to Logging Service to find all log entry objects
- sdbusplus::message::object_path path("/xyz/openbmc_project/logging");
- dbus::utility::getManagedObjects(
- "xyz.openbmc_project.Logging", path,
- [asyncResp](const boost::system::error_code& ec,
- const dbus::utility::ManagedObjectType& resp) {
- afterLogEntriesGetManagedObjects(asyncResp, ec, resp);
- });
-}
-
-inline void afterDBusEventLogEntryGet(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& entryID, const boost::system::error_code& ec,
- const dbus::utility::DBusPropertiesMap& resp)
-{
- if (ec.value() == EBADR)
- {
- messages::resourceNotFound(asyncResp->res, "EventLogEntry", entryID);
- return;
- }
- if (ec)
- {
- BMCWEB_LOG_ERROR("EventLogEntry (DBus) resp_handler got error {}", ec);
- messages::internalError(asyncResp->res);
- return;
- }
-
- std::optional<DbusEventLogEntry> optEntry =
- fillDbusEventLogEntryFromPropertyMap(resp);
-
- if (!optEntry.has_value())
- {
- messages::internalError(asyncResp->res);
- return;
- }
-
- fillEventLogLogEntryFromDbusLogEntry(*optEntry, asyncResp->res.jsonValue);
-}
-
-inline void dBusEventLogEntryGet(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, std::string entryID)
-{
- dbus::utility::escapePathForDbus(entryID);
-
- // DBus implementation of EventLog/Entries
- // Make call to Logging Service to find all log entry objects
- dbus::utility::getAllProperties(
- "xyz.openbmc_project.Logging",
- "/xyz/openbmc_project/logging/entry/" + entryID, "",
- std::bind_front(afterDBusEventLogEntryGet, asyncResp, entryID));
-}
-
-inline void dBusEventLogEntryPatch(
- const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& entryId)
-{
- std::optional<bool> resolved;
-
- if (!json_util::readJsonPatch(req, asyncResp->res, "Resolved", resolved))
- {
- return;
- }
- BMCWEB_LOG_DEBUG("Set Resolved");
-
- setDbusProperty(asyncResp, "Resolved", "xyz.openbmc_project.Logging",
- "/xyz/openbmc_project/logging/entry/" + entryId,
- "xyz.openbmc_project.Logging.Entry", "Resolved",
- resolved.value_or(false));
-}
-
-inline void dBusEventLogEntryDelete(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, std::string entryID)
-{
- BMCWEB_LOG_DEBUG("Do delete single event entries.");
-
- dbus::utility::escapePathForDbus(entryID);
-
- // Process response from Logging service.
- auto respHandler = [asyncResp,
- entryID](const boost::system::error_code& ec) {
- BMCWEB_LOG_DEBUG("EventLogEntry (DBus) doDelete callback: Done");
- if (ec)
- {
- if (ec.value() == EBADR)
- {
- messages::resourceNotFound(asyncResp->res, "LogEntry", entryID);
- return;
- }
- // TODO Handle for specific error code
- BMCWEB_LOG_ERROR(
- "EventLogEntry (DBus) doDelete respHandler got error {}", ec);
- asyncResp->res.result(
- boost::beast::http::status::internal_server_error);
- return;
- }
-
- messages::success(asyncResp->res);
- };
-
- // Make call to Logging service to request Delete Log
- dbus::utility::async_method_call(
- asyncResp, respHandler, "xyz.openbmc_project.Logging",
- "/xyz/openbmc_project/logging/entry/" + entryID,
- "xyz.openbmc_project.Object.Delete", "Delete");
-}
-
-inline void dBusLogServiceActionsClear(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
-{
- BMCWEB_LOG_DEBUG("Do delete all entries.");
-
- // Process response from Logging service.
- auto respHandler = [asyncResp](const boost::system::error_code& ec) {
- BMCWEB_LOG_DEBUG("doClearLog resp_handler callback: Done");
- if (ec)
- {
- // TODO Handle for specific error code
- BMCWEB_LOG_ERROR("doClearLog resp_handler got error {}", ec);
- asyncResp->res.result(
- boost::beast::http::status::internal_server_error);
- return;
- }
-
- messages::success(asyncResp->res);
- };
-
- // Make call to Logging service to request Clear Log
- dbus::utility::async_method_call(
- asyncResp, respHandler, "xyz.openbmc_project.Logging",
- "/xyz/openbmc_project/logging",
- "xyz.openbmc_project.Collection.DeleteAll", "DeleteAll");
-}
-
-inline void downloadEventLogEntry(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& entryID, const std::string& downloadEntryType)
-{
- std::string entryPath =
- sdbusplus::message::object_path("/xyz/openbmc_project/logging/entry") /
- entryID;
-
- auto downloadEventLogEntryHandler =
- [asyncResp, entryID,
- downloadEntryType](const boost::system::error_code& ec,
- const sdbusplus::message::unix_fd& unixfd) {
- log_services_utils::downloadEntryCallback(
- asyncResp, entryID, downloadEntryType, ec, unixfd);
- };
-
- dbus::utility::async_method_call(
- asyncResp, std::move(downloadEventLogEntryHandler),
- "xyz.openbmc_project.Logging", entryPath,
- "xyz.openbmc_project.Logging.Entry", "GetEntry");
-}
-
inline void handleSystemsDBusEventLogEntryCollection(
crow::App& app, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -366,7 +50,8 @@
systemName);
return;
}
- dBusEventLogEntryCollection(asyncResp);
+
+ eventlog_utils::dBusEventLogEntryCollection(asyncResp);
}
inline void handleSystemsDBusEventLogEntryGet(
@@ -392,7 +77,7 @@
return;
}
- dBusEventLogEntryGet(asyncResp, entryId);
+ eventlog_utils::dBusEventLogEntryGet(asyncResp, entryId);
}
inline void handleSystemsDBusEventLogEntryPatch(
@@ -418,7 +103,7 @@
return;
}
- dBusEventLogEntryPatch(req, asyncResp, entryId);
+ eventlog_utils::dBusEventLogEntryPatch(req, asyncResp, entryId);
}
inline void handleSystemsDBusEventLogEntryDelete(
@@ -444,7 +129,7 @@
return;
}
- dBusEventLogEntryDelete(asyncResp, entryId);
+ eventlog_utils::dBusEventLogEntryDelete(asyncResp, entryId);
}
inline void handleSystemsDBusLogServiceActionsClear(
@@ -469,7 +154,8 @@
systemName);
return;
}
- dBusLogServiceActionsClear(asyncResp);
+
+ eventlog_utils::dBusLogServiceActionsClear(asyncResp);
}
inline void handleSystemsDBusEventLogEntryDownloadGet(
@@ -502,7 +188,7 @@
return;
}
- downloadEventLogEntry(asyncResp, entryId, "System");
+ eventlog_utils::downloadEventLogEntry(asyncResp, entryId, "System");
}
inline void requestRoutesDBusEventLogEntryCollection(App& app)