summaryrefslogtreecommitdiff
path: root/redfish-core/include/utils
AgeCommit message (Collapse)AuthorFilesLines
8 daysAdd getAssetInfo into util functionMyung Bae1-0/+102
AssetInfo is needed for many schemas like Fan, Storage etc. Using this utility function, those AssetInfo can be obtained in one place. This function extracts the following properties if available. - Manufacturer - Model - PartNumber - SerialNumber - SparePartNumber (if requested) Tested: - GET Chassis, Fan, Storage etc - Redfish Service Validator passes Change-Id: I2e8fdab8969d24899c261cfdf601be971d0210d7 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2025-09-16Remove deprecated json decodesEd Tanous1-9/+1
These decodes haven't been standard practice for a while. While they will likely break some downstream builds, we need to clean things up. If you are seeing this commit message because your downstream build is broken, please migrate your code to using nlohmann::json::object_t instead of nlohmann::json when it does the unpack. Tested: Code compiles. Change-Id: Id892ee381b2d6b40a6366ee0622cde04d2cacd7b Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-09-15Add check to omit `DateTime` from etag calculationCorey Ethington2-0/+81
Ignores any json property named `DateTime` when calculating the etag value of an HTTP response as per the updated Redfish Spec (section 6.5: ETags) Tested: - Redfish Service Validator passes - Tested on romulus: 1. GET resource with a "DateTime" field ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/TaskService" \ --etag-save ./etag.txt -v ... < etag: "6A4CE897" ... { "@odata.id": "/redfish/v1/TaskService", "@odata.type": "#TaskService.v1_1_4.TaskService", "CompletedTaskOverWritePolicy": "Oldest", "DateTime": "2025-07-23T17:08:20+00:00", "Id": "TaskService", "LifeCycleEventOnTaskStateChange": true, "Name": "Task Service", "ServiceEnabled": true, "Status": { "State": "Enabled" }, "Tasks": { "@odata.id": "/redfish/v1/TaskService/Tasks" } ``` 2. GET same resource again later, etag is same as before ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/TaskService" \ --etag-save ./etag.txt -v ... < etag: "6A4CE897" ... { "@odata.id": "/redfish/v1/TaskService", "@odata.type": "#TaskService.v1_1_4.TaskService", "CompletedTaskOverWritePolicy": "Oldest", "DateTime": "2025-07-23T17:10:48+00:00", "Id": "TaskService", "LifeCycleEventOnTaskStateChange": true, "Name": "Task Service", "ServiceEnabled": true, "Status": { "State": "Enabled" }, "Tasks": { "@odata.id": "/redfish/v1/TaskService/Tasks" } ``` "DateTime" is the only value to have changed, but since it is ignored the etag did not change 3. GET with if-none-match returns 304 ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/TaskService" \ --etag-save ./etag.txt --etag-compare ./etag.txt -v ... > if-none-match: "6A4CE897" ... < HTTP/2 304 < allow: GET < odata-version: 4.0 < strict-transport-security: max-age=31536000; includeSubdomains < pragma: no-cache < cache-control: no-store, max-age=0 < x-content-type-options: nosniff < etag: "6A4CE897" < date: Wed, 23 Jul 2025 17:14:39 GMT < content-length: 0 < ... ``` Change-Id: I51f7668e75719c69c55535e4a1e48c8bae7c9488 Signed-off-by: Corey Ethington <cethington@coreweave.com>
2025-09-11Extract downloadEntryCallback functionOliver Brewka1-0/+129
As part of a EventLog refactor, extract this function into a log_services utility. Tested: Only code extraction. Code compiles. Change-Id: Iaa7aa583a38587c338280af2a9fff65d3732f301 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2025-09-08Revert "Refactor Managers with getValidManagerPath"Gunnar Mills1-72/+0
This reverts commit 0775449c62385f163a207d0f0c8e1f6338de1062. CI bumps are failing. Romulus is failing [1]. (UTC) 2025/09/07 07:28:06.903907 - 0.212714 - Executing: get('/redfish/v1/Managers/bmc') [1]: https://discord.com/channels/775381525260664832/855566794994221117/1414329724477636649 Change-Id: I0ff80780cf1eb2f14484fdd0a521f90cc15e914b Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2025-09-05Refactor Managers with getValidManagerPathMyung Bae1-0/+72
This adds getValidManagerPath() to find the valid manager dbus path and its service name. This can be used for manager GET and PATCH operations. Tested: - GET /redfish/v1/Managers/bmc - PATCH /redfish/v1/Managers/ LocationIndicatorActive - Redfish Service Validator passes Change-Id: Id46dd12be3050a2097364696a471b188b8167016 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2025-08-26Fix includesEd Tanous2-3/+1
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-21IndicatorLED: Add compile option for deprecated propertyJanet Adkins1-2/+8
The IndicatorLED property has been deprecated by Redfish since September 2020. The Redfish Service Validator reports a WARNING for this property: ``` WARNING - IndicatorLED: The given property is deprecated: This property has been deprecated in favor of the `LocationIndicatorActive` property. ``` The LocationIndicatorActive property is now implemented in bmcweb in all places where IndicatorLED was implemented. So a new meson option (redfish-allow-deprecated-indicatorled) is being added to control whether this property is part of get or patch requests. The option is disabled by default with plans to remove the option by March 2026. Tested: - Built with option enabled and confirmed IndicatorLED still part of Redfish responses and can be patched. - Built with option disabled and confirmed Redfish Service Validator no longer reports the warning. - Built with option disabled and confirmed IndicatorLED no longer part of Redfish responses and patch fails appropriately. ``` curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"IndicatorLED":"Blinking"}' https://${bmc}/redfish/v1/Systems/system { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The property IndicatorLED is not in the list of valid properties for the resource.", "MessageArgs": [ "IndicatorLED" ], "MessageId": "Base.1.19.PropertyUnknown", "MessageSeverity": "Warning", "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed." } ], "code": "Base.1.19.PropertyUnknown", "message": "The property IndicatorLED is not in the list of valid properties for the resource." } } curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X PATCH -d '{"IndicatorLED":"Off"}' https://${bmc}/redfish/v1/Chassis/chassis { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The property IndicatorLED is not in the list of valid properties for the resource.", "MessageArgs": [ "IndicatorLED" ], "MessageId": "Base.1.19.PropertyUnknown", "MessageSeverity": "Warning", "Resolution": "Remove the unknown property from the request body and resubmit the request if the operation failed." } ], "code": "Base.1.19.PropertyUnknown", "message": "The property IndicatorLED is not in the list of valid properties for the resource." } } ``` Change-Id: I2c0d415a7a54aa3122b18d2a1aa69bd9259d567e Signed-off-by: Janet Adkins <janeta@us.ibm.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-07-25Work around nlohmann changesEd Tanous1-18/+40
https://github.com/nlohmann/json/issues/4475 recently changed behavior that we rely on in a lot of places, and unit tests appear to have caught the failure. Functionally, this changes the readJson* class of values to attempt to read as the type requested first, then attempt to read as the opposite int/uint type requested, with a range check. In addition, the range check functions now need updated to handle comparisons between non-similar value types. Luckily c++20 added cmp_less/greater type functions that we can make use of. Tested: unit tests pass. Change-Id: If114bd55225a3a9948e80a407b19b69f50d048b6 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-07-17manager: Lower software version log severityDaniel Hsu1-1/+6
During the transition to using phosphor-settings-defaults-native for setting the software version, the version field may temporarily be empty. This change lowers the log severity for that case to avoid unnecessary warnings during expected intermediate states. ''' Jun 20 02:41:49 bmc bmcwebd[709]: [error_messages.cpp:1248] Internal Error /usr/src/debug/bmcweb/1.0+git/redfish-core/include/utils/sw_utils.hpp(126:32) `void redfish::sw_util::afterGetProperties(const std::shared_ptr<bmcweb::AsyncResp>&, const std::string&, bool, const std::string&, const std::string&, bool, const boost::system::error_code&, const dbus::utility::DBusPropertiesMap&)`: ''' Change-Id: I9123278f863fcf04107b42a5996ccb725c1bd870 Signed-off-by: Daniel Hsu <Daniel-Hsu@quantatw.com>
2025-07-07Add ServiceIdentificationCorey Ethington1-0/+64
Implements GET and PATCH support for ServiceIdentification in Managers/bmc and service root. Tested: - Refish Service Validator passes - Tested on romulus: 1. GET initial value ``` curl -k "https://$BMC/redfish/v1" { ... } ``` ServiceIdentification is not yet present in service root, as expected ``` curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/Managers/bmc" { ... "ServiceIdentification": "", ... } ``` 2. PATCH and GET with valid value ``` curl -k -X PATCH "https://$BMC/redfish/v1/Managers/bmc" -H "X-Auth-Token: $XAUTH_TOKEN" \ -H 'Content-Type: application/json' --data-raw '{"ServiceIdentification": "foo"}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request completed successfully.", "MessageArgs": [], "MessageId": "Base.1.19.Success", "MessageSeverity": "OK", "Resolution": "None." } ] } curl -k "https://$BMC/redfish/v1" { ... "ServiceIdentification": "foo", ... } curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/Managers/bmc" { ... "ServiceIdentification": "foo", ... } ``` 3. PATCH and GET with invalid value ``` curl -k -X PATCH "https://$BMC/redfish/v1/Managers/bmc" -H "X-Auth-Token: $XAUTH_TOKEN" \ -H 'Content-Type: application/json' --data-raw '{"ServiceIdentification": "$$$"}' { "ServiceIdentification@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The value provided for the property ServiceIdentification is not valid.", "MessageArgs": [ "ServiceIdentification" ], "MessageId": "Base.1.19.PropertyValueError", "MessageSeverity": "Warning", "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed." } ] } curl -k -X PATCH "https://$BMC/redfish/v1/Managers/bmc" -H "X-Auth-Token: $XAUTH_TOKEN" \ -H 'Content-Type: application/json' --data-raw '{"ServiceIdentification": "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"}' { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The string 'ServiceIdentification' exceeds the length limit 99.", "MessageArgs": [ "ServiceIdentification", "99" ], "MessageId": "Base.1.19.StringValueTooLong", "MessageSeverity": "Warning", "Resolution": "Resubmit the request with an appropriate string length." } ], "code": "Base.1.19.StringValueTooLong", "message": "The string 'ServiceIdentification' exceeds the length limit 99." } } curl -k "https://$BMC/redfish/v1" { ... "ServiceIdentification": "foo", ... } curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/Managers/bmc" { ... "ServiceIdentification": "foo", ... } ``` Change-Id: I5b71a73e947ec64cabb8d93c8503a18fb43b8937 Signed-off-by: Corey Ethington <cethington@coreweave.com>
2025-06-17Software: Add LowestSupportedVersionGunnar Mills1-0/+40
A Minimum Version interface was added.[1] This is the minimum software version that a component must have to operate. Like other interfaces it is optional. MinimumVersion maps to Redfish's LowestSupportedVersion.[2] "LowestSupportedVersion": { "description": "The lowest supported version of this software.", "longDescription": "This property shall represent the lowest supported version of this software. This string is formatted using the same format used for the `Version` property.", "readonly": true, "type": [ "string", "null" ], "versionAdded": "v1_1_0" phosphor-bmc-code-mgmt has support for minimum version.[3] phosphor-bmc-code-mgmt logs a Software Incompatible[4] error if this minimum version is not met. Mapping this error to a Redfish error is not done here but could be added later. This assumes the D-Bus path is /xyz/openbmc_project/software/$id. phosphor-bmc-code-mgmt moved this interface under $id at 72323[5]. We assume D-Bus Path /xyz/openbmc_project/software/ + $id for other properties already. [1]: https://github.com/openbmc/phosphor-dbus-interfaces/commit/9012243e543abdc5851b7e878c17c991b2a2a8b7 [2]: https://redfish.dmtf.org/schemas/v1/SoftwareInventory.v1_10_2.json [3]: https://github.com/openbmc/phosphor-bmc-code-mgmt/blob/85c71a13e0938cc4d36caf6b8e735e9740b2e351/meson.options#L100 [4]: https://github.com/openbmc/phosphor-dbus-interfaces/blob/1c140b9766a15d1cbb8546fa02d5050d772a171d/yaml/xyz/openbmc_project/Software/Version.errors.yaml#L1 [5]: https://gerrit.openbmc.org/c/openbmc/phosphor-bmc-code-mgmt/+/72323 Tested: Using an IBM p10bmc see: { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/788d20be", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Description": "BMC image", ... "LowestSupportedVersion": "fw1020.00-39.1", ... The Redfish Validator has no new errors. Change-Id: I17e6d64c86a7d6312726783425101775a959dc04 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2025-06-10Suppress SW EBADR messageMyung Bae1-9/+8
During the code update, the following EBADR messages may be generated and they can be suppressed. During the code update, the following journal messages may be generated due to a reason why there is a software version with EBADR because the software app deleted the old version. The EBADR check already does not throw an internal error and it shouldn't log to the journal either at the error based [1]. This commit also cleans up these journal traces because logging both ec and ec.message is redundant. ``` ay 27 20:17:04.992218 ever28bmc systemd[1]: Starting Delete image a from BMC storage... May 27 20:17:05.205158 ever28bmc obmc-flash-bmc[2159]: 2048+0 records in May 27 20:17:05.205158 ever28bmc obmc-flash-bmc[2159]: 2048+0 records out May 27 20:17:05.391229 ever28bmc obmc-flash-bmc[2161]: 2048+0 records in May 27 20:17:05.391229 ever28bmc obmc-flash-bmc[2161]: 2048+0 records out May 27 20:17:05.403161 ever28bmc systemd[1]: obmc-flash-mmc-remove@a.service: Deactivated successfully. May 27 20:17:05.404485 ever28bmc systemd[1]: Finished Delete image a from BMC storage. May 27 20:17:07.974923 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:148] error_code = Invalid request descriptor [generic:53] May 27 20:17:07.974923 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:150] error msg = Invalid request descriptor May 27 20:17:07.974923 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:148] error_code = Invalid request descriptor [generic:53] May 27 20:17:07.974923 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:150] error msg = Invalid request descriptor May 27 20:17:07.974923 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:148] error_code = Invalid request descriptor [generic:53] May 27 20:17:07.974923 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:150] error msg = Invalid request descriptor May 27 20:17:07.986380 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:148] error_code = Invalid request descriptor [generic:53] May 27 20:17:07.986380 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:150] error msg = Invalid request descriptor May 27 20:17:07.988780 ever28bmc bmcweb[1176]: [ERROR sw_utils.hpp:148] error_code = Invalid request descriptor [generic:53] ``` [1] https://github.com/openbmc/bmcweb/blob/10cf50dca112b27176dc5734126983ad37ba2c04/DEVELOPING.md?plain=1#L213 Change-Id: I9454e85b299649e1a1e40663fac6256415bbfe7d Signed-off-by: Myung Bae <myungbae@us.ibm.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-16Authenticate expand query parameterChandramohan Harkude1-3/+13
Addressed the below requirements for security GAP 1) PrivilegeRegistry is now enforced for all users and all expanded resources. If a user lacks access, the node will not be expanded. 2) If a user with Operator privilege calls '/redfish/v1?$expand', the response includes only resources the user has access to. 3) 'ReadOnly' and 'Operator' roles can expand, but not into nodes they lack privileges for. 4) Expand is completely disallowed without authentication. Requests without valid credentials receive 401 Unauthorized. Testing: Tested and verified that users can access only authorized resources. Unauthorized access and unauthenticated expand requests are blocked. Change-Id: Ic1c2761f30db73a2884cdecdb8eb08168446523b Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.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>
2025-04-29Remove is_objectEd Tanous1-2/+4
is_object doesn't throw, but generally is_object is used in some kind of pattern of. if (x.is_object()){ x["thing"]; } operator[] technically throws if it's the wrong type, which bloats binary sizes. Replace these with the equivalent get_ptr<object_t> Change-Id: If3734d7920f0a6f81efa10b3a2d91595e9e0af5a Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-04-29Fix more movesEd Tanous1-9/+9
This commit is fixing coverity issues reported for copy in stead of move. Tested: redfish service validator passes Change-Id: I97e755830f28390e7c4bfaba6f3f947898a21423 Signed-off-by: Ed Tanous <ed@tanous.net>
2025-04-21sensor_utils: Support upper/lower fatal thresholdPotin Lai1-0/+8
Add support of upper and lower fatal threshold settings. The fatal thresholds use the `xyz.openbmc_project.Sensor.Threshold.HardShutdown` interface as the source of threshold value. Tested on catalina: ``` { "@odata.id": "/redfish/v1/Chassis/NVIDIA_HMC/Sensors/temperature_HGX_GPU_0_TEMP_0", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "temperature_HGX_GPU_0_TEMP_0", "Name": "HGX GPU 0 TEMP 0", "Reading": 81.34375, "ReadingRangeMax": 127.0, "ReadingRangeMin": -128.0, "ReadingType": "Temperature", "ReadingUnits": "Cel", "Status": { "Health": "OK", "State": "Enabled" }, "Thresholds": { "UpperCaution": { "Reading": 82.0 }, "UpperCritical": { "Reading": 84.0 }, "UpperFatal": { "Reading": 87.0 } } } ``` ``` { "@odata.id": "/redfish/v1/Chassis/NVIDIA_HMC/Sensors/temperature_HGX_GPU_0_TEMP_1", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "temperature_HGX_GPU_0_TEMP_1", "Name": "HGX GPU 0 TEMP 1", "Reading": 5.4375, "ReadingRangeMax": 127.0, "ReadingRangeMin": -128.0, "ReadingType": "Temperature", "ReadingUnits": "Cel", "Status": { "Health": "OK", "State": "Enabled" }, "Thresholds": { "LowerCaution": { "Reading": -0.05 }, "LowerCritical": { "Reading": -4.0 }, "LowerFatal": { "Reading": -5.0 } } } ``` Change-Id: Ida54d663efdb042d21ea433d9c198c1ee4890173 Signed-off-by: Potin Lai <potin.lai@quantatw.com>
2025-04-15Avoid http request copy in OEM handlerRohit PAI1-3/+5
Initial copy was done to avoid request object going out of scope before OEM handler are invoked. The MR avoids the whole copy of the request object and create a sub route object which contains elements required for OEM route handling. Tested - Service Validator Passes - OpenBMC OEM properties and rendered well. Change-Id: I3ef80a130afe6ab764a13704a8b672f5b0635126 Signed-off-by: Rohit PAI <ropai@nvidia.com>
2025-04-10Add async_method_call to utilityEd Tanous2-0/+2
Adding async_method_call in dbus utility gives us a place where we can intercept method call requests from dbus to potentially add logging/caching. An example of logging is in the later commit: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/78265/ We already do this for setProperty, this moves the method calls to follow a similar pattern. Tested: Redfish service validator passes. Change-Id: I6d2c96e2b6b6a023ed2138106a55faebca161592 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-04-03OEM Route Handling Infrastructurerohitpai2-3/+58
Goal of the MR is to provide infrastructure support in bmcweb to manage the OEM fragment handling separately. OEM schema are vendor defined and per DMTF resource we could have multiple vendor defined OEM schema to be enabled. The feature allows registration of route handler per schema per OEM namespace. Example ``` REDFISH_SUB_ROUTE<"/redfish/v1/Managers/<str>/#/Oem/OpenBmc">(service, HttpVerb::Get)(oemOpenBmcCallback); REDFISH_SUB_ROUTE<"/redfish/v1/Managers/<str>/#/Oem/Nvidia">(service, HttpVerb::Get)(oemNidiaCallback); ``` We can have separate vendor defined route handlers per resource. Each of these route handlers can populate their own vendor specific OEM data. The OEM code can be better organized and enabled/disabled as per the platform needs. The current MR has the code changes related to handling GET requests alone. The feature only supports requests where the response payload is JSON. Tests - All UT cases passes - New UT added for RF OEM router passes - Service Validator passes on qemu - GET Response on Manager/bmc resource contains the OEM fragment ``` curl -c cjar -b cjar -k -X GET https://127.0.0.1:2443/redfish/v1/Managers/bmc { "@odata.id": "/redfish/v1/Managers/bmc", "@odata.type": "#Manager.v1_14_0.Manager", "Oem": { "OpenBmc": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc", "@odata.type": "#OpenBMCManager.v1_0_0.Manager", "Certificates": { "@odata.id": "/redfish/v1/Managers/bmc/Truststore/Certificates" } } }, "UUID": "40575e98-90d7-4c10-9eb5-8d8a7156c9b9" } ``` Change-Id: Ic82aa5fe760eda31e2792fbdfb6884ac3ea613dc Signed-off-by: Rohit PAI <rohitpai77@gmail.com>
2025-04-01Refactor chassisInterfaces into chassis_utilsMyung Bae1-4/+5
Some (e.g. IBM) do not use the `xyz.openbmc_project.Inventory.Item.Board` interface for chassis objects. To handle the use pattern easier, this refactors the Chassis interface into one location and it is referenced from the needed places (e.g. `getValidChassisPath()`). Moreover, this part is repeated many times, which goes against best practices. Tested: - GET Chassis related API and check they are the same as before - Redfish Service Validator passes Change-Id: Id4a51986262892c5dc81b1a3bc46fa5be7c0e9da Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2025-03-24Add handling for liquidflow & pressure sensorsZev Weiss1-0/+16
When pressure [1] and liquidflow [2] were added to phosphor-dbus-interfaces, bmcweb's unit-handling code and list of dbus sensor paths weren't updated accordingly; let's add them now. Tested: pressure and liquidflow sensors on dbus now appear (including appropriate units) in the redfish hierarchy and on the webui-vue sensors page. [1] https://github.com/openbmc/phosphor-dbus-interfaces/commit/69d821b0368b8c6943a91c7f96528e2c0047f432 [2] https://github.com/openbmc/phosphor-dbus-interfaces/commit/6a8507d06e172d8d29c0459f0a0d078553d2ecc7 Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Change-Id: I1dbe869d6c642eaeebad8605adad50315c52ad3d
2025-02-13Remove nlohmann::json::object helpersEd Tanous1-21/+4
readJsonHelper existed back before the distinction between nlohmann::json and nlohmann::json::object_t was understood. This commit cleans up our sub-value parsing by removing readJsonHelper that accepts a nlohmann::json overload, and always accepting via an object_t overload. Functionally, these two are identical, given that readJsonHelper only did a type check that was redundant. Tested: Unit tests pass. Good coverage of these methods. Change-Id: I734d956dd4bc2ddb14f6e3c735e15adf1f7e00a0 Signed-off-by: Ed Tanous <ed@tanous.net>
2025-02-05Fix Message arg error in JSON Patchrohitpai1-3/+3
When array/vector object is expected in JSON patch the error info does not contain the actual wrong property instead shows "null". Fix is to correct the value in the error info. Tested - add new test case to verify this - unit tests are passing. Change-Id: Ica26ac9e501b5a34a5b118769cc1917eeab30524 Signed-off-by: rohitpai <rohitpai77@gmail.com>
2025-02-04clang-format: update latest spec and reformatPatrick Williams6-34/+34
Copy the latest format file from the docs repository and apply. Change-Id: I2f0b9d0fb6e01ed36a2f34c750ba52de3b6d15d1 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2025-02-03Move error code utils into new filerohitpai2-80/+95
Error code utils can be used for aggregating error responses from multiples responses including use case for managing separate route handlers for OEM namespace Tests Units tests are passing. Change-Id: I2223d41fb318c0276de1ca64dd3e841bb988d902 Signed-off-by: rohitpai <rohitpai77@gmail.com>
2025-01-31Fix includesEd Tanous14-22/+78
Clang-tidy misc-include-cleaner appears to now be enforcing significantly more headers than previously. That is overall a good thing, but forces us to fix some issues. This commit is largely just taking the clang-recommended fixes and checking them in. Subsequent patches will fix the more unique issues. Note, that a number of new ignores are added into the .clang-tidy file. These can be cleaned up over time as they're understood. The majority are places where boost includes a impl/x.hpp and x.hpp, but expects you to use the later. include-cleaner opts for the impl, but it isn't clear why. Change-Id: Id3fdd7ee6df6c33b2fd35626898523048dd51bfb Signed-off-by: Ed Tanous <etanous@nvidia.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2025-01-26$filter Query parameter support for nested keys addedChandramohan Harkude1-0/+35
Implemented the code to identify the '/' character in the key and perform the level by level search Testing : Tested query parameter with path separated by / example curl -k -u root:0penBmc https://<IP>/redfish/v1/Systems/ Baseboard/LogServices/FaultLog/Entries?$filter=CPER/Oem/ OEM/IpSignature eq 'DRAM-CHANNELS' Results having 'DRAM-CHANNELS' in nested path "CPER/Oem/ OEM/IpSignature" are listed. Change-Id: Ie6cf796026a29ec7a3e8a0366bbfd0c658d0ac7e Signed-off-by: Chandramohan Harkude <chandramohan.harkude@gmail.com>
2025-01-24Move time_utils to compile unitEd Tanous1-410/+11
There's no reason for these functions to be in a header, and pulling them into a compile unit can reduce compile times overall. Tested: Unit tests pass (Good coverage) Change-Id: Ia6dc50d16bf2967e647a3c7437ba13bd7ab7ca3c Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-01-24Move to std::chronoEd Tanous1-0/+57
gcc-14 finally has calendar support. Move the existing helper functions over to using it, and deprecate the old methods (which involved a lot of magic numbers). The old methods are kept behind ifdefs for those still compiling against gcc-13 for the moment, but will be removed when we bump the requirements to gcc-14. Unrelated to the cleanup, this also saves 2Kb on the compressed binary size, presumably due to relying on implementations in libc++ instead of in bmcweb. Tested: Unit tests pass, good coverage. Change-Id: I739a3e876e84150dc654b9dff5eb05261b1daaf5 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-01-22Roll out error message utilsEd Tanous1-0/+1
This code should really be in a cpp/hpp file, not in a generated python script. The python script housed this temporarily to allow us to generate the registries. It's time to roll it out. Tested: Message registries generate successfully on GET. Redfish service validator passes. Change-Id: I7aca2d0a7fac6d530511421b667ff732617df61e Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-01-20Use SPDX identifiersEd Tanous14-30/+30
SPDX identifiers are simpler, and reduce the amount of cruft we have in code files. They are recommended by linux foundation, and therefore we should do as they allow. This patchset does not intend to modify any intent on any existing copyrights or licenses, only to standardize their inclusion. [1] https://www.linuxfoundation.org/blog/blog/copyright-notices-in-open-source-software-projects Change-Id: I935c7c0156caa78fc368c929cebd0f068031e830 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-01-14Break out journal utilsEd Tanous1-0/+148
A number of the journald utilities are distinct from Redfish, and could be reused. Functions moved are copy/paste with no modifications. Tested: Journald LogService GET still functions correctly Redfish service validator fails no new checks. Change-Id: Icf1c28152e14f3e0c1c5203aac50c40d56bb272e Signed-off-by: Ed Tanous <etanous@nvidia.com>
2025-01-07SW: Don't log if no associationGunnar Mills1-2/+2
We define logging levels in DEVELOPING.md[1], an error is "Something went wrong, and we weren't able to give the expected response. Service is still operational. "error" should be used for unexpected conditions that prevented bmcweb from fulfilling the request. "error" shall be used for 5xx errors.". This clearly isn't an error since we just ignore not having an association and move on. Moved these traces to DEBUG. Andrew mentioned these cluttering the journal when running CI. [1]: https://github.com/openbmc/bmcweb/blob/master/DEVELOPING.md#logging-levels Tested: This is changing a Logging Level only. Change-Id: If9324ab32a1f30f446a1b6f359d8a76af899378a Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-12-17Move getProperty calls to utilityEd Tanous1-4/+3
Having all dbus calls run through the same utility reduces the amount of generated code, and more importantly, gives us a place where we can log the requests and responses to help with debugging. Tested: Redfish service validator passes. Change-Id: Ic1bf45130b5069cd57f7af26e12c8d3159c87c67 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-12-04Refactor swutils to break down in to functionsEd Tanous1-187/+204
Prior to this patch, this is one of the offenders in the bmcweb codebase for complexity. It does 4 levels of nested lambdas in a single method, making it basically impossible to read. As a side note, this came up because of an unrelated refactoring, and clang-format seemed to have just given up, and formatted this block in a nonsensical way. Tested: Inspection only. Don't have systems that use this code. Change-Id: Ica5fa97bae6be2ba1d83d2ad01eeff85bdff6649 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-11-22json utility: fixed core dump during sensor loadJayanth Othayoth1-7/+31
bmcweb replaces underscores with spaces in sensor names for better readability. The existing objectKeyCmp function did not handle this case, leading to core dumps in the sensor load path. Error details are provided below. ``` bmcwebd[1368]: [DEBUG sensors.hpp:507] Added sensor P0_NS_VR_FAN_2 bmcwebd[1368]: terminate called after throwing an instance of 'boost::detail::with_throw_location<boost::system::system_error>' bmcwebd[1368]: what(): leftover [boost.url.grammar:4] ``` Implemented a new algorithm that alphabetically sorts non-URL keys and retains the existing logic for URL-type keys. Tested: Updated and verified the test cases. Change-Id: I39c3f7cc54dec5e7cf9658977e1078acb827afb2 Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com> Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-11-19fix redfish validator error for Update interfaceJagpal Singh Gill1-1/+2
Fix the redfish validator error for BIOS version with redfish-updateservice-use-dbus feature enabled. If there is no host bios version, for example, in case the flash_bios feature is not enabled, the populateSoftwareInformation shouldn't return an error. Tested - Before Fix: Redfish Validator failed with errors - 1 err.Bios.Bios errors in /redfish/v1/Systems/system 1 err.Collection(Manager.Manager) errors in /redfish/v1/Systems/system 2 failProp errors in /redfish/v1/Systems/system 2 fails errors in /redfish/v1/Systems/system 1 failGet errors in /redfish/v1/Systems/system/Bios 1 fails errors in /redfish/v1/Systems/system/Bios … err.Bios.Bios: 1 err.Collection(Manager.Manager): 3 err.Collection(Resource.Item): 1 … Validation has failed: 16 problems found After Fix: Redfish Validator Passed - Metadata: Namespaces missing from $metadata: set() Elapsed time: 0:00:33 missingRedfishAlias: 1 pass: 4343 passAction: 16 passGet: 217 passRedfishUri: 208 skipNoSchema: 3 skipOptional: 4001 unvalidated: 1 unverifiedAdditional.complex: 1 warnDeprecated: 5 warningPresent: 6 warnings: 4 Validation has succeeded. Change-Id: I881c6a780b9f2662fb81a17c258ff09f352668d7 Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
2024-10-17Handling of OutOfRange in ReadJsonMyung Bae1-2/+2
Currently readJsonPatch returns `PropertValueNotInList` in case when an input integer is out of range. This change is to return `PropertyValueOutOfRange` for the case out-of-range integer input. Tested: - Verify PATCH with an out-of-value integer. e.g. ``` $ curl -k -X PATCH https://${bmc}/redfish/v1/EventService/ -H "Content-Type: application/json" -d '{ "DeliveryRetryIntervalSeconds" : 4294967296}' ``` Before the change, its `MessageId` is `PropertyValueNotInList`. ``` "Message": "The value '4294967296' for the property DeliveryRetryIntervalSeconds is not in the list of acceptable values.", "MessageId": "Base.1.19.0.PropertyValueNotInList", "MessageSeverity": "Warning", "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed." ``` After the change, its `MessageId` will be `PropertyValueOutOfRange`. ``` "Message": "The value '4294967296' for the property DeliveryRetryIntervalSeconds is not in the supported range of acceptable values.", "MessageId": "Base.1.19.0.PropertyValueOutOfRange", "MessageSeverity": "Warning", "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed." ``` - Redfish Service Validator passes Change-Id: I0d0c5ecbc9f416b68fa7c0e81a0ea896ec2e50af Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-10-14Implement TemperatureReadingsCelsius property for ThermalMetricsGeorge Liu1-160/+296
The ThermalMetrics schema[1] provides for efficient thermal metric gathering for thermal sensors. The schema allows retrieving just the thermal metrics with one Redfish URI. This prevents the additional work required when returning all the sensor data, or multiple Redfish URI calls to retrieve the properties for all of the thermal sensors. This commit implements the TemperatureReadingsCelsius property of ThermalMetrics[1]. ThermalMetrics is a property of ThermalSubsystem[2]. TemperatureReadingsCelsius is a SensorArrayExcerpt[3]. [1] https://redfish.dmtf.org/schemas/v1/ThermalMetrics.v1_0_1.json [2] https://redfish.dmtf.org/schemas/v1/ThermalSubsystem.v1_3_2.json [3] http://redfish.dmtf.org/schemas/v1/Sensor.v1_9_0.json#/definitions/SensorArrayExcerpt The temperature sensors are found by finding 'all_sensors' endpoints for specific chassis of D-Bus service /xyz/openbmc_project/sensors/temperature. An entry of SensorArrayExcerpt is built for each temperature sensor retrieved. Implementation Notes: - Common function sensor_utils::objectPropertiesToJson() is used to fill in sensor excerpt properties. Currently the only excerpt ChassisSubNode is ThermalMetrics. However there are others excerpts defined by Redfish. Right now mostly this is just skipping things, but I'm expecting when other sensor excerpts are implemented that some of the other properties may be added for excerpts as well. I'm expecting the combination of the chassisSubNode and the sensorType will be used to determine which properties are included for a particular call to build a sensor Json representation. - New sensor_utils::objectExcerptToJson() function created. This wraps sensor_utils::objectPropertiesToJson() and builds DataSourceUri for a sensor excerpt. - New sensor_utils::getAllSensorObjects() function created. This builds list of 'all_sensors' association endpoints for specified D-Bus path with specified D-Bus interfaces. Callback function is called with list for handling sensors. Tested: 1. Redfish Service Validator passed. 2. doGet method: ``` curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics", "@odata.type": "#ThermalMetrics.v1_0_1.ThermalMetrics", "Id": "ThermalMetrics", "Name": "Thermal Metrics", "TemperatureReadingsCelsius": [ { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp0", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp1", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp2", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp1", "Reading": -131072000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp2", "Reading": -131072000.0 } ], "TemperatureReadingsCelsius@odata.count": 6 } ``` 3. Verification of DataSourceUri: ``` curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "temperature_ps1_temp0", "Name": "ps1 temp0", "Reading": -131072000.0, "ReadingType": "Temperature", "ReadingUnits": "Cel", "Status": { "Health": "OK", "State": "Enabled" } } ``` 4. A bad chassis ID: ``` curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassisBAD/ThermalSubsystem/ThermalMetrics { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisBAD' was not found.", "MessageArgs": [ "Chassis", "chassisBAD" ], "MessageId": "Base.1.18.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.18.1.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassisBAD' was not found." } } ``` Signed-off-by: George Liu <liuxiwei@ieisystem.com> Change-Id: I6e4ed1f281fd5371c978983b6cc5666badd3752c Signed-off-by: Janet Adkins <janeta@us.ibm.com>
2024-10-14Reformat with Never-AlignTrailingComments styleMyung Bae1-4/+4
clang-format currently formats the codes to align the trailing comments of the consecutive lines via `AlignTrailingComments/Kind` as `Always` in `.clang-format` file. This could shift the comment lines by the neighboring code changes and also potentially mislead the `diff` of code changes. This commit is to keep the existing trailing comments as they were. Tested: - Check whitespace only - Code compiles & CI passes. Change-Id: I1c64d53572a81d5012aa748fe44478f80c271c5f Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2024-10-09Support ProductionDate reportHieu Huynh1-0/+43
DSP0268 Redfish Data Model Specification provides ProductionDate property for various schema. phosphor-dbus-interface [1] also supports BuildDate property which we can map from FRU data, like `Board Manufacturer Date`. This adds code to support which gets the date from BuildDate property and report via Redfish. [1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Inventory/Decorator/Asset.interface.yaml#L16 Tested: Redfish Validator passes Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com> Change-Id: Ie4ae564fa00218e7896f04ec61941fa92b23b912
2024-10-03json utility: Update sort algorithmsEd Tanous1-7/+29
Modified sort utility to be able to sort on a specified key. New utility function sortJsonArrayByKey() added. Note: - Function odataObjectCmp() renamed to objectKeyCmp() - New function odataObjectCmp() created which calls objectKeyCmp() with @odata.id key specified. - Comments for odataObjectCmp() didn't match behavior for object without key. These objects are sorted as less than objects with the key. - sortJSONResponse() modified to use the new sortJsonArrayByKey(). Tested: - Added new unit tests. These tests are in addition to the existing tests. So they focus on testing comparing by different keys. The existing tests already cover the different permutations of the basic comparisons. - Redfish Service validator passes Change-Id: I949b7cb868c59a8eeda3798e6a82a1572bbc5792 Signed-off-by: Ed Tanous <etanous@nvidia.com> Signed-off-by: Janet Adkins <janeta@us.ibm.com>
2024-09-23event logs: introduce struct DbusEventLogEntryAlexander Hansen1-0/+52
This creates a partial representation of dbus interface xyz.openbmc_project.Logging.Entry as a struct. There is also a function to extract it from dbus. Which helps to refactor function fillEventLogLogEntryFromPropertyMap to be smaller. Tested: not tested, simple refactoring. All the data types remain the same as before. Change-Id: Ib32cac967bde487b137ceaf845dfb682e605a175 Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>