diff options
author | Vijay Lobo <vijaylobo@gmail.com> | 2021-10-08 00:53:16 +0300 |
---|---|---|
committer | Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com> | 2022-09-29 01:37:38 +0300 |
commit | 9c11a172247a663dfbd708f0ded12024afd9fb1e (patch) | |
tree | bb9dcdb29341e4810cc15773f55b968880a30492 /redfish-core/lib | |
parent | 0af99542b31a7ac59f9d76568c74a160a63baff2 (diff) | |
download | bmcweb-9c11a172247a663dfbd708f0ded12024afd9fb1e.tar.xz |
Redfish: Add resolution property
This property is used to provide suggestions on how to resolve the
situation that caused the log entry. Services can replace the resolution
defined in the message registry with a more specific resolution in a log
entry.
Tested:
curl command was run with a resolution property set in the d-bus object
curl -k -X GET https://$bmc:18080/redfish/v1/Systems/system/\
LogServices/EventLog/Entries
"Members": [
{
"@odata.id":
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/1",
"@odata.type": "#LogEntry.v1_9_0.LogEntry",
"AdditionalDataURI":
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/1/attachment",
"Created": "2022-08-05T18:44:34.201+00:00",
"EntryType": "Event",
"Id": "1",
"Message":
"xyz.openbmc_project.State.Error.CriticalServiceFailure",
"Modified": "2022-08-05T18:44:34.201+00:00",
"Name": "System Event Log Entry",
"Resolution": "1. Priority: High, Procedure: BMC0002\n",
"Resolved": false,
"Severity": "Critical"
},
...
]
Signed-off-by: Vijay Lobo <vijaylobo@gmail.com>
Change-Id: Ia28e97c17c1b9bd0e29b681727c3e36563ca7922
Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/log_services.hpp | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index d460794672..d4ef1f19df 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -496,7 +496,7 @@ inline void continue; } - thisEntry["@odata.type"] = "#LogEntry.v1_8_0.LogEntry"; + thisEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; thisEntry["@odata.id"] = entriesPath + entryID; thisEntry["Id"] = entryID; thisEntry["EntryType"] = "Event"; @@ -588,7 +588,7 @@ inline void } asyncResp->res.jsonValue["@odata.type"] = - "#LogEntry.v1_8_0.LogEntry"; + "#LogEntry.v1_9_0.LogEntry"; asyncResp->res.jsonValue["@odata.id"] = entriesPath + entryID; asyncResp->res.jsonValue["Id"] = entryID; asyncResp->res.jsonValue["EntryType"] = "Event"; @@ -1157,7 +1157,7 @@ static LogParseError } // Fill in the log entry with the gathered data - logEntryJson["@odata.type"] = "#LogEntry.v1_8_0.LogEntry"; + logEntryJson["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; logEntryJson["@odata.id"] = "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" + logEntryID; logEntryJson["Name"] = "System Event Log Entry"; @@ -1376,6 +1376,7 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app) const std::string* severity = nullptr; const std::string* message = nullptr; const std::string* filePath = nullptr; + const std::string* resolution = nullptr; bool resolved = false; for (const auto& interfaceMap : objectPath.second) { @@ -1403,6 +1404,11 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app) severity = std::get_if<std::string>( &propertyMap.second); } + else if (propertyMap.first == "Resolution") + { + resolution = std::get_if<std::string>( + &propertyMap.second); + } else if (propertyMap.first == "Message") { message = std::get_if<std::string>( @@ -1451,7 +1457,7 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app) } entriesArray.push_back({}); nlohmann::json& thisEntry = entriesArray.back(); - thisEntry["@odata.type"] = "#LogEntry.v1_8_0.LogEntry"; + thisEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; thisEntry["@odata.id"] = "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" + std::to_string(*id); @@ -1459,6 +1465,10 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app) thisEntry["Id"] = std::to_string(*id); thisEntry["Message"] = *message; thisEntry["Resolved"] = resolved; + if ((resolution != nullptr) && (!(*resolution).empty())) + { + thisEntry["Resolution"] = *resolution; + } thisEntry["EntryType"] = "Event"; thisEntry["Severity"] = translateSeverityDbusToRedfish(*severity); @@ -1528,13 +1538,14 @@ inline void requestRoutesDBusEventLogEntry(App& app) const std::string* severity = nullptr; const std::string* message = nullptr; const std::string* filePath = nullptr; + const std::string* resolution = nullptr; bool resolved = false; const bool success = sdbusplus::unpackPropertiesNoThrow( dbus_utils::UnpackErrorPrinter(), resp, "Id", id, "Timestamp", timestamp, "UpdateTimestamp", updateTimestamp, "Severity", - severity, "Message", message, "Resolved", resolved, "Path", - filePath); + severity, "Message", message, "Resolved", resolved, + "Resolution", resolution, "Path", filePath); if (!success) { @@ -1549,7 +1560,7 @@ inline void requestRoutesDBusEventLogEntry(App& app) return; } asyncResp->res.jsonValue["@odata.type"] = - "#LogEntry.v1_8_0.LogEntry"; + "#LogEntry.v1_9_0.LogEntry"; asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" + std::to_string(*id); @@ -1557,6 +1568,10 @@ inline void requestRoutesDBusEventLogEntry(App& app) asyncResp->res.jsonValue["Id"] = std::to_string(*id); asyncResp->res.jsonValue["Message"] = *message; asyncResp->res.jsonValue["Resolved"] = resolved; + if ((resolution != nullptr) && (!(*resolution).empty())) + { + asyncResp->res.jsonValue["Resolution"] = *resolution; + } asyncResp->res.jsonValue["EntryType"] = "Event"; asyncResp->res.jsonValue["Severity"] = translateSeverityDbusToRedfish(*severity); @@ -1819,7 +1834,7 @@ inline void fillHostLoggerEntryJson(const std::string& logEntryID, nlohmann::json::object_t& logEntryJson) { // Fill in the log entry with the gathered data. - logEntryJson["@odata.type"] = "#LogEntry.v1_4_0.LogEntry"; + logEntryJson["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; logEntryJson["@odata.id"] = "/redfish/v1/Systems/system/LogServices/HostLogger/Entries/" + logEntryID; @@ -2159,7 +2174,7 @@ static int } // Fill in the log entry with the gathered data - bmcJournalLogEntryJson["@odata.type"] = "#LogEntry.v1_8_0.LogEntry"; + bmcJournalLogEntryJson["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; bmcJournalLogEntryJson["@odata.id"] = "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/" + bmcJournalLogEntryID; @@ -2720,7 +2735,7 @@ static void "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" + logID + "/" + filename; nlohmann::json::object_t logEntry; - logEntry["@odata.type"] = "#LogEntry.v1_7_0.LogEntry"; + logEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; logEntry["@odata.id"] = "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" + logID; logEntry["Name"] = "CPU Crashdump"; @@ -3272,7 +3287,7 @@ static void fillPostCodeEntry( // add to AsyncResp logEntryArray.push_back({}); nlohmann::json& bmcLogEntry = logEntryArray.back(); - bmcLogEntry["@odata.type"] = "#LogEntry.v1_8_0.LogEntry"; + bmcLogEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; bmcLogEntry["@odata.id"] = "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/" + postcodeEntryID; @@ -3587,7 +3602,7 @@ inline void requestRoutesPostCodesEntry(App& app) << targetID; } - asyncResp->res.jsonValue["@odata.type"] = "#LogEntry.v1_4_0.LogEntry"; + asyncResp->res.jsonValue["@odata.type"] = "#LogEntry.v1_9_0.LogEntry"; asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/LogServices/PostCodes/Entries"; asyncResp->res.jsonValue["Name"] = "BIOS POST Code Log Entries"; |