Skip to content

Commit

Permalink
Change AdditionalDataURI to be a child URI
Browse files Browse the repository at this point in the history
Make the AdditionalDataURI a child relationship of the resource to better follow Hypermedia API best practices and match the AdditionalDataURI of the coming Post Code log entries.
Changed the AdditionalDataURI for bmc dump, system dump, and log entry

A hypermedia API gives us a search form in response and tells API what URL to use, which HTTP verb is appropriate, and what parameters to supply.

  URL change:-
  Old:
    "/redfish/v1/Systems/system/LogServices/EventLog/attachment/<str>"
  New:
    "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/attachment"

 #205

Tested: Validator passes.
- Verified the new AdditionalDataURI was correct for /redfish/v1/Systems/system/LogServices/EventLog/Entries:
$ curl -k https://w15.aus.stglabs.ibm.com/redfish/v1/Systems/system/LogServices/EventLog/Entries/1
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1",
  "@odata.type": "#LogEntry.v1_8_0.LogEntry",
  "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1/attachment",
  "Created": "2021-03-15T18:47:26+00:00",
  "EntryType": "Event",
  "Id": "1",
  "Message": "xyz.openbmc_project.Common.Error.InternalFailure",
  "Modified": "2021-04-30T17:26:38+00:00",
  "Name": "System Event Log Entry",
  "Resolved": true,
  "Severity": "Critical"
}

Change-Id: Ifb720ac2710ebd4a2df37a83c9deb8a6eefdffd5
Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com>
  • Loading branch information
Abhishek Patel authored and gtmills committed May 19, 2021
1 parent 3cde86f commit de8d94a
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions redfish-core/lib/log_services.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,16 @@ inline void
{
thisEntry["DiagnosticDataType"] = "Manager";
thisEntry["AdditionalDataURI"] =
"/redfish/v1/Managers/bmc/LogServices/Dump/"
"attachment/" +
entryID;
"/redfish/v1/Managers/bmc/LogServices/Dump/Entries/" +
entryID + "/attachment";
}
else if (dumpType == "System")
{
thisEntry["DiagnosticDataType"] = "OEM";
thisEntry["OEMDiagnosticDataType"] = "System";
thisEntry["AdditionalDataURI"] =
"/redfish/v1/Systems/system/LogServices/Dump/"
"attachment/" +
entryID;
"/redfish/v1/Systems/system/LogServices/Dump/Entries/" +
entryID + "/attachment";
}
}
asyncResp->res.jsonValue["Members@odata.count"] =
Expand Down Expand Up @@ -636,19 +634,17 @@ inline void
{
asyncResp->res.jsonValue["DiagnosticDataType"] = "Manager";
asyncResp->res.jsonValue["AdditionalDataURI"] =
"/redfish/v1/Managers/bmc/LogServices/Dump/"
"attachment/" +
entryID;
"/redfish/v1/Managers/bmc/LogServices/Dump/Entries/" +
entryID + "/attachment";
}
else if (dumpType == "System")
{
asyncResp->res.jsonValue["DiagnosticDataType"] = "OEM";
asyncResp->res.jsonValue["OEMDiagnosticDataType"] =
"System";
asyncResp->res.jsonValue["AdditionalDataURI"] =
"/redfish/v1/Systems/system/LogServices/Dump/"
"attachment/" +
entryID;
"/redfish/v1/Systems/system/LogServices/Dump/Entries/" +
entryID + "/attachment";
}
}
if (foundDumpEntry == false)
Expand Down Expand Up @@ -1508,8 +1504,8 @@ class DBusEventLogEntryCollection : public Node
{
thisEntry["AdditionalDataURI"] =
"/redfish/v1/Systems/system/LogServices/EventLog/"
"attachment/" +
std::to_string(*id);
"Entries/" +
std::to_string(*id) + "/attachment";
}
}
std::sort(entriesArray.begin(), entriesArray.end(),
Expand Down Expand Up @@ -1659,8 +1655,8 @@ class DBusEventLogEntry : public Node
{
asyncResp->res.jsonValue["AdditionalDataURI"] =
"/redfish/v1/Systems/system/LogServices/EventLog/"
"attachment/" +
std::to_string(*id);
"Entries/" +
std::to_string(*id) + "/attachment";
}
},
"xyz.openbmc_project.Logging",
Expand Down Expand Up @@ -1761,10 +1757,10 @@ class DBusEventLogEntryDownload : public Node
{
public:
DBusEventLogEntryDownload(App& app) :
Node(
app,
"/redfish/v1/Systems/system/LogServices/EventLog/attachment/<str>/",
std::string())
Node(app,
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/"
"attachment",
std::string())
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
Expand Down

0 comments on commit de8d94a

Please sign in to comment.