summaryrefslogtreecommitdiff
path: root/redfish-core/lib/log_services.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-03-16Redfish: Implement new event log propety ResolvedXiaochao Ma1-2/+70
In the new Redfish specification 2020.4,the eventlog propety "resolved" is added. This attribute indicates whether the log is marked as "resolved". Tested: Validator succeeded. The "Modified" attribute value will also change accordingly. This property can be changed as the "marked as resolved" is modified on the web page, or it can be modified directly using the redfish command. Before marked the log as resolved: ~$ curl -i -k -H "X-Auth-Token: $token" -X GET https://${bmc}/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", "Created": "1970-01-01T00:01:09+00:00", "EntryType": "Event", "Id": "1", "Message": "xyz.openbmc_project.Common.Device.Error.ReadFailure", "Modified": "1970-01-01T00:01:09+00:00", "Name": "System Event Log Entry", "Resolved": false, "Severity": "Critical" }% after marked the log as resolved on webpage OR use the redfish commond: ~$ curl -k -H "X-Auth-Token: $token" -X PATCH -d '{"Resolved": true}' https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries/1 ~$ curl -i -k -H "X-Auth-Token: $token" -X GET https://${bmc}/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", "Created": "1970-01-01T00:00:57+00:00", "EntryType": "Event", "Id": "1", "Message": "xyz.openbmc_project.Common.Device.Error.ReadFailure", "Modified": "1970-01-01T00:03:05+00:00", "Name": "System Event Log Entry", "Resolved": true, "Severity": "Critical" } Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com> Change-Id: Idd0cc0ca61ad56703303f90ba2bd1a372c321d94
2021-02-25log_services: Update PostCode D-Bus namesJonathan Doman1-8/+8
PostCode D-Bus service and object names are updated to include 0 suffix, based on updated POST code design for single host systems (see docs change Ibb0389c880243bf3a7c9de12bf409eee2eac9ad7). This change does not add any support for multi-host systems. Tested: With phosphor-host-postd: I89ab5f2eef7eab59823df3a063414f3ca3b2949f phosphor-post-code-manager: I59ed514f28c2bb9b159f51367c38557bf55bf226 1. Cleared POST code history by sending (HTTP)POST to /redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog/, and verify it returns 200 OK. 2. Verified the Entries collection was now empty at /redfish/v1/Systems/system/LogServices/PostCodes/Entries. 3. Power cycled host and repeat step 2 to verify that new entries are added. Signed-off-by: Jonathan Doman <jonathan.doman@intel.com> Change-Id: I2fdf97b7aaf8d6471d162f8ed1b72143491ac23f
2021-02-23clang-format-11: reformatPatrick Williams1-2/+3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I0f662e2e6d594567cc10eee34e1df2ca89614870
2021-02-19Start using sdbusplus::message::filename()Ed Tanous1-9/+8
Lots of code gets checked in that does this path checking incorrectly. So much so, that we have it documented in COMMON_ERRORS.md, yet, we persist. This patchset starts using the new object_path::filename() method that was added recently to sdbusplus. Overall, it deletes code, and makes for a much better developer experience. Tested: Pulled down several endpoints and verified that filename() method works properly, and the collections are returned as expected. curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/AccountService/Accounts Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ief1e0584394fb139678d3453265f7011bc931f3c
2021-02-11log_services: Improve error handling for DBus Log EntryAdriana Kobylak1-45/+19
Improve the error handling of the DBus Log Entry class: 1. Return internal error only if message, id, or severity are not initialized. 2. Handle Not Found error (404). 3. Escape the Entry ID used for the DBus call. Tested: A call to entries/foo returns not found: $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries/foo { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type EventLogEntry named foo was not found.", "MessageArgs": [ "EventLogEntry", "foo" ], "MessageId": "Base.1.8.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.8.1.ResourceNotFound", "message": "The requested resource of type EventLogEntry named foo was not found." } Change-Id: Icac06b34c9d4bc570973da369eef42fd785b4bf7 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
2020-12-18Fix .clang-tidyEd Tanous1-2/+2
camelLower is not a type, camelBack is. Changes were made automatically with clang-tidy --fix-errors To be able to apply changes automatically, the only way I've found that works was to build the version of clang/clang-tidy that yocto has, and run the fix script within bitbake -c devshell bmcweb. Unfortunately, yocto has clang-tidy 11, which can apparently find a couple extra errors in tests we already had enabled. As such, a couple of those are also included. Tested: Ran clang-tidy-11 and got a clean result. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9d1080b67f0342229c2f267160849445c065ca51
2020-11-21Add SYSLOG_IDENTIFIER to the BMC journal MessageJason M. Bills1-1/+15
journalctl prints the SYSLOG_IDENTIFIER from each journal entry to help identify the application that printed the message. If it exists in the journal entry, this adds the SYSLOG_IDENTIFIER to the beginning of the Redfish Message field. Tested: Confirmed that the Journal resource entries still display correctly and include the SYSLOG_IDENTIFIER. Change-Id: I0dfb020e5de13a280d5f1a64c2cf36f1d65a60fa Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2020-11-06log_services: Fix redundant AsyncResp objects when deleting dump entriesStanley Chu1-6/+5
In the doPost handler for clearing Dump entries, it may create redundant AsyncResp objects in deleteDumpEntry(). This will cause redundant execution of res->end() and lead to unexpected result for subsequent request within the same connection. Tested By: - pass the openbmc-test-automation with the following case. LogService Test [Documentation] Test LogService [Tags] Test_LogService Create User Initiated BMC Dump Redfish Delete All BMC Dumps Redfish.Login Signed-off-by: Stanley Chu <yschu@nuvoton.com> Change-Id: I636cdf7a4c18072898660fd0eab1380e294d263c
2020-10-27log_services: Remove odata.contextGunnar Mills1-20/+12
A series of commits 8 months ago removed odata.context. These creeped back in. Redfish made odata.context optional (1.6.0 of DSP0266, Sept 2018). Redfish has removed odata.context from example payloads in the specification (1.7.0 of DSP0266), removed it from the mockups, and Redfish recommended not using. The reason for making optional and removing from mockups/examples, "no one could figure out how to use it and it did not add value". Don't see value in it for our implementation. Tested: Was tested in a series in an earlier patch set. Change-Id: Ibee7a3839388d4bcafa16ad78b8211e8338c45dc Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-10-23Turn on ALL perf checksEd Tanous1-8/+8
1st, alphabetize the tidy-list for good housekeeping. Next, enable all the clang-tidy performance checks, and resolve all the issues. most of the issues boil down to: 1. Using std::move on const variables. This does nothing. 2. Passing big variables (like std::string) by value. 3. Using double quotes on a find call, which constructs an intermediate string, rather than using the character overload. Tested Loaded on system, logged in successfully and pulled down webui-vue. No new errors. Walked the Redfish tree a bit, and observed no new problems. Ran redfish service validator. Got no new failures (although there are a lot of log service deprecation warnings that we should look at). Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I2238958c4b22c1e554e09a0a1787c744bdbca43e
2020-10-15Lots of performance improvementsEd Tanous1-7/+7
(In the voice of the kid from sixth sense) I see string copies... Apparently there are a lot of places we make unnecessary copies. This fixes all of them. Not sure how to split this up into smaller patches, or if it even needs split up. It seems pretty easy to review to me, because basically every diff is identical. Change-Id: I22b4ae4f96f7e4082d2bc701098a04f7bed95369 Signed-off-by: Ed Tanous <ed@tanous.net> Signed-off-by: Wludzik, Jozef <jozef.wludzik@intel.com>
2020-10-13Change BMC and System dump codeAsmitha Karunanithi1-58/+52
This commit contains the dump code changes w.r.t the latest changes in the backend. The dump paths are being changed to /xyz/openbmc_project/dump/<bmc or system> as per the below commit: https://gerrit.openbmc-project.xyz/c/openbmc/phosphor- debug-collector/+/36276 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I57abffc59354c363236be42d2d697916bd6480a9
2020-10-09Write the clang-tidy file OpenBMC needsEd Tanous1-7/+7
Now that CI can handle clang-tidy, and a lot of the individual fixes have landed for the various static analysis checks, lets see how close we are. This includes bringing a bunch of the code up to par with the checks that require. Most of them fall into the category of extraneous else statements, const correctness problems, or extra copies. Tested: CI only. Unit tests pass. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I9fbd346560a75fdd3901fa40c57932486275e912
2020-10-05Implement bugprone-branch-clone complianceEd Tanous1-22/+7
As part of getting the clang-tidy bugprone tests running, these conditionals were found to have duplicate entries, or be somewhat nonsensical. Tested: clang-tidy now passes with the branch-compliance check set. Change-Id: Ibec106f3bbd866fc471a1fc56bd8cdd5d44024e0
2020-09-29Fix naming conventionsEd Tanous1-5/+5
Lots of code has been checked in that doesn't match the naming conventions. Lets fix that. Tested: Code compiles. Variable/function renames only. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I6bd107811d0b724f1fad990016113cdf035b604b
2020-09-27Fix Task related issue when creating a bmc dumpAsmitha Karunanithi1-5/+6
This commit fixes the issue where, while creating a bmc dump, the task was not being sent back to the redfish client as the response. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Id3d6466c5bfc04aa44a66f53e35c4ea28f8ae25b
2020-09-27Remove OEM schemas and related code for Dump LogServicesAsmitha Karunanithi1-43/+32
In this commit, Oem schemas for Dump LogServices are removed as per the latest Redfish schemas. Also, the code is changed w.r.t the latest schema changes. Redfish Validator Passed. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I12c8d283cd54c32e71a2b11857e7c4cce89b9f0a
2020-09-03Revert http::Request::socket() callbackEd Tanous1-70/+0
Details on why this revert is needed are here. https://lists.ozlabs.org/pipermail/openbmc/2020-August/022478.html Appu and Ravi still have not commented. It should be noted, this also causes a memory leak in http connection, where connections refuse to be freed, because of a bad usage of shared_from_this. This code wasn't very well thought through, and needs rearchitected to not break the unit testability of bmcweb, nor cause memory leaks. https://github.com/openbmc/bmcweb/blob/218bd4746130aac22366968c8c9a34a929e45a3d/http/http_connection.h#L351 Is the memory leak in question. Specifically, this reverts: The /attachment download in LogServices. This needs reimplemented properly, but is an OEM property, so it shouldn't be a big deal to revert, and shouldn't break our redfish compliance. The IpAddress property in SessionService. I have no idea why this was injected, and it's functionally incorrect. IpAddresses are not related to a session, and IP addresses can change over the course of a session, so this property is already broken as written. I suspect the author really wanted RedfishEvent type logging, but that was too complex, so they half implemented this. Redfish SSE properties. This needs to be reimplemented similar to the patchset here: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/13948 Where the ownership of the HTTP connection does not leave the http framework. As written, the SSE implementation causes ownership issues, as there's no clear delineation of the ownership between HttpConnection and the SSE framework. Tested: On current master, running this command: wget -O- --no-http-keep-alive --no-check-certificate https://{bmc hostname}:18080/redfish/v1 Which should download the service root, then immediately close and destroy the connection, prints: (2020-08-28 16:55:24) [DEBUG "routing.h":1258] Matched rule '/redfish/v1/' 2 / 4 (2020-08-28 16:55:24) [DEBUG "http_response.h":130] calling completion handler (2020-08-28 16:55:24) [DEBUG "http_response.h":133] completion handler was valid (2020-08-28 16:55:24) [INFO "http_connection.h":429] Response: 0x1e1ee28 /redfish/v1 200 keepalive=0 (2020-08-28 16:55:24) [DEBUG "timer_queue.h":48] timer add inside: 0x1d3d1a8 7 (2020-08-28 16:55:24) [DEBUG "http_connection.h":751] 0x1e1ee28 timer added: 0x1d3d1a8 7 (2020-08-28 16:55:24) [DEBUG "http_connection.h":655] 0x1e1ee28 doWrite (2020-08-28 16:55:24) [DEBUG "http_connection.h":663] 0x1e1ee28 async_write 1555 bytes (2020-08-28 16:55:24) [DEBUG "http_connection.h":697] 0x1e1ee28 timer cancelled: 0x1d3d1a8 7 (2020-08-28 16:55:24) [DEBUG "http_connection.h":676] 0x1e1ee28 from write(1) Then stops. Note, that the connection was not destroyed, and has leaked. Once this patchset is added, the connection closes and destroys properly, and doesn't leak, so it prints the above, but also prints. (2020-08-28 16:27:10) [DEBUG "http_connection.h":305] 0x1d15c90 Connection closed, total 1 Ran Redfish service validator. Saw one unrelated failure due to UUID, all other things pass. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I18686037bf58f20389d31facc0d77020274d38a1
2020-08-27Fix potential null pointer dereferenceGeorge Liu1-8/+21
Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ibeedbe61fa1575af2599c63e6513ddb7d1feff58
2020-08-25Implement Modified Event log propertyGeorge Liu1-20/+35
Refer to https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/29734 and implement Modified Event log property Tested: curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries/1 { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", "@odata.type": "#LogEntry.v1_6_0.LogEntry", "Created": "1970-01-01T00:01:35+00:00", "EntryType": "Event", "Id": "1", "Message": "xyz.openbmc_project.Common.Device.Error.ReadFailure", "Modified": "1970-01-01T00:01:35+00:00", "Name": "System Event Log Entry", "Severity": "Critical" } Passed the validator: VERBO - ServiceRoot -> Systems.Systems -> Members.ComputerSystem#0 -> LogServices.LogServices -> Members.LogService#0 -> Entries.Entries -> Members.LogEntry#0, LogEntry.v1_6_1, LogEntry VERBO - @odata.id PASS VERBO - @odata.type PASS VERBO - Created PASS VERBO - EntryType PASS VERBO - Id PASS VERBO - Message PASS VERBO - Modified PASS VERBO - Name PASS VERBO - Severity PASS Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I5a59a298e95e78acaad11a99558f9046675820d3
2020-08-17Deleting the deprecated format for SendRawPeciKarthick Sundarrajan1-38/+17
Crashdump.SendRawPeci redfish interface supports two input data formats. Removing the support for deprecated format. Change-Id: I86db8694d94f1dbabf2852dbde04c414c846b1d1 Signed-off-by: Karthick Sundarrajan <karthick.sundarrajan@intel.com>
2020-08-17Enable unused variable warnings and resolveEd Tanous1-59/+64
This commit enables the "unused variables" warning in clang. Throughout this, it did point out several issues that would've been functional bugs, so I think it was worthwhile. It also cleaned up several unused variable from old constructs that no longer exist. Tested: Built with clang. Code no longer emits warnings. Downloaded bmcweb to system and pulled up the webui, observed webui loads and logs in properly. Change-Id: I51505f4222cc147d6f2b87b14d7e2ac4a74cafa8 Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-17Enable clang warningsEd Tanous1-6/+6
This commit enables clang warnings, and fixes all warnings that were found. Most of these fall into a couple categories: Variable shadow issues were fixed by renaming variables unused parameter warnings were resolved by either checking error codes that had been ignored, or removing the name of the variable from the scope. Other various warnings were fixed in the best way I was able to come up with. Note, the redfish Node class is especially insidious, as it causes all imlementers to have variables for parameters, regardless of whether or not they are used. Deprecating the Node class is on my list of things to do, as it adds extra overhead, and in general isn't a useful abstraction. For now, I have simply fixed all the handlers. Tested: Added the current meta-clang meta layer into bblayers.conf, and added TOOLCHAIN_pn-bmcweb = "clang" to my local.conf Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: Ia75b94010359170159c703e535d1c1af182fe700
2020-08-17Remove middlewaresEd Tanous1-50/+36
Middlewares, while kinda cool from an academic standpoint, make our build times even worse than they already are. Given that we only really use 1 real middleware today (token auth) and it needs to move into the parser mode anyway (for security limiting buffer sizes), we might as well use this as an opportunity to delete some code. Some other things that happen: 1. Persistent data now moves out of the crow namespace 2. App is no longer a template 3. All request_routes implementations no longer become templates. This should be a decent (unmeasured) win on compile times. This commit was part of a commit previously called "various cleanups". This separates ONLY the middleware deletion part of that. Note, this also deletes about 400 lines of hard to understand code. Change-Id: I4c19e25491a153a2aa2e4ef46fc797bcb5b3581a Signed-off-by: Ed Tanous <ed@tanous.net>
2020-08-08Redfish: Support for DownloadLog ActionAsmitha Karunanithi1-5/+36
Supports offloading a dump to the client Tested-By: * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/ Dump/attachment/<dump-id> * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/Systems/system/LogServices/ Dump/attachment/<dump-id> Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I99bbb50bc171408273744f89220a46bfe64ba4c4
2020-08-04Remove QueryStringJames Feist1-8/+12
QueryString is an error-prone library that was leftover from crow. Replace it with boost::url, a header only library based and written by the one of the authors of boost beast. Tested: Verified logging paging still worked as expected Change-Id: I47c225089aa7d0f7d2299142f91806294f879381 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-08-04Minor changes in the code to use the appropriate errorsAsmitha Karunanithi1-15/+8
This commit contains changes that replaces the error messages in the response's body with the appropriate one. This change was made based on the comment in the following commit: https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/32033/35/ redfish-core/lib/log_services.hpp#501 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I56a63f1cde27776b86d588695ce9505bf38d7f38
2020-08-04Removing getTimestampStr methodAsmitha Karunanithi1-28/+6
The method 'getTimestampStr' is not used elsewhere in the code, hence it is removed and replaced by 'crow::utility::getDateTime' method. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I094fe8ca741bf36755a722e72fadd14ed8df7287
2020-07-28Redfish: Support for ClearLog ActionAsmitha Karunanithi1-28/+60
Clears the BMC dump entry collection Tested-By: * curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Managers/bmc/LogServices/ Dump/Actions/LogService.ClearLog * curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/system/LogServices/ Dump/Actions/LogService.ClearLog Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Iffe9b62d52bc28ccbeae3efdb34d30b2b750ab2c
2020-07-28Redfish: Creation of a BMC dumpAsmitha Karunanithi1-0/+187
This commit supports creation of a BMC dump entry. After initiation of the dump creation, a task is created that listens to "InterfaceAdded" signal over "/xyz/openbmc_project/dump" path. Once the task is completed, it returns the created BMC dump entry ID, as a part of the task's message args as well as in the task's http header. Tested-By: * curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Managers/bmc/LogServices/ Dump/Actions/Oem/OemLogService.CollectDiagnosticData -d '{"DiagnosticDataType" : "Managers", "OEMDiagnosticDataType": ""}' * curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/Systems/system/LogServices/ Dump/Actions/Oem/OemLogService.CollectDiagnosticData -d '{"DiagnosticDataType" : "OEM", "OEMDiagnosticDataType": "System"}' <Returns a Task> * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/redfish/v1/TaskService/Tasks/<task-id> <Returns Dump ID on completion> Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Ide44b6abda797d738851123f06696558bab05ce0
2020-07-28Redfish: BMC dump logEntry service implementationAsmitha Karunanithi1-225/+463
This commit supports adding a BMC dump entry under /redfish/ v1/Managers/bmc/LogServices/Dump * Removed the option for enabling each dump separately. Instead introduced one common option to enable dump. * Defined few methods that are common for both BMC and System dumps. * Compilation flag DBMCWEB_ENABLE_REDFISH_DUMP_LOG must be enabled. Tested-By: * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/ redfish/v1/Managers/bmc/LogServices/ * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/ redfish/v1/Managers/bmc/LogServices/Dump * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/ redfish/v1/Managers/bmc/LogServices/Dump/Entries * curl -k -H "X-Auth-Token: $bmc_token" -X GET https://${bmc}/ redfish/v1/Managers/bmc/LogServices/Dump/Entries/<dump-id> * curl -k -H "X-Auth-Token: $bmc_token" -X DELETE https://${bmc}/ redfish/v1/Managers/bmc/LogServices/Dump/Entries/<dump-id> Redfish Validator passed. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Iac9daa8242154e249fad66609b837cf7d2b16091
2020-07-10Codespell redfish-core spelling fixesGunnar Mills1-1/+1
These spelling errors were found using https://github.com/codespell-project/codespell Tested: Top commit (along with this) was built and ran against validator. Change-Id: Ic9dce27b1de8567eedf7753164ef564d3aedf8ca Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-30Add Crashdump.Telemetry interface and triggerKenny L. Ku1-2/+78
Tested: - Sent post requests Crashdump.OnDemand & Crashdump.Telemetry and correct trigger is received in crashdump application. - Redfish validator is run successfully. Signed-off-by: Kenny K. Ku <kenny.k.ku@intel.com> Change-Id: Ie0f49d3230aeb4450e11dfa2d46e309946763a6a
2020-06-11clang-format: update to latest from docs repoGunnar Mills1-234/+235
This is from openbmc/docs/style/cpp/.clang-format Other OpenBMC repos are doing the same. Tested: Built and validator passed. Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-06-03log_services: Fix Severity Empty string found issue when running Redfish ↵Tim Lee1-5/+7
Service Validator Symptom: When running Redfish Service Validator, we found that Severity Empty string issue except first post code in PostCodesEntry. *** /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1 Regetting resource from URI /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1 Type (#LogEntry.v1_4_0.LogEntry), GET SUCCESS (time: 0) PASS *** /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2 Regetting resource from URI /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2 Type (#LogEntry.v1_4_0.LogEntry), GET SUCCESS (time: 0) Severity: Empty string found - Services should omit properties if not supported Severity: Invalid Enum value '' found, expected ['OK', 'Warning', 'Critical'] FAIL... Root cause: In fillPostCodeEntry(), this statement "severity = message->severity" only be executed once. And another statement {"Severity", std::move(severity)} in the end of this function will clear severity string to null after calling std::move() standard function. Thus, only first post code Severity is 'OK', but the others are NULL. Solution: Move this statement "severity = message->severity" to for loop in fillPostCodeEntry() then all post codes will be recorded with correct severity string 'OK'. Tested: Passed the Redfish Service Validator and verified "Severity": "OK" in /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2 { "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-2", "@odata.type": "#LogEntry.v1_4_0.LogEntry", "Created": "2020-04-27T01:48:10+00:00", "EntryType": "Event", "Id": "B1-2", "Message": "Boot Count: 1: TS Offset: 0.0046; POST Code: 0x02", "MessageArgs": [ "1", "0.0046", "0x02" ], "MessageId": "OpenBMC.0.1.BIOSPOSTCode", "Name": "POST Code Log Entry", "Severity": "OK" } Signed-off-by: Tim Lee <timlee660101@gmail.com> Change-Id: Ibfccfa47cfe8e0f58e7f24650871edda5d248674
2020-05-29BMCWeb : Fix a warning spotted in meson scan buildManojkiran Eda1-0/+7
- This commit fixes a warning that is spotted in meson scan build which is run as a part of CI. ``` ../../../redfish-core/include/../lib/log_services.hpp:1519:9: warning: Value stored to 'ret' is never read ret = sd_journal_seek_realtime_usec(journal.get(), ts); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. ``` Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: I6800ef9d908494d8328ab8e66c12778df394023c
2020-05-28Redfish: ClearLog action support for system dump log entriesraviteja-b1-2/+48
Tested By: POST https://${IP}/redfish/v1/Systems/system/LogServices/SystemDump/Actions/LogService.ClearLog Change-Id: I28af3ccc1d7bd54c521e79d93e6ccb1436eefc4f Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
2020-05-28Redfish: Download action support for system dump entryraviteja-b1-0/+31
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>
2020-05-14Task: Use TaskEvent messagesJames Feist1-1/+3
Task registry messages make more sense to use for task events then standard registry entries when applicable. Use them. Tested: "Messages": [ { "@odata.type": "#Message.v1_0_0.Message", "Message": "The task with id 0 has started.", "MessageArgs": [ "0" ], "MessageId": "TaskEvent.1.0.1.TaskStarted", "Resolution": "None.", "Severity": "OK" } ], Validator passed Change-Id: I707492544e18def2833e8a2e2216ce803c42c775 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-05-14sdbusplus: replace message::variant with std::variantPatrick Williams1-3/+2
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Ia5d0845741f1d8d4bc6fd227c6d2e6f3a8d42b2e
2020-05-14sdbusplus: remove deprecated variant_nsPatrick Williams1-8/+4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I86e11299512704fa1df1e5f6517ea25cc6eced8f
2020-05-08Redfish: Log service implementation for system dumpraviteja-b1-0/+331
Dump is the debug data collected at any point of time from the system and is stored in a file Currently, Redfish doesn't have schema for operations on debug data(dump). This commit implements logService for system dump. we have a DMTF proposal to extend existing LogService schema for this purpose but its still work in progress, so moved to oem schema. below commit has changes to move properties to OEM https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/30352 Tested By: GET https://${IP}/redfish/v1/Systems/system/LogServices/SystemDump DELETE https://${IP}/redfish/v1/Systems/system/LogServices/SystemDump/Entries/<id> Redfish validator passed. (above mentioned commit required to pass validator). Change-Id: I4a4a4083be4556bc46a4335d31ce56f834bd4f5a Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
2020-04-22Correct privilege levels for LogServiceAppaRao Puli1-20/+34
Correct the privilege levels for LogService as per privilege registry under redfish specification. https://redfish.dmtf.org/registries/Redfish_1.0.4_PrivilegeRegistry.json 1) ClearLog actions(EventLog, CrashDump, PostCode, JournalLog etc..) are subordinates of LogService should be executed with "ConfigureComponents" privilege level. 2) For security reasons, Restricted CrashDump (LogService and LogEntry) to "ConfigureComponents". Tested: - Created Operator, User and Administrator users and validated all methods under LogService, LogEntry LogServiceCollections and LogEntryCollections, its subordinates. Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Change-Id: I4ce1ee90b3b999a80daa9aa20e5e7d79b64a9b85
2020-04-16Redfish: Allow slash at the end of ResourceGunnar Mills1-1/+1
This is defined in the Redfish protocol. Easiest way to allow this is to end the Node URL with "/", which most Nodes in bmcweb already had. Before: curl -k https://${bmc}/redfish/v1/TaskService/ Not Found After both /redfish/v1/TaskService/ and /redfish/v1/TaskService return the Task Service. Tested: Validator passed. Change-Id: Ic806dc5c91f631b87642e49b486a6b6da7fdf955 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-04-16Change EventLog Id to match odata.idGunnar Mills1-1/+1
Could not find a hard rule to require the Id to match the last segment of the URL/@odata.id but all Redfish mockups match this way, other bmcweb resources do as well, and redfishtool is easier to use if this is true. Before: $ python redfishtool.py -r xxxxxx -u xxxx -p xxxxxxx -S Always \ Systems Logs -i EventLog 5 Transport:getPathBy2:Match: failed match: matchProp=Id, matchValue=EventLog, readValue=Event Log Tested: Validator passed. curl -k https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog", "@odata.type": "#LogService.v1_1_0.LogService", "Actions": { "#LogService.ClearLog": { "target": "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog" } }, "Description": "System Event Log Service", "Entries": { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries" }, "Id": "EventLog", "Name": "Event Log Service", "OverWritePolicy": "WrapsWhenFull" Change-Id: Ia324bebfcae65a195adbb3a4126100d82efde383 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2020-04-09Match BMCWeb crashdump to the D-Bus interface provided by crashdumpJohnathan Mantey1-118/+142
The crashdump service changed to eliminate hangs, and failures to retrieve the crashdump data. The BMCWeb crashdump handling code has to be aligned with the server. Tested: Confirmed each of the primary functions operates as expected. Getting the collection Getting the entries Forcing an on demand capture Polling for the on demand capture to complete Retrieving the creashdump data Clearing all of the crashdump content Ran service validator Change-Id: Ie8fb48369a782d905b942c1f9bef11f387f6463e Signed-off-by: Johnathan Mantey <johnathanx.mantey@intel.com>
2020-03-18Log BIOS POST Codes Through RedfishZhikuiRen1-12/+494
Added PostCodes MessageID, PostCodesLogService, PostCodesClear, PostCodesEntry and PostCodesEntryCollection to redfish-core log_services. Design document located at openbmc/docs/designs/redfish-postcodes.md: Tested: Build with changes in phosphor-dbus-interfaces and phosphor-post-code-manager. PostCode Collection and entries passed RedfishServiceValidator test. Boot cycles are ordered so that B1 is for the most recent power on. Reviewed redfish log contents against design document that is mentioned above: bmc/redfish/v1/Systems/system/LogServices bmc/redfish/v1/Systems/system/LogServices/PostCodes bmc/redfish/v1/Systems/system/LogServices/PostCodes/Entries Send POST clear commands and verified PostCodes log is cleared and boot cycle count is reset to 1. Change-Id: I8de4d4749d1a17d590619d70670d279c01753b03 Signed-off-by: ZhikuiRen <zhikui.ren@intel.com>
2020-03-17Task: Add payload supportJames Feist1-4/+5
This adds the payload values to task responses. Tested: passed validator Change-Id: I50467e28ce8142d198f916ea0c63bd413edcd524 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-03-13log: Fix ValidatorJames Feist1-1/+1
Should be updating state when finished, not status. Tested: Validator passed again Change-Id: Ida75eb480d7873c56e37f99b4a093be20362c9d6 Signed-off-by: James Feist <james.feist@linux.intel.com>
2020-03-12task: add fwupdate supportJames Feist1-1/+2
This adds firmware update task service support. It adds a match and updates the task value when the interface changes. Tested: On successful fwupdate task was created and updated correctly. On failed fwupdate the status went to failed. Change-Id: Id12cc5d5270e8e45498b665e78601c5c30775323 Signed-off-by: James Feist <james.feist@linux.intel.com>