summaryrefslogtreecommitdiff
path: root/redfish-core/lib/log_services.hpp
AgeCommit message (Collapse)AuthorFilesLines
2021-10-05Boost uri updateEd Tanous1-4/+2
Update to the latest version of boost::uri The newest version of boost uri makes some breaking changes that we need to account for. At the same time, we take the opportunity to move to the error code based parse methods that don't rely on exceptions. The biggest changes are: The standalone build is no longer present. A discussion with the boost::url maintainers shows that our best option is to do a simple copy of the headers, and compile boost/url/src.hpp in a separate file. This is intended to allow people to pull the library in "standalone" and not have to rely on the build machinery in boost-url, which we don't really need. Interestingly, this file doesn't have a newline at the end, which clang correctly flags. OpenBMC doesn't really need that warning, as we rely on clang-format to do that, so we add -Wno-newline-eof clang to get the code to compile there. All url parsers are moved to the parse_uri, or parse_relative_uri equivalents. This slightly tightens the requirements around what URLs are accepted, but in no ways that should break anything. (Ie, "/redfish/v1" is no longer accepted for a virtual media endpoint. boost::urls::url_view::params_type has been renamed to query_params_type, and the relevant methods have been updated. Because of the missing standalone mode, we now need to use boost::string_view which doesn't implicitly construct from std::string_view. Some discussion on the boost list shows that this is coming soon, so that cruft can eventually be cleaned up, but for now we need the construction. Tested: Loaded in qemu, and ran some URLs (/redfish/v1 and /redfish/v1/Chassis) to ensure that the url handler functions as intended. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5843776d4ec01b4d92af2ee3a9cf1ebb1d920ae7
2021-09-29log_services: Add download of post code log entriesGeorge Liu1-43/+139
- Add a GET method /redfish/v1/Systems/system/LogServices/PostCodes /Entries/<str>/attachment/, Get the attribute value through the getPostCodes method and encode it as base64, and send it off. - This allows the use to offload error logs for analysis and further parsing if needed. An http header of "Accept: application/octet-stream" or the default "*/*" is expected. Tested: - Ran Redfish validator. - Before, It broke post JSON content as HTTP https://gerrit.openbmc-project.xyz/c/openbmc/bmcweb/+/44660 Now, I tested it passed. - pldmtool raw --data 0x80 0x3F 0xC 0x0A 0x00 0x00 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x53 0x54 0x41 0x4e 0x44 0x42 0x59 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 $curl -k https://127.0.0.1:2443/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1/attachment/ output: AgAAAQAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFNUQU5EQlkgICAgICAgICAgICAgICAgICAgICAgICAg Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ide684146a4ae9d55dc95fb765927867b042fc27c
2021-09-23Show only "Completed" dump entries in Redfish respAsmitha Karunanithi1-4/+63
In the current implementation, the dumps whose status remain "InProgress" were also displayed when a GET request on dump entries is fired. That is, when the user initiates a dump creation, and immediately does a GET on dump entries, the dump that is now created will also be displayed with size 0 and an invalid date in the redfish response as below, until the status becomes "Completed" { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/7", "@odata.type": "#LogEntry.v1_7_0.LogEntry", "AdditionalDataSizeBytes": 0, "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/7/attachment", "Created": "1970-01-01T00:00:00+00:00", "DiagnosticDataType": "Manager", "EntryType": "Event", "Id": "7", "Name": "BMC Dump Entry" } This commit contains changes that will avoid displaying the incomplete dumps. Tested By: * GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Entries/12 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type BMC dump named 12 was not found.", "MessageArgs": [ "BMC dump", "12" ], "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 BMC dump named 12 was not found." } } * GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Entries/ -- This also avoids displaying incomplete dump entries. Redfish Validator passed. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Ifc5e1773cde0c4c4288e8ebbcdf87b2ec480af55
2021-09-22Move log service file parsing to use from_charsEd Tanous1-32/+6
std::from_chars seems to be what most other bmcweb code has moved to, and allows removal of exceptions usage. Tested: Ran redfishtool -S Always -A Session -u root -p 0penBmc -r 192.168.7.2 raw GET "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1632252609998258" And observed that the uri component got parsed properly. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Icd4808196eeae0f8a19a208a065b5f2f4f0b050c
2021-07-30Fix System EventLog Collection permissionGunnar Mills1-1/+1
Both are the login Privilege so this has no client impact. From redfish-core/include/registries/privilege_registry.hpp: conststaticauto& getLogEntry = privilegeSetLogin; conststaticauto& getLogEntryCollection = privilegeSetLogin; From https://redfish.dmtf.org/schemas/v1/LogEntryCollection_v1.xml: /redfish/v1/Systems/{ComputerSystemId}/LogServices/{LogServiceId}/Entries Tested: None. Change-Id: I955fa005db332346e3151d1ac6b7f4ad43406063 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-07-30Correct Manager LogService Collection permissionGunnar Mills1-1/+1
Both are the login Privilege so this has no client impact. From redfish-core/include/registries/privilege_registry.hpp: const auto& getLogServiceCollection = privilegeSetLogin; const auto& getLogService = privilegeSetLogin; From https://redfish.dmtf.org/schemas/v1/LogServiceCollection_v1.xml: <String>/redfish/v1/Managers/{ManagerId}/LogServices</String> Tested: None. Change-Id: Ie836e2fa9bc841f16e1d6c6104c6d474751c5a09 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-07-14Fix System dump entries routeAsmitha Karunanithi1-1/+1
The system dump entries URI was wrong (same as bmc dump entries) and hence causes bmcweb to crash with the following error: "handler already exists for /redfish/v1/Managers/bmc/LogServices/Dump/Entries/" The below commit has caused this issue: https://github.com/openbmc/bmcweb/commit/ed3982131dcef2b499da36e674d2d21 b2289ef29 The above change will impact the clients as listing of system dumps will never work and also this causes bmcweb to crash. This commit has the fix for the same. Old Incorrect URI: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/ is changed to the following RI: /redfish/v1/Systems/system/LogServices/Dump/Entries/ Tested the same. Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: Idbf23cb2ca52575dd47d296884793a33710e07d5
2021-07-13Make code compile with clang-13Ed Tanous1-2/+1
Clang-13 rightfully warns that the hasWebuiRoute variable isn't declared as static. This commit resolves that, and adds the static keyword so it can be used in multiple compile units. It also adds the static keyword to the privilege registry, and the inline keyword to many methods that now need it. clang-format is also updated to version 12 in parse_registies.py, as that's what CI uses, and what most people have installed. Tested: Followed clang-tidy instructions in README.md "bitbake bmcweb" step now succeeds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id43b13606754cb37a404799fce155599ac3a3240
2021-07-08Automate PrivilegeRegistry to codeEd Tanous1-31/+46
This commit attempts to automate the creation of our privileges structures from the redfish privilege registry. It accomplishes this by updating parse_registries.py to also pull down the privilege registry from DMTF. The script then generates privilege_registry.hpp, which include const defines for all the privilege registry entries in the same format that the Privileges struct accepts. This allows new clients to simply reference the variable to these privilege structures, instead of having to manually (ie error pronely) put the privileges in themselves. This commit updates all the routes. For the moment, override and OEM schemas are not considered. Today we don't have any OEM-specific Redfish routes, so the existing ones inherit their parents schema. Overrides have other issues, and are already incorrect as Redfish defines them. Binary size remains unchanged after this patchset. Tested: Ran redfish service validator Ran test case from f9a6708c4c6490257e2eb6a8c04458f500902476 to ensure that the new privileges constructor didn't cause us to regress the brace construction initializer. Checked binary size with: gzip -c $BBPATH/tmp/work/s7106-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/rootfs/usr/bin/bmcweb | wc -c 1244048 (tested on previous patchset) Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ideede3d5b39d50bffe7fe78a0848bdbc22ac387f
2021-07-01Revert "log_services: Add AdditionalDataURI to Post Code log entries"Ed Tanous1-13/+6
This reverts commit 0ef217f4e89016e8f49f487fe65934b934aab077. This commit requires 753d034d9fb0f2dbd240f5f0ae51371dd3a28369 to function, which is also being reverted as part of fixing a regression. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie6cfa6bb247d66f7c0d0291a07982bbd54d104c4
2021-07-01Revert "log_services: Add download of post code log entries"Ed Tanous1-114/+18
This reverts commit af61db10fb40c7beb91a70f0b3ff28cb8e6c1704 which breaks the ability to detect and post json content as HTTP. I suspect something went wrong with the requestPrefersHtml() method that was modified in this commit. Authors should feel free to resubmit this patch once they have the failure understood and fixed. Change-Id: Id6e8d102fe5d4b02ac0dce06bff50c28edfcf44c Signed-off-by: Ed Tanous <edtanous@google.com>
2021-06-30Remove code using ambiguous privileges constructorGunnar Mills1-1/+1
432a890c removed the ambiguous privileges constructor. af61db10 added code that used this removed ambiguous privileges constructor. This is causing bmcweb CI and bmcweb autobumps to fail. The error looks like: error: cannot convert '<brace-enclosed initializer list>' to 'const std::initializer_list<std::initializer_list<const char*> >&' | 3102 | .privileges({"Login"}) af61db10 passed CI because it was pushed before and based on a parent that was before 432a890c. Tested: bmcweb builds. No further testing done. Change-Id: I21399033d63851e3c83f3cd5a00e1227064e6941 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2021-06-30Add DateTime & Offset in Managers & LogServicesTejas Patil1-0/+47
This commit adds the support for "DateTimeLocalOffset" property under "/redfish/v1/Managers/bmc/" Redfish URI. And it also adds the support for "DateTime" & "DateTimeLocalOffset" properties under "/redfish/v1/Systems/system/LogServices/<id>/" & "/redfish/v1/Managers/bmc/LogServices/<id>/" Redfish URI's. These properties shows the current Date, Time & the UTC offset that the current DateTime property value contains. Tested: - Redfish Validator Test passed. curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X GET https://${bmc}/redfish/v1/Managers/bmc/ { "@odata.id": "/redfish/v1/Managers/bmc", "@odata.type": "#Manager.v1_11_0.Manager", "Actions": { "#Manager.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Managers/bmc/ResetActionInfo", "target": "/redfish/v1/Managers/bmc/Actions/Manager.Reset" }, "#Manager.ResetToDefaults": { "ResetType@Redfish.AllowableValues": [ "ResetAll" ], "target": "/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults" } }, "DateTime": "2021-06-04T12:18:28+00:00", "DateTimeLocalOffset": "+00:00", "Description": "Baseboard Management Controller", "EthernetInterfaces": { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces" }, "FirmwareVersion": "2.11.0-dev-114-gc1989599d", "GraphicalConsole": { "ConnectTypesSupported": [ "KVMIP" ], "MaxConcurrentSessions": 4, "ServiceEnabled": true }, "Id": "bmc", "LastResetTime": "2021-06-04T12:07:02+00:00", "Links": { "ActiveSoftwareImage": { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/419c86fb" }, "ManagerForServers": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "ManagerForServers@odata.count": 1, "SoftwareImages": [ { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/419c86fb" } ], "SoftwareImages@odata.count": 1 }, "LogServices": { "@odata.id": "/redfish/v1/Managers/bmc/LogServices" }, "ManagerType": "BMC", "Model": "OpenBmc", "Name": "OpenBmc Manager", "NetworkProtocol": { "@odata.id": "/redfish/v1/Managers/bmc/NetworkProtocol" }, "Oem": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem", "@odata.type": "#OemManager.Oem", "OpenBmc": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc", "@odata.type": "#OemManager.OpenBmc", "Certificates": { "@odata.id": "/redfish/v1/Managers/bmc/Truststore/Certificates" } } }, "PowerState": "On", "SerialConsole": { "ConnectTypesSupported": [ "IPMI", "SSH" ], "MaxConcurrentSessions": 15, "ServiceEnabled": true }, "ServiceEntryPointUUID": "1832ebbb-0b54-44e9-90d7-b49108f6863c", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "UUID": "7fe3d13d-4ae7-4a4f-add1-2d60308124b4" } curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X GET 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" } }, "DateTime": "2021-06-04T12:11:10+00:00", "DateTimeLocalOffset": "+00:00", "Description": "System Event Log Service", "Entries": { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries" }, "Id": "EventLog", "Name": "Event Log Service", "OverWritePolicy": "WrapsWhenFull" } Signed-off-by: Tejas Patil <tejaspp@ami.com> Change-Id: I416d13ae11e236cf4552f817a9bd69b48f9b5afb
2021-06-30log_services: Add download of post code log entriesGeorge Liu1-18/+114
- Add a GET method /redfish/v1/Systems/system/LogServices/PostCodes /Entries/<str>/attachment/, Get the attribute value through the getPostCodes method and encode it as base64, and send it off. - This allows the use to offload error logs for analysis and further parsing if needed. An http header of "Accept: application/octet-stream" or the default "*/*" is expected. Tested: - Ran Redfish validator. - pldmtool raw --data 0x80 0x3F 0xC 0x0A 0x00 0x00 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x53 0x54 0x41 0x4e 0x44 0x42 0x59 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 $curl -k https://127.0.0.1:2443/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1/attachment/ output: AgAAAQAAAEgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFNUQU5EQlkgICAgICAgICAgICAgICAgICAgICAgICAg Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I74dd6c1dc2d3dfb7908f7741e0d9e7825c1df816
2021-06-30log_services: Add AdditionalDataURI to Post Code log entriesGeorge Liu1-6/+13
- Need to support the Additional Data URI on Post Code log service. IBM progress codes are typically 72 bytes including a primary code (8 bytes) and a secondary code that contains hex words that would provide additional details on the core problem during boot hangs. These secondary hex words would be in this Additional Data URI. - Need to check for the secondary progress code(std::vector<uint8_t>) If it is empty, then do not generate the Additional Data URI. If it is not empty, then generate Additional Data URI for that particular post entry. - This commit is not alone for IBM, it is a generic code that should work on every system. As per the recent PDI change that went into Progress code structure https://github.com/openbmc/phosphor-dbus-interfaces/commit/9a96970ebb93eb1f495c200801343a4d1c53977c#diff-0aad0ef8ed32e2652256f50357eede1aedd6ff1398df1bb1a121ad9125916c5f 1. The primary code(uint64_t) is what we see in the BIOSPOSTCode Message registry. 2. The secondary code(array[byte]) is the entire raw buffer which could be used to offload the information out of BMC. This should not impact any systems that does not have a secondary code, as if the secondary code is empty -> we will not populate the AdditionalDataURI at all. Tested: - Ran Redfish validator which instructed to bump the odata.type from v1_4_0 to v1_8_0 and passed. - Verified the new AdditionalDataURI was correct for LogServices/PostCodes/Entries/<str>: $ curl -k https://127.0.0.1:2443/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1 { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "Description": "Collection of POST Code Log Entries", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1/attachment", ... ... } ], "Members@odata.count": 1, "Name": "BIOS POST Code Log Entries" } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I897888a08db94e22b5a8098bc2a874b00bfb5361
2021-06-16Remove ambiguous privileges constructorEd Tanous1-37/+37
There are a number of endpoints that assume that a given routes privileges are governed by a single set of privileges, instead of multiple sets ORed together. To handle this, there were two overloads of the privileges() method, one that took a vector of Privileges, and one that took an initializer_list of const char*. Unfortunately, this leads some code in AccountService to pick the wrong overload when it's called like this .privileges( {{"ConfigureUsers"}, {"ConfigureManager"}, {"ConfigureSelf"}}) This is supposed to be "User must have ConfigureUsers, or ConfigureManager, or ConfigureSelf". Currently, because it selects the wrong overload, it computes to "User must have ConfigureUsers AND ConfigureManager AND ConfigureSelf. The double braces are supposed to cause this to form a vector of Privileges, but it appears that the initializer list gets consumed, and the single invocation of initializer list is called. Interestingly, trying to put in a privileges overload of intializer_list<initializer_list<const char*>> causes the compilation to fail with an ambiguous call error, which is what I would've expected to see previously in this case, but alas, I'm only a novice when it comes to how the C++ standard works in these edge cases. This is likely due in part to the fact that they were templates of an unused template param (seemingly copied from the previous method) and SFINAE rules around templates. This commit functionally removes one of the privileges overloads, and adds a second set of braces to every privileges call that previously had a single set of braces. Previous code will not compile now, which is IMO a good thing. This likely popped up in the Node class removal, because the Node class explicitly constructs a vector of Privilege objects, ensuing it can hit the right overload Tested: Ran Redfish service validator Tested the specific use case outlined on discord with: Creating a new user with operator privilege: ``` redfishtool -S Always -u root -p 0penBmc -vvvvvvvvv -r 192.168.7.2 AccountService adduser foo mysuperPass1 Operator ``` Then attempting to list accounts: ``` curl -vvvv --insecure --user foo:mysuperPass1 https://192.168.7.2/redfish/v1/AccountService/Accounts/foo ``` Which succeeded and returned the account in question. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I83e62b70e97f56dc57d43b9081f333a02fe85495
2021-06-15log_services: Fix system dump entries routeCharles Boyer1-1/+1
With redfish-dump-log enabled, the bmcweb service would throw a runtime error and exit because the dump entries routes for Managers and Systems were the same. The Systems dump entries route should be '/redfish/v1/Systems/system/LogServices/Dump/Entries/' Tested: With redfish-dump-log enabled, - bmcweb service does not throw runtime error - Redfish Service Validator passes Signed-off-by: Charles Boyer <Charles.Boyer@fii-usa.com> Change-Id: I0ffd19bfc643cb8a3be3c5c2cd88c270ec974267
2021-06-09Corrects URI by removing /<str>John Edward Broadbent1-6/+4
A URI was accidentally changed, and this issue is corrected in the change. Change-Id: Icd840dd60bba2a2fd0010ce2cf88fac801b37cf7 Signed-off-by: John Edward Broadbent <jebr@google.com>
2021-06-03Remove Redfish Node classJohn Edward Broadbent1-1961/+1555
Reduces the total number of lines and will allow for easier testing of the redfish responses. A main purpose of the node class was to set app.routeDynamic(). However now app.routeDynamic can handle the complexity that was once in critical to node. The macro app.routeDynamic() provides a shorter cleaner interface to the unerlying app.routeDyanic call. The old pattern set permissions for 6 interfaces (get, head, patch, put, delete_, and post) even if only one interface is created. That pattern creates unneeded code that can be safely removed with no effect. Unit test for the responses would have to mock the node the class in order to fully test responses. see https://github.com/openbmc/bmcweb/issues/181 The following files still need node to be extracted. virtual_media.hpp account_service.hpp redfish_sessions.hpp ethernet.hpp The files above use a pattern that is not trivial to address. Often their responses call an async lambda capturing the inherited class. ie (https://github.com/openbmc/bmcweb/blob/ffed87b5ad1797ca966d030e7f979770 28d258fa/redfish-core/lib/account_service.hpp#L1393) At a later point I plan to remove node from the files above. Tested: I ran the docker unit test with the following command. WORKSPACE=$(pwd) UNIT_TEST_PKG=bmcweb ./openbmc-build-scripts/run-unit-test-docker.sh I ran the validator and this change did not create any issues. python3 RedfishServiceValidator.py -c config.ini Signed-off-by: John Edward Broadbent <jebr@google.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I147a0289c52cb4198345b1ad9bfe6fdddf57f3df
2021-05-21log_services: Fix BMC Journal Entries collection odata.idCharles Boyer1-4/+0
This commit removes odata.id assertions so the odata.id becomes Journal/Entries instead of BmcLog/Entries. Tested: - Redfish Service Validator passes - The response from `curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries` contained the correct odata.id, `{ "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries", "@odata.type": "#LogEntryCollection.LogEntryCollection", "Description": "Collection of BMC Journal Entries", ...` Signed-off-by: Mohaimen Alsamarai <mohaimen.alsamrai@fii-na.com> Signed-off-by: Charles Boyer <Charles.Boyer@fii-usa.com> Change-Id: Ie9cfa52b141d9f5d0fc12945fa3936bad871a413
2021-05-19Change AdditionalDataURI to be a child URIAbhishek Patel1-20/+16
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" openbmc/bmcweb#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>
2021-05-04Change the word TS to Time Stamp & add time unitManojkiran Eda1-2/+2
- The Message argument in the BIOSPOSTCode Message Entry uses short form wording for TS (Time Stamp) & without any time unit. - As the Message argument is directly displayed on OpenBMC GUI as it is, word "TS" would create customer confusion due to it not being a well known acronym. Also a field like this that captures a physical quantity(time) should have units. - Redfish clients should not be parsing the message argument, so changing this wording should not break them. - Also, this commit changes ":" to ";" in the Message argument to makes things look consistent. - As we changed the content of Message in the Message Entry, we had to bump up the minor version of the Message registry. Tested By: 1. Redfish Validator Passed. Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: I17924c2dfdcf34563f8f8cd325011e13cb70e476
2021-04-08Using AsyncResp everywherezhanghch051-143/+146
Get the core using AsyncResp everywhere, and not have each individual handler creating its own object.We can call app.handle() without fear of the response getting ended after the first tree is done populating. Don't use res.end() anymore. Tested: 1. Validator passed. Signed-off-by: zhanghaicheng <zhanghch05@inspur.com> Change-Id: I867367ce4a0caf8c4b3f4e07e06c11feed0782e8
2021-04-03log_services: Remove raw PECI commandJason M. Bills1-82/+0
The raw PECI command is recommended not to include in a standard build, so removing it from the bmcweb to avoid accidental inclusion. Tested: Confirmed that the raw PECI command is gone. Change-Id: I2b52e0ede089da6df6ca3ad304194de8af27b709 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2021-04-02log_services: Add download of log entriesAdriana Kobylak1-0/+128
Add a GET function for endpoint /redfish/v1/Systems/system/LogServices/EventLog/attachment/<str> which would read the File Path property of the specified entry, encode it as base64, and send it off. This allows the user to offload error logs for analysis and further parsing if needed. An http header of "Accept: application/octet-stream" or the default "*/*" is expected. Tested: - Ran Redfish validator. - Verified the contents of the offloaded file were the same as the file in the BMC, after decoding it with a base64 decoder. curl -k -H "X-Auth-Token: $token" \ https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/attachment/2 - Verified the supported Accept header values, ex: "Accept: application/octet-stream;q=1" "Accept: text/plain;q=0,application/octet-stream;q=1,multipart/form-data;q=2" - Verified an unsupported Accept header returned "Bad Request", ex: curl -k -H "X-Auth-Token: $token" -H "Accept: application/*" curl -k -H "X-Auth-Token: $token" -H "Accept: foo, not/supported" - Verified 404 was returned for a not found endpoint: $ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/attachment/foo { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type EventLogAttachment named foo was not found.", "MessageArgs": [ "EventLogAttachment", "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 EventLogAttachment named foo was not found." } } Change-Id: Id9e2308ebedc70852a2ed62def107648f7e6fb7a Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
2021-04-02log_services: Add AdditionalDataURI to log entriesAdriana Kobylak1-87/+126
The File Path property was added to the DBus Event Log Entries with https://github.com/openbmc/phosphor-logging/commit/1ff95efecaf24bf296b291ed85798b6e22189d0f The Path was added to indicate the path to the Entry file and that the file could be offloaded out of the BMC. Check if the Path property exists, and if so add an AdditionalDataURI field to the EventLog redfish output and populate it with string "LogServices/EventLog/attachment/id" in the same fashion as the dump URI entry. An implementation of GET on that path is done in a subsequent commit. The new Path property is located under the xyz.openbmc_project.Common.FilePath interface. The rest of the current properties are under the xyz.openbmc_project.Logging.Entry interface. In order to read the Path property for an individual entry (endpoint Entries/<str>/), need to remove the Entry interface from the GetAll call so that all properties from all interfaces are returned. In order to get the Path property when querying all entries (endpoint Entries/), need to query the properties under the Entry and FilePath interface, then build the json response for that entry. Tested: - Ran Redfish validator - Verified the new AdditionalDataURI was correct for both LogServices/EventLog/Entries and LogServices/EventLog/Entries/<str>: $ curl -k -H "X-Auth-Token: $token" \ https://${bmc}/redfish/v1/Systems/system/LogServices/EventLog/Entries/7 { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/7", "@odata.type": "#LogEntry.v1_8_0.LogEntry", "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/attachment/7", - Verified that AdditionalDataURI is not added if the Path property doesn't exist. Change-Id: Ib82361bae19a99e74d53f4ab5c4b446d277f0937 Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
2021-03-28Update Crashdump to the latest LogService and LogEntry schemasJason M. Bills1-95/+58
This updates Crashdump to the latest LogService schema which now has a "CollectDiagnosticData" Action that replaces the OEM actions. It also updates to the latest LogEntry to use the new "AdditionalDataURI" property to provide the Crashdump file URI. Tested: Confirmed that the Crashdump LogEntries are displayed and can be collected correctly. Confirmed that the schema changes pass the Redfish Service Validator. Change-Id: I34f533b78441269a66201a13e990dba18745c7ba Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2021-03-23log-services: Error return 500(internal error)George Liu1-2/+15
- If the server returns 500(internal error) to any of these requests, the security scanner logs it as an error for followup. - Sometimes, it is not a real 500(internal error), may be is a 404 (not found) error, and we think that the 404(not found) error is a benign error, and not actually a real security threat. - We should handle the 404(not found) error correctly and return it where appropriate. - Refer to: https://github.com/openbmc/bmcweb/blob/master/COMMON_ERRORS.md#11-not-responding-to-404 Tested: curl -k -X DELETE -v https://$bmc/redfish/v1/Systems/system/LogServices/Dump/Entries/198274391874 - Before: { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request failed due to an internal service error. The service is still operational.", "MessageArgs": [], "MessageId": "Base.1.8.1.InternalError", "MessageSeverity": "Critical", "Resolution": "Resubmit the request. If the problem persists, consider resetting the service." } ], "code": "Base.1.8.1.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } } - After: { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type systemDumpEntry named 198274391874 was not found.", "MessageArgs": [ "LogEntry", "198274391874" ], "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 systemDumpEntry named 198274391874 was not found." } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I84c14f0294cf84606c9850dc4bacbda16e8cfa8e
2021-03-19Change PostCode property signatureManojkiran Eda1-7/+13
- This commit would change the backend signature of the PostCode Raw Value property. - IBM progress codes are typically around 72 bytes including a primary code (typically 8 bytes) & a secondary code that contains hex words that would provide additional details on the core problem during boot hangs. - The intent behind this commit is to change the signature of the backend Post Code Raw Value Property as per the proposed PDI change. - This commit has various dependencies across mutiple repos like phosphor-host-postd, phosphor-post-code-manager, all the dependent commit can be found in gerrit with topic name : progress codes Tested By : 1. PATCHED a witherspoon system with the new PDI library with both changes(40927,40936). 2. PACTHED the new snoopd daemon, post code manager, bmcweb & pldm with the progress code support. 3. Trigger a progress code(ASCII Value : STANDBY) using the pldm tool as shown below: ./pldmtool raw --data 0x80 0x3F 0xC 0x0A 0x00 0x00 0x00 0x00 0x00 0x07 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x00 0x00 0x00 0x48 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x53 0x54 0x41 0x4e 0x44 0x42 0x59 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 0x20 4. Now check the Raw Property : busctl call xyz.openbmc_project.State.Boot.Raw /xyz/openbmc_project/state/boot/raw0 org.freedesktop.DBus.Properties Get ss xyz.openbmc_project.State.Boot.Raw Value v (tay) 6004496007600167200 72 2 0 0 1 0 0 0 72 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 83 84 65 78 68 66 89 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 5. Check the Redfish GET on Post Code Log Service Entry { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries", "@odata.type": "#LogEntryCollection.LogEntryCollection", "Description": "Collection of POST Code Log Entries", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1", "@odata.type": "#LogEntry.v1_4_0.LogEntry", "Created": "2021-02-27T08:38:31+00:00", "EntryType": "Event", "Id": "B1-1", "Message": "Boot Count: 1: TS Offset: 0.0000; POST Code: 0x5354414e44425920", "MessageArgs": [ "1", "0.0000", "0x5354414e44425920" ], "MessageId": "OpenBMC.0.1.BIOSPOSTCode", "Name": "POST Code Log Entry", "Severity": "OK" } ], "Members@odata.count": 1, "Members@odata.nextLink": "/redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=1000", "Name": "BIOS POST Code Log Entries" } The post code Field shows 0x5354414e44425920 in Hex(In Ascii it would be STANDBY) Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com> Change-Id: I960a9a4f35ac8d7af03e9547d1f609b6adda0caa
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>