summaryrefslogtreecommitdiff
path: root/redfish-core/lib/log_services.hpp
diff options
context:
space:
mode:
authorSui Chen <suichen@google.com>2022-04-11 09:09:36 +0300
committerEd Tanous <edtanous@google.com>2023-02-28 00:45:22 +0300
commitd1d411f9eebc1d2ca49eec0700670ba564dac5c8 (patch)
tree076d80209a4ca8688690cc3c48f83fdb6042b4ec /redfish-core/lib/log_services.hpp
parentaf20dd1ccc481af63b528a851bce390a0070ab32 (diff)
downloadbmcweb-d1d411f9eebc1d2ca49eec0700670ba564dac5c8.tar.xz
Move getMessage and getMessageFromRegistry to cpp and add test
This change moves getMessage and getMessageFromRegistry to a .cpp file so that they can be easily tested. Tested: Unit test passes Signed-off-by: Sui Chen <suichen@google.com> Change-Id: Ia9fc91e5a47036198bf013ff3ea21ea9f6d5259a
Diffstat (limited to 'redfish-core/lib/log_services.hpp')
-rw-r--r--redfish-core/lib/log_services.hpp45
1 files changed, 0 insertions, 45 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 24a065721c..34625d3abc 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -72,51 +72,6 @@ enum class DumpCreationProgress
DUMP_CREATE_INPROGRESS
};
-namespace registries
-{
-static const Message*
- getMessageFromRegistry(const std::string& messageKey,
- const std::span<const MessageEntry> registry)
-{
- std::span<const MessageEntry>::iterator messageIt =
- std::find_if(registry.begin(), registry.end(),
- [&messageKey](const MessageEntry& messageEntry) {
- return std::strcmp(messageEntry.first, messageKey.c_str()) == 0;
- });
- if (messageIt != registry.end())
- {
- return &messageIt->second;
- }
-
- return nullptr;
-}
-
-static const Message* getMessage(std::string_view messageID)
-{
- // Redfish MessageIds are in the form
- // RegistryName.MajorVersion.MinorVersion.MessageKey, so parse it to find
- // the right Message
- std::vector<std::string> fields;
- fields.reserve(4);
- bmcweb::split(fields, messageID, '.');
- const std::string& registryName = fields[0];
- const std::string& messageKey = fields[3];
-
- // Find the right registry and check it for the MessageKey
- if (std::string(base::header.registryPrefix) == registryName)
- {
- return getMessageFromRegistry(
- messageKey, std::span<const MessageEntry>(base::registry));
- }
- if (std::string(openbmc::header.registryPrefix) == registryName)
- {
- return getMessageFromRegistry(
- messageKey, std::span<const MessageEntry>(openbmc::registry));
- }
- return nullptr;
-}
-} // namespace registries
-
namespace fs = std::filesystem;
inline std::string translateSeverityDbusToRedfish(const std::string& s)