summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
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>
2023-03-09Move hypervisor reset to separate methodsGunnar Mills1-120/+127
Similar to the code we've been building elsewhere, move Reset Hypervisor to separate methods, and avoid lambdas. Tested: Code compiles. Tested as part of top patch. Change-Id: I19ee473908fac42e69985d406c34cdd6da44c2c6 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-03-08Add originator id & type for user trigerred dumpsAsmitha Karunanithi1-3/+89
The LogEntry schema has the below properties to store the originator (or the source) of the dump log entry and type of originator data: * Originator * OriginatorType The above properties are used for all the user trigerred dumps, where ip of the dump originator will be stored in the originatorId field. The same is stored in the backend (phosphor-debug-collector). phosphor-debug-collector orchestrates the collection and offload of dumps. It now implements the OriginatedBy interface for dumps. The below change is upstreamed: [1] https://gerrit.openbmc.org/c/openbmc/phosphor-debug-collector/+/48337 Reference: [1] https://redfish.dmtf.org/schemas/v1/LogEntry_v1.xml Redfish Validator passed. Tested By: * Created bmc dump * Get on the created bmc dump lists the newly added properties in the redfish response Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I473eabb81db7511f064904120992ed5449d323e5
2023-03-08Remove the redfish hypervisor namespaceEd Tanous2-7/+7
This namespace was created due to some conflicts between these two namespaces. This commit renames the function that's overloaded and removes the namespace, along with the TODO. Tested: No access to hypervisor to test. Inspection only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib94fc23571660fdb74ca90c58f7ab729bced544f
2023-03-08account_service: Don't call HEAD handler in GET handlerJiaqing Zhao1-7/+25
When If-Match header is provided, calling the HEAD handler in GET handler will not break the execution flow if Etag does not match. This patch fixes it by calling setUpRedfishRoute() in GET handlers. Tested: GET /redfish/v1/AccountService/Accounts/root with an invalid If-Match, only the PreconditionFailed error message is in the respose body. Change-Id: I0bbec820a1d62503db721d8bf620a81bd7c6a92e Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-03-07Pass boost error_code by referenceLakshmi Yadlapati2-5/+5
Id42ea4a90b6685a84818b87d1506c11256b3b9ae missed in couple of files Tested: None. Change-Id: I6cbd404132c34168cbc5901c9124ecc6ae6caacb Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-03-06Fix local CI failure issueGeorge Liu1-11/+11
Error message: redfish-core/lib/virtual_media.hpp:308:72: style: Parameter 'item' can be declared as reference to const. However it seems that 'afterGetVmData' is a callback function, if 'item' is declared with const you might also need to cast function pointer(s). [constParameterCallback] dbus::utility::DBusInteracesMap>& item) ^ redfish-core/lib/virtual_media.hpp:346:41: note: You might need to cast the function pointer here std::bind_front(&afterGetVmData, name)); ^ redfish-core/lib/virtual_media.hpp:308:72: note: Parameter 'item' can be declared as reference to const dbus::utility::DBusInteracesMap>& item) ^ This regressed in commit: 79fdf63e2c4148593bb7aec4a3f471ade4c5cba0 Tested: Local CI passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Ia68e63ccaa069aedda01a11ce02aa2ef41021a07
2023-03-06Change BMCWEB_LOG level for 404/405Gunnar Mills1-2/+2
404/405 which are part of 4xx errors are client-side errors. These might be server errors, e.g. a client is walking the redfish tree and had a id that no longer exists but they could also be the client tried an id or URL that isn't there, e.g. a fuzz tester. Due to this, use WARNING log level. A future commit attempts to better clarify our log levels. Saw "404 on path v1/badinput/badinput" Tested: None. Change-Id: I4f056754638ef2d640615e9fcc74a7a68a767593 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-03-03Fix async_method_call object paths while updating/deleting IP addressRavi Teja1-92/+31
This commit fixes IP address object paths in IP address patch/delete functions as per new networkd d-bus object paths Tested By: Delete IPv4/IPv6 IP addresses PATCH IPv4/IPv6 IP addresses Change-Id: Ia5a9db763a9ce7a2964f4e07cf8ecb85f04d374f Signed-off-by: Ravi Teja <raviteja28031990@gmail.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-03-03Add the getAssociationEndPoints methodGeorge Liu1-6/+4
There are currently many files that use the get endpoints methods[1]. Since they are general methods, they are defined in the dbus_utility.hpp file and will be further refactored in subsequent patches. Since the current endpoints of phosphor-objmgr do not support object_path and fails in romulus CI[2], so we should revert to std::string. Also, Updated the populateSoftwareInformation method of sw_utils.hpp [1] https://github.com/openbmc/docs/blob/master/architecture/object-mapper.md#associations [2] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/58924/22/include/dbus_utility.hpp#98 When an object with, for example, an object path of pathA uses the following values: ["foo", "bar", "pathB"] The mapper will create 2 new objects: pathA/foo pathB/bar Tested: Built bmcweb successuflly and Validator passes curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Managers/bmc { "@odata.id": "/redfish/v1/Managers/bmc", "@odata.type": "#Manager.v1_14_0.Manager", ... "FirmwareVersion": "2.14.0-dev-95-gea3949e76-dirty", ... } Tested: Validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I32a2c663bf2b8c84517bd0ecb4ccba61ce87c7e2
2023-03-02Remove excessive logging in managersEd Tanous1-35/+0
nlohmann::json::dump() calls are very wordy, have a lot of code to them, and have some odd usages in exception safety (that are documented in COMMON_ERRORS.md). Therefore, we should minimize how many places we call it. This file dumped the json values to the console for logging, which no other handler does, and if we want, we have generic ways to do it. readJson these days has quite a bit of built-in logging that should cover all of these cases for debug. Remove the logging, and make managers take on the style of the other code around it. Tested: Debug logging deletes only. Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I019dd0549d65e4698e2cee863d9815ca7ddae5a2
2023-03-02Implement ManagerDiagnosticData/ServiceRootUptimeSecondsEd Tanous1-1/+50
This property was added in Redfish 2022.2 to denote how long this service has been up and available. This implementation opts to go to systemd to get the bmcweb service uptime rather than track it through internal process state, given that systemd already has an API that tracks the bmcweb uptime, and bmcweb attempts to keep as little state as possible. Given that we already have helper functions that give durations in milliseconds precision, this patchset opts to keep the millisecond granularity, rather than dropping to microsecond precision of the systemd API. There are no use cases that would require microsecond precision, so this patchset opts for lower complexity. Tested: Redfish service validator passes. GET /redfish/v1/Managers/bmc/ManagerDiagnosticData Returns a ServiceRootUptime property. Value matches systemctl status bmcweb. systemctl restart bmcweb, causes counter to reset. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie1b82c5150f3374faf0ce376402eba410e59891d
2023-03-02Add ManagerProvidingService implementationEd Tanous1-1/+4
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-02-28processor: Change `Step` default value to USHRT_MAXMichael Shen1-1/+2
Change `Step` default value to USHRT_MAX due to https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/60717 For a new processor, it's possible that the stepping is really `0`. In this case, the `Step` will still be ignored which is not expected. https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/60717 changes the `Step` default value to `maxint`. Thus the `Step` can correctly display 0 on redfish. Tested: 1. Redfish service validator passing. 2. bmcweb works fine without errors. 3. Step was hidden when its value is 65535 (max uint16_t). 4. Step also displayed even the value is `0`. ``` root@machine:~# curl localhost/redfish/v1/Systems/system/Processors/cpu0 ... "Step": "0x0000" ... ``` Change-Id: I1857fc597ef2ab13256dc60e534c23d452e5d695 Signed-off-by: Michael Shen <gpgpgp@google.com>
2023-02-28Implement AggregationServiceEd Tanous4-0/+72
AggregationService is used to inform a client that some of the results might be aggregated, and to allow setting up aggregation sources. Today, this resource only contains the basic fields, as well as "Enabled", which informs the client of the fact that the service is aggregation enabled. AggregationService was one of the schemas we ignored, so this adds it to the supported list. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifb16a86ff81e387f01016a83f9e69240c8928614
2023-02-28Retrieve port info for systems serviceAbhishek Patel3-71/+117
In systems.hpp for Serialconsole, SSH service-enabled and its Port number info is hardcoded. Same for IPMI service-enabled info is also hardcoded. Implementation: SSH: check for obmc-console-ssh@2200.service service is enable or not, and yes then, on which port number. Retrieve service-related information and pass that into DMTF for "/redfish/v1/Systems/system/". IPMI:- check for phosphor-ipmi-net@eth0.socket service is enable or not, and pass that info DMTF for "/redfish/v1/Systems/system/". Tested: Manually tested on the Witherspoon system, there is no change in output. Run Redfish validator. No error found. Before: "SerialConsole": { "IPMI": { "ServiceEnabled": true }, "MaxConcurrentSessions": 15, "SSH": { "HotKeySequenceDisplay": "Press ~. to exit console", "Port": 2200, "ServiceEnabled": true } } After: Note: SSH Info retrieve via Dbus ListUnit API "SerialConsole": { "IPMI": { "ServiceEnabled": true }, "MaxConcurrentSessions": 15, "SSH": { "HotKeySequenceDisplay": "Press ~. to exit console", "Port": 2200, "ServiceEnabled": true } } Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com> Change-Id: I70009ee785aab3ca4a61fe0d96fbc5b340831647
2023-02-28Move getMessage and getMessageFromRegistry to cpp and add testSui Chen3-45/+59
This change moves getMessage and getMessageFromRegistry to a .cpp file so that they can be easily tested. Tested: Unit test passes Signed-off-by: Sui Chen <suichen@google.com> Change-Id: Ia9fc91e5a47036198bf013ff3ea21ea9f6d5259a