summaryrefslogtreecommitdiff
path: root/redfish-core/include/utils
AgeCommit message (Collapse)AuthorFilesLines
11 hoursutils: add PrettyName utility functionAkash Arunkumar1-0/+93
Create a reusable utility function getPrettyName() in utils/name_utils.hpp that can retrieve the PrettyName property from the D-Bus xyz.openbmc_project.Inventory.Item interface. The function accepts a JSON pointer parameter, allowing it to set the PrettyName at any location in the response (e.g. within arrays or nested objects). This makes it reusable across multiple components (Drives, Processors, Memory, Chassis, etc.). Relates-to: https://github.com/openbmc/bmcweb/issues/204 Tested: - Built bmcweb with meson/ninja successfully - Tested with https://gerrit.openbmc.org/c/openbmc/bmcweb/+/90364 and verified that PrettyName appears in the response - Falls back to default name when PrettyName is empty Change-Id: Iebd31b523797152b0e8e7ea8852f86b292fb5f55 Signed-off-by: Akash Arunkumar <mirrorghost007@gmail.com> Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
12 daysRefactor eventlog_utils respHandler lambdasYuvakumar Selvamani1-42/+50
The dBusEventLogEntryDelete and dBusLogServiceActionsClear functions each contained an inline respHandler lambda that triggered the long-lambda ast-grep rule, requiring an inline suppression (// ast-grep-ignore: long-lambda). This commit extracts each lambda into a separate named function, afterDBusEventLogEntryDelete and afterDBusLogServiceActionsClear respectively, and uses std::bind_front to handle the asynchronous callback. This aligns the code with the preferred bmcweb pattern for D-Bus callbacks, improves readability, and allows the removal of the static analysis suppressions. Tested on AST2600 SoC (with PACKAGECONFIG `redfish-dbus-log` enabled; disabled by default). - `DELETE .../EventLog/Entries/1` (real entry) Expected: HTTP 200 Base.1.19.Success, entry removed Actual: HTTP 200 Base.1.19.Success, entry removed - `DELETE .../EventLog/Entries/999` (nonexistent) Expected: HTTP 404 Base.1.19.ResourceNotFound Actual: HTTP 404 Base.1.19.ResourceNotFound - `POST .../EventLog/Actions/LogService.ClearLog` Expected: HTTP 200 Base.1.19.Success, all entries cleared Actual: HTTP 200 Base.1.19.Success, all entries cleared - RSV: 5845 Pass / 353 Warn / 0 Fail Change-Id: I323a0813fef4f04622a71f27258fe9b1930ec6cd Signed-off-by: Yuvakumar Selvamani <yuvakumars@ami.com>
13 dayssubprocessor: Add Status.State/Health to coresGeorge Liu1-0/+62
Populate Redfish Status.Health and Status.State for processor core resources resource_utils::getResourceState() and getResourceHealth() are extended to accept MapperServiceMap and use the first service implementing the required interface. This avoids duplicate requests when multiple services advertise the same interface for a core object This commit also changes the iterator name in HEAD and GET path from `it` to `coreIt` for better readability as well as passing coreId by reference to avoid copies Tested: ``` curl -k -X GET https://${bmc}/redfish/v1/Systems/system/Processors/cpu0/SubProcessors/core0 { ... "Status": { "Health": "OK", "State": "Enabled" } } ``` - Where "State" can be "Present", "Available", "Enabled" - Redfish Validator Passed Change-Id: I5833541dceb9627b56b96e8235afcde78a09081f Signed-off-by: Myung Bae <myungbae@us.ibm.com> Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
2026-09-09Refactor remaining lambdas in dump utilityOliver Brewka1-221/+231
Remove all remaining lambdas violating the lambda length rule. Tested: Code compiles. Validator was run on romulus in qemu with phosphor-debug-collector ibm extension enabled to get access to /xyz/openbmc_project/dump/system. Via the 'CreateDump' method empty dump entries were manually created for: /xyz/openbmc_project/dump/system /xyz/openbmc_project/dump/bmc /xyz/openbmc_project/dump/faultlog ``` busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/bmc \ xyz.openbmc_project.Dump.Create CreateDump a{sv} 0 > o "/xyz/openbmc_project/dump/bmc/entry/1" busctl tree xyz.openbmc_project.Dump.Manager `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/dump |- /xyz/openbmc_project/dump/bmc | `- /xyz/openbmc_project/dump/bmc/entry | `- /xyz/openbmc_project/dump/bmc/entry/1 |- /xyz/openbmc_project/dump/faultlog | `- /xyz/openbmc_project/dump/faultlog/entry | `- /xyz/openbmc_project/dump/faultlog/entry/1 |- /xyz/openbmc_project/dump/resource `- /xyz/openbmc_project/dump/system `- /xyz/openbmc_project/dump/system/entry `- /xyz/openbmc_project/dump/system/entry/1 ``` Overwrite OperationStatus of /xyz/openbmc_project/dump/system/entry/1 for the entry to be added to the collection: ``` busctl set-property xyz.openbmc_project.Dump.Manager \ /xyz/openbmc_project/dump/system/entry/1 \ xyz.openbmc_project.Common.Progress Status \ s xyz.openbmc_project.Common.Progress.OperationStatus.Completed \ ``` Systems/Dump Validating /redfish/v1/Systems/system/LogServices/Dump... - Pass: 14, Warn: 0, Fail: 0, Skip: 9 Validating /redfish/v1/Systems/system/LogServices/Dump/Entries... - Pass: 17, Warn: 0, Fail: 0, Skip: 30 Validating /redfish/v1/Systems/system/LogServices/Dump/Entries/1... - Pass: 10, Warn: 0, Fail: 0, Skip: 26 +--------------+--------------+--------------+--------------+ | PASS | WARN | FAIL | NOT TESTED | +--------------+--------------+--------------+--------------+ | 41 | 0 | 0 | 65 | +--------------+--------------+--------------+--------------+ Managers/Dump Validating /redfish/v1/Managers/bmc/LogServices/Dump... - Pass: 14, Warn: 0, Fail: 0, Skip: 9 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries... - Pass: 26, Warn: 0, Fail: 0, Skip: 58 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/1... - Pass: 9, Warn: 0, Fail: 0, Skip: 27 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2... - Pass: 9, Warn: 0, Fail: 0, Skip: 27 +--------------+--------------+--------------+--------------+ | PASS | WARN | FAIL | NOT TESTED | +--------------+--------------+--------------+--------------+ | 58 | 0 | 0 | 121 | +--------------+--------------+--------------+--------------+ Managers/FaultLog Validating /redfish/v1/Managers/bmc/LogServices/FaultLog... - Pass: 12, Warn: 0, Fail: 0, Skip: 9 Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries... - Pass: 13, Warn: 0, Fail: 0, Skip: 34 Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/1... - Pass: 6, Warn: 0, Fail: 0, Skip: 30 +--------------+--------------+--------------+--------------+ | PASS | WARN | FAIL | NOT TESTED | +--------------+--------------+--------------+--------------+ | 31 | 0 | 0 | 73 | +--------------+--------------+--------------+--------------+ Change-Id: Iaac0b9b14b898b079765eb18f513aaea3c417740 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-09-07Inline dump util functionOliver Brewka1-1/+1
It should be avoided using static for header only functions. Tested: Code compiles. Change-Id: Icb944588fc6f64c663960bf40da29e2de9e0b8bd Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-09-07Fix createDump progress logicOliver Brewka1-4/+2
The current logic in createDump always sets the isProgressIntfPresent flag to true, even if it is not present at all. It breaks out of the search loop on the first interface that may not be xyz.openbmc_project.Common.Progress. This can cause a task to time out and not be handled properly since completion is only reported when the Progress interface a) exists and b) reports Status=Completed. Tested: Manually tested on romulus running in qemu with ibm dump extension enabled. POST request to Managers/Dump action ``` curl -v -k POST 'https://localhost:44443/redfish/v1/Managers/bmc/ LogServices/Dump/Actions/LogService.CollectDiagnosticData' \ -H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' \ -H "Content-Type: application/json" -d \ '{"DiagnosticDataType":"Manager", \ "OEMDiagnosticDataType":"Manager"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/2", "@odata.type": "#Task.v1_4_3.Task", "HidePayload": false, "Id": "2", "Messages": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The task with Id '2' has started.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.TaskStarted", "MessageSeverity": "OK", "Resolution": "None." } ], "Name": "Task 2", "Payload": { "HttpHeaders": [ "user-agent: curl/8.20.0", "accept: */*", "content-length: 66" ], "HttpOperation": "POST", "JsonBody": "{\"DiagnosticDataType\":\"Manager\",\"OEMDiagnosticDataType\":\"Manager\"}", "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData" }, "PercentComplete": 0, "StartTime": "2026-09-07T15:10:26+00:00", "TaskMonitor": "/redfish/v1/TaskService/TaskMonitors/2", "TaskState": "Running", "TaskStatus": "OK" * Connection #1 to host localhost:44443 left intact } ``` dbus tree dump manager ``` busctl tree xyz.openbmc_project.Dump.Manager `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/dump |- /xyz/openbmc_project/dump/bmc | `- /xyz/openbmc_project/dump/bmc/entry | |- /xyz/openbmc_project/dump/bmc/entry/1 | |- /xyz/openbmc_project/dump/bmc/entry/2 | `- /xyz/openbmc_project/dump/bmc/entry/3 |- /xyz/openbmc_project/dump/faultlog |- /xyz/openbmc_project/dump/resource `- /xyz/openbmc_project/dump/system `- /xyz/openbmc_project/dump/system/entry |- /xyz/openbmc_project/dump/system/entry/1 `- /xyz/openbmc_project/dump/system/entry/2 ``` bmcweb debug log ``` Sep 07 15:11:02 romulus bmcweb[200]: [dump_utils.hpp:655] /xyz/openbmc_project/dump/bmc/entry/3: Dump creation task is in progress Sep 07 15:11:02 romulus bmcweb[200]: [dump_utils.hpp:655] /xyz/openbmc_project/dump/bmc/entry/3: Dump creation task is in progress Sep 07 15:11:02 romulus bmcweb[200]: [dump_utils.hpp:679] /xyz/openbmc_project/dump/bmc/entry/3: Dump creation task completed ``` Systems/Dump Set machine state to Quiesced ``` busctl set-property xyz.openbmc_project.State.Host0 \ /xyz/openbmc_project/state/host0 \ xyz.openbmc_project.State.Host CurrentHostState \ s "xyz.openbmc_project.State.Host.HostState.Quiesced" ``` POST request to Systems/Dump action ``` curl -v -k POST 'https://localhost:44443/redfish/v1/Systems/system/ LogServices/Dump/Actions/LogService.CollectDiagnosticData' \ -H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' \ -H "Content-Type: application/json" -d \ '{"DiagnosticDataType":"OEM", \ "OEMDiagnosticDataType":"Systems"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/3", "@odata.type": "#Task.v1_4_3.Task", "HidePayload": false, "Id": "3", "Messages": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The task with Id '3' has started.", "MessageArgs": [ "3" ], "MessageId": "TaskEvent.1.0.TaskStarted", "MessageSeverity": "OK", "Resolution": "None." } ], "Name": "Task 3", "Payload": { "HttpHeaders": [ "user-agent: curl/8.20.0", "accept: */*", "content-length: 61" ], "HttpOperation": "POST", "JsonBody": "{\"DiagnosticDataType\":\"OEM\",\"OEMDiagnosticDataType\":\"System\"}", "TargetUri": "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData" }, "PercentComplete": 0, "StartTime": "2026-09-07T15:14:53+00:00", "TaskMonitor": "/redfish/v1/TaskService/TaskMonitors/3", "TaskState": "Running", "TaskStatus": "OK" * Connection #1 to host localhost:44443 left intact } busctl tree xyz.openbmc_project.Dump.Manager `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/dump |- /xyz/openbmc_project/dump/bmc | `- /xyz/openbmc_project/dump/bmc/entry | |- /xyz/openbmc_project/dump/bmc/entry/1 | |- /xyz/openbmc_project/dump/bmc/entry/2 | |- /xyz/openbmc_project/dump/bmc/entry/3 | `- /xyz/openbmc_project/dump/bmc/entry/4 |- /xyz/openbmc_project/dump/faultlog |- /xyz/openbmc_project/dump/resource `- /xyz/openbmc_project/dump/system `- /xyz/openbmc_project/dump/system/entry |- /xyz/openbmc_project/dump/system/entry/1 |- /xyz/openbmc_project/dump/system/entry/2 `- /xyz/openbmc_project/dump/system/entry/3 ``` Set /xyz/openbmc_project/dump/system/entry/3 status to Completed ``` busctl set-property xyz.openbmc_project.Dump.Manager \ /xyz/openbmc_project/dump/system/entry/3 \ xyz.openbmc_project.Common.Progress Status \ s "xyz.openbmc_project.Common.Progress.OperationStatus.Completed" journalctl -u bmcewb Sep 07 15:17:24 romulus bmcweb[200]: [dump_utils.hpp:679] /xyz/openbmc_project/dump/system/entry/3: Dump creation task completed ``` Change-Id: I8efc2588e31d9b838b6a4bf1d33f08b589ed5808 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-09-07Refactor createDump functionOliver Brewka1-169/+176
The function as well as the task callback consisted of multiple lambdas that exceeded the lambda length rule. Extract each lambda into separate functions. Tested: Code compiles. Manually tested on romulus running in qemu with ibm dump extension enabled. POST Managers/bmc ``` curl -v -k POST 'https://localhost:44443/redfish/v1/Managers/bmc/ LogServices/Dump/Actions/LogService.CollectDiagnosticData' \ -H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' \ -H "Content-Type: application/json" -d \ '{"DiagnosticDataType":"Manager", \ "OEMDiagnosticDataType":"Manager"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "HidePayload": false, "Id": "0", "Messages": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The task with Id '0' has started.", "MessageArgs": [ "0" ], "MessageId": "TaskEvent.1.0.TaskStarted", "MessageSeverity": "OK", "Resolution": "None." } ], "Name": "Task 0", "Payload": { "HttpHeaders": [ "user-agent: curl/8.20.0", "accept: */*", "content-length: 68" ], "HttpOperation": "POST", "JsonBody": "{\"DiagnosticDataType\":\"Manager\", \"OEMDiagnosticDataType\":\"Manager\"}", "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/ LogService.CollectDiagnosticData" }, "PercentComplete": 0, "StartTime": "2026-09-01T03:39:42-07:00", "TaskMonitor": "/redfish/v1/TaskService/TaskMonitors/0", "TaskState": "Running", "TaskStatus": "OK" * Connection #1 to host localhost:4343 left intact } ``` bmcweb log output: ``` Sep 01 14:58:28 romulus bmcweb[200]: [dump_utils.hpp:720] Dump Created. Path: /xyz/openbmc_project/dump/bmc/entry/2 ... Sep 01 14:58:53 romulus bmcweb[200]: [dump_utils.hpp:564] /xyz/ openbmc_project/dump/bmc/entry/2: Dump creation task is in progress Sep 01 14:58:53 romulus bmcweb[200]: [dump_utils.hpp:564] /xyz/ openbmc_project/dump/bmc/entry/2: Dump creation task is in progress Sep 01 14:58:53 romulus bmcweb[200]: [dump_utils.hpp:588] /xyz/ openbmc_project/dump/bmc/entry/2: Dump creation task completed ``` dump/bmc tree after two POST request ``` busctl tree xyz.openbmc_project.Dump.Manager `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/dump |- /xyz/openbmc_project/dump/bmc | `- /xyz/openbmc_project/dump/bmc/entry | |- /xyz/openbmc_project/dump/bmc/entry/1 | |- /xyz/openbmc_project/dump/bmc/entry/2 |- /xyz/openbmc_project/dump/faultlog |- /xyz/openbmc_project/dump/resource `- /xyz/openbmc_project/dump/system ``` POST Systems/system CreateDump only works if the host is either in "Running", "Quiesced" or "TransitioningToOff" state. ``` busctl set-property xyz.openbmc_project.State.Host0 /xyz/openbmc_project/state/host0 \ xyz.openbmc_project.State.Host \ CurrentHostState \ s "xyz.openbmc_project.State.Host.HostState.Quiesced" ``` ``` curl -v -k POST 'https://localhost:44443/redfish/v1/Systems/system/ LogServices/Dump/Actions/LogService.CollectDiagnosticData' \ -H 'X-Auth-Token: '"$BMCWEB_SESSION_TOKEN_ROML"'' \ -H "Content-Type: application/json" -d \ '{"DiagnosticDataType":"OEM", "OEMDiagnosticDataType":"System"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/2", "@odata.type": "#Task.v1_4_3.Task", "HidePayload": false, "Id": "2", "Messages": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The task with Id '2' has started.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.TaskStarted", "MessageSeverity": "OK", "Resolution": "None." } ], "Name": "Task 2", "Payload": { "HttpHeaders": [ "user-agent: curl/8.20.0", "accept: */*", "content-length: 62" ], "HttpOperation": "POST", "JsonBody": "{\"DiagnosticDataType\":\"OEM\", \"OEMDiagnosticDataType\":\"System\"}", "TargetUri": "/redfish/v1/Systems/system/LogServices/Dump/Actions/ LogService.CollectDiagnosticData" }, "PercentComplete": 0, "StartTime": "2026-09-01T03:54:01-07:00", "TaskMonitor": "/redfish/v1/TaskService/TaskMonitors/2", "TaskState": "Running", "TaskStatus": "OK" * Connection #1 to host localhost:4343 left intact } ``` Set system dump entry to completed: ``` busctl set-property xyz.openbmc_project.Dump.Manager /xyz/ openbmc_project/dump/system/entry/1 \ xyz.openbmc_project.Common.Progress Status \ s "xyz.openbmc_project.Common.Progress.OperationStatus.Completed" ``` bmcweb log output: ``` Sep 02 11:26:44 romulus bmcweb[200]: [dump_utils.hpp:804] Dump Created. Path: /xyz/openbmc_project/dump/system/entry/1 ... Sep 02 11:28:13 romulus bmcweb[200]: [dump_utils.hpp:672] /xyz/ openbmc_project/dump/system/entry/1: Dump creation task completed ``` busctl tree xyz.openbmc_project.Dump.Manager ``` `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/dump |- /xyz/openbmc_project/dump/bmc | `- /xyz/openbmc_project/dump/bmc/entry | |- /xyz/openbmc_project/dump/bmc/entry/1 | |- /xyz/openbmc_project/dump/bmc/entry/2 |- /xyz/openbmc_project/dump/faultlog |- /xyz/openbmc_project/dump/resource `- /xyz/openbmc_project/dump/system `- /xyz/openbmc_project/dump/system/entry `- /xyz/openbmc_project/dump/system/entry/1 ``` Change-Id: Id48b4643fcb634405b06db928e9a5c9d951f3ee4 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-09-03Fix unchecked optional value in dump createTaskOliver Brewka1-2/+10
In order to silence clang-tidy, check payload value. Tested: Code compiles. clang-tidy runs through. Change-Id: Ib9db2552b0c9f8974728b8afe909a138d948b278 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-09-03Break out dump / faultlog log servicesOliver Brewka1-0/+922
Similar to how other log services got broken out into own header files, do the same for dump / faultlog. A new dump utility header has been created, request handler and route register function went into manager / systems log service header files respectively. Code logic stays untouched in this patch. Tested: Code compiles. Unit test runs through. Validator was run on romulus in qemu with phosphor-debug-collector ibm extension enabled to get access to /xyz/openbmc_project/dump/system. Via the 'CreateDump' method empty dump entries were manually created for: /xyz/openbmc_project/dump/system /xyz/openbmc_project/dump/bmc /xyz/openbmc_project/dump/faultlog ``` busctl call xyz.openbmc_project.Dump.Manager \ /xyz/openbmc_project/dump/bmc \ xyz.openbmc_project.Dump.Create \ CreateDump a{sv} 0 > o "/xyz/openbmc_project/dump/bmc/entry/1" busctl tree xyz.openbmc_project.Dump.Manager `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/dump |- /xyz/openbmc_project/dump/bmc | `- /xyz/openbmc_project/dump/bmc/entry | |- /xyz/openbmc_project/dump/bmc/entry/1 | |- /xyz/openbmc_project/dump/bmc/entry/2 | |- /xyz/openbmc_project/dump/bmc/entry/3 | |- /xyz/openbmc_project/dump/bmc/entry/4 | |- /xyz/openbmc_project/dump/bmc/entry/5 | `- /xyz/openbmc_project/dump/bmc/entry/6 |- /xyz/openbmc_project/dump/faultlog | `- /xyz/openbmc_project/dump/faultlog/entry | `- /xyz/openbmc_project/dump/faultlog/entry/1 |- /xyz/openbmc_project/dump/resource `- /xyz/openbmc_project/dump/system `- /xyz/openbmc_project/dump/system/entry `- /xyz/openbmc_project/dump/system/entry/1 ``` Overwrite OperationStatus of /xyz/openbmc_project/dump/system/entry/1 for the entry to be added to the collection: ``` busctl set-property xyz.openbmc_project.Dump.Manager \ /xyz/openbmc_project/dump/system/entry/1 \ xyz.openbmc_project.Common.Progress Status \ s xyz.openbmc_project.Common.Progress.OperationStatus.Completed \ ``` Systems/Dump Validating /redfish/v1/Systems/system/LogServices/Dump... - Pass: 14, Warn: 0, Fail: 0, Skip: 9 Validating /redfish/v1/Systems/system/LogServices/Dump/Entries... - Pass: 17, Warn: 0, Fail: 0, Skip: 30 Validating /redfish/v1/Systems/system/LogServices/Dump/Entries/1... - Pass: 10, Warn: 0, Fail: 0, Skip: 26 +--------------+--------------+--------------+--------------+ | PASS | WARN | FAIL | NOT TESTED | +--------------+--------------+--------------+--------------+ | 41 | 0 | 0 | 65 | +--------------+--------------+--------------+--------------+ Managers/Dump Validating /redfish/v1/Managers/bmc/LogServices/Dump... - Pass: 14, Warn: 0, Fail: 0, Skip: 9 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries... - Pass: 70, Warn: 0, Fail: 0, Skip: 162 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/1... - Pass: 11, Warn: 0, Fail: 0, Skip: 25 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2... - Pass: 11, Warn: 0, Fail: 0, Skip: 25 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/3... - Pass: 9, Warn: 0, Fail: 0, Skip: 27 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/4... - Pass: 9, Warn: 0, Fail: 0, Skip: 27 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/5... - Pass: 9, Warn: 0, Fail: 0, Skip: 27 Validating /redfish/v1/Managers/bmc/LogServices/Dump/Entries/6... - Pass: 9, Warn: 0, Fail: 0, Skip: 27 +--------------+--------------+--------------+--------------+ | PASS | WARN | FAIL | NOT TESTED | +--------------+--------------+--------------+--------------+ | 142 | 0 | 0 | 329 | +--------------+--------------+--------------+--------------+ Managers/FaultLog Validating /redfish/v1/Managers/bmc/LogServices/FaultLog... - Pass: 12, Warn: 0, Fail: 0, Skip: 9 Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries... - Pass: 13, Warn: 0, Fail: 0, Skip: 34 Validating /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/1... - Pass: 6, Warn: 0, Fail: 0, Skip: 30 +--------------+--------------+--------------+--------------+ | PASS | WARN | FAIL | NOT TESTED | +--------------+--------------+--------------+--------------+ | 31 | 0 | 0 | 73 | +--------------+--------------+--------------+--------------+ Change-Id: I6379f877149c545b3b3bfcda8510c6ee1085dcf9 Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-08-28Refactor location_utils getLocationCode lambdaYuvakumar Selvamani1-19/+23
getLocationCode() used an inline lambda for the D-Bus async response callback. The lambda body was long enough to trigger the long-lambda ast-grep rule, which required an inline suppression comment (// ast-grep-ignore: long-lambda). Extract the lambda into a named afterGetLocationCode() function and bind it with std::bind_front() instead. This matches the existing bmcweb pattern for D-Bus response callbacks, improves readability, and removes the need for the ast-grep suppression. Also change the EBADR log message from BMCWEB_LOG_ERROR to BMCWEB_LOG_WARNING. Tested: - Tested on an AST2600 SoC platform. - Redfish Service Validator passed with no new errors or warnings. Change-Id: I3ffa51b1f6bb4bc7bd31e0b2f361294c8aa36978 Signed-off-by: Yuvakumar Selvamani <yuvakumars@ami.com>
2026-08-26clang-tidy fixes for log services headerOliver Brewka2-16/+14
Silent clang-tidy warnings: - remove unused header includes - switch <systemd/sd_bus.h> to <systemd/sd-bus-protocol> for sd_bus_error usage - change str.find usage to str.contains Tested: Code compiles. Change-Id: I814239d47e1586ebc28bccc00c08e41f711b9beb Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
2026-08-21redfish-core: Refactor sw_utils lambdasYuvakumar Selvamani1-52/+55
The getSwMinimumVersion and getSwStatus functions each contained an inline lambda that triggered the long-lambda ast-grep rule, requiring an inline suppression (// ast-grep-ignore: long-lambda). This commit extracts each lambda into a separate named function, afterGetSwMinimumVersion and afterGetSwStatus respectively, and uses std::bind_front to handle the asynchronous callback. This aligns the code with the preferred bmcweb pattern for D-Bus callbacks, improves readability, and allows the removal of the static analysis suppressions. Tested: - No other functional change. - Tested on an AST2600 SoC platform. - Redfish Service Validator passed with no new errors or warnings introduced. Change-Id: I5557501b1af6506ebd23301110899b324b94d867 Signed-off-by: Yuvakumar Selvamani <yuvakumars@ami.com>
2026-08-21Refactor asset_utils getAssetInfo lambdaYuvakumar Selvamani1-17/+23
The getAssetInfo function contained an inline lambda that triggered the long-lambda ast-grep rule, requiring an inline suppression (// ast-grep-ignore: long-lambda). This commit extracts the lambda into a separate afterGetAssetInfo function and uses std::bind_front to handle the asynchronous callback. This aligns the code with the preferred bmcweb pattern for D-Bus callbacks, improves readability, and allows the removal of the static analysis suppression. Tested: - No other functional change. - Tested on an AST2600 SoC platform. - Redfish Service Validator passed with no new errors or warnings introduced. Change-Id: I471ab2402be00c81e629e965994a650024e120c4 Signed-off-by: Yuvakumar Selvamani <yuvakumars@ami.com>
2026-08-21redfish-core: Refactor getManagedHostPropertyYuvakumar Selvamani1-13/+19
The getManagedHostProperty function contained an inline lambda that triggered the long-lambda ast-grep rule, requiring an inline suppression (// ast-grep-ignore: long-lambda). This commit extracts the lambda into a separate afterGetManagedHostProperty function and uses std::bind_front to handle the asynchronous callback. This aligns the code with the preferred bmcweb pattern for D-Bus callbacks, improves readability, and allows the removal of the static analysis suppression. Tested: - No other functional change. - Tested on an AST2600 SoC platform. - Redfish Service Validator passed with no new errors or warnings introduced. Change-Id: I8e1fe0aae26b07a4f84c1d41aef536627f7051ac Signed-off-by: Yuvakumar Selvamani <yuvakumars@ami.com>
2026-08-19utils: Map Available to UnavailableOfflineJustin Nguyen1-0/+165
- State `Available` will be mapped to `UnavailableOffline` for Status.State for resources that are present but unavailable - Added a utility function to reduce code duplication for retrieving resource's Status.State (`getResourceState`) and Status.Health (`getResourceHealth`) Tested: - Compiles and builds - Unit tests pass Change-Id: I1164a9412cbd4e1ab8938366ffc7ea9c7fe58786 Signed-off-by: Justin Nguyen <justinnanguyen@gmail.com>
2026-08-17Refactor fan_utils getFanPaths lambdaYuvakumar Selvamani1-16/+20
The getFanPaths function contained an inline lambda that triggered the long-lambda ast-grep rule, requiring an inline suppression (// ast-grep-ignore: long-lambda). This commit extracts the lambda into a separate afterGetFanPaths function and uses std::bind_front to handle the asynchronous callback. This aligns the code with the preferred bmcweb pattern for D-Bus callbacks, improves readability, and allows the removal of the static analysis suppression. Change-Id: Ibb72a939590077f1f8b4f19dfc5809d3411d0742 Signed-off-by: Yuvakumar Selvamani <yuvakumars@ami.com>
2026-08-11Use enums for State and Health propertiesVinothkumar Shanmugavel2-12/+13
Several utility functions return State and Health values as std::string literals, which lacks compile-time type safety. This can lead to typos or invalid values that are only caught at runtime. Convert these functions to return resource::State and resource::Health enums instead. These enums are already defined in resource.hpp with NLOHMANN_JSON_SERIALIZE_ENUM mappings and are used extensively throughout the codebase. The enums automatically serialize to the same JSON strings, so there is no functional change. This provides compile-time type checking. Tested: - No functional change. - Verified State and Health properties serialize to identical JSON values. - Redfish Service Validator: PASS: 5788, WARN: 353, FAIL: 0, NOT TESTED: 4878 Change-Id: I590fc3dddac6f126c26814b549d2fea961409170 Signed-off-by: Vinothkumar Shanmugavel <vinothkumars@ami.com>
2026-08-01Implement SubProcessors for processor collectionGeorge Liu1-0/+4
The SubProcessors is a collection under the processor collection schema. The association objects, (containing, contained_by), are used to link the processor. The association between processor and core have been documented in phosphor-dbus-interfaces [1] [1] https://github.com/openbmc/phosphor-dbus-interfaces/commit/8c79b1dc0270d01c0b713a345c8ec39533c542e4 Tested: - GET cpu and cpu subprocessors ``` curl -k -X GET https://${bmc}/redfish/v1/Systems/system/Processors/cpu0 { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0", "@odata.type": "#Processor.v1_18_0.Processor", "Id": "cpu0", ... "SubProcessors": { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0/SubProcessors" }, ... } ``` ``` curl -k -X GET https://${bmc}/redfish/v1/Systems/system/Processors/cpu0/SubProcessors { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0/SubProcessors", "@odata.type": "#ProcessorCollection.ProcessorCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0/SubProcessors/core0" }, { "@odata.id": "/redfish/v1/Systems/system/Processors/cpu0/SubProcessors/core1" }, ... ], "Members@odata.count": 4, "Name": "SubProcessor Collection" } ``` - Verified that below return a link header - GET /redfish/v1/Systems/system/Processors/cpu0/SubProcessors - HEAD /redfish/v1/Systems/system/Processors/cpu0/SubProcessors - Redfish Validator Passed Change-Id: If155b97b0c782d82541c00ecf5ee70cb0180f71f Signed-off-by: George Liu <liuxiwei@ieisystem.com> Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com> Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2026-07-28bmcweb: share processor inventory interfacesJacky Huang1-0/+16
Move the common processor D-Bus interface list into processor_utils.hpp and use it for processor, chassis, PCIe, and environment metrics. This avoids duplicate lists drifting apart. Tested: Only code extraction. Verified Processor responses are unchanged. Change-Id: I952c9985c393a903d2949dc3c7b5b592381e4b7f Signed-off-by: Jacky Huang <jackyhuang@nvidia.com>
2026-07-24Remove final IWYU hintsEd Tanous1-2/+0
IWYU is not a tool we have seen results from in some time. I very much suspect that these few comments are not enough to get a clean build. Clean them up. If we want to turn this tool back on in the future, this patch can be reverted. Tested: Comment only change. Review only. Change-Id: I45ff737800f9d8b1b63db2f482e59f815d7126a2 Signed-off-by: Ed Tanous <ed@tanous.net>
2026-07-23bmcweb: map PCIe Gen6 generationEnder Hsieh1-0/+5
Add Gen6 to redfishPcieGenerationFromDbus so a Gen6 device reports PCIeType Gen6 instead of failing as an unknown generation. The Gen6 value was added to the PCIeSlot generations in phosphor-dbus-interfaces: https://github.com/openbmc/phosphor-dbus-interfaces/commit/8d09e7d Tested: Built for nvl32-obmc; a Gen6 GPU now reports PCIeType "Gen6". Change-Id: I8b51d407887e57a3479b8a39cbbe08aa2993e8b2 Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
2026-07-22Return JSON instead of base64 for EventLog entry attachment downloadArchit Mehrotra1-2/+3
After this change [1] log entry attachment returns a JSON instead of a binary blob, it is no longer required to be base-64 encoded. Return the JSON as-is and modify the response header to reflect the new format. Tested: - Unit tests pass - Built an image with my code, ran it in QEMU: 1. Injected a log entry with command: [2]. 2. Verified LogEntry data [3]. 3. Verified Attachment returns JSON data which is no longer base-64 encoded with expected header [4]. 4. Verified Attachment returns 400 with octet-stream header which was previously accepted [5]. [1] https://gerrit.openbmc.org/c/openbmc/phosphor-logging/+/89777 [2] Command to inject a log entry and its output: ``` log-create xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold --json '{ "SENSOR_NAME": "TEST_SENSOR", "READING_VALUE": 99.5, "UNITS": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", "THRESHOLD_VALUE": 8.0 }' <3> OPENBMC_MESSAGE_ID={"severity":2,"xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold":{"READING_VALUE":99.5,"SENSOR_NAME":"TEST_SENSOR","THRESHOLD_VALUE":8.0,"UNITS":"xyz.openbmc_project.Sensor.Value.Unit.DegreesC","_SOURCE":{"COLUMN":45,"FILE":"/usr/src/debug/phosphor-logging/1.0+git/log_create_main.cpp","FUNCTION":"int generate_event(const std::string&, const nlohmann::json_abi_v3_12_0::json&, std::optional<int>)","LINE":35,"PID":9445}}} /xyz/openbmc_project/logging/entry/40 ``` [3] Logservices request and output ``` curl -ks -u root:0penBmc -H "Content-Type: application/json" https://${bmc}/localhost/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40 { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40/attachment", "Created": "2026-06-23T09:45:05.600-07:00", "EntryType": "Event", "Id": "40", "Message": "Sensor 'TEST_SENSOR' reading of 99.5 (xyz.openbmc_project.Sensor.Value.Unit.DegreesC) is above the 8.0 upper critical threshold.", "MessageArgs": [ "TEST_SENSOR", "99.5", "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", "8.0" ], "MessageId": "SensorEvent.1.0.ReadingAboveUpperCriticalThreshold", "Modified": "2026-06-23T09:45:05.600-07:00", "Name": "Manager Event Log Entry", "Resolution": "Check the condition of the resources listed in RelatedItem.", "Resolved": false, "Severity": "Critical" } ``` [4] LogEntry Attachment ``` curl -ks -u root:0penBmc -H "Accept: application/json" -D - https://localhost/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40/attachment HTTP/1.1 200 OK Allow: GET OData-Version: 4.0 Content-Type: application/json Strict-Transport-Security: max-age=31536000; includeSubdomains Pragma: no-cache Cache-Control: no-store, max-age=0 X-Content-Type-Options: nosniff Date: Tue, 23 Jun 2026 18:07:51 GMT Content-Length: 814 { "additionalData": { "READING_VALUE": "99.5", "SENSOR_NAME": "TEST_SENSOR", "THRESHOLD_VALUE": "8.0", "UNITS": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", "_CODE_FILE": "/usr/src/debug/phosphor-logging/1.0+git/log_create_main.cpp", "_CODE_FUNC": "int generate_event(const std::string&, const nlohmann::json_abi_v3_12_0::json&, std::optional<int>)", "_CODE_LINE": "35", "_PID": "9445" }, "associations": [], "eventId": "", "id": 40, "jsonVersion": 1, "message": "xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold", "resolution": "", "resolved": false, "severity": 2, "timestamp": 1782233105600, "updateTimestamp": 1782233105600, "version": "catalina-47de2434c3a-dirty" } ``` [5] Verify that the octet-stream header is rejected ```curl -ks -u root:0penBmc -H "Accept: application/octet-stream" -D - https://localhost/redfish/v1/Managers/bmc/LogServices/EventLog/Entries/40/attachment HTTP/1.1 400 Bad Request Allow: GET OData-Version: 4.0 Content-Type: application/json Strict-Transport-Security: max-age=31536000; includeSubdomains Pragma: no-cache Cache-Control: no-store, max-age=0 X-Content-Type-Options: nosniff Date: Tue, 23 Jun 2026 17:03:06 GMT Content-Length: 814 { "additionalData": { "READING_VALUE": "99.5", "SENSOR_NAME": "TEST_SENSOR", "THRESHOLD_VALUE": "8.0", "UNITS": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", "_CODE_FILE": "/usr/src/debug/phosphor-logging/1.0+git/log_create_main.cpp", "_CODE_FUNC": "int generate_event(const std::string&, const nlohmann::json_abi_v3_12_0::json&, std::optional<int>)", "_CODE_LINE": "35", "_PID": "9445" }, "associations": [], "eventId": "", "id": 40, "jsonVersion": 1, "message": "xyz.openbmc_project.Sensor.Threshold.ReadingAboveUpperCriticalThreshold", "resolution": "", "resolved": false, "severity": 2, "timestamp": 1782233105600, "updateTimestamp": 1782233105600, "version": "catalina-47de2434c3a-dirty" } ``` Change-Id: Ic6019b80ca6ea32783ae2ffe711adeb5ef2eb157 Signed-off-by: Archit Mehrotra <architmehrotra@meta.com>
2026-07-22sensor: add frequency type supportVishnunithyasoundhar S1-0/+8
Add Frequency ReadingType and Hz units mapping for sensors exposed under /sensors/frequency. Ref to gerrit PR introducing the same in PDI: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/83009 Change-Id: I7b2dc504682863cc3243cb7ccf0dbaf4db1e3e55 Signed-off-by: Vishnunithyasoundhar S <vishnunithyasoundhar.s@intel.com>
2026-07-11redfish: Return empty DBus EventLog collectionJoel Pullokaran Jesin1-1/+9
When the DBus-backed EventLog entry collection is unavailable, return an empty Redfish collection instead of an internal error for expected absence cases. Treat EBADR and host_unreachable from GetManagedObjects as optional backend unavailability. In those cases, populate Members with an empty array and set Members@odata.count to 0, while continuing to surface unexpected DBus errors as internal errors. Tested: - ninja -C build bmcweb Change-Id: Iffff05231927f8d2239b25bbbb98960d7b5d71e0 Signed-off-by: Joel Pullokaran Jesin <joelpj@ami.com>
2026-07-01Flag long lambdasEd Tanous8-0/+11
Long lambdas have been documented as an anti-pattern for some time.[1] Despite this being generally understood, bmcweb has a long ways to go cleaning these up, and routinely code is submitted in violation of this anti-pattern. Invent an ast-grep rule that can identify when new examples of this anti-pattern are added, and ignore the existing 200+ examples that are in the codebase already using ast-grep ignore. These flags will give us something to search for as we clean this up, and will help to prevent new instances from being added unintentionally. [1] https://github.com/openbmc/docs/blob/master/anti-patterns.md#very-long-lambda-callbacks Tested: Comment only change. ast-grep passes. Manually removing an ast-grep ignore flag shows as a failure in ast-grep scan Change-Id: I77d634a393884969f184d2c39c02cc08288d5a29 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-06-26fix 'Chassis' property in oem schemaAlexander Hansen1-0/+28
`redfish-core/schema/oem/openbmc/` oem schema defines 'Chassis' property for fan zones but the implementation forms invalid chassis links. Affected options: redfish-oem-manager-fan-data=enabled (default) Using following configuration, plus a few fans and pid controller (a typical single-host 2U server with 3 fans, Tyan S8030 board) ``` { "FailSafePercent": 100, "MinThermalOutput": 10, "Name": "Zone0", "Type": "Pid.Zone" }, ``` It is straightforward to get a response like below ``` ... "FanZones": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones", "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZones", "Zone0": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0", "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZone", "Chassis": { "@odata.id": "/redfish/v1/Chassis/Zone0" }, "FailSafePercent": 100.0, "MinThermalOutput": 10.0 } }, ... ``` when querying ``` curl --insecure --user root:root https://${bmc}/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan ``` For reference, the chassis collection ``` { "@odata.id": "/redfish/v1/Chassis", "@odata.type": "#ChassisCollection.ChassisCollection", "Members": [ { "@odata.id": "/redfish/v1/Chassis/MBX_1_57_Chassis" }, { "@odata.id": "/redfish/v1/Chassis/Tyan_S8030_Baseboard" } ], "Members@odata.count": 2, "Name": "Chassis Collection" } ``` Since that configuration is representative of various boards and the bug has been seen by others before [1] (in terms of a fan zone and chassis sharing the same name, suggesting ill-formed link), fix the implementation to use the result of GetManagedObjects call and find valid chassis path there. This is to allow redfish validator to pass with default meson options and a common system configuration. Since it's a config dependent failure it would be great for others to test and share their result. Inspection of the code causing validation failure: ``` auto pids = std::make_shared<GetPIDValues>(asyncResp); pids->run(); then run(); returns and `~GetPIDValues()` is called which calls processingComplete which calls asyncPopulatePid ``` Inside `asyncPopulatePid` it does `dbus::utility::getManagedObjects` and iterates over the results ``` 112 for (const auto& pathPair : managedObj) 113 { 114 for (const auto& intfPair : pathPair.second) ``` then checks for an interface ``` 180 if (intfPair.first == pidZoneConfigurationIface) 181 { 182 sdbusplus::message::object_path pidPath( 183 pathPair.first.str); 184 std::string chassis = pidPath.filename(); 185 if (chassis.empty()) 186 { 187 chassis = "#IllegalValue"; 188 } ``` and simply uses the object path from PID Zone config interface to extract the leaf and insert that as the chassis link. It can only work in case the Board/Chassis interface is on the same object path which is unlikely. Tested: on Tyan S8030. Result after the change, the optional property now contains the correct chassis link. ``` ... "FanZones": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones", "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZones", "Zone0": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0", "@odata.type": "#OpenBMCManager.v1_0_0.Manager.FanZone", "Chassis": { "@odata.id": "/redfish/v1/Chassis/MBX_1_57_Chassis" }, "FailSafePercent": 100.0, "MinThermalOutput": 10.0 } }, ... ``` ``` /tmp/rsv-venv/bin/rf_service_validator \ --auth Session -i https://${bmc}:443 \ -u ${username} -p ${password} --payload 'Tree' /redfish/v1/Managers/bmc ... Elapsed time: 0:00:32 Listing any warnings and errors: Results Summary: Pass: 766, Fail: 0, Warning: 0 Validation has succeeded. ``` RF validator Tree validation errors are reduced compared to previous. References: [1] https://discordapp.com/channels/775381525260664832/1449737223493910559/1450273124804333598 Change-Id: I2a2db456f42c5dafa451f69362b1d9c8a094e86e Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com> Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-06-12sensor: add charge type supportJagpal Singh Gill1-0/+8
Add ChargeAh ReadingType and Ah units mapping for charge sensors exposed under /sensors/charge/ D-Bus path. This enables battery backup unit remaining and full charge sensors to appear in Redfish. Unit test added for charge sensor type. Tested: 1. Sensor Query using curl - ``` { "@odata.id": "/redfish/v1/Chassis/BBU_SHELF_1/Sensors/charge_BBU_SHELF_1_BBU5_REMAINING_CHARGE_AH", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "charge_BBU_SHELF_1_BBU5_REMAINING_CHARGE_AH", "Name": "BBU SHELF 1 BBU5 REMAINING CHARGE AH", "Reading": 10477.0, "ReadingType": "ChargeAh", "ReadingUnits": "Ah", "Status": { "Health": "OK", "State": "Enabled" }, ... } ``` 2. Redfish Validation passed using Redfish Validator. Signed-off-by: Jagpal Singh Gill <paligill@gmail.com> Change-Id: I9b7180cb8597378a1b42f9da73335ca96b20d55a
2026-06-04PCIE: add DeviceType to PCIeDeviceEric Liu1-0/+35
Map the Inventory.Item.PCIeDevice.DeviceType D-Bus property into the Redfish PCIeDevice schema's DeviceType property. When the D-Bus value is the PDI default (Unknown), the Redfish field is omitted; otherwise the enum is rendered. The implementation maps D-Bus to Redfish as follows: - Inventory.Item.PCIeDevice.DeviceTypes.SingleFunction -> PCIeDevice.DeviceType.SingleFunction - Inventory.Item.PCIeDevice.DeviceTypes.MultiFunction -> PCIeDevice.DeviceType.MultiFunction - Inventory.Item.PCIeDevice.DeviceTypes.Simulated -> PCIeDevice.DeviceType.Simulated - Inventory.Item.PCIeDevice.DeviceTypes.Retimer -> PCIeDevice.DeviceType.Retimer - Inventory.Item.PCIeDevice.DeviceTypes.Unknown / empty -> field omitted Key changes: - redfish-core/include/utils/pcie_util.hpp: add redfishPcieDeviceTypeFromDbus() that maps the D-Bus DeviceTypes enum strings to pcie_device::DeviceType. - redfish-core/lib/pcie.hpp: unpack the DeviceType property in addPCIeDeviceProperties() and set jsonValue["DeviceType"] using the mapper. Tested: Built an image for nvl32-obmc with the following patches cherry-picked: ``` 1. Align with upstream u-boot dts tree: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89932 2. U-Boot change phy mode (in-flight on mailing list): https://lore.kernel.org/openbmc/20260504044702.2613879-1-\ andhsieh@nvidia.com/T/#t 3. Kernel device tree add mac mode (in-flight on mailing list): https://lore.kernel.org/linux-aspeed/20260505050541.\ 3031447-1-andhsieh@nvidia.com/T/#t 4. platform-init enable LCLK and espiCLK: https://gerrit.openbmc.org/c/openbmc/platform-init/+/89900 5. mctpd configuration: https://gerrit.openbmc.org/c/openbmc/openbmc/+/87390 6. Enable nvidia-gpu sensor: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89933 ``` Deployed the rebuilt bmcweb onto Alon8-GBT-20. ``` $ curl -sk -u <credentials> \ https://${BMC}/redfish/v1/Systems/system/PCIeDevices/\ GPU_0_0 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/\ GPU_0_0", "@odata.type": "#PCIeDevice.v1_19_0.PCIeDevice", "DeviceType": "SingleFunction", ... } $ curl -sk -u <credentials> \ https://${BMC}/redfish/v1/Systems/system/PCIeDevices/\ Nvidia_ConnectX_0_PCIe { ... (no DeviceType field; D-Bus property not registered) } ``` 1. Verified the Redfish DeviceType field is rendered as SingleFunction on the GPU PCIeDevice resource. 2. Verified the field is omitted when the D-Bus property is not registered (ConnectX path), so the Redfish output remains consistent with the PDI default behavior. 3. Redfish Service Validator: pass. Change-Id: I13a6214f71e9a06b5f2ab9ca8abef6663a856da2 Signed-off-by: Eric Liu <liuer@nvidia.com>
2026-05-17Add uint64_t fallback when unpacking float valuesSwaroop Aradhya N M1-0/+9
nlohmann/json v3.11.3 changed behavior (issue #4475) where positive integer values are now stored internally as uint64_t instead of int64_t. The floating-point unpack path in unpackValueWithErrorCode() only attempted double* and int64_t* fallbacks. As a result, PATCH requests with integer values targeting a double field were rejected with invalidType, while float values continued to work. This was a partial fix introduced in commit 8d9cf72d ("Work around nlohmann changes"), which correctly added uint64_t fallbacks for the signed/unsigned integer unpack paths but missed the floating- point path. Adding a uint64_t* fallback in the is_floating_point_v branch, mirroring the pattern used in the signed integer branch, so that integer JSON values are safely cast to double and accepted. Tested: PATCH method with both integer and float Reading values succeeds as expected Change-Id: Id8eac85820b70fc41ae52b5d31236b541a8c3d92 Signed-off-by: Utkarsh Kumar <utkarshx.kumar@intel.com> Signed-off-by: Swaroop Aradhya N M <swaroopx.aradhya.n.m@intel.com>
2026-04-21Add helper function for Location and `LocationType`Ed Tanous1-0/+80
The location_util::getLocation is used to find the `LocationCode` interface used for `ServiceLabel`. Also added logic to look for the Inventory.Connector.X interfaces to populate `LocationType`. The helper function is added to serve as the common location helper and remove the same method call in each individual resource files. For example, `Inventory.Connector.Embedded` means LocationType of Embedded type. Currently only support LocationType of - Slot - Embedded Tested: No changes to redfish tree yet Added unit tests Change-Id: I7f2a8d6172e37dd72881fbfb5a9dfeaf83b2db09 Signed-off-by: Zhenwei Chen <zhenweichen0207@gmail.com> Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-04-21Remove static variablesEd Tanous1-3/+4
These static variables have the potential to cause reentrancy issues. In practice, the conditions to cause issues would require someone to basically write incorrect code, but it makes sense to wrap this into a state tracker anyway to clean up the code. While we're here, convert to using std::chrono. Note, this changes the behavior such that the values produced are now no longer dependent on timezone. Functionally, Redfish only recently got the ability to set a timezone, so this is not expected to have any user facing impact, even though the unit tests need to change. Tested: RSV Passes Change-Id: Icb7cff1d289ae23790a5fb1db6604abd73dd68fd Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-04-21Deduplicate functionEd Tanous1-45/+3
These two functions differ in only one minor thing, how the first entry is handled. event_log::getUniqueEntryID is better unit tested, so move to it for all uses. Next commit will move the static variables out so the behavior of these two methods is identical. Tested: in next commit Change-Id: I7a27d3506a6fec1f62fe8f584dbceb0ac34893ac Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-04-21Remove time_tEd Tanous1-2/+1
time_t is less specific than using the equivalents in std::chono. In practice, most of the time we end up converting the time_t to some std::chrono class anyway. Avoid the intermediate conversion and just use the std::chrono version of time. Tested: Unit tests pass. Good Coverage Change-Id: I2e3eca78760e158feaaf4b91793631343e417f15 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-04-15sdbusplus: use shorter type aliasesPatrick Williams9-44/+39
The sdbusplus headers provide shortened aliases for many types. Switch to using them to provide better code clarity and shorter lines. Possible replacements are for: * bus_t * exception_t * manager_t * match_t * message_t * object_t * slot_t * object_path Change-Id: Iace20f9ad26e8d9dc234979e7a4087d599da2641 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2026-04-11Expose date/time in local timezoneIgor Kanyuka2-21/+15
BMC now exposes DateTime property under the Manager/<ID> in timezone configured on the BMC (local TZ) and not in UTC, but the other date time properties are still in UTC. Convert date time fields to local timezone. Tested: 1. Redfish service validator 2. Built Facebook's Catalina image with this change, ran in QEMU and checked manually varioius endpoints. 3. Ran automated tests [1] from openbmc-test-automation repo. 4. Unit tests [1] https://gerrit.openbmc.org/c/openbmc/openbmc-test-automation/+/88659 Change-Id: I8e587c7a1030deff8e6a550651c5e62719fe5299 Signed-off-by: Igor Kanyuka <ifelmail@gmail.com> Signed-off-by: Ed Tanous <ed@tanous.net>
2026-03-31Encapsulate sd-journalEd Tanous2-67/+88
It would be better if the larger compile units didn't have to pull in the sd-journal header. At the same time, there's C handling of a number of resources that could be moved to an RAII class, and unit tests that we can add. This commit does all those things. Note, vacuum.journal is a file created with ``` journalctl --rotate && sleep 1 && journalctl --rotate ```` And contains a few log entries. Note, while this file is 8MB, the majority are zeros, so git should compress it just fine. Tested: Unit tests updated. Redfish service validator passes Change-Id: If578316bcd1d0162b7ecdcca27c1c7818ce2b6fa Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-03-25Upgrade to Boost 1.90Ed Tanous1-2/+1
Boost seems to have removed some of the enums that were previously in the enumeration[1]. We relied on two of these Http2-Settings and Content-Tranfer-Encoding. It's not clear why they were removed, but move those to using inline strings. [1] https://github.com/boostorg/beast/pull/3042/changes/db31a880525fe84b0e17b80015049363106c5b61 Change-Id: I233f103531de1361f903bae5c2981845143983d1 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-03-20Allow to set Manager TZ and show its time in localIgor Kanyuka2-3/+14
Current code always return Date time in UTC, despite local timezone may differ. This change allows to set manager timezone via redfish and show manager's TZ and offset in manager's local timezone. When the DateTime is being patched, the provided date time gets converted from the provided TZ to the local timezone, but configured TZ does not get changed. A user must explicitly patch TimeZoneName to change Manager's TZ. Tested: 1. Built an image, ran in QEMU, changed TZ to PST8PDT (negative offset), UTC (0 offset), and Tokyo (positive offset). Made sure the patch works and all the touched fields have correct values. See [1]. 2. Unit tests 3. Redfish validator [1] ``` $ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName' "2026-03-19T11:03:16-07:00" "-07:00" "PST8PDT" $ curl -i -k -H 'Content-type: application/json' -u root:0penBmc -d '{"TimeZoneName": "UTC"}' -X PATCH https://localhost:8443/redfish/v1/Managers/bmc HTTP/1.1 204 No Content Allow: GET, PATCH 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 Date: Thu, 19 Mar 2026 18:03:28 GMT Content-Length: 0 $ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName' "2026-03-19T18:03:53+00:00" "+00:00" "UTC" $ curl -i -k -H 'Content-type: application/json' -u root:0penBmc -d '{"TimeZoneName": "Asia/Tokyo"}' -X PATCH https://localhost:8443/redfish/v1/Managers/bmc HTTP/1.1 204 No Content Allow: GET, PATCH 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 Date: Thu, 19 Mar 2026 18:04:20 GMT Content-Length: 0 $ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName' "2026-03-20T03:04:32+09:00" "+09:00" "Asia/Tokyo" $ curl -i -k -H 'Content-type: application/json' -u root:0penBmc -d '{"DateTime": "2026-01-02T11:03:16-07:00"}' -X PATCH https://localhost:8443/redfish/v1/Managers/bmc HTTP/1.1 204 No Content Allow: GET, PATCH 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 Date: Fri, 02 Jan 2026 18:03:16 GMT Content-Length: 0 $ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc | jq '.DateTime, .DateTimeLocalOffset, .TimeZoneName' "2026-01-03T03:03:21+09:00" "+09:00" "Asia/Tokyo" $ curl -s -k -H 'Content-type: application/json' -u root:0penBmc https://localhost:8443/redfish/v1/Managers/bmc/LogServices/Journal/Entries | jq '.Members[0]' { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/cz0zNTMzMTVkMTBjYWQ0ZTg5ODJiYjliZGVmOTc2NDE2MDtpPTE7Yj00YzU5NzY1NzQ0M2M0N2IzOWZjYTZiNzU1ZWVlY2NjOTttPTFlZjc1Yzg7dD02MzY0OGQxOTFhZTE0O3g9ZDU5MjYwNzJkZTgzMWYzYw==", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2025-05-29T16:30:41.794580+00:00", "EntryType": "Oem", "Id": "cz0zNTMzMTVkMTBjYWQ0ZTg5ODJiYjliZGVmOTc2NDE2MDtpPTE7Yj00YzU5NzY1NzQ0M2M0N2IzOWZjYTZiNzU1ZWVlY2NjOTttPTFlZjc1Yzg7dD02MzY0OGQxOTFhZTE0O3g9ZDU5MjYwNzJkZTgzMWYzYw==", "Message": "kernel: Booting Linux on physical CPU 0xf00", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" } ``` Change-Id: I5a4567b9ca6a0f56dd9d1b971d418a19bf625a10 Signed-off-by: Igor Kanyuka <ifelmail@gmail.com>
2026-03-19sensor_utils: Assume non-finite values as unpopulatedAmithash Prasad1-6/+21
Threshold property pairs such as LowerCritical, UpperCritical when not defined by the service will now be represented as null. ReadingRangeMax and ReadingRangeMin properties will be absent if they are undefined by the service. Depending on the configuration many sensors might not specify values and these properties on DBus would default to inf/-inf. Examples of these properties are MinValue, MaxValue along with Thresholds where only one of the tuple (upper/lower) is populated. This change will reflect this in output and interpret inf/-inf as "unpopulated" and set to null for thresholds which may be changed by the users and skipped for Min/Max values. This is done by keeping a list of allowed values and inferring it to determine what needs to be done. Tested: Tested changes on a Ventura BMC. Ensured that `journalctl -f -u bmcweb` no longer has a flood of entries with `Sensor value for MaxValue was unexpectedly inf`. Also ensure the output of curl matches new expectation Missing Min/Max Value results in missing ReadingRangeMin/Max values: ``` curl https://$BMC/redfish/v1/Chassis/Ventura_Fan_Board_0/Sensors/current_FCB_0_FAN_1_CURR_A { "@odata.id": "/redfish/v1/Chassis/Ventura_Fan_Board_0/Sensors/current_FCB_0_FAN_1_CURR_A", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "current_FCB_0_FAN_1_CURR_A", "Name": "FCB 0 FAN 1 CURR A", "Reading": 0.3793103448275862, "ReadingType": "Current", "ReadingUnits": "A", "Status": { "Health": "OK", "State": "Enabled" } } ``` Ensure that when one tuple of the range is missing we insert null ``` curl https://$BMC/redfish/v1/Chassis/Ventura_RMC/Sensors/power_RMC_HSC_PWR_W { "@odata.id": "/redfish/v1/Chassis/Ventura_RMC/Sensors/power_RMC_HSC_PWR_W", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "power_RMC_HSC_PWR_W", "Name": "RMC HSC PWR W", "Reading": 35.602771994768936, "ReadingRangeMax": 3000.0, "ReadingRangeMin": 0.0, "ReadingType": "Power", "ReadingUnits": "W", "Status": { "Health": "OK", "State": "Enabled" }, "Thresholds": { "LowerCritical": { "Reading": null }, "UpperCritical": { "Reading": 580.0 } } } ``` Executed redfish service validator on a QEMU instance with an external sensor with missing lower critical/warning sensors. ``` *** Validating /redfish/v1/Chassis/MyCoolBoard/Sensors/temperature_HostDevTemp Type (Sensor.v1_11_0.Sensor), GET SUCCESS (time: 0:00:00.000026) PASS ``` Change-Id: I78c0529cd52f7703af6346b239ecb7519479b70d Signed-off-by: Amithash Prasad <amithash@meta.com>
2026-03-18Fix collection Members io_error regressionTony Ao1-0/+3
Keep existing Members on local I/O failures in the generic collection path, and ensure empty collections still return mandatory Members and Members@odata.count properties. Add a reusable JSON array helper and use it in both collection building and aggregator merge logic to avoid clearing the response on transient failures. Fixes common error #13.[1] [1] https://github.com/openbmc/bmcweb/blob/master/docs/COMMON_ERRORS.md#13-complete-replacement-of-the-response-object Tested: unit test passed; validator passed on empty collection URIs. Change-Id: I8e144f55b99e3f8017abcebb11c409fffebf38ad Signed-off-by: Tony Ao <tao@nvidia.com>
2026-03-17Collection: keep Members stable on io_error; add array helperTony Ao1-8/+26
The generic collection path could clear the "Members" array on a local I/O error, which breaks aggregated responses and can trigger Common Error #13 [1]. The aggregator merge logic also needed a small reusable helper to ensure a JSON value is an array. Add a generic JSON array "ensure" helper in utils/collection.hpp and use it from both the local collection builder and the aggregator merge path. This avoids resetting Members on transient failures and avoids relying on transitive includes for the helper. [1] https://github.com/openbmc/bmcweb/blob/master/docs/COMMON_ERRORS.md#13-complete-replacement-of-the-response-object Tested: Unit tests passed. Change-Id: Iddaa608916af661f75989b4aeae9b557d09eebe3 Signed-off-by: Tony Ao <tao@nvidia.com>
2026-03-17journal_utils: Fix memory leak from sd_journal_get_cursorJason M. Bills1-1/+4
sd_journal_get_cursor() returns a pointer allocated with malloc. That pointer is wrapped in std::unique_ptr to manage it, but the default std::unique_ptr calls delete[], so the memory allocated with malloc is not properly freed. This changes the std::unique_ptr Deleter to be std::free, so when the pointer is destroyed, free is called on the allocated memory to release it. Tested: Looped a GET of /redfish/v1/Managers/bmc/LogServices/Journal/Entries and monitored bmcweb memory usage. Before: 0 sec: VmRSS: 13696 kB RssAnon: 3840 kB RssFile: 9856 kB RssShmem: 0 kB 60s: VmRSS: 29304 kB RssAnon: 18212 kB RssFile: 11092 kB RssShmem: 0 kB 120s: VmRSS: 43976 kB RssAnon: 32844 kB RssFile: 10940 kB RssShmem: 192 kB After: 0 sec: VmRSS: 18008 kB RssAnon: 6836 kB RssFile: 7920 kB RssShmem: 3252 kB 60s: VmRSS: 17048 kB RssAnon: 6172 kB RssFile: 7768 kB RssShmem: 3108 kB 120s: VmRSS: 17136 kB RssAnon: 6180 kB RssFile: 7768 kB RssShmem: 3188 kB Change-Id: I4438a59798f2fb88992edc92e2049ebe3c5592b1 Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
2026-03-05Add SpeedPercent information for FanGeorge Liu1-0/+8
Adds SpeedPercent and SecondarySpeedPercent information according to the Redfish Fan schema.[1] The schema only allows fans of ReadingType Percent to be reported in SpeedPercent and SecondarySpeedPercent. These new properties are accessed through the Redfish Uri for a particular fan on a particular chassis[2]: ``` /redfish/v1/Chassis/<chassisId>/ThermalSubsystem/Fans/<fanId> ``` The primary and secondary fan sensors connected to the fan are found by: 1) Find all sensors associated to fan using the 'sensors' endpoint.[3] 2) For each sensor get its priority using the 'xyz.openbmc_project.Common.Priority' interface.[4][5] 3) Retrieve the sensor excerpt and place into the response based on the priority of the sensor. Implementation Notes: - The utility function objectExcerptToJson() is used to populate the SensorFanExcerpt. - Guards are added to handle different cases of D-Bus sensors Priority settings: - Fan has only 1 sensor associated and the sensor has no priority. Fills SpeedPercent for response. - Fan has more than one sensor. Any sensor without priority will be skipped. - Fan has one or more sensors with priority. The priority setting determines which property will be filled for the response. If the priority is 0 it uses SpeedPercent. If the priority is 1 it uses SecondarySpeedPercent. Any other priority the sensor will not be included in the response. - Fan has two sensors with the same priority. The first one is in the response and the second one is skipped. [1] https://redfish.dmtf.org/schemas/v1/Fan.v1_6_0.json [2] https://www.dmtf.org/sites/default/files/standards/documents/DSP0268_2025.4.html#fan [3] https://github.com/openbmc/docs/blob/master/architecture/sensor-architecture.md#association-type-2-linking-a-low-level-hardware-item-to-its-sensors [4] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/66779 [5] https://gerrit.openbmc.org/c/openbmc/phosphor-hwmon/+/67170 Tested (using p10bmc hardware simulator with fan configuration edits): - Redfish Service Validator passes - Tested various fan configurations with Percent fans: ``` /* Fan has two sensors both with priority set */ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0", "@odata.type": "#Fan.v1_6_0.Fan", ... "SecondarySpeedPercent": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_1", "Reading": 60, "SpeedRPM": 12036.0 }, ... "SpeedPercent": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "Reading": 100, "SpeedRPM": 18000.0 }, ... } /* Fan has two sensors neither with priority, both skipped */ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan1", "@odata.type": "#Fan.v1_6_0.Fan", ... "PartNumber": "XXXXXXX", "SerialNumber": "XXXXXXXXXXXX", "SparePartNumber": "XXXXXXX", "Status": { "Health": "OK", "State": "Enabled" } } /* Fan has one sensor without priority, shown as primary */ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan2", "@odata.type": "#Fan.v1_6_0.Fan", ... "SpeedPercent": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0", "Reading": 50, "SpeedRPM": 18000.0 }, ... } /* Fan has two sensors. Both have priority 0. The first sensor is in the * response the second sensor is skipped. */ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan3", "@odata.type": "#Fan.v1_6_0.Fan", "Id": "fan3", "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.1234567-A3" } }, "LocationIndicatorActive": false, "Manufacturer": "Delta", "Model": "7B5G", "Name": "Fan", "PartNumber": "02YK200", "SerialNumber": "YS10JP12V0TY", "SparePartNumber": "02YK237", "SpeedPercent": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0", "Reading": null, "SpeedRPM": 18000.0 }, "Status": { "Health": "OK", "State": "Enabled" } } /* Fan has two sensors. One priority 0, other priority 2. Only the * primary is in the response. */ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan4", "@odata.type": "#Fan.v1_6_0.Fan", ... "PartNumber": "XXXXXXX", "SerialNumber": "XXXXXXXXXXXX", "SparePartNumber": "XXXXXXX", "SpeedPercent": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0", "Reading": null, "SpeedRPM": 18000.0 }, ... } /* Fan has two sensors. One priority 1, other priority 2. Only the * secondary is in the response. */ curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan5", "@odata.type": "#Fan.v1_6_0.Fan", ... "SecondarySpeedPercent": { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan5_1", "Reading": null, "SpeedRPM": 12036.0 }, "SerialNumber": "XXXXXXXXXXXX", "SparePartNumber": "XXXXXXX", "Status": { "Health": "OK", "State": "Enabled" } } ``` - Tested with rotational fans the new fields are not in response: ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0 { "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans/fan0", "@odata.type": "#Fan.v1_6_0.Fan", ... "PartNumber": "XXXXXXX", "SerialNumber": "XXXXXXXXXXXX", "SparePartNumber": "XXXXXXX", "Status": { "Health": "OK", "State": "Enabled" } } curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", ... "ReadingType": "Rotational", ... } ``` Signed-off-by: George Liu <liuxiwei@inspur.com> Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com> Signed-off-by: Janet Adkins <janeta@us.ibm.com> Change-Id: Ic767de3bde8bfe14b31da23b67e17a8d04eefadb
2026-02-27bmcweb: add PhysicalContext support for SensorsEnder Hsieh1-4/+31
This change implements support for the D-Bus interface xyz.openbmc_project.Common.PhysicalContext for Sensors. It allows bmcweb to fetch the physical location context via the 'Type' property from this interface and expose it through the Redfish Sensor resource. The dBusSensorPhysicalContextToRedfish helper is added to map the D-Bus PhysicalContextType enum string to the Redfish PhysicalContext enumeration. Currently only the Accelerator type is supported by PDI; additional types should be added here as they are introduced in phosphor-dbus-interfaces. This implementation follows the interface definition introduced in: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/86504 Key changes: - sensor_utils.hpp: Added dBusSensorPhysicalContextToRedfish helper. - sensor_utils.hpp: Updated fillSensorIdentity to unpack and map the PhysicalContext property to the sensor JSON response. - Redfish.md: Documented the PhysicalContext property for the Chassis Sensors resource (/redfish/v1/Chassis/{ChassisId}/ Sensors/{Id}/). Tested: ``` Sample output $ curl -k -H "Content-Type: application/json" -X GET https://"${BMC}"/redfish/v1/Chassis/<id>/Sensors/<sensor_id> { ... "PhysicalContext": {}, ... } ``` 1. Verified that PhysicalContext appears in the Redfish Sensor response (e.g., /redfish/v1/Chassis/<id>/Sensors/<sensor_id>). 2. Validated with Redfish Service Validator. Depends-On: I83dcbe4810139fb92fddf6b099f5a1a057e7e05e Depends-On: I1d5abfa5d4416af3565bf315e0f28cb6af56f14c Change-Id: I23a40f9c74c6c368c04488af727e0889fc44e010 Signed-off-by: Ender Hsieh <andhsieh@nvidia.com>
2026-02-25Add FanSpeedsPercent for EnvironmentMetricsGeorge Liu2-9/+67
Adds FanSpeedsPercent information according to the Redfish EnvironmentMetrics schema [1]. The schema only allows fans of ReadingType Percent to be included in the FanSpeedsPercent array. The Redfish Uri supports retrieval of the metrics for a specific chassis: ``` /redfish/v1/Chassis/<chassisId>/EnvironmentMetrics ``` The fan sensors connected to the chassis are found by: 1) Find all fans associated to the chassis using the 'cooled_by' endpoint. [3]. 2) Find all sensors associated to each fan using the 'sensors' endpoint. [4] 3) Retrieve the sensor excerpt data for each sensor. A similar approach to retrieving the sensor data is used here as for the proposed implementation for ThermalSubsystem/Fans [2]. [1] https://redfish.dmtf.org/schemas/v1/EnvironmentMetrics.v1_3_2.json [2] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57657 [3] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/58300 [4] https://github.com/openbmc/docs/blob/master/architecture/sensor-architecture.md#association-type-2-linking-a-low-level-hardware-item-to-its-sensors Implementation notes: - The utility function objectExcerptToJson() is used to populate the SensorFanArrayExcerpt. - Altered the objectExcerptToJson() function to take a sensor::ReadingType value for the optional expected sensor type. Tested: (using hardware simulator) - Redfish Validator passes. - With redfish-allow-rotational-fans disabled: (Note fans that percent cannot be computed have null for Reading property.) ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics", "@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics", "FanSpeedsPercent": [ { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "Reading": 100, "SpeedRPM": 18000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_1", "Reading": 60, "SpeedRPM": 12036.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_0", "Reading": 50, "SpeedRPM": 18000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_1", "Reading": 32, "SpeedRPM": 12036.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0", "Reading": 50, "SpeedRPM": 18000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_1", "Reading": 25, "SpeedRPM": 12036.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0", "Reading": null, "SpeedRPM": 18000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_1", "Reading": null, "SpeedRPM": 12036.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0", "Reading": null, "SpeedRPM": 18000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_1", "Reading": null, "SpeedRPM": 12036.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan5_0", "Reading": null, "SpeedRPM": 18000.0 }, { "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan5_1", "Reading": null, "SpeedRPM": 12036.0 } ], "FanSpeedsPercent@odata.count": 12, "Id": "EnvironmentMetrics", "Name": "Chassis Environment Metrics" } ``` - Can see DataSourceUri match Sensors fan paths of ReadingType Percent: ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors | grep fan "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_1" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_0" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_1" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_1" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_1" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_1" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan5_0" "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan5_1" // E.g. curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan0_0", ... "ReadingType": "Percent", ... ``` - With redfish-allow-rotational-fans enabled the only fans are not Percent ReadingType so are not added to the FanSpeedsPercent array : ``` curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/EnvironmentMetrics { "@odata.id": "/redfish/v1/Chassis/chassis/EnvironmentMetrics", "@odata.type": "#EnvironmentMetrics.v1_3_0.EnvironmentMetrics", "FanSpeedsPercent": [], "FanSpeedsPercent@odata.count": 0, "Id": "EnvironmentMetrics", "Name": "Chassis Environment Metrics" } // E.g. curl -k -H "X-Auth-Token: $token" https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan0_0", ... "ReadingType": "Rotational", ... ``` Signed-off-by: George Liu <liuxiwei@inspur.com> Signed-off-by: Janet Adkins <janeta@us.ibm.com> Change-Id: I4cfc0aa28d68e7e0fa947251363deb6f06e36225
2026-02-10Fix the build for sensorsEd Tanous1-1/+1
Not clear how this made through CI. Change-Id: If9fc33916e3c44c0937ce24acaeb39f089ae910d Signed-off-by: Ed Tanous <etanous@nvidia.com>
2026-02-05Sensors: Convert fan_tach sensors to PercentJanet Adkins1-77/+211
Redfish 2025.3 clarified the reporting of fan sensors should always be as ReadingType Percent to address issue #6197. [1] The fan_tach sensors on D-Bus are Rotational sensors. Conversion is necessary for these sensor values to reflect Percent instead. [2] This is reflected in a published mockup. [3] The Redfish update includes an additional sentence for the ReadingType description: ``` "... Services should represent fan speed and pump speed sensors with the `ReadingType` value `Percent`." ``` The ReadingRangeMax and ReadingRangeMin properties also must be converted to percent basis as they are defined to reflect the range of the Reading property. ``` curl -s https://redfish.dmtf.org/schemas/v1/Sensor.v1_11_1.json | jq .definitions.Sensor.properties.ReadingRangeMax.longDescription "This property shall indicate the maximum possible value of the `Reading` property for this sensor. This value is the range of valid readings for this sensor. Values outside this range are discarded as reading errors." ``` A new compile option, redfish-allow-rotational-fans, will maintain the old behavior of reporting fan_tach sensors as Rotational. When the option is disabled they will be reported as Percent. This will allow time for distributions to make adjustments to handle Percent reported fan sensors. The SpeedRPM Redfish property contains the RPM value for these sensors whether this option is enabled or disabled. Clients wanting to use the RPM value should convert to use the SpeedRPM property instead of the Reading property. ``` curl -s https://redfish.dmtf.org/schemas/v1/Sensor.v1_11_1.json | jq .definitions.Sensor.properties.SpeedRPM { "description": "The rotational speed.", "excerpt": "SensorFan,SensorFanArray,SensorPump", "longDescription": "This property shall contain a reading of the rotational speed of the device in revolutions per minute (RPM) units.", "readonly": true, "type": [ "number", "null" ], "units": "{rev}/min", "versionAdded": "v1_2_0" } ``` With the compile option disabled the following differences will be reflected in the responses for /redfish/v1/Chassis/chassis/Sensors/{}: - ReadingRangeMax/ReadingRangeMin: Converted to percent range, (100,0) - ReadingType: "Percent" - ReadingUnits: "%" - Reading: Computed percent value. The computation is the percent of the RPM Value within the MaxValue to MinValue range as reported by D-Bus for the sensor. - Note: If the percent cannot be computed for any reason the Reading property is set to null. - Note: SpeedRPM: Remains unchanged, it continues to report the RPM value as reported by D-Bus. Implementation Notes: - The SensorFanExcerpt and SensorFanArrayExcerpt definitions also include the SpeedRPM property. So moved setting of this property to be handled for excerpts as well. - The Sensor schema version has been updated regardless of the compile option setting. [1] https://github.com/DMTF/Redfish/issues/6197 [2] https://redfish.dmtf.org/schemas/v1/Sensor.v1_11_1.json [3] https://github.com/DMTF/Redfish-Publications/blob/main/mockups/public-rackmount1/Chassis/1U/Sensors/CPUFan1/index.json Tested: - Added new unit tests for new function getFanPercent() - Adjusted existing unit tests for Sensors to reflect changes for fan_tach sensors. - Redfish Service Validator passes (with option enabled and disabled) - Using hardware simulator hand-edited values for the min/max of the fan_tach sensors: - Option enabled: confirmed Redfish response same before and after code changes. - Option disabled: Confirmed Redfish responses and percent calculation. Example responses with compile option disabled: ``` // D-Bus: "Value" d 18000 "MaxValue" d 18000 "MinValue" d 0 curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan0_0", "Name": "fan0 0", "Reading": 100, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } // D-Bus: "Value" d 18000 "MaxValue" d 36000 "MinValue" d 0 curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan1_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan1_0", "Name": "fan1 0", "Reading": 50, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } // Minimum is non-zero // D-Bus: "Value" d 18000 "MaxValue" d 27000 "MinValue" d 9000 curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan2_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan2_0", "Name": "fan2 0", "Reading": 50, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } // Minimum is not initialized - Reading is null // D-Bus: "Value" d 18000 "MaxValue" d 18000 "MinValue" d -inf curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan3_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan3_0", "Name": "fan3 0", "Reading": null, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } // Minimum and Maximum are not initialized - so Reading is null // D-Bus: "Value" d 18000 "MaxValue" d inf "MinValue" d -inf curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan4_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan4_0", "Name": "fan4 0", "Reading": null, "ReadingRangeMax": 100, "ReadingRangeMin": 0, "ReadingType": "Percent", "ReadingUnits": "%", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } ``` Example of unchanged response with compile option enabled: ``` curl -s -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0 { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/fantach_fan0_0", "@odata.type": "#Sensor.v1_11_1.Sensor", "Id": "fantach_fan0_0", "Name": "fan0 0", "Reading": 18000.0, "ReadingRangeMax": 18000.0, "ReadingRangeMin": 0.0, "ReadingType": "Rotational", "ReadingUnits": "RPM", "SpeedRPM": 18000.0, "Status": { "Health": "OK", "State": "Enabled" } } ``` Change-Id: I8ec1e739bcd5ebce7453a2570569f2edc2284341 Signed-off-by: Janet Adkins <janeta@us.ibm.com>
2026-01-30Remove usages of nlohmann::json::begin()Ed Tanous1-8/+33
nlohmann::json::begin() throws an uncaught exception. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <ed@tanous.net> Change-Id: I08244b0787cd4d6e592b0731196490a5160aba62
2026-01-21Use boost::urls::formatBrad Bishop1-8/+8
boost::urls::format is specifically meant for URL construction. It handles encoding like percentage encoding which std::format does not. Change-Id: Ief7d574d1652096c2701979a9f8fe9897957f492 Signed-off-by: Brad Bishop <bradbish@qti.qualcomm.com>
2026-01-07Renaming of eventlog variables and functionsOliver Brewka1-73/+94
Following a comment on [1], fix some of the variable and function names, to match redfish terms. Tested: Unit tests pass. Validation succeeded. [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/83354/13 Change-Id: Ie52309126c798b17136be99fd4a3d6650721257e Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>