summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-05-02Aggregation: Process subordinate top collectionsCarson Labrado2-15/+320
Adds a function to process responses from URIs that are uptree from a top level collection. A follow-up patch will hook this into the aggregation code to allow adding links to top level collections which are only supported by satellite BMCs. Adds test cases to validate this function is working correctly. Tested: New test cases pass Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I7f0fd6c3955398e2fde136c1d3b37a6bf4bf06b9
2023-05-01Fix PCIeDevice redfish validator failureLakshmi Yadlapati1-1/+1
Specify correct interface for getSubTreePaths in getPCIeDeviceList. This commit addresses a Redfish validator failure that occurred after a previous commit. ''' https://github.com/openbmc/bmcweb/commit/94c3a10b94c3ce063d6c1aed3a597f0d524594d5 ''' Both the inventory path and interface were incorrect, and the inventory path was fixed in the previous commit. This commit fixes the interface in the getSubTreePaths function to ensure that it returns the correct PCIeDevice list. Without the correct interface, the function was returning incorrect devices, which was causing the Redfish validator failure. Tested: Validator passed for PCIeDevice Change-Id: Iab6a26ee0dd933be6cf371bdd13e5d10d6d10efa Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Cleanup pcie codeLakshmi Yadlapati1-12/+6
Remove unused variable pcieService, fix pciePath and use global variables pciePath and pcieDeviceInterface. Tested: tested PCIeDeviceCollection and PCIeDevice, and tested the changes with the peci-pcie commit https://gerrit.openbmc.org/c/openbmc/peci-pcie/+/62100 Change-Id: Iff8aee3f8bc43740b1885a2da584b0e6cf579dcc Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Add Asset information for PCIeDeviceSunnySrivastava19842-0/+70
This commit publishes inventory properties like SparePartNumber, Model, PartNumber, SerialNumber, Manufacturer for PCIe devices. Tested: Validator passed ``` "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card10", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "pcie_card10", "Manufacturer": "", "Model": "6B87", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card10/PCIeFunctions" }, "PCIeInterface": { "LanesInUse": 16, "PCIeType": "Gen4" }, "PartNumber": "03FL204", "SerialNumber": "YA31UF07200Z", "SparePartNumber": "03FL205" ``` Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: I850fe5eb2b3b3b9d47f4256ce0c4408bb1dd2bd1 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Refactor SystemPCIeFunction methodLakshmi Yadlapati1-104/+121
Move SystemPCIeFunction to a separate method, and refactor the code. Validate the PCIe device path and add link header. Tested: Validator passed ``` { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7/PCIeFunctions/0", "@odata.type": "#PCIeFunction.v1_2_3.PCIeFunction", "ClassCode": "0x020000", "DeviceId": "0x1657", "FunctionId": 0, "Id": "0", "Links": { "PCIeDevice": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7" } }, "Name": "PCIe Function", "RevisionId": "0x01", "SubsystemId": "0x0420", "SubsystemVendorId": "0x1014", "VendorId": "0x14e4" } ``` Change-Id: I99add03210983a255a615512b6137d04982f83a5 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Refactor SystemPCIeFunctionCollection methodLakshmi Yadlapati1-80/+81
Move SystemPCIeFunctionCollection to a separate method, and refactor the code. Validate the PCIe device path and add link header. Tested: Validator passed ``` { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7/PCIeFunctions", "@odata.type": "#PCIeFunctionCollection.PCIeFunctionCollection", "Description": "Collection of PCIe Functions for PCIe Device pcie_card7", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7/PCIeFunctions/0" } ], "Name": "PCIe Function Collection", "PCIeFunctions@odata.count": 1 } ``` Change-Id: I5aa10ce0b4d2f20104612f840cf4098698a83470 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Refactor SystemPCIeDevice methodLakshmi Yadlapati1-95/+177
Move SystemPCIeDevice to a separate method, and refactor the code. Validate the PCIe device path. Tested: Validator passed ```# curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices/pcie_card7 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "pcie_card7", "Name": "PCIe Device", "PCIeInterface": { "LanesInUse": 4, "PCIeType": "Gen1" } } ``` Change-Id: Ib9bd3ff37293b64adbf9987c3d932882befd21d4 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Moving to correct PCIe Device interfaceLakshmi Yadlapati1-1/+1
Move PCIe device interface to "xyz.openbmc_project.Inventory.Item.PCIeDevice". peci-pcie commit: https://gerrit.openbmc.org/c/openbmc/peci-pcie/+/62100 Tested: Validator passed Change-Id: Ica6f4ca37bf9adca18bedc69422ff05f0c7d73f2 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Removed myself from OWNERS fileKrzysztof Grobelny1-15/+0
Reason: I will be leaving OpenBmc project soon. Change-Id: I726eaafe38a15636fd855b591bb73b5c62108a5a Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
2023-04-27Remove nameStr from routerEd Tanous1-26/+2
It isn't used anywhere in the code, so it can be removed, and the router simplified. These common data structures have caused problems, in that they're not copied to child handlers, and cause bugs like #249. Tested: Redfish service validator passes. Basic sanity tests of both static file routes such as $metadata (which use DynamicRule) as well as method routes, such as /redfish/v1, return valid data. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I93ad74581912e18ee5db9aaa9ecdaf08ed765418
2023-04-27Remove number support from the routerEd Tanous5-507/+76
The router historically came from crow. Crow supported wildcards of <int>, <float>, and <double>. bmcweb doesn't use them, nor should it in basically any case, as we now have explicit 404 handling. This commit removes them. This amounts to about -450 lines of code, but it's some of the scarier code we have, some of it existing in the namespace "black_magic". Reducing the brain debt for people working in this subsystem seems worthwhile. There is no case in the future where we would use integer based url parameters. Tested: Redfish service validator passes. Should be good enough coverage for a code removal. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I34add8df7d3486952474ca7ec3dc6be990c50ed0
2023-04-25http_connection: Allow empty json objectsLei YU1-1/+1
Currently http_connection will produce empty body in the response if the res.jsonValue is empty, including empty array, object. This makes the output confusing in case a response does contain an empty object or array. Change the code to print the json object even if it's empty object or array, so that the output is consistent with the `res.jsonValue`. Tested: With an OEM URL that returns empty array depending on the system config, the response becomes `[]` instead of empty. Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: Ie97378a2cffce7b1fd6586a56b6cfa7d5c476dc1
2023-04-25dbus_utility: Support new ObjectMapper methodsWilly Tu1-0/+36
The new ObjectMapper methods are added as part of https://gerrit.openbmc.org/c/openbmc/phosphor-objmgr/+/57822 - GetAssociatedSubTree - GetAssociatedSubTreePaths The two methods are meant to be used to replace places where two dbus calls are used to get subtree and then get associated objects. Change-Id: I80a7ea935700a1ac5aebe6271f242aa103cc3d59 Signed-off-by: Willy Tu <wltu@google.com>
2023-04-25Fix regression in virtual mediaBoleslaw Ogonczyk Makowski1-1/+2
VmMode::Proxy was being checked incorrectly in [1] instead of VmMode::Legacy which didn't allow mounting in legacy mode. Removing return in [2] caused the code to display an error while unmounting even when unmounted successfully. Tested: Can mount in legacy mode Unmounting successfully in legacy mode doesn't display an error [1]: https://github.com/openbmc/bmcweb/commit/365a73f4725a6cefa3d69168ae5500fd05ff8866#diff-3d181e155cfa7f397eface92af17130f3db87773ce4219d9c7e24e00b76b94acR865 [2]: https://github.com/openbmc/bmcweb/commit/365a73f4725a6cefa3d69168ae5500fd05ff8866#diff-3d181e155cfa7f397eface92af17130f3db87773ce4219d9c7e24e00b76b94acL956 Change-Id: I522369cfd81ca084c7379ff97371f8a292950849 Signed-off-by: Boleslaw Ogonczyk Makowski <boleslawx.ogonczyk-makowski@intel.com>
2023-04-19log_services: Fix isContentTypeAllowed checksMatt Spinler1-2/+2
The commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/56694 inadvertently changed the polarity on the if checks using the newly introduced isContentTypeAllowed function which caused 'Bad Request' to be returned when the content type was allowed. Tested: Getting the EventLog and PostCodes attachment would return the data instead of 'Bad Request'. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Iafcdeaba1a0723326347bb2a832b53bbf0aab230
2023-04-18Copy privilegeset into websocket ruleEd Tanous1-0/+1
Resolves #249 Tested: Running websockets now shows rules being applied ``` Apr 10 20:26:35 p10bmc bmcweb[745]: (2023-04-10 20:26:35) [INFO "http_connection.hpp":209] Request: 0x11e3248 HTTP/1.1 GET /console0 ::ffff:X.XX.XX.XXX | Apr 10 20:26:35 p10bmc bmcweb[745]: (2023-04-10 20:26:35) [DEBUG "routing.hpp":1460] Matched rule (upgrade) '/console0' 1 / 2 Apr 10 20:26:36 p10bmc bmcweb[745]: (2023-04-10 20:26:36) [DEBUG "routing.hpp":1299] userName = admin userRole = priv-admin Apr 10 20:26:36 p10bmc bmcweb[745]: (2023-04-10 20:26:36) [DEBUG "routing.hpp":101] checkPrivileges: Active BASE priv: ConfigureManager <<<<<< Apr 10 20:26:36 p10bmc bmcweb[745]: (2023-04-10 20:26:36) [DEBUG "routing.hpp":101] checkPrivileges: Active BASE priv: ConfigureComponents <<<<<< Apr 10 20:26:36 p10bmc bmcweb[745]: (2023-04-10 20:26:36) [ERROR "routing.hpp":1361] isUserPrivileged: URL: /console0 IsPrivelegeSetEmpty: 0 Username: admin ``` Signed-off-by: Ed Tanous <edtanous@google.com> Tested-by: Ninad Palsule <ninadpalsule@us.ibm.com> Change-Id: Ia2eae1847822b50a425afd2e5e13b528393aa7ad
2023-04-17Fix clang-tidy issue in aggregationEd Tanous1-2/+2
clang-tidy flags the following error, which is correct. ``` ../redfish-core/include/query.hpp:145:26: error: static member accessed through instance [readability-static-accessed-through-instance,-warnings-as-errors] needToCallHandlers = RedfishAggregator::getInstance().beginAggregation( ``` Tested (Carson): Verified that queries to top level collections as well as aggregated resources still return as expected. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I440fb29d2e0b3da52bfd564676d33b72f69f2fbc Signed-off-by: Carson Labrado <clabrado@google.com>
2023-04-12meson: remove deprecated get_pkgconfig_variablePatrick Williams1-1/+1
Since meson 0.56, the `get_pkgconfig_variable` has been deprecated. In meson 0.58 the `get_variable` was enhanced to no longer require the `pkgconfig` keyword argument. Ensure meson 0.58 is required and update the usage of all `get_pkgconfig_variable` and `get_variable` to be the modern variant. Change-Id: I61193ae9fb34cec80af60acef68ff643c392e29d Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2023-04-11Fix PowerSubsystem/PowerSupplies causing validator to failGeorge Liu1-0/+2
In the following commit[1], the member of Members was removed by mistake, causing the validator to fail. This commit fixes this problem. Redfish validator failing with the following: ERROR - Members: Mandatory prop does not exist 1 failMandatoryExist errors in /redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies 1 failMandatoryExist errors in /redfish/v1/Chassis/motherboard/PowerSubsystem/PowerSupplies [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57668/26..29//COMMIT_MSG#b15 Tested: Validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I814e07d860422c5dce0fbb6267cb58dc07a74c31
2023-04-11Implements PowerSupplies schemaGeorge Liu4-0/+134
This commit implements the Redfish PowerSupplyCollection at /redfish/v1/Chassis/<chassis Id>/PowerSubsystem/PowerSupplies. It shall contain an array of links to resources of type PowerSupply that represent the power supplies that provide power to this chassis. For the association between power supply and chassis, refer to[1]. Also, the members property is implemented in the next commit with the PowerSupply implementation, this is so the validator will pass. [1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/57428 Tested: Validator passes 1. curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies" "@odata.type": "#PowerSupplyCollection.PowerSupplyCollection", "Description": "The collection of PowerSupply resource instances chassis", "Members": [ ], "Members@odata.count": 0, "Name": "Power Supply Collection" } 2. Bad chassisId curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassisError/PowerSubsystem/ PowerSupplies { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisError' was not found.", "MessageArgs": [ "Chassis", "chassisError" ], "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 Chassis named 'chassisError' was not found." } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I48e087d6fb52013e3a96b44391cc4d86049ac176
2023-04-07Aggregation: Check for subordinate collectionCarson Labrado2-0/+234
Adds a search function which is able to determine if a passed URI is a top level collection, is uptree from a top level collection, or both. The type being searched for depends on a second argument passed to the function. Each of these searches are used to add links to top level collections which are only supported by a satellite BMC. They all use similar steps so rolling them into a single function cuts down on redundant code. Adds test cases to verify the implementation is correct. Tested: New test cases pass Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I72ae7442d5f314656b57a73aee544bca516fa7c2
2023-04-06Fix websocket csrf checkingGunnar Mills2-4/+2
https://github.com/openbmc/bmcweb/commit/f8aa3d2704d3897eb724dab9ac596af8b1f0e33e (4/15/20) added CSRF check into websockets but later setting cookieAuth to true was removed so this session->cookieAuth is always false. https://github.com/openbmc/bmcweb/commit/3909dc82a003893812f598434d6c4558107afa28 (7/15/20). 2 choices here add back this cookieAuth=true when cookie auth is used or remove this "if cookieAuth" and do this check anytime BMCWEB_INSECURE_DISABLE_CSRF_PREVENTION isn't enabled. Really we shouldn't support any other auth on websockets so maybe if (!session->cookieAuth){ unauthorized; } if go with the first choice. Went with the 2nd choice because cleaner. This checking is a bit weird because it uses protocol for csrf checking. https://github.com/openbmc/webui-vue/blob/b63e9d9a70dabc4c9a7038f7727fca6bd17d940a/src/views/Operations/SerialOverLan/SerialOverLanConsole.vue#L98 Tested: Before could log in to webui-vue, delete the XSRF-TOKEN but still connect to the host console. After if deleted the XSRF-TOKEN (browser dev tools), the websocket does not connect. Don't have a system with KVM, VM enabled so wasn't able to check those but the webui-vue code for them looks to pass the token. The webui-vue host console works the same as before if you aren't messing with the XSRF-TOKEN. Change-Id: Ibd5910587648f68809c7fd518bcf5a0bcf8cf329 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-04-05Revisit OEM schemasEd Tanous1-57/+85
This documentation was written a while ago, and needs some updates in its statements, as well as updates that have happened to the Redfish spec in the meantime. There's lots of wording here that implies a level of control for maintainers, when really, it's about the ecosystem as a whole. Overall goals in the rewording: - Added emphasis on the Redfish specification rules, not maintainers. - Addition of the OpenBMC namespace (now called out int he specification) and guides to reuse. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iffb88f8c466743fe0badb61d5d5bebfa6741b876
2023-04-04Add HotPluggable support in RedfishLogananth Sundararaj2-17/+42
HotPluggable is an indication of whether this component can be inserted or removed while the equipment is in operation. HotPluggable is a property can read from the Entity manager under the xyz.openbmc_project.Inventory.Decorator.Replaceable interface. Tested: Tested and verified in YosemiteV2 platform and Redfish validator has passed. Change-Id: I7b2203b1843fa3cbdbef7803b598d113346c0682 Signed-off-by: Logananth Sundararaj <logananth_s@hcl.com>
2023-03-29Fix If Match header in Http layerHieu Huynh1-0/+6
Commit [1] prevents the clients performing methods if missing ETag from the If-Match header. For the "If-Match: *" [2] that representing any resource, it should be the valid command. [1] https://github.com/openbmc/bmcweb/commit/2d6cb56b6b47c3fbb0d234ade5c1208edb69ef1f [2] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match Tested: Can performing methods GET/POST/PATCH/DELETE with "If-Match: *" header. Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com> Change-Id: I2e5a81ed33336a939b01bd6b64d3ff99501341d0
2023-03-28Support for configurable host reboot countCorey Hardesty1-29/+107
ComputerSystem.v1.11 introduced a new property, AutomaticRetryAttempts, which allows for the amount of automatic retry attempts on host boot failures to be configured through Redfish. This commit adds support for this new property. The added function "setAutomaticRetryAttempts()" allows users to set the "RetryAttempts" property externally through bmcweb. This property is documented in D-Bus and has a default value of 3. All implementations of the interface have this property implemented. The new code preserves backward compatibility and does not break any existing user-facing behavior. Tested: - Ensured that the new "AutomaticRetryAttempts" property could be retrieved through bmcweb. Verified that it was accurately representing its corresponding DBus property, "RetryAttempts". - Sent curl commands to patch the "AutomaticRetryAttempts" property which also updates the "AttemptsLeft" DBus property represented as "RemainingAutomaticRetryAttempts" as expected. - Verified that changes made to "RetryAttempts" through DBus were accurately represented in successive "Gets" from bmcweb. - Passed Redfish Validator curl -k -H "X-AUTH" -X GET https://${BMC_IP}/redfish/v1/Systems/system/ "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "RemainingAutomaticRetryAttempts": 3, "StopBootOnFault": "Never", "TrustedModuleRequiredToBoot": "Disabled" }, curl -k -X PATCH https://${BMC_IP}/redfish/v1/Systems/system/ -d '{"Boot": {"AutomaticRetryAttempts":4}}' "Boot": { "AutomaticRetryAttempts": 4, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "RemainingAutomaticRetryAttempts": 4, "StopBootOnFault": "Never", "TrustedModuleRequiredToBoot": "Disabled" }, Signed-off-by: Corey Hardesty <corey.hardesty@icloud.com> Change-Id: I034782847a2318e2604bdd0cf33cdf705d224acb Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-03-28Aggregation: Prefix fix HttpHeaders propertyCarson Labrado2-0/+73
The "HttpHeaders" property in a response is an array of HTTP headers. We perform prefix fixing on the "Location" header from responses so we should also fix any "Location" headers which are contained by "HttpHeaders" in an aggregated response. This requires special handling since each header is represented as a single string in the response. Added testcase for HttpHeaders property Tested: All unit tests pass Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I3040c4ea52b2bebcb6e206bb50585c6a75538f0a
2023-03-24UpdateService: Support for MultipartHttpPushUriGeorge Liu1-47/+167
Since a service support the MultipartHttpPushUri property within the UpdateService resource, so add a new MultipartHttpPushUri property, This property shall contain a URI used to perform a Redfish Specification-defined Multipart HTTP or HTTPS POST of a software image for the purpose of installing software contained within the image, and use the requirements of a multipart/form-data to request body for HTTP push software update. Tested: curl -k -H "X-Auth-Token: $token" -H "Content-Type: multipart/form-data" -F 'UpdateParameters={"Targets":["/redfish/v1/Managers/bmc"], "@Redfish.OperationApplyTime":"Immediate"};type=application/json' -F 'UpdateFile=@obmc-phosphor-image.static.mtd.tar;type=application/ octet-stream' https://${bmc}/redfish/v1/UpdateService/update { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } Passed the validator: Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ie1ea0594337efdb073270aba6918389c4381a2b3
2023-03-23Refactor getAssociationEndPoints methodGeorge Liu5-62/+35
Since the getAssociationEndPoints method has been implemented in dbus_utility and this commit is to integrate all the places where the endpoints attribute is obtained, and use the method in dbus_utility uniformly. Tested: 1. Redfish Validator Passed 2. For all the endpoints we changed, we got the same result as before Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I91a5e80de5bc3b5712c2d5b81f2f8b982d1c884e
2023-03-23nbd proxy and websocket cleanupsEd Tanous4-137/+253
As-written, the nbd (and all websocket daemons) suffer from a problem where there is no way to apply socket backpressure, so in certain conditions, it's trivial to run the BMC out of memory on a given message. This is a problem. This commit implements the idea of an incremental callback handler, that accepts a callback function to be run when the processing of the message is complete. This allows applying backpressure on the socket, which in turn, should provide pressure back to the client, and prevent buffering crashes on slow connections, or connections with high latency. Tested: NBD proxy not upstream, no way to test. No changes made to normal websocket flow. Signed-off-by: Michal Orzel <michalx.orzel@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3f116cc91eeadc949579deacbeb2d9f5e0f4fa53
2023-03-23Break out another lambdaEd Tanous1-60/+66
Tested: No way to test. Non-upstream backend, inspection only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib2593b66407e0f102f543777ecf907b434acac52
2023-03-23Remove authorization checks in nbd_proxyEd Tanous2-134/+59
nbd proxy should not have its own authorization checks, as these are now handled in the core as of 7e9093e625961f533250a6c193c1a474e98007c4 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8874d8a09278ba21d2acfdf076cb76dee718ecf4
2023-03-22systems: Fix missing EnterDwellTime propertyChris Cain1-3/+3
Prior commit missed adding a required property to a rewrite using sdbusplus::unpackProperties() Fixes a regression introduced in commit bc1d29de81216e99d0a73c5fd3b6bb7fd2194ba8 Validator passed: IdlePowerSaver [JSON Object] ComputerSystem.v1_16_0.IdlePowerSaver Yes complex IdlePowerSaver.Enabled False boolean Yes PASS IdlePowerSaver.EnterUtilizationPercent 8 number Yes PASS IdlePowerSaver.EnterDwellTimeSeconds 240 number Yes PASS IdlePowerSaver.ExitUtilizationPercent 12 number Yes PASS IdlePowerSaver.ExitDwellTimeSeconds 10 number Yes PASS Change-Id: I345c714b71d50d6c8c03120c54bdabe0bd5d0714 Signed-off-by: Chris Cain <cjcain@us.ibm.com>
2023-03-22Fix Request use-after-moveJonathan Doman1-11/+10
Partial revert of 915d2d4e59be56958b04a79ba96e0242ef735f44 Request object was being moved out of the owning Connection object, which would then try to use the Request again in completeRequest(). Just pass around a reference instead of taking ownership. The obvious symptom was that Redfish pages were served as json in the browser instead of HTML, because the headers in the Request were no longer valid after being moved. Tested: /redfish/v1 is served as HTML in the browser again. Change-Id: Iae68a68817146c28377bbcade04716725e4a6096 Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
2023-03-22LogService: Fix potential null pointer dereferenceCarson Labrado1-6/+9
Querying CollectDiagnosticData Action results in a crash if there is not an active user session. Fixes the null pointer dereferencing introduced by https://gerrit.openbmc.org/c/openbmc/bmcweb/+/58688. Tested: Queried the Action URI and received a response instead of bmcweb crashing curl -X POST -H 'Content-Type: application/json' \ localhost/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData/ \ -d '{"DiagnosticDataType": "Manager"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ic46ece84598613e4bbe51f4188a623ba857c18a0
2023-03-21Add component integrity schemasEd Tanous7-0/+2099
Update the schema pack to include ComponentIntegrity resources. ComponentIntegrity is used for representing roots of trust, and conveying attestation parameters forward. Tested: Automated change Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1c62ddeeb9151bfe2852199a9ebb12a6636e6262
2023-03-21IPv6: Remove AddressState from redfish response.Sunitha Harish1-1/+1
Network backend does not return the AddressState and its currently displayed as null. This is misleading the user. This commit removes this property until backend supports. Tested by: Verify ethernet interface does not return AddressState for IPv6 Change-Id: I5489f57ce3d50d1480033f27adf1bc95153fdd18 Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
2023-03-20Aggregation: Increase response read limit to 50MBCarson Labrado5-193/+103
With Redfish aggregation, responses from satellite BMCs can be on the order of MBs due to use cases like logging or binary payloads. Offloading $expand could similar result in responses that exceed the current read limit of 128 KB. Splits the connection pools used for aggregation and EventService so that the response read limit is 50MB for responses associated with aggregation. Pools used by EventService keep the current limit of 2^17 bytes or 128 KB. It also propogates a ConnectionPolicy object that gets instantiated within HttpClient, which allows per-client policies for retry/byte limits. This allows EventService and aggregation to have different policies. Tested: With aggregation enabled I was able to return a response from a satellite BMC which was than 2MB. Ran the Redfish Mockup Creator and it was able to successfully query all aggregated resources as part of walking the tree. Also verified that HTTP push events still work with EventListener. Change-Id: I91de6f82aadf8ad6f7bc3f58dfa0d14c0759dd47 Signed-off-by: Carson Labrado <clabrado@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-03-18Implement AggregationSourceCarson Labrado9-53/+1342
Adds an AggregationSource resource for each satellite config present on dbus. Adds the AggregationSource schema which we had previously ignored. Tested: Querying an AggregationSource returned the expected information. curl localhost/redfish/v1/AggregationService/AggregationSources/5B247A { "@odata.id": "/redfish/v1/AggregationService/AggregationSources/5B247A", "@odata.type": "#AggregationSource.v1_3_1.AggregationSource", "HostName": "http://122.111.11.1:80", "Id": "5B247A", "Name": "Aggregation source", "Password": null, } Service Validator passed. The Service Validator also passed after removing the satellite config from the system such that /redfish/v1/AggregationService/AggregationSources returns an empty Members array. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I88b5fbc15f27cddd330ec22a25427fd8b18cf766
2023-03-17Fix cannot get NTPServersJian Zhang1-2/+5
When we have 2 or more netdevs, if eth0 configured the StaticNTPServers and eth1 not by default, the NTPServers will be empty. We could merge all the NTPServers from all the interfaces, and remove the duplicate ones(Already have). Limitations(not this patch): When setting the NTPServers, will set all the interfaces, cannot be set individually. Tested: Only config the eth0's NTPServers, keep eth1's NTPServers empty. ``` ~# curl -k -H "X-Auth-Token: $token" https://$bmc/redfish/v1/Managers/bmc/NetworkProtocol { ... "NTP": { "NTPServers": [ "fdbd:dc00::10:8:8:14", "fdbd:dc00::10:8:8:15", "fdbd:dc00::10:8:8:16", "10.8.8.14", "10.8.8.15", "10.8.8.16" ], "ProtocolEnabled": true }, } ``` Change-Id: Ie181bb117577bc46f87e714b87dcb7cd8f5145a8 Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
2023-03-17dbus_rest: Fix dangling reference of crow::ResponseLei YU1-19/+20
The openbmc_dbus_reset was holding reference of `crow::Response`, set the response in `~InProgressActionData()`, and call res.end() to complete the result of the response. The bmcweb code now uses `std::shared_ptr<AsyncResp>` for the response and the `res.end()` is handled in `~AsyncResp()`. By using the reference of `crow::Response`, the `InProgressActionData` is actually using a dangling reference because the `std::shared_ptr<AsyncResp>` is already destructed, and bmcweb will crash on `action` calls, or not crash but get invalid response, as it's undefined behavior. Fix the above issue by using `std::shared_ptr<AsyncResp>` to make sure the response is correctly handled. Tested: 1. Without the fix, bmcweb crashes, or get no json output response on the below method call, be noted that it's an invalid call: ``` $ curl -k -H "X-Auth-Token: $token" -x POST -d '{"data": []}' https://${bmc}/xyz/openbmc_project/logging/action/deleteAll ``` 2. With the fix, bmcweb gives expected response: ``` $ curl -k -H "X-Auth-Token: $token" -x POST -d '{"data": []}' https://${bmc}/xyz/openbmc_project/logging/action/deleteAll { "data": { "description": "The specified method cannot be found" }, "message": "404 Not Found", "status": "error" } $ curl -k -H "X-Auth-Token: $token" -x POST -d '{"data": []}' https://${bmc}/xyz/openbmc_project/logging/action/DeleteAll { "data": null, "message": "200 OK", "status": "ok" } ``` Signed-off-by: Lei YU <yulei.sh@bytedance.com> Change-Id: I38ef34fe8ff18e4e127664c853c6792461f6edf8
2023-03-17Add the GetManagedObjects method to dbus_utilityGeorge Liu2-9/+24
There are currently many files that use the GetManagedObjects method. Since they are a general method, they are defined in the dbus_utility.hpp file and refactors them. Tested: 1. Built bmcweb successfully and Validator passes. 2. We got the same result as previously in the ethernet schema. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I0c25b7b6b9421bea46ff0afadbaa4783b704e664
2023-03-17Fix some movesEd Tanous1-17/+22
This code is doing some copy operations instead of moves. This commit moves to passing a Request&& through the validate function, so that we don't have to split the usage of req between the two paths. Ideally someday we'd run Request as a shared_ptr like we do with Response and remove the possibility of this, but that's a longer term thing. This fixes a regression introduced in 7e9093e625961f533250a6c193c1a474e98007c4 Tested: Redfish service validator passes. /redfish/v1/Systems/system passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib6d99726a64326b7c8bad15bc9d4ca774ab6256d
2023-03-16Fix resource delete event issueAsmitha Karunanithi1-1/+1
This change corrects the event type when a resource is removed. Tested By: Tested in the client side - resource removed events are received Change-Id: Ib7b017c58401b9be674d330bc476d8c30d3721d6 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2023-03-15Move PCIeDeviceCollection to separate methodLakshmi Yadlapati1-24/+35
Similar to the code we've been building elsewhere, move PCIeDeviceCollection system to a separate method, and use getCollectionMembers. Tested: Validator passed ``` { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices", "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection", "Description": "Collection of PCIe Devices", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/dp0_drive2" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/dp0_drive3" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card0" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" }, ..... ..... ], "Members@odata.count": 20, "Name": "PCIe Device Collection" } ``` Change-Id: Ib8d468f9163e49fc3767dd92b81e70b4d48e8867 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-03-15Take url views by valueEd Tanous5-63/+54
Any of our things taking URLs should be taking url_view by value, similar to how we take string_view. From the beast documentation: "...it acts like a string_view in terms of ownership." [1] Therefore, we should treat it like we treat string_view, and take by value, not reference. [1] https://www.boost.org/doc/libs/master/libs/url/doc/html/url/ref/boost__urls__url_view.html Tested: Stacked these patches. Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I696b495f4aa04984225853f653cc175c0eaad79d
2023-03-15Replace space with underscore for Dbus Object PathYaswanth Reddy M1-1/+1
Currently code search for underscore and replace space in the dbus object path , which construct invalid object path.This Patch construct proper dbus object path by replacing space with underscore. Tested: Verified that object path is created in proper format. Change-Id: Ibdf18c13ce30aa007f165e1ccfe7f68e86d50c32 Signed-off-by: Yaswanth Reddy M <yaswanthx.reddy.munukuru@intel.com>
2023-03-15Add Support for privilege check in handleUpgradeP Dheeraj Srujan Kumar2-46/+79
This commit enables privilege check for user(s) in case of upgraded connections. Currently users with no privileges will also be able to access Websockets connections (Ex: KVM). The privilege check was already in place for normal connections (i.e. router->handle()). This commit lifts off the privilege check code and moves it into a common function (validatePrivilege()), which can be used both by handle() and handleUpgrade() and register required callback to be called. Also, the const qualifier for Request in the handleUpgrade() function's signature is removed to enable setting "isConfigureSelf" field of request. The signature of handleUpgrade() is made identical to handle() Tested: - websocket_test.py Passed - Admin and Operator users are able to access KVM on WebUI - Readonly User was unable to access KVM on WebUI Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Change-Id: I6f743c27e7e6077f1c6c56e6958922027e4404e8
2023-03-15Remove try-catch blocks on handleUpgradeEd Tanous1-22/+2
handleUpgrade is pretty simple, and has no methods that can throw. This was there previously because of handling exceptions in handle() and was copied to handleUpgrade(), even though it doesn't make a ton of sense to do so, given the throw conditions don't really exist, and start() doesn't call path handlers directly anymore. Tested: Code compiles. Only affects error conditions. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iedd7e42b7e908282ab2c2d698e9f6c815b88e857
2023-03-15Move validation code to unpackPropertiesNoThrowEd Tanous1-32/+28
Tested: Tested in 46991 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia714c7de02d714e636d5624ea884dbb6633baee5