summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
2023-05-11time-utils: fix clang-tidy warningPatrick Williams1-2/+2
The code already does size checking to ensure that buffer overruns are not done, so switch to using operator[] rather than pointer arithmetic. ``` ../redfish-core/include/utils/time_utils.hpp:71:19: error: unsafe pointer arithmetic [-Werror,-Wunsafe-buffer-usage] end = fmt.data() + pos; ``` Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: Iaabe82d7c1621dc27ad10288732609dfd0516d17
2023-05-11clang-format: copy latest and re-formatPatrick Williams33-191/+147
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-05-10managers: fix bug of searching dbus object pathPotin Lai1-2/+4
Notice a bug of patching existed object if the object name contains space or underscore. Normally dbus replace space with underscore for object path. Replacing all spaces in input name with underscore to find the correct dbus object path. Tested results: - Add new object Input JSON ``` { "Oem": { "OpenBmc": { "Fan": { "StepwiseControllers": { "Test_1": { "Direction": "Floor", "Inputs": [ "MB_U402_THERM_LOCAL" ], "NegativeHysteresis": 0.0, "PositiveHysteresis": 0.0, "Steps": [ { "Output": 0.0, "Target": 48.0 }, { "Output": 40.0, "Target": 52.0 } ], "Zones": [ { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0" } ] } } } } } } ``` Check result from /redfish/v1/Managers/bmc ``` "Test_1": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/Test_1", "@odata.type": "#OemManager.StepwiseController", "Direction": "Floor", "Inputs": [ "MB U402 THERM LOCAL" ], "NegativeHysteresis": 0.0, "PositiveHysteresis": 0.0, "Steps": [ { "Output": 0.0, "Target": 48.0 }, { "Output": 40.0, "Target": 52.0 } ], "Zones": [ { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0" } ] } ``` - Patching existed object successful Input JSON ``` { "Oem": { "OpenBmc": { "Fan": { "StepwiseControllers": { "Test_1": { "NegativeHysteresis": 0.0, "PositiveHysteresis": 5.0, } } } } } } ``` Check result from /redfish/v1/Managers/bmc ``` "Test_1": { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/Test_1", "@odata.type": "#OemManager.StepwiseController", "Direction": "Floor", "Inputs": [ "MB U402 THERM LOCAL" ], "NegativeHysteresis": 0.0, "PositiveHysteresis": 5.0, "Steps": [ { "Output": 0.0, "Target": 48.0 }, { "Output": 40.0, "Target": 52.0 } ], "Zones": [ { "@odata.id": "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/Zone0" } ] } ``` Signed-off-by: Potin Lai <potin.lai@quantatw.com> Change-Id: I12c78e52801bd0814ba2d928cf020e0a04214c39
2023-05-04bugfix: find existing powersupply for power sensorAlexander Hansen1-1/+2
Fix lookup for existing powersupplies when building json. (dbus: '_' , json: ' ') Tested: manually with 2 Supermicro Power Supplies. Change-Id: Iecd14c0b9860a12c64b004c99cb6a7fb1dd0328a Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
2023-05-04Update depth parameter in getPCIeDeviceListLakshmi Yadlapati1-1/+1
The current call to getSubTreePaths is using a depth of 1, which limits the search to only the direct children of the inventoryPath. However, the interface may be found at any depth in the subtree, so the depth parameter should be set to 0 to search the entire subtree, in order to ensure that all relevant objects are included in the search results. getValidPCIeDevicePath and getPCIeDeviceList should call getSubTreePaths with the same depth parameter value to ensure that the same level of the PCIe device tree is being searched for devices. Tested: Validator passed Change-Id: Ic990581ef186f4bf1511a221c4e305ff6c2afdf2 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-05-02virtual_media: Fix for bmcweb crashJayaprakash Mutyala1-0/+10
bmcweb crashes when user not providing userName or password while posting ISO form Redfish. This fix provides to avoid bmcweb crash when user try to post ISO images from Redfish without providing username or password. Tested: Redfish validator passed with this change. Verified by Posting ISO from Redfish. Signed-off-by: Arun Kapale <arunx.kapale@intel.com> Signed-off-by: Jayaprakash Mutyala <mutyalax.jayaprakash@intel.com> Change-Id: Ib9c7ed668f13943bdacdd9afda0e65d6bcc438d0
2023-05-02Aggregation: Process subordinate top collectionsCarson Labrado1-15/+163
Adds a function to process responses from URIs that are uptree from a top level collection. A follow-up patch will hook this into the aggregation code to allow adding links to top level collections which are only supported by satellite BMCs. Adds test cases to validate this function is working correctly. Tested: New test cases pass Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I7f0fd6c3955398e2fde136c1d3b37a6bf4bf06b9
2023-05-01Fix PCIeDevice redfish validator failureLakshmi Yadlapati1-1/+1
Specify correct interface for getSubTreePaths in getPCIeDeviceList. This commit addresses a Redfish validator failure that occurred after a previous commit. ''' https://github.com/openbmc/bmcweb/commit/94c3a10b94c3ce063d6c1aed3a597f0d524594d5 ''' Both the inventory path and interface were incorrect, and the inventory path was fixed in the previous commit. This commit fixes the interface in the getSubTreePaths function to ensure that it returns the correct PCIeDevice list. Without the correct interface, the function was returning incorrect devices, which was causing the Redfish validator failure. Tested: Validator passed for PCIeDevice Change-Id: Iab6a26ee0dd933be6cf371bdd13e5d10d6d10efa Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Cleanup pcie codeLakshmi Yadlapati1-12/+6
Remove unused variable pcieService, fix pciePath and use global variables pciePath and pcieDeviceInterface. Tested: tested PCIeDeviceCollection and PCIeDevice, and tested the changes with the peci-pcie commit https://gerrit.openbmc.org/c/openbmc/peci-pcie/+/62100 Change-Id: Iff8aee3f8bc43740b1885a2da584b0e6cf579dcc Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Add Asset information for PCIeDeviceSunnySrivastava19841-0/+65
This commit publishes inventory properties like SparePartNumber, Model, PartNumber, SerialNumber, Manufacturer for PCIe devices. Tested: Validator passed ``` "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card10", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "pcie_card10", "Manufacturer": "", "Model": "6B87", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card10/PCIeFunctions" }, "PCIeInterface": { "LanesInUse": 16, "PCIeType": "Gen4" }, "PartNumber": "03FL204", "SerialNumber": "YA31UF07200Z", "SparePartNumber": "03FL205" ``` Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com> Change-Id: I850fe5eb2b3b3b9d47f4256ce0c4408bb1dd2bd1 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Refactor SystemPCIeFunction methodLakshmi Yadlapati1-104/+121
Move SystemPCIeFunction to a separate method, and refactor the code. Validate the PCIe device path and add link header. Tested: Validator passed ``` { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7/PCIeFunctions/0", "@odata.type": "#PCIeFunction.v1_2_3.PCIeFunction", "ClassCode": "0x020000", "DeviceId": "0x1657", "FunctionId": 0, "Id": "0", "Links": { "PCIeDevice": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7" } }, "Name": "PCIe Function", "RevisionId": "0x01", "SubsystemId": "0x0420", "SubsystemVendorId": "0x1014", "VendorId": "0x14e4" } ``` Change-Id: I99add03210983a255a615512b6137d04982f83a5 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Refactor SystemPCIeFunctionCollection methodLakshmi Yadlapati1-80/+81
Move SystemPCIeFunctionCollection to a separate method, and refactor the code. Validate the PCIe device path and add link header. Tested: Validator passed ``` { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7/PCIeFunctions", "@odata.type": "#PCIeFunctionCollection.PCIeFunctionCollection", "Description": "Collection of PCIe Functions for PCIe Device pcie_card7", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7/PCIeFunctions/0" } ], "Name": "PCIe Function Collection", "PCIeFunctions@odata.count": 1 } ``` Change-Id: I5aa10ce0b4d2f20104612f840cf4098698a83470 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Refactor SystemPCIeDevice methodLakshmi Yadlapati1-95/+177
Move SystemPCIeDevice to a separate method, and refactor the code. Validate the PCIe device path. Tested: Validator passed ```# curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices/pcie_card7 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card7", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "pcie_card7", "Name": "PCIe Device", "PCIeInterface": { "LanesInUse": 4, "PCIeType": "Gen1" } } ``` Change-Id: Ib9bd3ff37293b64adbf9987c3d932882befd21d4 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-28Moving to correct PCIe Device interfaceLakshmi Yadlapati1-1/+1
Move PCIe device interface to "xyz.openbmc_project.Inventory.Item.PCIeDevice". peci-pcie commit: https://gerrit.openbmc.org/c/openbmc/peci-pcie/+/62100 Tested: Validator passed Change-Id: Ica6f4ca37bf9adca18bedc69422ff05f0c7d73f2 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-04-25Fix regression in virtual mediaBoleslaw Ogonczyk Makowski1-1/+2
VmMode::Proxy was being checked incorrectly in [1] instead of VmMode::Legacy which didn't allow mounting in legacy mode. Removing return in [2] caused the code to display an error while unmounting even when unmounted successfully. Tested: Can mount in legacy mode Unmounting successfully in legacy mode doesn't display an error [1]: https://github.com/openbmc/bmcweb/commit/365a73f4725a6cefa3d69168ae5500fd05ff8866#diff-3d181e155cfa7f397eface92af17130f3db87773ce4219d9c7e24e00b76b94acR865 [2]: https://github.com/openbmc/bmcweb/commit/365a73f4725a6cefa3d69168ae5500fd05ff8866#diff-3d181e155cfa7f397eface92af17130f3db87773ce4219d9c7e24e00b76b94acL956 Change-Id: I522369cfd81ca084c7379ff97371f8a292950849 Signed-off-by: Boleslaw Ogonczyk Makowski <boleslawx.ogonczyk-makowski@intel.com>
2023-04-19log_services: Fix isContentTypeAllowed checksMatt Spinler1-2/+2
The commit https://gerrit.openbmc.org/c/openbmc/bmcweb/+/56694 inadvertently changed the polarity on the if checks using the newly introduced isContentTypeAllowed function which caused 'Bad Request' to be returned when the content type was allowed. Tested: Getting the EventLog and PostCodes attachment would return the data instead of 'Bad Request'. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Iafcdeaba1a0723326347bb2a832b53bbf0aab230
2023-04-17Fix clang-tidy issue in aggregationEd Tanous1-2/+2
clang-tidy flags the following error, which is correct. ``` ../redfish-core/include/query.hpp:145:26: error: static member accessed through instance [readability-static-accessed-through-instance,-warnings-as-errors] needToCallHandlers = RedfishAggregator::getInstance().beginAggregation( ``` Tested (Carson): Verified that queries to top level collections as well as aggregated resources still return as expected. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I440fb29d2e0b3da52bfd564676d33b72f69f2fbc Signed-off-by: Carson Labrado <clabrado@google.com>
2023-04-11Fix PowerSubsystem/PowerSupplies causing validator to failGeorge Liu1-0/+2
In the following commit[1], the member of Members was removed by mistake, causing the validator to fail. This commit fixes this problem. Redfish validator failing with the following: ERROR - Members: Mandatory prop does not exist 1 failMandatoryExist errors in /redfish/v1/Chassis/chassis/PowerSubsystem/PowerSupplies 1 failMandatoryExist errors in /redfish/v1/Chassis/motherboard/PowerSubsystem/PowerSupplies [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/57668/26..29//COMMIT_MSG#b15 Tested: Validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I814e07d860422c5dce0fbb6267cb58dc07a74c31
2023-04-11Implements PowerSupplies schemaGeorge Liu3-0/+128
This commit implements the Redfish PowerSupplyCollection at /redfish/v1/Chassis/<chassis Id>/PowerSubsystem/PowerSupplies. It shall contain an array of links to resources of type PowerSupply that represent the power supplies that provide power to this chassis. For the association between power supply and chassis, refer to[1]. Also, the members property is implemented in the next commit with the PowerSupply implementation, this is so the validator will pass. [1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/57428 Tested: Validator passes 1. curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies" "@odata.type": "#PowerSupplyCollection.PowerSupplyCollection", "Description": "The collection of PowerSupply resource instances chassis", "Members": [ ], "Members@odata.count": 0, "Name": "Power Supply Collection" } 2. Bad chassisId curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassisError/PowerSubsystem/ PowerSupplies { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named 'chassisError' was not found.", "MessageArgs": [ "Chassis", "chassisError" ], "MessageId": "Base.1.13.0.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.0.ResourceNotFound", "message": "The requested resource of type Chassis named 'chassisError' was not found." } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I48e087d6fb52013e3a96b44391cc4d86049ac176
2023-04-07Aggregation: Check for subordinate collectionCarson Labrado1-0/+105
Adds a search function which is able to determine if a passed URI is a top level collection, is uptree from a top level collection, or both. The type being searched for depends on a second argument passed to the function. Each of these searches are used to add links to top level collections which are only supported by a satellite BMC. They all use similar steps so rolling them into a single function cuts down on redundant code. Adds test cases to verify the implementation is correct. Tested: New test cases pass Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I72ae7442d5f314656b57a73aee544bca516fa7c2
2023-04-04Add HotPluggable support in RedfishLogananth Sundararaj1-17/+41
HotPluggable is an indication of whether this component can be inserted or removed while the equipment is in operation. HotPluggable is a property can read from the Entity manager under the xyz.openbmc_project.Inventory.Decorator.Replaceable interface. Tested: Tested and verified in YosemiteV2 platform and Redfish validator has passed. Change-Id: I7b2203b1843fa3cbdbef7803b598d113346c0682 Signed-off-by: Logananth Sundararaj <logananth_s@hcl.com>
2023-03-29Fix If Match header in Http layerHieu Huynh1-0/+6
Commit [1] prevents the clients performing methods if missing ETag from the If-Match header. For the "If-Match: *" [2] that representing any resource, it should be the valid command. [1] https://github.com/openbmc/bmcweb/commit/2d6cb56b6b47c3fbb0d234ade5c1208edb69ef1f [2] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Match Tested: Can performing methods GET/POST/PATCH/DELETE with "If-Match: *" header. Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com> Change-Id: I2e5a81ed33336a939b01bd6b64d3ff99501341d0
2023-03-28Support for configurable host reboot countCorey Hardesty1-29/+107
ComputerSystem.v1.11 introduced a new property, AutomaticRetryAttempts, which allows for the amount of automatic retry attempts on host boot failures to be configured through Redfish. This commit adds support for this new property. The added function "setAutomaticRetryAttempts()" allows users to set the "RetryAttempts" property externally through bmcweb. This property is documented in D-Bus and has a default value of 3. All implementations of the interface have this property implemented. The new code preserves backward compatibility and does not break any existing user-facing behavior. Tested: - Ensured that the new "AutomaticRetryAttempts" property could be retrieved through bmcweb. Verified that it was accurately representing its corresponding DBus property, "RetryAttempts". - Sent curl commands to patch the "AutomaticRetryAttempts" property which also updates the "AttemptsLeft" DBus property represented as "RemainingAutomaticRetryAttempts" as expected. - Verified that changes made to "RetryAttempts" through DBus were accurately represented in successive "Gets" from bmcweb. - Passed Redfish Validator curl -k -H "X-AUTH" -X GET https://${BMC_IP}/redfish/v1/Systems/system/ "Boot": { "AutomaticRetryAttempts": 3, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "RemainingAutomaticRetryAttempts": 3, "StopBootOnFault": "Never", "TrustedModuleRequiredToBoot": "Disabled" }, curl -k -X PATCH https://${BMC_IP}/redfish/v1/Systems/system/ -d '{"Boot": {"AutomaticRetryAttempts":4}}' "Boot": { "AutomaticRetryAttempts": 4, "AutomaticRetryConfig": "RetryAttempts", "AutomaticRetryConfig@Redfish.AllowableValues": [ "Disabled", "RetryAttempts" ], "RemainingAutomaticRetryAttempts": 4, "StopBootOnFault": "Never", "TrustedModuleRequiredToBoot": "Disabled" }, Signed-off-by: Corey Hardesty <corey.hardesty@icloud.com> Change-Id: I034782847a2318e2604bdd0cf33cdf705d224acb Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-03-28Aggregation: Prefix fix HttpHeaders propertyCarson Labrado1-0/+40
The "HttpHeaders" property in a response is an array of HTTP headers. We perform prefix fixing on the "Location" header from responses so we should also fix any "Location" headers which are contained by "HttpHeaders" in an aggregated response. This requires special handling since each header is represented as a single string in the response. Added testcase for HttpHeaders property Tested: All unit tests pass Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I3040c4ea52b2bebcb6e206bb50585c6a75538f0a
2023-03-24UpdateService: Support for MultipartHttpPushUriGeorge Liu1-47/+167
Since a service support the MultipartHttpPushUri property within the UpdateService resource, so add a new MultipartHttpPushUri property, This property shall contain a URI used to perform a Redfish Specification-defined Multipart HTTP or HTTPS POST of a software image for the purpose of installing software contained within the image, and use the requirements of a multipart/form-data to request body for HTTP push software update. Tested: curl -k -H "X-Auth-Token: $token" -H "Content-Type: multipart/form-data" -F 'UpdateParameters={"Targets":["/redfish/v1/Managers/bmc"], "@Redfish.OperationApplyTime":"Immediate"};type=application/json' -F 'UpdateFile=@obmc-phosphor-image.static.mtd.tar;type=application/ octet-stream' https://${bmc}/redfish/v1/UpdateService/update { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } Passed the validator: Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ie1ea0594337efdb073270aba6918389c4381a2b3
2023-03-23Refactor getAssociationEndPoints methodGeorge Liu5-62/+35
Since the getAssociationEndPoints method has been implemented in dbus_utility and this commit is to integrate all the places where the endpoints attribute is obtained, and use the method in dbus_utility uniformly. Tested: 1. Redfish Validator Passed 2. For all the endpoints we changed, we got the same result as before Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I91a5e80de5bc3b5712c2d5b81f2f8b982d1c884e
2023-03-22systems: Fix missing EnterDwellTime propertyChris Cain1-3/+3
Prior commit missed adding a required property to a rewrite using sdbusplus::unpackProperties() Fixes a regression introduced in commit bc1d29de81216e99d0a73c5fd3b6bb7fd2194ba8 Validator passed: IdlePowerSaver [JSON Object] ComputerSystem.v1_16_0.IdlePowerSaver Yes complex IdlePowerSaver.Enabled False boolean Yes PASS IdlePowerSaver.EnterUtilizationPercent 8 number Yes PASS IdlePowerSaver.EnterDwellTimeSeconds 240 number Yes PASS IdlePowerSaver.ExitUtilizationPercent 12 number Yes PASS IdlePowerSaver.ExitDwellTimeSeconds 10 number Yes PASS Change-Id: I345c714b71d50d6c8c03120c54bdabe0bd5d0714 Signed-off-by: Chris Cain <cjcain@us.ibm.com>
2023-03-22LogService: Fix potential null pointer dereferenceCarson Labrado1-6/+9
Querying CollectDiagnosticData Action results in a crash if there is not an active user session. Fixes the null pointer dereferencing introduced by https://gerrit.openbmc.org/c/openbmc/bmcweb/+/58688. Tested: Queried the Action URI and received a response instead of bmcweb crashing curl -X POST -H 'Content-Type: application/json' \ localhost/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData/ \ -d '{"DiagnosticDataType": "Manager"}' { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" } Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ic46ece84598613e4bbe51f4188a623ba857c18a0
2023-03-21Add component integrity schemasEd Tanous1-0/+2
Update the schema pack to include ComponentIntegrity resources. ComponentIntegrity is used for representing roots of trust, and conveying attestation parameters forward. Tested: Automated change Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1c62ddeeb9151bfe2852199a9ebb12a6636e6262
2023-03-21IPv6: Remove AddressState from redfish response.Sunitha Harish1-1/+1
Network backend does not return the AddressState and its currently displayed as null. This is misleading the user. This commit removes this property until backend supports. Tested by: Verify ethernet interface does not return AddressState for IPv6 Change-Id: I5489f57ce3d50d1480033f27adf1bc95153fdd18 Signed-off-by: Sunitha Harish <sunithaharish04@gmail.com>
2023-03-20Aggregation: Increase response read limit to 50MBCarson Labrado3-54/+46
With Redfish aggregation, responses from satellite BMCs can be on the order of MBs due to use cases like logging or binary payloads. Offloading $expand could similar result in responses that exceed the current read limit of 128 KB. Splits the connection pools used for aggregation and EventService so that the response read limit is 50MB for responses associated with aggregation. Pools used by EventService keep the current limit of 2^17 bytes or 128 KB. It also propogates a ConnectionPolicy object that gets instantiated within HttpClient, which allows per-client policies for retry/byte limits. This allows EventService and aggregation to have different policies. Tested: With aggregation enabled I was able to return a response from a satellite BMC which was than 2MB. Ran the Redfish Mockup Creator and it was able to successfully query all aggregated resources as part of walking the tree. Also verified that HTTP push events still work with EventListener. Change-Id: I91de6f82aadf8ad6f7bc3f58dfa0d14c0759dd47 Signed-off-by: Carson Labrado <clabrado@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-03-18Implement AggregationSourceCarson Labrado4-53/+207
Adds an AggregationSource resource for each satellite config present on dbus. Adds the AggregationSource schema which we had previously ignored. Tested: Querying an AggregationSource returned the expected information. curl localhost/redfish/v1/AggregationService/AggregationSources/5B247A { "@odata.id": "/redfish/v1/AggregationService/AggregationSources/5B247A", "@odata.type": "#AggregationSource.v1_3_1.AggregationSource", "HostName": "http://122.111.11.1:80", "Id": "5B247A", "Name": "Aggregation source", "Password": null, } Service Validator passed. The Service Validator also passed after removing the satellite config from the system such that /redfish/v1/AggregationService/AggregationSources returns an empty Members array. Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I88b5fbc15f27cddd330ec22a25427fd8b18cf766
2023-03-17Fix cannot get NTPServersJian Zhang1-2/+5
When we have 2 or more netdevs, if eth0 configured the StaticNTPServers and eth1 not by default, the NTPServers will be empty. We could merge all the NTPServers from all the interfaces, and remove the duplicate ones(Already have). Limitations(not this patch): When setting the NTPServers, will set all the interfaces, cannot be set individually. Tested: Only config the eth0's NTPServers, keep eth1's NTPServers empty. ``` ~# curl -k -H "X-Auth-Token: $token" https://$bmc/redfish/v1/Managers/bmc/NetworkProtocol { ... "NTP": { "NTPServers": [ "fdbd:dc00::10:8:8:14", "fdbd:dc00::10:8:8:15", "fdbd:dc00::10:8:8:16", "10.8.8.14", "10.8.8.15", "10.8.8.16" ], "ProtocolEnabled": true }, } ``` Change-Id: Ie181bb117577bc46f87e714b87dcb7cd8f5145a8 Signed-off-by: Jian Zhang <zhangjian.3032@bytedance.com>
2023-03-17Add the GetManagedObjects method to dbus_utilityGeorge Liu1-9/+9
There are currently many files that use the GetManagedObjects method. Since they are a general method, they are defined in the dbus_utility.hpp file and refactors them. Tested: 1. Built bmcweb successfully and Validator passes. 2. We got the same result as previously in the ethernet schema. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I0c25b7b6b9421bea46ff0afadbaa4783b704e664
2023-03-16Fix resource delete event issueAsmitha Karunanithi1-1/+1
This change corrects the event type when a resource is removed. Tested By: Tested in the client side - resource removed events are received Change-Id: Ib7b017c58401b9be674d330bc476d8c30d3721d6 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com>
2023-03-15Move PCIeDeviceCollection to separate methodLakshmi Yadlapati1-24/+35
Similar to the code we've been building elsewhere, move PCIeDeviceCollection system to a separate method, and use getCollectionMembers. Tested: Validator passed ``` { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices", "@odata.type": "#PCIeDeviceCollection.PCIeDeviceCollection", "Description": "Collection of PCIe Devices", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/dp0_drive2" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/dp0_drive3" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card0" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" }, ..... ..... ], "Members@odata.count": 20, "Name": "PCIe Device Collection" } ``` Change-Id: Ib8d468f9163e49fc3767dd92b81e70b4d48e8867 Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-03-15Take url views by valueEd Tanous3-55/+45
Any of our things taking URLs should be taking url_view by value, similar to how we take string_view. From the beast documentation: "...it acts like a string_view in terms of ownership." [1] Therefore, we should treat it like we treat string_view, and take by value, not reference. [1] https://www.boost.org/doc/libs/master/libs/url/doc/html/url/ref/boost__urls__url_view.html Tested: Stacked these patches. Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I696b495f4aa04984225853f653cc175c0eaad79d
2023-03-15Replace space with underscore for Dbus Object PathYaswanth Reddy M1-1/+1
Currently code search for underscore and replace space in the dbus object path , which construct invalid object path.This Patch construct proper dbus object path by replacing space with underscore. Tested: Verified that object path is created in proper format. Change-Id: Ibdf18c13ce30aa007f165e1ccfe7f68e86d50c32 Signed-off-by: Yaswanth Reddy M <yaswanthx.reddy.munukuru@intel.com>
2023-03-14Only parse to the depth requestedEd Tanous1-9/+36
There are cases in aggregation where an expand parameter might get forwarded to a client. Because our previous expand algorithm assumed that any endpoint within bmcweb would only produce "depth=1" responses, it was reasonable to assume that the pre-response could not contain expanded content. Aggregated resources can't make that assumption. This commit attempts to pass through depth through the request, to ensure that we only expand the level that the user requested, and not any level returned by the request. This is done by using the existence of the resource identifer "@odata.id" to indicate each level in an expanded response. This should be fine since the Redfish spec requires that property to exist. Added unit tests to cover aggregation scenarios. Modified existing $expand tests to comply with the resource identifier dependency. Tested: New unit tests pass Queried '/redfish/v1/Systems?$expand=.($levels=2)' on an aggregated system whose satellite BMC supported $expand. The overall response was correctly expanded for both resources on the aggregating BMC as well as on the satellite BMC. Expanding the satellite resources did not require sending multiple queries to the satellite. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I20ba60ee39bac11ffb3fe1768cec6299cf9ee13e Signed-off-by: Carson Labrado <clabrado@google.com>
2023-03-14Implement AggregationSourceCollectionCarson Labrado3-0/+34
This is an intermediate step in setting up aggregation sources. A future patch will add aggregation sources based on the existence of satellite configs. For now the collection will always return as 0 members. Adds the AggregationSourceCollection schema which we previously ignored. Tested: Service Validator passes Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I65c9231289bf0a9b6392696d55bc3feb0023c694
2023-03-13Raise UnpackErrorPrinter to Log BMCWEB_LOG_ERRORdeepakala-k1-1/+1
If reading a particular property failed, it hits the UnpackErrorPrinter. The error was captured as a debug message(BMCWEB_LOG_DEBUG). As it is important to capture these traces on a release image, the log level is raised to BMCWEB_LOG_ERROR Change-Id: I14b8d6d48e3354beb317f6380b2f746cad151168 Signed-off-by: Deepa Karthikeyan <deepakala.karthikeyan@ibm.com>
2023-03-13Fix `MemberId` value error causes Validator to failGeorge Liu1-5/+3
The test using the latest Redfish verifier found the following errors ``` 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/ Temperatures/0 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/ Temperatures/1 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/ Temperatures/2 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/0 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/1 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/2 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/3 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/4 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/5 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/6 1 badMemberId errors in /redfish/v1/Chassis/chassis/Thermal#/Fans/7 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/0 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/1 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/2 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/3 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/4 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/5 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/6 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/7 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/8 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/Voltages/9 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/ Voltages/10 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/ Voltages/11 1 badMemberId errors in /redfish/v1/Chassis/chassis/Power#/ Voltages/12 ``` Because the Redfish verifier checks whether the MemberId matches the last part of the URL [1] ``` Added validation of the last segment of the URI to ensure it matches the Id property or MemberId property where appropriate. ``` [1] https://github.com/DMTF/Redfish-Service-Validator/blob/master/CHANGELOG.md#224---2023-02-05 Tested: Validator passes curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Thermal { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal", "@odata.type": "#Thermal.v1_4_0.Thermal", "Fans": [ { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Fans/0", "@odata.type": "#Thermal.v1_3_0.Fan", "MemberId": "0", ... }, { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Fans/1", "@odata.type": "#Thermal.v1_3_0.Fan", "MemberId": "1", ... }, { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Fans/2", "@odata.type": "#Thermal.v1_3_0.Fan", "MemberId": "2", ... }, { "@odata.id": "/redfish/v1/Chassis/chassis/Thermal#/Fans/3", "@odata.type": "#Thermal.v1_3_0.Fan", "MemberId": "3", ... }, ... Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I12151a2b20475071ea9b3ed3296754d56a0fed53
2023-03-11Make url by value in RequestEd Tanous7-14/+18
There's some tough-to-track-down safety problems in http Request. This commit is an attempt to make things more safe, even if it isn't clear how the old code was wrong. Previously, the old code took a url_view from the target() string for a given URI. This was effectively a pointer, and needed to be updated in custom move/copy constructors that were error prone to write. This commit moves to taking the URI by non-view, which involves a copy, but allows us to use the default move and copy constructors, as well as have no internal references within Request, which should improve the safety and reviewability. There's already so many string copies in bmcweb, that this is unlikely to show up as any sort of performance regression, and simple code is much better in this case. Note, because of a bug in boost::url, we have to explicitly construct a url_view in any case where we want to use segments() or query() on a const Request. This has been reported to the boost maintainers, and is being worked for a long term solution. https://github.com/boostorg/url/pull/704 Tested: Redfish service validator passed on last commit in series. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I49a7710e642dff624d578ec1dde088428f284627
2023-03-11Remove body member from RequestEd Tanous3-3/+3
Per cpp core guidelines, these should be methods. Tested: on last patchset of the series. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib16479db9d2b68da68e7ad6e825c7e205c64f1de
2023-03-11Remove fields member from RequestEd Tanous2-3/+3
Per cpp core guidelines, we should be returning this via a function call, not a direct member variable. Doing this also improves the safety, as we don't have to remember to move the references over in a move. Tested: Tested as part of top patch in series. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I837d6fd277ffa076ba5425003d6e6ee79204d014
2023-03-11Update hypervisor todoGunnar Mills1-5/+0
https://gerrit.openbmc.org/c/openbmc/bmcweb/+/61237/3 merged. hypervisor is no longer in its own namespace. Tested: None. Change-Id: I3dc3e01a0c3bcfd9a00a060f04505a6bc70860e6 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-03-11Fix hypervisor system GetAsmitha Karunanithi2-24/+15
The reason for this change is that there are two routes defined: [1] /redfish/v1/Systems/<str> in systems.hpp [2] /redfish/v1/Systems/hypervisor in hypervisor_system.hpp Whenever a user does a get on /redfish/v1/Systems/hypervisor, the first route is hit and that checks if <str> is "system" and if not, bmcweb returns resource not found error. ``` Error: ERROR - Members: GET of resource at URI /redfish/v1/Systems/hypervisor returned HTTP error. Check URI. ERROR - URI did not return resource /redfish/v1/Systems/hypervisor GET Failure HTTP Code (404) ``` The below upstream commit is causing this issue: [1] openbmc/bmcweb@22d268c#diff-cddfc26fddb6ba29f3fd81ecf5840fc6d9a8554bbca92f578d81b97db8b14895 To resolve this issue, an if hypervisor is inserted in the /redfish/v1/Systems/<str> and that calls handleHypervisorSystemGet. The /redfish/v1/Systems/hypervisor in redfish-core/lib/hypervisor_system.hpp is removed. Also fix /redfish/v1/Systems/hypervisor/ResetActionInfo/. Redfish validator passed. redfish/v1/Systems/hypervisor looks good. /redfish/v1/Systems/hypervisor/ResetActionInfo/ looks good. Change-Id: Ie2d9d19c258236ce86d6552ae4a3bd486e02de01 Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-03-09Move logging level to WARNING for 404Gunnar Mills3-5/+5
These are 4xx errors, 404 not found. Move the logging to WARNING so they don't log unless WARNING level is enabled. This follows the guidance in the commit below. Tested: None. Change-Id: I38b2bec64507d75286f79d61acf7a96226598e0b Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-03-09Move hypervisor system to separate methodGunnar Mills1-41/+43
Similar to the code we've been building elsewhere, move Hypervisor system to a separate method, and avoid lambdas. Tested: Code compiles. Tested as part of top patch. Change-Id: Iac49b1d2e216bf785aa0b0aced6d169457ef5a3c Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-03-09Move hypervisor ethernet to separate methodsGunnar Mills1-193/+198
Similar to the code we've been building elsewhere, move ethernet Hypervisor to separate methods, and avoid lambdas. Tested: Code compiles. Tested as part of top patch. Change-Id: I3f49b3824c212a9b1e8129b99265ed7a470b3e18 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>