summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2024-01-19Clean up tftp update to use URLEd Tanous3-51/+125
Similar to transforms we've done elsewhere, we shouldn't be parsing urls using std::string::find, regex, or anything else, as they don't handle URL % encoding properly. Change-Id: I48bb30c0c737c4df2ae73f40fc49c63bac5b658f Signed-off-by: Ed Tanous <edtanous@google.com>
2024-01-17Pass correct Argument Types to propertyValueIncorrect Error MessageGinu George3-11/+11
Changed the code to pass the parameters according to their types. Tested: Code Compiles properly and tested. Change-Id: Ie0e13d39cd892afda36dfabec871f0fe8d8498e4 Signed-off-by: Ginu George <ginugeorge@ami.com>
2024-01-16DBus REST: Fix array and dict handlingMikhail Zhvakin1-3/+3
The bmcweb DBus REST API cannot currently handle array or dictionary data types correctly. This commit is meant to fix that. Tested: get/set DBus attributes (consisting of array and/or dictionary) via bmcweb DBus REST API. Change-Id: I9694cb888375c90d7a8fb1a10e53bdb5c0bce3bb Signed-off-by: Mikhail Zhvakin <striker_1993@mail.ru>
2024-01-15redfish: Fix the property name to get EncryptionStatusKonda Reddy Kachana1-2/+2
Update the property name to get the EncryptionStatus correctly Tested: curl localhost/redfish/v1/.../emmc { "@odata.type": "#Drive.v1_7_0.Drive", "EncryptionStatus": "Unlocked", } Change-Id: Ie7b84caba1d2566c372805330353e708ec1b3c3d Signed-off-by: Konda Reddy Kachana <kkachana@google.com>
2024-01-09Fix spelling mistakesEd Tanous34-69/+83
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$") At some point in the future, we might want to get this enabled in CI. Change-Id: Iccb57b2adfd06a2e177e99db2923fe4e8e329118 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-01-09http_client: fix for broken connectionAbhilash Raju1-11/+37
http_client is not handling connection termination by server due to keep alive timeout. At present client is not aware of connection termination from server. So whenever next redfish is event ready to be sent, the client will try send/receives data over broken connection. After failed operation the client will try to restart the connection by closing the current connection. Problems: 1) Restart is not attempted on all failure paths. Eg: stream_truncated error was ignored, which usually happens when try to read from broken connection, due to which retry is never performed. 2) Ssl shutdown over broken connection often fails to call the shutdown callback 3) ssl session was reused for new connection attempt. Which is wrong Solution: This patch will try to reattempt the connection in all failure cases. It uses new socket object and new ssl session for the retries Tested by: Test normal event flow between redfish-event clients and the BMC Test failure event flow between redfish-event clients and the BMC Tested the bad path by keeping the setup idle for 3 hours on the above two setups. Verified the events flow after this idle time Change-Id: I3d725b9d77bea22e2e8860e01ee0dfc971789008 Signed-off-by: Abhilash Raju <abhilash.kollam@gmail.com> Signed-off-by: Ed Tanous <ed@tanous.net>
2023-12-25bmcweb: Add nullptr check for weakptrzhaogang.01081-0/+5
When we call a null weakptr, it will cause a crash. Add nullptr check for weakptr can avoid this situation. Tested: bmcweb.service did not experience core-dump. Change-Id: I4490d68c70ea5d43681f4fb18b3859afb01ed70a Signed-off-by: Zhao Gang <zhaogang.0108@bytedance.com>
2023-12-21Fix typo in collection.hppMyung Bae1-1/+1
Commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/64087 has a typo in redfish-core/include/utils/collection.hpp ``` L33: jsonCountKeyName /= back + "@data.count"; --> jsonCountKeyName /= back + "@odata.count"; ``` Tested: - Validator passes Change-Id: Ied52944bd43ec5080c4eef141813674bab1cc0b4 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-12-18Refactor PCIeDeviceList to use getCollectionMembersLakshmi Yadlapati4-48/+41
This commit refactors the code in the PCIeDeviceList function to use the getCollectionMembers function for retrieving collection members. Additionally, a new function getCollectionToKey() is added to handle the retrieval of collection members with custom key name. Tested: Validator passed ''' Test1: Redfish query of PCI devices on a system that does not have any PCIe devices curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices", "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection", "Description": "Collection of PCIe Devices", "Members": [], "Members@odata.count": 0, "Name": "PCIe Device Collection" } Test2: Redfish query of PCIe devices on a system that has PCIe devices curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices", "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection", "Description": "Collection of PCIe Devices", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/drive0" }, ....... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card2" }, ....... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card12" } ], "Members@odata.count": 22, "Name": "PCIe Device Collection" } Test3: Redfish query of system with PCIe devices curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem", "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } }, ...... "PCIeDevices": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/drive0" }, ....... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" }, .... ], "PCIeDevices@odata.count": 22, "PartNumber": "", .... "SubModel": "S0", "SystemType": "Physical" } ''' Change-Id: Icb38945a2c7bc5219ff3917fbbc8a9986c9c6155 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-12-12Use MonotonicTimeStamp for bmc log idMyung Bae3-17/+131
/redfish/v1/Managers/bmc/LogServices/Journal/Entries gives the system journal entries whose ID is based on the realtime timestmap. However, the system realtime may go backward if the system time is changed either manually or via NTP. If that happens, those entries may not found via redfish GET as `sd_journal_seek_realtime_usec()`[1] may not always work on the entries which are not sorted in time-order. This may cause the inconsistency between the content of `/redfish/v1/Managers/bmc/LogServices/Journal/Entries/` and /redfish/v1/Managers/bmc/LogServices/Journal/Entries/<bmc_journal_id>`. For example, ``` sudo journalctl --vacuum-time=1s <wait for a while to clear up journal> date -s "<backward-time>" date -s "<forward-time>" ``` Run redfish journal entries and get each entry id from the output ``` curl -k -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries > rj.out ``` Take some logEntry Id that its time going backward like ``` grep "@odata.id" rj.out ``` Run redfish query for each id, and some of them can't be successful. ``` % curl -k -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type LogEntry named '1701604800002075' was not found.", "MessageArgs": [ "LogEntry", "1701604800002075" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type LogEntry named '1701604800002075' was not found." } }% ``` This can also be verified by checking the failure of Redfish Validator run ``` python3 RedfishServiceValidator.py --auth Session -i https://${bmc} -u admin -p 0penBmc0 --payload Tree /redfish/v1/Managers/bmc/LogServices/Journal/Entries ``` For example, ``` ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075 returned HTTP error. Check URI. ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800065949 returned HTTP error. Check URI. ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701607680003048 returned HTTP error. Check URI. ``` ``` --Time goes backwrd { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2023-12-03T12:00:00+00:00", "EntryType": "Oem", "Id": "1701604800002075", "Message": "systemd-resolved: Clock change detected. Flushing caches.", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" }, ... { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701607680003048", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2023-12-03T12:48:00+00:00", "EntryType": "Oem", "Id": "1701607680003048", "Message": "systemd-resolved: Clock change detected. Flushing caches.", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" }, -- Time comes back to the previous moment ``` The solution is proposed to use <bootid> + <monototic timestamp> as the redfish journal entry id instead of realtime timestamp. Unlike realtime timestamp which may go backward, <monotonic timestamp> is monotonically increasing. Tested: - Redfish Validator passes - GET Journal Entry ID will be found even if its time goes backward. [1] https://github.com/openbmc/bmcweb/blob/7164bc62dd26ec92b01985aaae97ecc48276dea5/redfish-core/lib/log_services.hpp#L2690 Change-Id: I83bfb1ed88c9cf036f594757aa4a00d2709dd196 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-12-09mutual-tls: Add support for Meta certificatesMarco Kawajiri7-1/+155
Meta Inc's client certificates use an internal Subject CN format which AFAIK is specific to Meta and don't adhere to a known standard: Subject: CN = <type>:<entity>/<hostname> Commit adds the `mutual-tls-common-name-parsing=meta` option to, on Meta builds, parse the Subject CN field and map either the <entity> to a local user. The <type> field determines what kind of client identity the cert represents. Only type="user" is supported for now with <entity> being the unixname of a Meta employee. For example, the Subject CN string below maps to a local BMC user named "kawmarco": Subject CN = "user:kawmarco/dev123.facebook.com" Tested: Unit tests, built and tested on romulus using the script below: https://gist.github.com/kawmarco/87170a8250020023d913ed5f7ed5c01f Flags used in meta-ibm/meta-romulus/conf/layer.conf : ``` -Dbmcweb-logging='enabled' -Dmutual-tls-common-name-parsing='meta' ``` Change-Id: I35ee9b92d163ce56815a5bd9cce5296ba1a44eef Signed-off-by: Marco Kawajiri <kawajiri@meta.com>
2023-12-09Simplify mutual TLS checksEd Tanous2-116/+38
bmcweb should be using the openssl primitives for these checks. There are examples where we've known to have gotten the behavior incorrect, so given that OpenSSL clearly should know these things better than we do, use it. Tested: unit tests pass. Change-Id: I0bcd381a9e3c9a1e8e6dc39534e81fa698570689 Signed-off-by: Ed Tanous <ed@tanous.net>
2023-12-09Add mutual tls unit testEd Tanous3-3/+210
Mutual TLS paths were not tested. Add some unit tests. Because CI doesn't actually compile dependent libraries with ASAN enabled, and these tests call into openssl, we need to add a check for if we're compiling with asan enabled. Tested: unit tests pass. Change-Id: I02dcb69708619cc00fffd840738c608db3ae8bdf Signed-off-by: Ed Tanous <ed@tanous.net>
2023-12-08Reponse: Fix incomplete implementation in writeAbhilash Raju3-2/+97
Write function in http_response.hpp missing implementation for first write after changing from filebody. Usecase: Current resonse type is filebody. Developer tries to change the body type to stringbody by calling write function. Observed: The write fails to update the body type. Expected: Write should succeed and body should change to string body. Tested: Unit test has been added for crow::Response. Manual sanity test done for file offloads using curl. Change-Id: Icbf8585b5b04c3ac5120d7b334c13d89ed3eb4aa Signed-off-by: Abhilash Raju <abhilash.kollam@gmail.com>
2023-12-07meson: adjust nlohmann-json dependencyPatrick Williams1-7/+2
* Simplify the meson.build boiler-plate for meson. * Rename the wrap file for consistency with other repositories. * Adjust the meson required version to match the wrap file. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I2da418c10fbe0450944567d276b17f3196da0b55
2023-12-05Fix missing dateEd Tanous2-7/+21
At some point, the date got removed from http1 requests. HTTP2 does not show this issue, but this showed up in unit tests (which is why the prior commit is adding unit tests). The Date Header is useful for synchronizing things like Cache-Control-Policy, with the actual server time, instead of the local system time. Tested: Unit tests pass. Change-Id: I8f105f0cbb6c816c5ec6b14cbeae587d728a20d2 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-12-05Unit test ConnectionEd Tanous6-107/+180
Boost asio provides a test stream object that we can use to begin unit testing the connection object. This patchset uses it to re-enable some simple http1.1 tests. There's some features that have snuck into the connection class that aren't compatible with a stream (like ip address getting), so unfortunately we do need the connection class to be aware if it's in test mode, but that tradeoff seems worthwhile. Tested: Unit test pass. Change-Id: Id8b1f8866582b58502dbafe6139f841bf64b8ef3 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-11-29chassis: Tidy up lambda funcs in get chassisChau Ly1-294/+289
This commit tries to avoid the cumbersomeness of lambda functions used directly or indirectly by handleChassisGet method. Lengthy lambda functions are replaced by or involve normal functions. There's no functional change in this commit. Change-Id: I67e028cdab3ea4407dafde0a510b37a160497f48 Signed-off-by: Chau Ly <chaul@amperecomputing.com>
2023-11-29build: use allowed over enabledPatrick Williams2-13/+13
Meson feature options are typically in a tri-state of enabled, disabled, or auto. The enabled and disabled functions on an option (from `get_option`) no longer return true for auto features. Instead, the expectation is to use `allowed()` which is true for both enabled and auto. Switch all uses of `enabled` to `allowed`. Change-Id: Ia40b13fdce7af88085cf23a4a87d9be939edd1e3 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2023-11-20managers: use async_method_call() set PID propertiesPotin Lai1-5/+5
In sdbusplus::asio::setProperty(), the property value will be wrapped by std:variant automaticly, it will fail and show `Invalid argument [generic:22]` error if we pass the property value that has been wrapped by std::variant into sdbusplus::asio::setProperty(). Because the type of property.second is DbusVariantType, we cannot use sdbusplus::asio::setProperty() for property setting, so change it back to use async_method_call(). Tested on Bletchley: Success PATCH the properties of StepwiseControllers. ``` { "Oem": { "OpenBmc": { "Fan": { "StepwiseControllers": { "Test1": { "NegativeHysteresis": 7.0, "PositiveHysteresis": 8.0 } } } } } } ``` Signed-off-by: Potin Lai <potin.lai@quantatw.com> Change-Id: I92d9e0d6ffe97fa6ce2905e17497d4d0fffa1d58
2023-11-15ethernet: change MTU type to size_tAnthony1-2/+2
Modify the type to get this working on 64-bit system. In phosphor-dbus-interfaces, the type is `size`: https://github.com/openbmc/phosphor-dbus-interfaces/blob/8a2674b/yaml/xyz/openbmc_project/Network/EthernetInterface.interface.yaml#L26 phoshor-networkd has this correct and no other places use. https://github.com/openbmc/phosphor-networkd/blob/6f256bc591bec72dd1448522d941874b21145a81/src/ethernet_interface.hpp#L146 Tested: ``` Before: curl localhost/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 -s | grep MTU "MTUSize": 0, After: curl localhost/redfish/v1/Managers/bmc/EthernetInterfaces/eth0 -s | grep MTU "MTUSize": 1500, ``` Change-Id: If3506c6274d2083b61c5c27cc6d8e178495ccea0 Signed-off-by: Anthony <anthonyhkf@google.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-11-14Fix Dump and EventLog URIRavi Teja1-2/+2
This commit fixes the Dump and EventLog URI while registering BMCWEB_ROUTE Commit 168d1b1ac forgot to include the "/" at the end. Add that. Tested By: GET /redfish/v1/Managers/bmc/LogServices/Dump/Entries/id/attachment/ Change-Id: Ie8a4d8a1d5fa2b508499cc578efe531d06185c1a Signed-off-by: Ravi Teja <raviteja28031990@gmail.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-11-06Fix SNMP invalid Destination errorRavi Teja1-13/+25
This commit handles invalid SNMP destination error Tested by: Configure SNMP with invalid destination IP address '{"Destination": "snmp://10.6.6.256:162", "SubscriptionType": "SNMPTrap", "Protocol": "SNMPv2c"}' Change-Id: I88f81a79a6665a7adc654e138b4f07ce321898a4 Signed-off-by: Ravi Teja <raviteja28031990@gmail.com>
2023-11-06Make callback a template to avoid memory leakEd Tanous1-2/+4
Tested: Gunnar built this and below for a p10bmc, webui-vue looks reasonable and the Validator had no new errors. Did a few operations: delete a log, set an ntp server, etc. Change-Id: I587ccd04515164fce1ea0bf5baf9f820347c63e6 Signed-off-by: Ed Tanous <edtanous@google.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-11-06Don't warn on unused macrosEd Tanous1-0/+1
Change-Id: If12934606c3ef00025d05a9f0b8bd46000865c9a Signed-off-by: Ed Tanous <edtanous@google.com>
2023-11-06Remove use after free in error handling pathEd Tanous1-1/+2
Change-Id: I04476b016584f1d19af035ae51e0c04076b4de0b Signed-off-by: Ed Tanous <edtanous@google.com>
2023-11-06Break out retrieveUriToDbusMapEd Tanous1-14/+19
Change-Id: I7c01c9e455b077348ceb67e524158f997fb0c6cf Signed-off-by: Ed Tanous <edtanous@google.com>
2023-11-06Move date_h to pragma onceEd Tanous1-5/+1
Change-Id: I04864e8c47c8bb1763016b6ba1e5826450afdc72 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-11-02Rename getLocationIndicatorActive/setLocationIndicatorActiveGeorge Liu3-9/+9
This commit renames getLocationIndicatorActive/setLocationIndicatorActive No functional changes. Tested: built bmcweb successfully and Validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I0c5d538c1dd9f0d8dd1e6ae4d8ba4f606b804373 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-10-31Move to file_body in boostEd Tanous12-183/+286
As is, it reads the whole file into memory before sending it. While fairly fast for the user, this wastes ram, and makes bmcweb less useful on less capable systems. This patch enables using the boost::beast::http::file_body type, which has more efficient serialization semantics than using a std::string. To do this, it adds a openFile() handler to http::Response, which can be used to properly open a file. Once the file is opened, the existing string body is ignored, and the file payload is sent instead. openFile() also returns success or failure, to allow users to properly handle 404s and other errors. To prove that it works, I moved over every instance of direct use of the body() method over to using this, including the webasset handler. The webasset handler specifically should help with system load when doing an initial page load of the webui. Tested: Redfish service validator passes. Change-Id: Ic7ea9ffefdbc81eb985de7edc0fac114822994ad Signed-off-by: Ed Tanous <ed@tanous.net>
2023-10-27Refactor populateUserInfoJonathan Doman1-47/+21
- No need to set error code in asyncResp since caller already does that. Then we can remove the asyncResp param altogether. - Check if session is valid before unpacking properties to avoid unnecessary work. - Use std::optional instead of pointers for slighter cleaner code. - Enforce required properties for local users based on D-Bus interface documentation (UserGroups must be provided for local users). Change-Id: I770d3556a0d62182b6abd72bfa3f8d62e2a105d1 Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
2023-10-26Refactor getComputerSystemLakshmi Yadlapati1-215/+225
This commit refactors the getComputerSystem function into smaller functions. There is no functional change in this commit. Tested: Validator passed ''' curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem", "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } }, "Bios": { "@odata.id": "/redfish/v1/Systems/system/Bios" }, "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "BootSourceOverrideEnabled": "Disabled", "BootSourceOverrideMode": "UEFI", "BootSourceOverrideMode@Redfish.AllowableValues": [ "Legacy", "UEFI" ], "BootSourceOverrideTarget": "None", "BootSourceOverrideTarget@Redfish.AllowableValues": [ "None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb" ], "RemainingAutomaticRetryAttempts": 3, "StopBootOnFault": "Never", "TrustedModuleRequiredToBoot": "Required" }, "BootProgress": { "LastState": "None", "LastStateTime": "1970-01-01T00:00:00.000000+00:00" }, "Description": "Computer System", "FabricAdapters": { "@odata.id": "/redfish/v1/Systems/system/FabricAdapters" }, "GraphicalConsole": { "ConnectTypesSupported": [ "KVMIP" ], "MaxConcurrentSessions": 4, "ServiceEnabled": true }, "Id": "system", "IndicatorLED": "Off", "LastResetTime": "2023-09-29T13:27:47+00:00", "Links": { "Chassis": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "ManagedBy": [ { "@odata.id": "/redfish/v1/Managers/bmc" } ] }, "LocationIndicatorActive": false, "LogServices": { "@odata.id": "/redfish/v1/Systems/system/LogServices" }, "Memory": { "@odata.id": "/redfish/v1/Systems/system/Memory" }, "MemorySummary": { "TotalSystemMemoryGiB": 0.0 }, "Name": "system", "PCIeDevices": [], "PCIeDevices@odata.count": 0, "PowerRestorePolicy": "LastState", "PowerState": "Off", "ProcessorSummary": { "Count": 0 }, "Processors": { "@odata.id": "/redfish/v1/Systems/system/Processors" }, "SerialConsole": { "IPMI": { "ServiceEnabled": true }, "MaxConcurrentSessions": 15, "SSH": { "HotKeySequenceDisplay": "Press ~. to exit console", "Port": 2200, "ServiceEnabled": true } }, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Disabled" }, "Storage": { "@odata.id": "/redfish/v1/Systems/system/Storage" }, "SystemType": "Physical" } ''' Change-Id: I16a0c054dfff4ace0b43e156a64fd07b3244fbc1 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-10-24Fix boost build locallyEd Tanous1-7/+0
Change I1d00ef561fed7e3ba799969a112ee58b6578ce32 fixed local compilation of bmcweb, but it is causing failures when attempting to SRCREV bump. This should fix the issues during SRCREV bump while still allowing local builds to succeed. Tested (Carson): I was able to locally build bmcweb without having previously installed any boost libraries. All unit tests also passed. meson buildlocal && ninja -C buildlocal test Change-Id: I8cbb764dc564b84b4adb06ba80cb87b2a2c4701f Signed-off-by: Ed Tanous <edtanous@google.com> Signed-off-by: Carson Labrado <clabrado@google.com>
2023-10-24multipart-parser: eliminate temporary to emplace_backPatrick Williams1-2/+2
Fix the following clang-tidy warning: ``` ../include/multipart_parser.hpp:108:50: error: unnecessary temporary object created while calling emplace_back [modernize-use-emplace,-warnings-as-errors] 108 | mime_fields.emplace_back(FormPart{}); | ^~~~~~~~~~ ``` Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I362b4ad7f90f80a7746b79d643e3a7c5ff1db78c
2023-10-24utils: date: fix clang warningPatrick Williams1-4/+4
``` ../redfish-core/include/utils/extern/date.h:983:34: error: identifier '_d' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator] 983 | CONSTCD11 date::day operator "" _d(unsigned long long d) NOEXCEPT; | ~~~~~~~~~~~~^~ | operator""_d ../redfish-core/include/utils/extern/date.h:984:34: error: identifier '_y' preceded by whitespace in a literal operator declaration is deprecated [-Werror,-Wdeprecated-literal-operator] 984 | CONSTCD11 date::year operator "" _y(unsigned long long y) NOEXCEPT; | ~~~~~~~~~~~~^~ | operator""_y ``` Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I2304818ddc498441f9ed2ede54c92b7f7c48b7c1
2023-10-24clang-format: copy latest and re-formatPatrick Williams63-931/+930
clang-format-17 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository. Change-Id: I2f9540cf0d545a2da4d6289fc87b754f684bc9a7 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2023-10-23Update schemas to 2023.2Ed Tanous91-318/+3687
To quote from The Redfish release [1] 2022.3 Redfish Schema Bundle – This .zip file contains the current versions of all Redfish schemas. The bundle includes 40 schema updates and developer resources. Added Compute Express Link (CXL) support (NEW) Extensions to Fabric, PCIeDevice, Processor, Memory, ComputerSystem, and Chassis schemas Defined by DMTF alliance partner Compute Express Link (CXL) Consortium Extensions to Fabric, PCIeDevice, Processor, Memory, ComputerSystem, and Chassis schemas New CXLLogicalDevice schema Added MultiFactorAuth to AccountService to configure a service for multi-factor authentication HTTP Basic authentication is not available for accounts configured for multi-factor authentication For client certificate authentication, the client provides their identity certificate during TLS handshaking For RSA SecurID, Google Authenticator, and Microsoft Authenticator, clients provide a new Token property in the session creation request Added Heater and HeaterMetrics resources [1] https://www.dmtf.org/content/redfish-release-20223-now-available Change-Id: Iefe80866bfb83e65ab98b2cf4ee2eacce5238c5b Signed-off-by: Ed Tanous <ed@tanous.net>
2023-10-20LogService: Retrieve dump generated by ManagerCarson Labrado2-108/+207
Adds support for retrieving the dump file that's generated by phosphor-debug-collector as a result of using the LogServices/Dump Action LogService.CollectDiagnosticData from the bmc Manager resource. Refactors the handling for /redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment to use one of the new functions and remove the large lambda. Tested: I began the dump generation process by sending a POST request to /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData. That spawned a Task to track the dump being generated by phosphor-debug-collector. The dump was retrieved by querying the /redfish/v1/Managers/bmc/LogServices/Dump/Entries/<str>/attachment URI which is associated with the Task. Verified that an event log returned by querying /redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment is the same as it was before this change. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I352b2628a9990bbde40f22e6134f02c89189c925
2023-10-20multipart-parser: use emplace_backPatrick Williams1-2/+2
clang-17 will have a stronger 'modernize-use-emplace' check and fails with the following warning: ``` ../include/multipart_parser.hpp:308:33: error: use emplace_back instead of push_back [modernize-use-emplace,-warnings-as-errors] 308 | mime_fields.push_back({}); | ^~~~~~~~~~~~ | emplace_back( ``` The vector::emplace_back needed an extra hint, as it would not directly coerce an initializer-list into the vector's value_type, so we need to use the value_type constructor. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I74417e0ff5a6e0991bfbe4936b4814f6ee4c1269
2023-10-18Fix local compileCarson Labrado1-4/+34
The update to boost 1.83.0 was breaking for our build process if boost 1.83.0 was not already installed. Update our meson file to correctly pull in all of the required boost libraries. Tested: I was able to locally build bmcweb without having previously installed any boost libraries. All unit tests also passed. meson buildlocal && ninja -C buildlocal test Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I1d00ef561fed7e3ba799969a112ee58b6578ce32
2023-10-16Remove extra variables in websocketsEd Tanous3-32/+40
These variables don't need propagated to handlers. Any usage of them is incorrect. This makes Websocket once again a pure virtual class, which is desired. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Id1ecc3911fc502d436a3e6aa29024628fc51aff4
2023-10-11Fix update_schemas.py to add Oem JsonSchemasMyung Bae7-85/+70
GET on redfish/v1/JsonSchema does not show OEM schemas but shows only DMTF redfish schemas. It is because Oem schemas are not included into `schemas.hpp`. In addition, the explicit OEM JsonSchema gives the content of the file rather than the valid Json output. Tested: - Query JsonSchemas ``` curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas" curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas/<OemSchema>" e.g. curl -k -H "X-Auth-Token: $token" -X GET "https://$bmc/redfish/v1/JsonSchemas/OemManager" ``` - Redfish Service Validator passed Change-Id: I0fc9c3d4a48fb9c6ddec9591af12fd2c849331e3 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-10-05Update to boost 1.83.0Ed Tanous14-35/+30
In boost 1.83.0, the boost::url maintainers deprecated the header only usage of the library without warning. A discussion with the maintainers[1] made it clear that they removed the abiliy on purpose, and they're not going to add it back or add a deprecation strategy (they did say they would update the documentation to actually match the intent), and that from here on in we should be using the cmake boost project to pull in the non-header-only boost libraries we use (which at this point is ONLY boost url). This commit updates to remove the usage of boost::urls::result typedef, which was deprecated in this release (which causes a compile error) and moves it to boost::system::result. In addition, it updates our meson files to pull in the boost project as a cmake dependency. [1] https://cpplang.slack.com/archives/C01JR6C9C4U/p1696441238739129 Tested: Not yet. Change-Id: Ia7adfc0348588915440687c3ab83a1de3e6b845a Signed-off-by: Ed Tanous <edtanous@google.com>
2023-10-03Add trace when unknown user errorGunnar Mills1-0/+1
Have seen this internalError a few times. A trace would help debug why User Manager is returning an error. In line with https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#logging-levels. IBM has bmcweb-logging=error enabled. Tested: None. Visual only. Change-Id: I16f56c3170fb92dcfb52e57c9a420cefabc4c763 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-09-28Refactor getCollectionMembersLakshmi Yadlapati7-52/+59
This commit refactors the getCollectionMembers function into smaller functions. Additionally, the 'subtree' parameter is no longer a default parameter but is explicitly required in the function. All calls to getCollectionMembers have been updated to pass the 'subtree' parameter. Tested: Validator passed ''' curl -k https://$bmc/redfish/v1/Systems/system/Storage { "@odata.id": "/redfish/v1/Systems/system/Storage", "@odata.type": "#StorageCollection.StorageCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/1" } ], "Members@odata.count": 1, "Name": "Storage Collection" } curl -k https://$bmc/redfish/v1/Cables { "@odata.id": "/redfish/v1/Cables", "@odata.type": "#CableCollection.CableCollection", "Description": "Collection of Cable Entries", "Members": [ { "@odata.id": "/redfish/v1/Cables/dp0_cable0" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable1" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable2" }, { "@odata.id": "/redfish/v1/Cables/dp0_cable3" } ], "Members@odata.count": 4, "Name": "Cable Collection" } curl -k https://$bmc/redfish/v1/Chassis { "@odata.id": "/redfish/v1/Chassis", "@odata.type": "#ChassisCollection.ChassisCollection", "Members": [ { "@odata.id": "/redfish/v1/Chassis/chassis" } ], "Members@odata.count": 1, "Name": "Chassis Collection" } curl -k https://$bmc/redfish/v1/Systems/system/Memory { "@odata.id": "/redfish/v1/Systems/system/Memory", "@odata.type": "#MemoryCollection.MemoryCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm0" }, { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm1" }, ...... { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm31" } ], "Members@odata.count": 32, "Name": "Memory Module Collection" } ''' Change-Id: If5091431b548f371bff03b2897fd0aaf8b0ef203 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-09-25Fix http2 stream pointerEd Tanous2-40/+30
Response and Request are now movable, so lets use that to our advantage and make this no longer require a pointer. This removes a couple NOLINT exceptions in our code, and cleans up a lot of places where we could potentially get a nullptr. Tested: enabled http2-experimental option. Loaded service root from redfish in curl with logging enabled, logging verified http/2 was being used. Redfish service validator passes. Curl compiled with http returns service root correctly. Change-Id: I65e11a2311be982df594086413d52838235e1a0c Signed-off-by: Ed Tanous <ed@tanous.net>
2023-09-25Clean up vm CredentialPipeEd Tanous4-165/+118
This code is needlessly complicated for what it does. Even with the intent, which is secure buffer cleanup, it's trivial to encase all this into a single class that accepts the strings by rvalue reference, then cleans them up afterward. Doing this also cleans up a potential lifetime problem, where if the unix socket returned immediately, it would've invalidated the buffers that were being sent. It also moves to async_write, instead of async_write_some. The former could in theory fail if the socket blocks (unlikely in this scenario) but it's good to handle anyway. Tested: Need some help here. There's no backend for this, so we might just have to rely on inspection. Change-Id: I9032d458f8eb7a0689bee575aae611641bacee26 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-09-25Adjust #LogService schema version to same for all routesJanet Adkins1-4/+4
Both the #LogService.v1_1_0.LogService and #LogService.v1_2_0.LogService schemas were being used. Follow what OpenBMC has done in the past and use the same version across all resources of that type. I've moved them all to use #LogService.v1_2_0.LogService. The original addition of #LogService.v1_2_0.LogService was here: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/36638 Tested: Ran Redfish Validator with and without the change. No new failures seen. No failures in the #LogService routes. Change-Id: Ie9eaeca32d190d627b439e511e25dfeee4b7e4eb Signed-off-by: Janet Adkins <janeta@us.ibm.com>
2023-09-21Fix unessesary URL readEd Tanous1-7/+2
This call was neccesary back when we were doing moves of a url_view, but because this constructor doesn't use a url_view anymore, this isn't neccesary. Functionally, this clears up a strange unit test failure that occured in some cases where this consturctor is used. This constructor is not used for anything but unit tests. Tested: Unit tests pass. Change-Id: I034a69d3a6b6aeada2460bb39f3518846b39f817 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-09-21Generate OpenBMC registryEd Tanous4-1865/+3823
We haven't been very good about maintaining this file, so lets generate it like we do everything else. This commit takes the existing, manually built openbmc_message_registry.hpp and copies the generated json from a working system, then hooks it into the parse_registries script to generate the hpp file. This results in a couple changes, and somewhat proves how bad our ability to manage this file manually is.. Tested: Looking for input on if this is the right direction. Change-Id: I5dc03021d194f0674e4a8f41421096b211462a0a Signed-off-by: Ed Tanous <edtanous@google.com>