summaryrefslogtreecommitdiff
path: root/test/redfish-core/lib
AgeCommit message (Collapse)AuthorFilesLines
12 daysTest dbusToRfBootType and dbusToRfBootModeVinothkumar Shanmugavel1-0/+33
Add coverage for dbusToRfBootType() and dbusToRfBootMode(), which translate D-Bus boot configuration values into Redfish enum values. Verify the supported boot type values Legacy and EFI map to BootSourceOverrideMode::Legacy and BootSourceOverrideMode::UEFI. Verify the supported boot mode values Regular, Safe, and Setup map to BootSource::None, BootSource::Diags, and BootSource::BiosSetup. Also verify that unknown D-Bus values return the corresponding Invalid enum value instead of being silently interpreted as a valid setting. Tested: - meson test -C builddir system_test -v - All 6 system_test tests passed, including both new tests Change-Id: I926187c3e87abc4baf2af22a6ca6f689c03dcd77 Signed-off-by: Vinothkumar Shanmugavel <vinothkumars@ami.com>
2026-09-03Break out dump / faultlog log servicesOliver Brewka1-2/+2
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-09-03bmcweb: add unit tests for Fabric Switch PowerState handlersJY Voon1-0/+165
Cover dbusToRfPowerState() and the callbacks introduced by the Fabric Switch PowerState change: afterGetSwitchPowerState and afterGetSwitchPowerStateService. The tests assert each branch's externally visible behavior: known PowerState decorator values map to the matching resource::PowerState and unmapped values yield nullopt; a property read error or an unmapped value leaves PowerState omitted without failing the request; EBADR, io_error and an empty mapper object leave PowerState omitted; any other mapper error sets an internal server error. Change-Id: Id488f88b8d7784a4f195fcf7c832fbecfdb0b513 Signed-off-by: JY Voon <jvoon@nvidia.com>
2026-09-01bmcweb: add PCIeDevice UUID propertyJY Voon1-0/+69
Add optional support for UUID property for PCIeDevice. Tested: Build an image for nvl32-obmc machine with the following patch cherry picked. ``` 1. Align with upstream u-boot dts tree: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89932 2. mctpd configuration: https://gerrit.openbmc.org/c/openbmc/openbmc/+/87390 3. Enable nvidia-gpu sensor: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89933 ``` PCIeDevice with Common.UUID published (GPU path): $ busctl get-property xyz.openbmc_project.GpuSensor \ /xyz/openbmc_project/inventory/Nvidia_GPU_10 \ xyz.openbmc_project.Common.UUID UUID s "68174e99-daf4-02d1-ba39-4ed2bf8a0f21" $ curl -sk https://{BMC_IP}/redfish/v1/Systems/system/\ PCIeDevices/Nvidia_GPU_10 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/Nvidia_GPU_10", "@odata.type": "#PCIeDevice.v1_19_0.PCIeDevice", "Id": "Nvidia_GPU_10", "Manufacturer": "NVIDIA", "Model": "RTXPRO6000BlackwellDC", "Name": "PCIe Device", "PartNumber": "900-2G153-0000-000", "SerialNumber": "1792425045093", "Status": { "Health": "OK", "State": "Enabled" }, "UUID": "68174e99-daf4-02d1-ba39-4ed2bf8a0f21" } PCIeDevice without Common.UUID published (ConnectX path): $ busctl get-property xyz.openbmc_project.GpuSensor \ /xyz/openbmc_project/inventory/Nvidia_ConnectX_24_PCIe \ xyz.openbmc_project.Common.UUID UUID Failed to get property UUID on interface xyz.openbmc_project.Common.UUID: Unknown interface xyz.openbmc_project.Common.UUID or property UUID. $ curl -sk https://{BMC_IP}/redfish/v1/Systems/system/\ PCIeDevices/Nvidia_ConnectX_24_PCIe | jq 'has("UUID")' false Change-Id: I38cf972f03f0dd0299b708ea8203872c73c8e224 Signed-off-by: JY Voon <jvoon@nvidia.com>
2026-07-23bmcweb: tolerate missing deprecated Software PurposeJY Voon1-0/+47
The xyz.openbmc_project.Software.Version interface marks the Purpose property as deprecated in favor of Compatible strings and inventory associations, so a conforming object may publish only Version. The FirmwareInventory handler treated a missing Purpose as an internal error and returned HTTP 500 for every such object. Added this patch\ to skip the optional Description and RelatedItem links rather than failing the resource. Objects that publish Purpose keep their existing output. Tested: Build an image for nvl32-obmc machine with the following patches cherry-picked: 1. Align with upstream u-boot dts tree: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89932 2. mctpd configuration: https://gerrit.openbmc.org/c/openbmc/openbmc/+/87390 3. Enable nvidia-gpu sensor: https://gerrit.openbmc.org/c/openbmc/openbmc/+/89933 4. dbus-sensors expose GPU inventory interfaces: https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/88990 $ curl -sk https://{BMC_IP}/redfish/v1/UpdateService/\ FirmwareInventory/Nvidia_GPU_10_Firmware { "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/\ Nvidia_GPU_10_Firmware", "@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory", "Id": "Nvidia_GPU_10_Firmware", "Name": "Software Inventory", "Status": { "HealthRollup": "OK", "State": "Enabled" }, "Updateable": false, "Version": "98.02.AF.00.01" } Depends-On: Id0c09f4ced40dbe505ca7cbd99f6de0e847afe3b Change-Id: I2a9562e461ffd39fcbdc176413a1bf2cb6fdbc22 Signed-off-by: JY Voon <jvoon@nvidia.com>
2026-07-23bmcweb: add unit tests for processor FirmwareVersion handlersJY Voon1-0/+113
Cover the callbacks introduced by the GPU Processor FirmwareVersion change. The tests assert each branch's externally visible behavior: unexpected D-Bus errors, an ambiguous subtree, and a missing owning service set an internal server error, while EBADR, an empty subtree, and an empty version leave FirmwareVersion omitted. Change-Id: Ic00549fe7513651a139ebb8a4e7b36c95b3f453c Signed-off-by: JY Voon <jvoon@nvidia.com>
2026-06-29Manage user password expiration via RESTIvan Moiseev1-0/+66
This change adds user password expiration date time mgmt via REST API provided by bmcweb. Password expiration date time is managed as string in 'YYYY-MM-DDTHH:MM:SS±hh:mm' format and internally operates as Epoch time. When set password expiration date time can be specified in any format supported by 'dateStringToEpoch' function in 'redfish::time_utils'. Value 'null' is used to make password not to expire. Unit tests checking correct password expiration value conversion were added. This change depends on corresponding change in phosphor-dbus-interfaces [1] and in phospor-user-manager [2]. Password expiration management: - create user with password expiration ``` curl -k -X POST -H 'Content-Type: application/json' \ "https://<bmc>/redfish/v1/AccountService/Accounts" \ -d '{"UserName":"<user>", "Password":"<password>", "RoleId":"<role>", "PasswordExpiration": "<YYYY-MM-DDTHH:MM:SS>"}' ``` - modify user password expiration ``` curl -k -X PATCH -H 'Content-Type: application/json' \ https://<bmc>/redfish/v1/AccountService/Accounts/<user> \ -d '{"PasswordExpiration": "<YYYY-MM-DDTHH:MM:SS>"}' ``` - get user password expiration ``` curl -k -X GET https://<bmc>/redfish/v1/AccountService/Accounts/<user> ``` - modify user password not to expire ``` curl -k -X PATCH -H 'Content-Type: application/json' \ https://<bmc>/redfish/v1/AccountService/Accounts/<user> \ -d '{"PasswordExpiration": null}' ``` Tested: Functionality of this change was tested via curl utility. Also, it was checked that proper value was set on dbus for'PasswordExpiration' attribute of the specified user. - create user account without password expiration, verify that password expiration is not set - create user account with password expiration specified, verify that it is correct - create user account with null password expiration which makes password not to expire, verify that it is correct - try to create user account with various invalid password expiration values(incorrect type, invalid format), verify that user is not created and appropriate error is returned in response - modify user password expiration to specific time, verify that is is correct - make user password not to expiry, verify that it is correct - try to set password expiration to an invalid value (incorrect type, invalid format), verify that is does not change and appropriate error is returned in response Redfish service validation on /redfish/v1/AccountService/Accounts tree containing both user accounts with and without password expiration has passed successfully. [1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/75236 [2] https://gerrit.openbmc.org/c/openbmc/phosphor-user-manager/+/75237 Change-Id: Idf5e4356eaa8866dd4a10664996117e2cdba0684 Signed-off-by: Ivan Moiseev <moiseev.ivan4w@yandex.com> Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
2026-06-26fix 'Chassis' property in oem schemaAlexander Hansen1-6/+11
`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-25Add unit test for TelemetryServiceRamya Sivakumar1-0/+43
Add test case for handleTelemetryServiceGet function to verify the static attributes returned by the TelemetryService endpoint The test validates the following response fields: - @odata.type and @odata.id - Id and Name - Navigation properties: MetricReportDefinitions, MetricReports and Triggers Tested - All assertions passed Change-Id: Ibc71ad9ff1796b90fed19d25be1525204919fa04 Signed-off-by: Ramya Sivakumar <sramya@ami.com>
2026-06-22bmcweb: expose PID D term and hysteresis mode in OEM schemaYou Peng Wu1-27/+25
Extend the OpenBMCManager OEM fan configuration to cover the two additional PID parameters already supported by phosphor-pid-control: * DCoefficient (derivative term of the PID loop) * CheckHysteresisWithSetpoint (boolean indicating whether input hysteresis is applied around the setpoint) These fields are now exposed through the Oem/OpenBmc/Fan/PidControllers Redfish interface and correctly mapped to the underlying D-Bus PidConfiguration objects. To keep the OEM schema backwards compatible, introduce a new version OpenBMCManager.v1_1_0 that adds the two properties to the PidController definition, and update bmcweb to reference the new schema version. Test(qemu evb-ast2600): Load Fantable via entity-manager /var/configuration/system.json content: https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(my_commit)/system.txt Verify OEM properties in Manager resource GET /redfish/v1/Managers/bmc: https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(my_commit)/Managers-bmc-oem.png Verify OpenBMCManager OEM schema exposure GET /redfish/v1/JsonSchemas/OpenBMCManager: https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(my_commit)/redfish-oem-schema.png Run Redfish Service Validator (RSV) Summary: https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(my_commit)/redfish-validator-summary.png Details: https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(my_commit)/redfish-validator-details.png Full log: https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(my_commit)/ConformanceLog_12_14_2025_180449.txt Baseline (community/original) RSV log for comparison (no new failures introduced): https://github.com/YouPengWu/ToReviewer/blob/main/85785 /Test_case/Bmcweb(57d41)/ConformanceLog_12_14_2025_174610.txt Change-Id: Ide1a118f9fd27eb94e911997d99e5934fe3e1095 Signed-off-by: You Peng Wu <twpeng50606@gmail.com>
2026-06-22Remove giant inline lambda in OpenBMC ManagerEd Tanous1-0/+482
This lambda needs to go away. There's no way it should've been accepted in the first place, but it was written in a different time. Tested: Functional in next commit. Unit tests in patch. Change-Id: I81360460c23329169f441b6bea02d28a8b410eca Signed-off-by: Ed Tanous <ed@tanous.net>
2026-06-02bmcweb: refactor getCpuLocationCodeJY Voon1-0/+45
Move the LocationCode D-Bus callback out of getCpuLocationCode() and rename the request helper to getProcessorLocationCode(), because the helper handles all processor inventory types and not only CPUs. This is a no-functional-change cleanup. Processor GET responses continue to expose Location/PartLocation/ServiceLabel from the existing xyz.openbmc_project.Inventory.Decorator.LocationCode interface. Redfish.md is unchanged because this refactor does not add or remove any Redfish schema fields. No phosphor-dbus-interfaces change is required; the patch continues to use the existing Decorator.LocationCode API. The D-Bus to Redfish mapping remains: - Inventory.Decorator.LocationCode/LocationCode -> Location/PartLocation/ServiceLabel Key changes: - redfish-core/lib/processor.hpp: add afterGetProcessorLocationCode(); rename getCpuLocationCode() to getProcessorLocationCode(); switch the getProperty callback to std::bind_front; log LocationCode D-Bus errors with the ec value - test/redfish-core/lib/processor_test.cpp: add unit tests for the success and error paths in afterGetProcessorLocationCode() - test/meson.build: register processor_test.cpp in the unit-test source list Tested: Built an image for nvl32-obmc machine 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 $ curl -sk https://{BMC_IP}/redfish/v1/Systems/system/Processors/GPU_0_0 { "@odata.id": "/redfish/v1/Systems/system/Processors/GPU_0_0", "@odata.type": "#Processor.v1_18_0.Processor", "Id": "GPU_0_0", "Manufacturer": "NVIDIA", "Model": "RTXPRO6000BlackwellDC", "Name": "Processor", "PartNumber": "900-2G153-0000-000", "ProcessorType": "Accelerator", "SerialNumber": "1792425045048", "Status": { "Health": "OK", "State": "Enabled" }, "UUID": "48b2ad9f-afb1-47ed-a1f0-01c610da73af", "Version": "2BB5-895-A1" } 1. Verified no regression: Processor GET responses remain correct after the rename to getProcessorLocationCode(). 2. Ran Redfish Service Validator: Summary - PASS: 10797, WARN: 370, FAIL: 1, NOT TESTED: 17149 Validating /redfish/v1/Managers/bmc... - Pass: 45, Warn: 0, Fail: 1, Skip: 27 The FAIL is Oem/OpenBmc/Certificates, an unknown OEM property in the schema that is pre-existing and unrelated to this change. Change-Id: I346265d1e90024266fb23221e54705cbd3ae286c Signed-off-by: JY Voon <jvoon@nvidia.com>
2026-03-12Fabric: add support for PCIe Switch Port MetricsHarshit Aghera1-0/+3
This patch enable support for following properties for Port Metrics URI of a PCIe Switch. [1] - PCIeErrors.CorrectableErrorCount - PCIeErrors.NonFatalErrorCount - PCIeErrors.FatalErrorCount - PCIeErrors.L0ToRecoveryCount - PCIeErrors.ReplayCount - PCIeErrors.ReplayRolloverCount - PCIeErrors.NAKSentCount - PCIeErrors.NAKReceivedCount - PCIeErrors.UnsupportedRequestCount The patch uses "xyz.openbmc_project.Metric.Value" Interface for PCIe Port Metrics properties. Association between a Metric and a Port is `measuring` and `measured_by`. PDI patch - https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/84839 dbus-sensors patches - https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/84132 Tested: Build an image for nvl32-obmc machine with the following patch cherry picked. https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/84132 https://gerrit.openbmc.org/c/openbmc/openbmc/+/85490 The openbmc patch cherry-picks the following patches that are currently under review. ``` 1. device tree https://lore.kernel.org/all/aRbLqH8pLWCQryhu@molberding.nvidia.com/ 2. mctpd patches https://github.com/CodeConstruct/mctp/pull/85 3. u-boot changes https://lore.kernel.org/openbmc/20251121-msx4-v1-0-fc0118b666c1@nvidia.com/T/#t 4. kernel changes as specified in the openbmc patch (for espi) 5. entity-manager changes https://gerrit.openbmc.org/c/openbmc/entity-manager/+/85455 6. platform-init changes https://gerrit.openbmc.org/c/openbmc/platform-init/+/85456 7. spi changes https://lore.kernel.org/all/20251121-w25q01jv_fixup-v1-1-3d175050db73@nvidia.com/ ``` redfish service validator is passing. ``` $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/UP_0/Metrics/ { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/UP_0/Metrics", "@odata.type": "#PortMetrics.v1_3_0.PortMetrics", "Id": "Metrics", "Name": "Nvidia_ConnectX_0 UP_0 Port Metrics", "PCIeErrors": { "CorrectableErrorCount": 0, "FatalErrorCount": 0, "L0ToRecoveryCount": 1, "NAKReceivedCount": 0, "NAKSentCount": 0, "NonFatalErrorCount": 0, "ReplayCount": 0, "ReplayRolloverCount": 0, "UnsupportedRequestCount": 0 } }% ``` [1]: https://redfish.dmtf.org/schemas/v1/PortMetrics_v1.xml Change-Id: I7cca75fa5d4c77a4b02d35f7ce0b024f325ceff0 Signed-off-by: Harshit Aghera <haghera@nvidia.com>
2026-02-03Fabric: add support for PCIe Switch Port URIHarshit Aghera1-1/+1
This patch enable support for following properties for Port of a PCIe Switch. [1] - PortProtocol - PortType - CurrentSpeedGbps - ActiveWidth One of the devices that gets enabled with this patch is Nvidia ConnectX devices, which are network cards featuring an integrated PCIe switch. These devices combine both PCIe ports and network ports in a single unit. Since such devices don't strictly qualify as Fabric Adapters, the Switch URI is used instead of the FabricAdapter URI. Port schema only allows certain URIs as Port URI. URI /redfish/v1/Fabrics/{FabricId}/Switches/{SwitchId}/Ports/{PortId} seems most appropriate choice for PCIe Switch Port. [1] The Fabric resource is modeled similarly to the System resource, meaning that only one Fabric resource will exist for each BMC. Route handler for collections and each individual components are added in this patch for each URI resource under /redfish/v1/Fabrics. DBus Interface "xyz.openbmc_project.Inventory.Item.PCIeSwitch" is used to identify the Switch resources. Association between Switch and Port is `connecting` and `connected_to`. Feature like Port Metrics properties (for PCIe Error Counters) can be added in future at Port Metric URI. dbus-sensors patches - https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/84079 https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/83202 Tested: Build an image for nvl32-obmc machine with the following patch cherry picked. https://gerrit.openbmc.org/c/openbmc/dbus-sensors/+/84079 https://gerrit.openbmc.org/c/openbmc/openbmc/+/85490 The openbmc patch cherry-picks the following patches that are currently under review. ``` 1. device tree https://lore.kernel.org/all/aRbLqH8pLWCQryhu@molberding.nvidia.com/ 2. mctpd patches https://github.com/CodeConstruct/mctp/pull/85 3. u-boot changes https://lore.kernel.org/openbmc/20251121-msx4-v1-0-fc0118b666c1@nvidia.com/T/#t 4. kernel changes as specified in the openbmc patch (for espi) 5. entity-manager changes https://gerrit.openbmc.org/c/openbmc/entity-manager/+/85455 6. platform-init changes https://gerrit.openbmc.org/c/openbmc/platform-init/+/85456 7. spi changes https://lore.kernel.org/all/20251121-w25q01jv_fixup-v1-1-3d175050db73@nvidia.com/ ``` redfish service validator is passing. ``` $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/ { "@odata.id": "/redfish/v1/Fabrics", "@odata.type": "#FabricCollection.FabricCollection", "Members": [ { "@odata.id": "/redfish/v1/Fabrics/fabric" } ], "Members@odata.count": 1, "Name": "Fabric Collection" }% $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/fabric/ { "@odata.id": "/redfish/v1/Fabrics/fabric", "@odata.type": "#Fabric.v1_2_0.Fabric", "Id": "fabric", "Name": "fabric Fabric", "Switches": { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches" } }% $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/fabric/Switches/ { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches", "@odata.type": "#SwitchCollection.SwitchCollection", "Members": [ { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0" }, { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_1" }, { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_2" }, { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_3" } ], "Members@odata.count": 4, "Name": "fabric Switch Collection" }% $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0 { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0", "@odata.type": "#Switch.v1_7_0.Switch", "Id": "Nvidia_ConnectX_0", "Name": "Nvidia_ConnectX_0", "Ports": { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports" }, "Status": { "Health": "OK", "State": "Enabled" } }% $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/ { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports", "@odata.type": "#PortCollection.PortCollection", "Members": [ { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/DOWN_0" }, { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/DOWN_1" }, { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/UP_0" } ], "Members@odata.count": 3, "Name": "Nvidia_ConnectX_0 Port Collection" }% $ curl -k -u 'root:0penBmc' https://${bmc_ip}/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/UP_0/ { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/UP_0", "@odata.type": "#Port.v1_4_0.Port", "ActiveWidth": 8, "CurrentSpeedGbps": 32.0, "Id": "UP_0", "Metrics": { "@odata.id": "/redfish/v1/Fabrics/fabric/Switches/Nvidia_ConnectX_0/Ports/UP_0/Metrics" }, "Name": "Nvidia_ConnectX_0 UP_0 Port", "PortProtocol": "PCIe", "PortType": "UpstreamPort", "Status": { "Health": "OK", "State": "Enabled" } }% ``` [1]: https://redfish.dmtf.org/schemas/v1/Port_v1.xml Change-Id: I52f4ca62b4953f6196c589e340602a0d7885d9c1 Signed-off-by: Harshit Aghera <haghera@nvidia.com>
2026-01-31test: Add Cables and JsonSchemas to service root testRamya Sivakumar1-0/+7
Add test assertions for Cables and JsonSchemas endpoints in the ServiceRoot response. These verify that both endpoints are properly exposed with their respective @odata.id URIs at /redfish/v1/Cables and /redfish/v1/JsonSchemas Change-Id: Icec5d2c5a99872f6a44a6c82f0d5ab02490d9339 Signed-off-by: Ramya Sivakumar <sramya@ami.com>
2025-11-25Add temp file and FD support to TemporaryFileHandlerajeeranjan1-3/+3
This commit adds file descriptor and temporary file management to DuplicatableFileHandle, removing the redundant test-only TemporaryFileHandle utility. Changes: - Add file descriptor constructor and setFd() method - Add temporary file constructor with string_view content - Add filePath member and automatic cleanup in destructor - Add configurable temp-dir meson option (default: /tmp/bmcweb) - Remove include/file_test_utilities.hpp - Update all tests to use DuplicatableFileHandle - Rename stringPath to filePath These features will be used by the multipart parser to stream large uploads to temporary files instead of keeping them in memory, and by the update service to pass file descriptors over D-Bus. Change-Id: I982f5928d453f9f0c13d91c3525006134ddc87b3 Signed-off-by: Rajeev Ranjan <ranjan.rajeev1609@gmail.com>
2025-01-20Use SPDX identifiersEd Tanous10-0/+20
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>
2024-12-27Fix setting gatewaysEd Tanous1-0/+212
There's a number of conditions in setting gateways that don't work properly. Specifically, one of the issues is setting a gateway on an address that already exists. It returns a PropertyValueConflict error on Ipv4Addresses/1/Gateway with Ipv4Addresses/1/Gateway Obviously an address can't conflict with itself, so this is wrong. To address this, move the gateway setting and selection code into a routine outside of the main loop, after all the gateways are accounted for, and so we can treat them separately. Tested; PATCH to an existing ip address works, and no longer returns the error. More test cases likely needed. Change-Id: I0339e02fc27164337416637153d0b0f744b64ad8 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-12-11Put simple update behind an optionEd Tanous1-18/+9
4e338b2313f9f2a91aa1fb36693e36a328d58933 Removed tftp update support from the codebase, but left SimpleUpdate in a non functional state. Given that a number of forks have implemented the HTTPS/SCP versions of simple update, we don't want to fully delete the code at this time, so for the moment put it behind an option flag. Tested: WIP Change-Id: Ibab1e3a48ff640787eabf8ed5f7a5c08e3381307 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-12-11Always fall back to ChassisType RackMountGunnar Mills1-1/+2
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/75914 added support for dynamic ChassisType. Before 75914, ChassisType was hardcoded to RackMount. If you implement Inventory.Item.Chassis the default Chassis Type is Unknown. Unknown in 75914 maps to Invalid and ChassisType is left off the Redfish Chassis resource. The Redfish Validator flags this as an error since ChassisType is a required property in the Chassis schema. The implementations should be setting the ChassisType but let's get bmcweb bumps back on the rails and just set ChassisType = RackMount if there is an error or if the Chassis Type is something we can't map (like Unknown). This "your default ChassisType is RackMount" matches what we had before. Tested: Inspection and unit tests only. Change-Id: Id577be522be7c2d3463da9c497d9063a284a4d54 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-12-04Simplify journal pagingEd Tanous1-71/+0
sd-journal has its own paging mechanisms for generating and seeking to unique ids. Ironically they look fairly similar to what we've implemented here, but they have more content, presumably because they can use internal implementation details to do paging. This commit switches all sd-journal paging to use cursors. Functionally this changes the odata.id from being a concatenated string into being a base64 encoded identifier that is much longer. The end result is vastly simplified code. Tested: check journal script [1] succeeds [1] https://github.com/openbmc/openbmc-tools/blob/master/check_journal/check_journal Script runs to completion and shows all tests passed. Change-Id: Ia49fbfc272bef6dfbe1ea45a8d993dc785041659 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-12-02Dynamically determine ChassisType for RedfishJoseph-Jonathan Salzano1-0/+95
The function handleChassisGetSubTree will now handle properties that are part of the xyz.openbmc_project.Inventory.Item.Chassis interface. At time of development this is only ChassisType. The new function "handleChassisProperties" will attempt to get the Type property from the interface, translate it to a Redfish standard string and set it as the ChassisType value. If the property cannot be found the default "RackMount" will be used. Tested: Added and ran 4 new unit tests. Ran manual tests with ChassisType being exposed via dbus in QEMU emulated environments. Tested on ASPEED 2600 eval board. Change-Id: Ibbd048db5007f5154e88495ec6e651a3a2137b06 Signed-off-by: Joseph-Jonathan Salzano <joseph-jonathan.salzano@hp.com>
2024-09-05Break out post codesEd Tanous2-30/+43
Similar to other patches, break out the post codes log services into their own file. log_services.hpp is far too large. Change-Id: I3cb644d52a9d3b5f9a15a2f90c1b69c87491e5c8 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-09-04Remove IWYU pragmasEd Tanous1-8/+2
These were added as part of d5c80ad9c07b94465d8ea62d2b6f87c30cac765e: test treewide: iwyu Since then, Nan hasn't been very active on the project, and to my knowledge, since the initial run, we've never used IWYU again. clang-include-cleaner seems to work well without needing these pragmas, and is what we're using, even if it's less useful than IWYU. Remove all mention of IWYU. Tested: Code compiles. Change-Id: I06feedeeac9a114f5bdec81d59ca83223efd8aa7 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-09-04Fix includesEd Tanous3-3/+4
This commit is automatically generated by enabling clang-include-fixer. Tested: Code compiles. Change-Id: I475d7b9d43e95bbdeeaadf11905d3b2a60aa8ef3 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-08-22Sensors: Create utility class for sensorsJanet Adkins1-36/+0
Create a separate utility class for sensors. The goal is to make these functions easily available for use outside of sensors for paths which need reference sensors. Moved splitSensorNameAndType() into new utility class. Created new utility function getSensorId(). The Id for a sensor is built from its name and type in a few different locations. These are modified to call the new function. The function has also been simplified to use std::format() to build the Id. Tested: - Checked before and after results for queries using this function: (Note: I was not able to confirm the setSensorsOverride() caller as it is only being used for redfish-allow-deprecated-power-thermal URI.) ''' - https://${bmc}/redfish/v1/Chassis/chassis/Sensors - https://${bmc}/redfish/v1/Chassis/chassis/Sensors/<str> where <str> was sensors of different types - https://${bmc}/redfish/v1/Chassis/chassis/Sensors?\$expand=* - https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/Fans - https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies ''' - Redfish Validator passed Change-Id: Ifa200b6e63f8e52d47f70c33d350999f5c527bbd Signed-off-by: Janet Adkins <janeta@us.ibm.com>
2024-08-17clang-format: re-format for clang-18Patrick Williams1-4/+4
clang-format-18 isn't compatible with the clang-format-17 output, so we need to reformat the code with the latest version. The way clang-18 handles lambda formatting also changed, so we have made changes to the organization default style format to better handle lambda formatting. See I5e08687e696dd240402a2780158664b7113def0e for updated style. See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement. Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2024-07-23Make journal log efficientEd Tanous1-5/+9
Journal logging currently loops over all entries to find even a single entry. This was reasonable at the time when bmc couldn't really store a lot, but now that BMCs are getting significantly more flash storage, this simplification is insufficient. In an example system with an AST2600, this API takes 32 seconds to respond. This is mediocre for obvious reasons. This commit updates to use the sd_journal APIs to let journald do the skipping, which can use internal details and can be a lot more efficient. To get the total size, bmcweb still needs to pull the sequenceids of HEAD and TAIL to determine the complete size, but this is still reasonable. Tested: Redfish service validator passes. Various versions of top and skip return the correct result, pulling various top sizes from 0, omitted to the limit. https://gerrit.openbmc.org/c/openbmc/openbmc-tools/+/72975 To test all corner cases. Change-Id: I0456bca4e037529f70eaee0bdd9191e9d5839226 Signed-off-by: Ed Tanous <etanous@nvidia.com>
2024-07-23Break out Journal log into its own fileEd Tanous1-0/+1
log_services.hpp probably shouldn't have been allowed to get as large as it has. This commit starts by breaking out functions from log_services.hpp, and moves them to manager_logservices_journal.hpp. Code is moved as-is with no functional changes. Tested: Journal GET works as before. Redfish service validator passes. Change-Id: I93c372ae3e39967e1b0eaf0cf496f84ac4114b5c Signed-off-by: Ed Tanous <ed@tanous.net>
2024-07-01Add filter parameter supportEd Tanous1-1/+2
$filter is a parameter documented in the Redfish specification, section 7.3.4. It defines a mechanism for filtering arbitrary collections of parameters based on a set of arbitrary language expressions. From the specification, it supports the following language operators: () Precedence grouping operator. (Status/State eq 'Enabled' and Status/Health eq 'OK') or SystemType eq 'Physical' and Logical and operator. ProcessorSummary/Count eq 2 and MemorySummary/TotalSystemMemoryGiB gt 64 eq Equal comparison operator. ProcessorSummary/Count eq 2 ge Greater than or equal to comparison operator. ProcessorSummary/Count ge 2 gt Great than comparison operator. ProcessorSummary/Count gt 2 le Less than or equal to comparison operator MemorySummary/TotalSystemMemoryGiB le 64 lt Less than comparison operator. MemorySummary/TotalSystemMemoryGiB lt 64 ne Not equal comparison operator. SystemType ne 'Physical' not Logical negation operator. not (ProcessorSummary/Count eq 2) or Logical or operator. ProcessorSummary/Count eq 2 or ProcessorSummary/Count eq 4 Support for these operators have been added in previous commits. This commit enables them behind the insecure-enable-redfish-query meson option. This is an arbitrary language, so the likelihood there's some improper implementation in the patch is high. This gives folks the ability to test it. Tested: Lots of unit tests included in this patch. Functionally tested the basic operators: ``` GET /redfish/v1/Managers/bmc/LogServices/Journal/Entries?\$filter=EntryType+eq+'Oem' GET /redfish/v1/Managers/bmc/LogServices/Journal/Entries?\$filter=EntryType+ne+'Oem' ``` Function as expected, producing multiple results or no results respectively. GET /redfish/v1 reports "FilterQuery": true Redfish service validator passes. Change-Id: Id568acc5dcfce868af12da5ee16c4f0caae8060a Signed-off-by: Ed Tanous <ed@tanous.net>
2024-06-19Make aggregator unit tests passEd Tanous1-1/+11
When enabled, redfish aggregation causes unit tests to fail. Tested: Unit tests now pass with redfish aggregation enabled. Change-Id: Ieb92a4ad0a4be3ce757c816a676e0a641cd7c85a Signed-off-by: Ed Tanous <ed@tanous.net>
2024-05-30Add ipv6 URL parsing testEd Tanous1-0/+13
It was reported that ipv6 URLS failed to parse now. This test seems useful to have. Tested: Unit tests pass. Change-Id: I21f1b11039c1b35dff5c85ecab784dd3cd6228dc Signed-off-by: Ed Tanous <ed@tanous.net>
2024-05-28Generate metadata at runtimeEd Tanous1-0/+52
In the initial implementation of metadata indexing the bmc knew at compile time what schemas it could potentially publish. bmcweb took the approach of adding all schemas of all versions to the $metadata resource. Since that was made, two major changes have happened. First, Redfish has added significantly more versions of each schema, as well as significantly more schemas to the point where the metadata index is now 213KB. While this file compresses fairly well, the size is obvious from the large amount of time that redfish service validator takes to parse the schemas, compared to actually acquiring BMC redfish resources. Second, aggregation was added, where an aggregated Redfish service might implement any number of schemas, including OEM ones. In an effort to fix this, this patch takes the compile-time algorithm in update_schemas.py, and moves it into bmcweb itself, parsing the files on disk as needed on demand. This has some immediate benefits; First, is that now schemas can be potentially installed from anywhere, not only from within the bmcweb build, and they will be resolved at runtime. Second, patches that want to add support for a given schema need to only symlink the schema into the correct folder, without needing to rerun update_schemas.py. This saves time in review. Finally, this opens to door to reducing the schema versions present in the metadata to the unique set of only what this bmcweb instance, and its aggregated BMCs expose. Tested: Redfish service validator passes. Need A/B checking to verify the file is byte for byte the same. GET /redfish/v1/$metadata returns what looks like sane results, with a correct content-type. Unit tests require the use of TemporaryFileHandle, so that class is moved into a more general folder, outside of test/http. Change-Id: I326159099c6b6c4056023b2e173c5f074ed88ce1 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-05-08Add https parsingEd Tanous1-1/+58
This is yet another step in parsing HTTP requests. Tested: ''' curl -vvvv -k --user "root:0penBmc" -H "Content-Type: application/json" \ -X POST https://192.168.7.2/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate \ -d '{ \ "TransferProtocol":"TFTP", \ "ImageURI":"https://192.168.7.1/myfile.bin" \ }' ''' Returns ActionParameterNotSupported TransferProtocol: Omitted ImageURI: https://192.168.7.1/myfile.bin Returns ActionParameterNotSupported TransferProtocol: Omitted ImageURI: 192.168.7.1/myfile.bin Returns ActionParameterValueTypeError TransferProtocol: Bad ImageURI: https:/192.168.7.1/myfile.bin Returns: ActionParameterNotSupported No changes to GET requests, so Redfish Service Validator not necessary. Change-Id: Ibf4b69877031f3b8617412c06d40f2d0d0827ac3 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-05-01Bring consistency to config optionsEd Tanous1-5/+5
The configuration options that exist in bmcweb are an amalgimation of CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms and meson options using a config file. This history has led to a lot of different ways to configure code in the codebase itself, which has led to problems, and issues in consistency. ifdef options do no compile time checking of code not within the branch. This is good when you have optional dependencies, but not great when you're trying to ensure both options compile. This commit moves all internal configuration options to: 1. A namespace called bmcweb 2. A naming scheme matching the meson option. hyphens are replaced with underscores, and the option is uppercased. This consistent transform allows matching up option keys with their code counterparts, without naming changes. 3. All options are bool true = enabled, and any options with _ENABLED or _DISABLED postfixes have those postfixes removed. (note, there are still some options with disable in the name, those are left as-is) 4. All options are now constexpr booleans, without an explicit compare. To accomplish this, unfortunately an option list in config/meson.build is required, given that meson doesn't provide a way to dump all options, as is a manual entry in bmcweb_config.h.in, in addition to the meson_options. This obsoletes the map in the main meson.build, which helps some of the complexity. Now that we've done this, we have some rules that will be documented. 1. Runtime behavior changes should be added as a constexpr bool to bmcweb_config.h 2. Options that require optionally pulling in a dependency shall use an ifdef, defined in the primary meson.build. (note, there are no options that currently meet this class, but it's included for completeness.) Note, that this consolidation means that at configure time, all options are printed. This is a good thing and allows direct comparison of configs in log files. Tested: Code compiles Server boots, and shows options configured in the default build. (HTTPS, log level, etc) Change-Id: I94e79a56bcdc01755036e4e7278c7e69e25809ce Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-19Add missing headersEd Tanous1-0/+2
Most of these were found by breaking every redfish class handler into its own compile unit: When that's done, these missing headers become compile errors. We should just fix them. In addition, this allows us to enable automatic header checking in clang-tidy using misc-header-cleaner. Because the compiler can now "see" all the defines, it no longer tries to remove headers that it thinks are unused. [1] https://github.com/openbmc/bmcweb/commit/4fdee9e39e9f03122ee16a6fb251a380681f56ac Tested: Code compiles. Change-Id: Ifa27ac4a512362b7ded7cc3068648dc4aea6ad7b Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-17Refactor tftp parserEd Tanous1-16/+23
This function in the next patch will be used for more than just TFTP, so rename it to match intent, and refactor to use non-TFTP specific types. Tested: Rename only. Need help on TFTP setups if we need it. Change-Id: Ifc7485aa60ec53407c38b3d1bec530bdacf50075 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-04-11Fix post code parsingEd Tanous1-0/+29
If we use string_view with std::from_chars, we can use begin() and end() directly (because they return pointers) and not have to do silly things like dereference end(), which, while works in practice, is technically undefined behavior, and some static analyzers complain about it. Tested: Unit tests pass against both old parsePostCode and new. Change-Id: Icfdec3b81f4a9c9bed3599571a8bc8779f9bfb98 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-28Add misc-include-cleanerEd Tanous9-16/+27
And fix the includes that are wrong. Note, there is a very large ignore list included in the .clang-tidy configcfile. These are things that clang-tidy doesn't yet handle well, like knowing about a details include. Change-Id: Ie3744f2c8cba68a8700b406449d6c2018a736952 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-27Check optionals in tidyEd Tanous1-3/+15
clang-tidy-18 makes this feature stable enough for us to use in general. Enable the check, and fix the couple of regressions that have snuck in since we last ran the check. Tidy seems to not be able to understand that ASSERT will not continue, so if we ASSERT a std::optional, it's not a bug. Add explicit checks to keep tidy happy. Tested: clang-tidy passes. Change-Id: I0986453851da5471056a7b47b8ad57a9801df259 Signed-off-by: Ed Tanous <ed@tanous.net>
2024-03-04AllowedHostTransitions: look for on dbusAndrew Geissler1-0/+132
Commit [1] introduced a new optional dbus property that OpenBMC developers can populate to define which redfish/v1/Systems/system/ResetActionInfo AllowableValues are. Look for that new property on dbus. If not found, hard code the previous values otherwise utilize the property to fill in the return value. Tested: - Put new property on dbus and confirmed Redfish API returned expected values: ``` curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Systems/system/ResetActionInfo { "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo", "@odata.type": "#ActionInfo.v1_1_2.ActionInfo", "Id": "ResetActionInfo", "Name": "Reset Action Info", "Parameters": [ { "AllowableValues": [ "ForceOff", "PowerCycle", "Nmi", "On", "ForceOn", "ForceRestart", "GracefulRestart", "GracefulShutdown" ], "DataType": "String", "Name": "ResetType", "Required": true } ] } ``` - Did not run redfish validator as response was same as previous [1]: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/68933 Change-Id: Iecece14e7ff55db98d96df71b106ecc9e3f0ac33 Signed-off-by: Andrew Geissler <geissonator@yahoo.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2024-02-23manager_diagnostic_data: add metric getJagpal Singh Gill1-0/+75
Add support to fetch MemoryStatistics, FreeStorageSpaceKiB and ProcessorStatistics for Manager Diagnostic Data. https://redfish.dmtf.org/schemas/v1/ManagerDiagnosticData.v1_2_1.json This change is in relation to following design and D-Bus interface - https://gerrit.openbmc.org/c/openbmc/docs/+/64917 https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64914 Test: Redfish query output - { "@odata.id": "/redfish/v1/Managers/bmc/ManagerDiagnosticData", "@odata.type": "#ManagerDiagnosticData.v1_2_0.ManagerDiagnosticData", "FreeStorageSpaceKiB": 3772, "Id": "ManagerDiagnosticData", "MemoryStatistics": { "AvailableBytes": 354224066, "BuffersAndCacheBytes": 78984633, "SharedBytes": 11876066, "TotalBytes": 425516000 }, "Name": "Manager Diagnostic Data", "ProcessorStatistics": { "KernelPercent": 13.0234, "UserPercent": 5.7374 }, "ServiceRootUptimeSeconds": 2255.117 } Redfish service validator passing - Elapsed time: 0:03:12 metadataNamespaces: 3726 pass: 5133 passAction: 9 passGet: 205 passRedfishUri: 197 skipNoSchema: 3 skipOptional: 3492 warnDeprecated: 4 warningPresent: 7 Validation has succeeded. Change-Id: I43758a993eb7f342cb9ac5f5574498b37261c2cc Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
2024-01-19Clean up tftp update to use URLEd Tanous1-0/+55
Similar to transforms we've done elsewhere, we shouldn't be parsing urls using std::string::find, regex, or anything else, as they don't handle URL % encoding properly. Change-Id: I48bb30c0c737c4df2ae73f40fc49c63bac5b658f Signed-off-by: Ed Tanous <edtanous@google.com>
2023-12-12Use MonotonicTimeStamp for bmc log idMyung Bae1-0/+69
/redfish/v1/Managers/bmc/LogServices/Journal/Entries gives the system journal entries whose ID is based on the realtime timestmap. However, the system realtime may go backward if the system time is changed either manually or via NTP. If that happens, those entries may not found via redfish GET as `sd_journal_seek_realtime_usec()`[1] may not always work on the entries which are not sorted in time-order. This may cause the inconsistency between the content of `/redfish/v1/Managers/bmc/LogServices/Journal/Entries/` and /redfish/v1/Managers/bmc/LogServices/Journal/Entries/<bmc_journal_id>`. For example, ``` sudo journalctl --vacuum-time=1s <wait for a while to clear up journal> date -s "<backward-time>" date -s "<forward-time>" ``` Run redfish journal entries and get each entry id from the output ``` curl -k -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries > rj.out ``` Take some logEntry Id that its time going backward like ``` grep "@odata.id" rj.out ``` Run redfish query for each id, and some of them can't be successful. ``` % curl -k -X GET https://${bmc}/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type LogEntry named '1701604800002075' was not found.", "MessageArgs": [ "LogEntry", "1701604800002075" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type LogEntry named '1701604800002075' was not found." } }% ``` This can also be verified by checking the failure of Redfish Validator run ``` python3 RedfishServiceValidator.py --auth Session -i https://${bmc} -u admin -p 0penBmc0 --payload Tree /redfish/v1/Managers/bmc/LogServices/Journal/Entries ``` For example, ``` ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075 returned HTTP error. Check URI. ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800065949 returned HTTP error. Check URI. ERROR - Members: GET of resource at URI /redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701607680003048 returned HTTP error. Check URI. ``` ``` --Time goes backwrd { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701604800002075", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2023-12-03T12:00:00+00:00", "EntryType": "Oem", "Id": "1701604800002075", "Message": "systemd-resolved: Clock change detected. Flushing caches.", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" }, ... { "@odata.id": "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/1701607680003048", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "Created": "2023-12-03T12:48:00+00:00", "EntryType": "Oem", "Id": "1701607680003048", "Message": "systemd-resolved: Clock change detected. Flushing caches.", "Name": "BMC Journal Entry", "OemRecordFormat": "BMC Journal Entry", "Severity": "OK" }, -- Time comes back to the previous moment ``` The solution is proposed to use <bootid> + <monototic timestamp> as the redfish journal entry id instead of realtime timestamp. Unlike realtime timestamp which may go backward, <monotonic timestamp> is monotonically increasing. Tested: - Redfish Validator passes - GET Journal Entry ID will be found even if its time goes backward. [1] https://github.com/openbmc/bmcweb/blob/7164bc62dd26ec92b01985aaae97ecc48276dea5/redfish-core/lib/log_services.hpp#L2690 Change-Id: I83bfb1ed88c9cf036f594757aa4a00d2709dd196 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-05-25Fix some includesEd Tanous1-1/+2
System includes should be included with <>, in-tree includes should be included with "". This was found manually, with the help of the following grep statement[1]. git grep -o -h "#include .*" | sort | uniq Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1a6b2a5ba35ccbbb61c67b7c4b036a2d7b3a36a3
2023-05-12Update RedfishVersion to 1.17.0Ed Tanous1-1/+1
The latest version of the specification is 1.17.0, and arguably, we should be updating this every time we pull in any new feature, but that hasn't happened. So far as I'm aware, there are no tools that actually look at this parameter to make branching decisions in the client about supported features, so the likelihood this has impact is basically nil. Tested: GET /redfish/v1 returns RedfishVersion of 1.17.0 Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I055b6010329599b7b39c587fa85faf51a38c9b57
2023-05-12use emplace where appropriate per clang-tidyPatrick Williams1-2/+2
The clang-tidy warning 'modernize-use-emplace' correctly flags a few places where emplace should be used over push. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I6ca79285a87d6927e718345dc8dce0387e6b1eda
2023-05-11clang-format: copy latest and re-formatPatrick Williams1-2/+1
clang-format-16 has some backwards incompatible changes that require additional settings for best compatibility and re-running the formatter. Copy the latest .clang-format from the docs repository and reformat the repository. Change-Id: I75f89d2959b0f1338c20d72ad669fbdc1d720835 Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
2023-03-02Add ManagerProvidingService implementationEd Tanous1-2/+5
This property was added in Redfish 2022.3 to allow clients to determine which manager is hosting the ServiceRoot, such that they can find uptime statistics, and other metrics from that resource, without needing to attach them directly to serviceroot. Tested: Redfish service validator passes. GET /redfish/v1/Managers/bmc returns the expected response. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If2b78528d1499fbdae46120e1a1792ecf7ceb1d3
2023-01-14LogService: Use DeleteAll DBus method in clearDumpClaire Weinan1-91/+0
Update the clearDump() implementation to call the DeleteAll D-Bus method instead of iterating through D-Bus objects representing individual log entries and calling the Delete D-Bus method on each one. (It's more efficient for phosphor-debug-collector to iterate through entries in its DeleteAll method handler than for bmcweb to iterate through them.) It seems like clearDump() wasn't originally implemented using DeleteAll because dumps of various types were under the same D-Bus path namespace at the time and there wasn't a way to selectively clear dumps of only a specific type. The commit at [1] put different dump types under different path namespaces (enabling us to now use DeleteAll). Now clients should see a bit of performance improvement when running the ClearLog action on dump LogServices, due to the reduced number of D-Bus method calls needed to execute ClearLog. Also updated getDumpServiceInfo() to populate the ClearLog action for dump LogServices based on whether their dump manager object implements xyz.openbmc_project.Collection.DeleteAll. Tested: Cleared the fault log containing 100 entries. Ran with the time command several times before and after the change: ``` time curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Managers/bmc/LogServices/FaultLog/Actions/LogService.ClearLog ``` Before the change, "real" time reported was ~1.2s. After the change, "real" time reported was ~0.4s. Forced creation of dump entries and then ran Redfish ClearLog action on each dump type: ``` curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Managers/bmc/LogServices/FaultLog/Actions/LogService.ClearLog curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog ``` Then verified that there were no dump LogService entries afterwards: ``` curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Entries curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries ``` Also verified that the corresponding D-Bus objects were gone from the D-Bus tree after running ClearLog on each dump type: Before ClearLog: 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/101 |-/xyz/openbmc_project/dump/faultlog | `-/xyz/openbmc_project/dump/faultlog/entry | |-/xyz/openbmc_project/dump/faultlog/entry/11 | |-/xyz/openbmc_project/dump/faultlog/entry/12 | |-/xyz/openbmc_project/dump/faultlog/entry/13 | |-/xyz/openbmc_project/dump/faultlog/entry/14 | |-/xyz/openbmc_project/dump/faultlog/entry/15 | |-/xyz/openbmc_project/dump/faultlog/entry/16 | |-/xyz/openbmc_project/dump/faultlog/entry/17 | |-/xyz/openbmc_project/dump/faultlog/entry/18 | |-/xyz/openbmc_project/dump/faultlog/entry/19 | `-/xyz/openbmc_project/dump/faultlog/entry/20 |-/xyz/openbmc_project/dump/internal | `-/xyz/openbmc_project/dump/internal/manager `-/xyz/openbmc_project/dump/system `-/xyz/openbmc_project/dump/system/entry |-/xyz/openbmc_project/dump/system/entry/3 `-/xyz/openbmc_project/dump/system/entry/4 After ClearLog: busctl tree xyz.openbmc_project.Dump.Manager `-/xyz `-/xyz/openbmc_project `-/xyz/openbmc_project/dump |-/xyz/openbmc_project/dump/bmc |-/xyz/openbmc_project/dump/faultlog |-/xyz/openbmc_project/dump/internal | `-/xyz/openbmc_project/dump/internal/manager `-/xyz/openbmc_project/dump/system Confirmed that ClearLog action is listed for the following LogServices: /redfish/v1/Managers/bmc/LogServices/Dump /redfish/v1/Managers/bmc/LogServices/FaultLog /redfish/v1/Systems/system/LogServices/Dump Then ran "systemctl stop xyz.openbmc_project.Dump.Manager" (which removes dump manager objects including their xyz.openbmc_project.Collection.DeleteAll interface) and saw that the ClearLog action was no longer listed. Also locally built a version of phosphor-debug-collecor with the interface xyz.openbmc_project.Collection.DeleteAll removed from dump managers and ran it and saw that the ClearLog action wasn't listed. Redfish Service Validator passed on the following URIs (with service xyz.openbmc_project.Dump.Manager running): /redfish/v1/Managers/bmc/LogServices/Dump /redfish/v1/Managers/bmc/LogServices/FaultLog /redfish/v1/Systems/system/LogServices/Dump Note: Most dump LogService unit tests were removed in this patchset since this patchset adds a D-Bus call to getDumpServiceInfo(), and we haven't decided how to mock D-Bus calls for unit testing yet. [1] https://github.com/openbmc/phosphor-debug-collector/commit/fef66a951fe6fe283515480b2c493dfdc2275a95 Signed-off-by: Claire Weinan <cweinan@google.com> Change-Id: Ic5f8f9e3528f521887766d8710bd77f969d8236a