summaryrefslogtreecommitdiff
path: root/redfish-core/include/utils/systems_utils.hpp
AgeCommit message (Collapse)AuthorFilesLines
2025-08-26Fix includesEd Tanous1-3/+0
Our includes haven't been enforced by tidy in a while. Run the script, check in the result, minus the false positives. Change-Id: I6a6da26f5ba5082d9b4aa17cdc9f55ebd8cd41a6 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-08-26Multi-host support for GET routes in systems.hppOliver Brewka1-0/+53
Add support for multi-host GET request-handling under the /redfish/v1/Systems/{computerSystemId}/ redfish resource. All multi-host supported redfish URIs can be found in this listing [1]. Multi-host meson options needed: -Dexperimental-redfish-multi-computer-system=enabled Tested: Validator passes on single-host machine and yv4 qemu emulation. [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/76118 Change-Id: I67c17c3dd7a354fa9a2ebbc56d4def7a7e788909 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2025-08-20Systems: Update LocationIndicatorActive propertyJanet Adkins1-0/+58
Modify get/set of LocationIndicatorActive property for Systems to use identifying association instead of hard-coding led group.[1] History: Almost 5 years ago IBM added support for this property to the Systems.[2] That original implementation assumed the system and chassis shared the same LED and just looked at the enclosure_identify_blink and enclosure_identify like the existing IndicatorLED property did. IBM renamed these functions getSystemLocationIndicatorActive and setSystemLocationIndicatorActive.[3] The interest from other companies has mostly been around IndicatorLED (old deprecated LED property).[4] Today, LEDs have the association documented above and used elsewhere like PowerSupplies, Fans, etc. Switching to this association: 1) follows the design 2) allows multiple chassis support 3) doesn't assume your system led is your chassis led. This is the last caller of the getSystemLocationIndicatorActive() and setSystemLocationIndicatorActive() functions so they are being removed. [1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/58299 [2] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/36886 [3] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57765 [4] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/27301 Tested: - Redfish Service Validator passes - Confirm able to set and get LED 1. Get for Systems ``` curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems/system { { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_22_0.ComputerSystem", ... "LocationIndicatorActive": false, ... } ``` 2. Set for Systems ``` curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"LocationIndicatorActive": true}' https://${bmc}/redfish/v1/Systems/system curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_22_0.ComputerSystem", ... "LocationIndicatorActive": true, ... } ``` Change-Id: I1c06621586148d4b299b1f8e1ee1fb0ccdc51f10 Signed-off-by: George Liu <liuxiwei@inspur.com> Signed-off-by: Janet Adkins <janeta@us.ibm.com> Co-authored-by: George Liu <liuxiwei@inspur.com>
2025-07-31Multi-host helper functionsOliver Brewka1-0/+142
The change implements the getComputerSystemIndex function which leverages the xyz.openbmc_project.ManagedHost interface to retrieve the index corresponding to the host the request was made for, when on a multi-host machine. On single-host the index always defaults to 0. It is not the perfect solution, but it is a starting point to introduce multi-host support to bmcweb, allowing for power control, via redfish and in general something we can build from. More efficient ways of doing things are already discussed, but will need more time to design properly. The implementation relies on the experimental-redfish-multi-computer-system meson flag to give bmcweb an indication, whether it is running on single- or multi-host and to drop unsupported redfish resources for the time being. Multi-host meson options needed: -Dexperimental-redfish-multi-computer-system=enabled -Dredfish-system-uri-name= These helper functions are needed for the multi-host patches further down the patch chain. Tested: All relevant tests have been made in the following patches. Change-Id: Ie481aa8b05903dab59f39a1134463ac0c54aa781 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2025-05-23Refactor boost::urls usage in system collection handlerOliver Brewka1-3/+2
This is a simple refactor in handleComputerSystemCollection to use boost::urls::format instead of the crow util function appendUrlPieces. Tested: Query the route with curl and check if it still responds with a valid collection. Change-Id: If9c5f6dc8672c00b94db296d5968f756598a05e7 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2025-05-23Add copyright comment to systems_utils.hppOliver Brewka1-0/+2
Added the missing copyright comment at top of the file. Tested: Code compiles. Change-Id: I7dfd32c9bb26223e7dafe5ab4da7aad6eabc116c Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2025-05-12Introducing systems_utils.hpp and getSystemCollectionMembersOliver Brewka1-0/+118
This change introduces a new a function similar to getCollectionMembers but specific to computerSystem discovery. Since more functionality will be added soon to support multi host redfish and in general request handling with the long term goal not using hardcoded URIs anymore, a new utility header for systems.hpp is being introduced in this patch that will hold the rest of the incoming definitions. getSystemCollectionMembers supports multi-host platforms like yosemite4. Currently we have to distinguish between single- and multi-host platforms and handle both separate from each other, thus cannot use the generic getCollectionMembers from collection.hpp. However, this should change sometime in the future. It should be mentioned, that functionalitywise the newly introduced function shares almost all of the code used in getCollectionMembers from collection.hpp. Only simplification has been done, since this function only serves a single usecase. In order to create the collection for a multi-host platform, the collection handler looks for the ManagedHost dbus interface via the ObjectMapper and adds everything it gets from a getSubTree call to the collection. Single-host systems do not populate this interface, so an empty result from the ObjectMapper is treated as the request came from a single-host system. Testing: Full redfish service validator has been ran on a romulus image with and without the changes, representative for a single-host system. No regression has been observed. A yosemite4 image has been validated constraining the validator to only check the collection url without following sub uris. Validation also succeeded. In addition, the collection url has been curled manually on both images to check the correct members are added to the collection. curl -w "@curl-format.txt" -c cjar -b cjar -k -X GET \ 'https://'"${BMC}"':4443/redfish/v1/Systems \ -H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN"'' romulus output: { "@odata.id": "/redfish/v1/Systems", "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system" } ], "Members@odata.count": 1, "Name": "Computer System Collection" } yosemite4 output: { "@odata.id": "/redfish/v1/Systems", "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_1_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_2_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_3_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_4_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_5_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_6_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_7_Chassis" }, { "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_Slot_8_Chassis" } ], "Members@odata.count": 8, "Name": "Computer System Collection" } Change-Id: I82d59487b7c17b22cd638acd8f687f31c96ca156 Signed-off-by: Oliver Brewka <mox669.dev@gmail.com>