summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
2022-11-11Aggregation: Fix header clobberingCarson Labrado1-6/+0
We attempt to sanitize the response body of the asyncResp object as the first step of copying over the satellite response into the object. This is clobbering the "OData-Version" from the response header. We can completely remove this step since the body will already be empty. Tested: OData-Version is still present in the header when querying a satellite resource curl -s -D- localhost/redfish/v1/Chassis/5B247A_test | grep OData OData-Version: 4.0 Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I82f54ae9b990504a3236b7a1273c794b1ee6f090
2022-11-08power subsystem: fix headerNan Zhou1-0/+1
Added the logging header. Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ie707780e195766b37a3d307818615c6be36d424e
2022-11-08Add ThermalMetrics schemaGeorge Liu1-0/+1
Based on DSP8010_2022.2 and adds the ThermalMetrics schema. ThermalMetrics is child of the ThermalSubsystem schema. It is part of the new Power/Thermal Schemas. ThermalMetrics contains temperature readings and the corresponding link to that sensor in the sensor collection. Temperatures such as Ambient, Exhaust, Intake, and Internal can be found in the schema. Tested: built bmcweb successfully and validator passes. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I16ad2f922acc963a0434f3d9ab5583d2242b0013
2022-11-07Implement links and HEAD for NetworkProtocolEd Tanous1-0/+21
Along the lines of changes we've made elsewhere, add Links, and a HEAD handler for bmc NetworkProcotol instances. Tested: ``` curl -vvvv --insecure --user root:0penBmc https://192.168.7.2/redfish/v1/JsonSchemas/NetworkProtocol/NetworkProtocol.json ``` Returns a links header as part of the response. Adding -X HEAD to the curl request results in the same header being included. Redfish service validator passes. Redfish PROTOCOL VALIDATOR PASSES ! ! ! ! ! with zero failures. Summary - PASS: 392, WARN: 0, FAIL: 0, NOT_TESTED: 32 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib96f7c8d5d8d960000a1bb77065fc06d2829e4b8
2022-11-02Update CollectionMembers to use UrlFromPiecesWilly Tu8-25/+29
Refactor getCollectionMembers to make sure all Url created with dbus paths are generated via UrlFromPieces helper function. This allow us to manage all URL generated from dbus in one place and allow us to make future changes to affect all resources. We can make changes to all resources easier if they are all managed by one function. Tested: Redfish Validator Passed. All Collections working as expected and match previous implmentation. Change-Id: I5d3b2b32f047ce4f20a2287a36a3e099efd6eace Signed-off-by: Willy Tu <wltu@google.com>
2022-10-31pcie: Fixed return nothing when get PCIeDeviceIdTony Lee1-5/+3
GET /redfish/v1/Systems/system/PCIeDevices/<str> nothing will be returned if their 'generationInUse' is Unknown. The original intention is that if it is Unknown, there is no need to display '"PCIeType"'. But the others still have to show. After fix: PCIeType is not Unknown: GET http://${bmc}/redfish/v1/Systems/system/PCIeDevices/<str> { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>.", "@odata.type": "#PCIeDevice.v1_4_0.PCIeDevice", "DeviceType": "SingleFunction", "Id": "<str>", "Manufacturer": "Intel Corporation", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions" }, "PCIeInterface": { "PCIeType": "Gen1" } } PCIeType is Unknown: GET http://${bmc}/redfish/v1/Systems/system/PCIeDevices/<str> { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>", "@odata.type": "#PCIeDevice.v1_4_0.PCIeDevice", "DeviceType": "SingleFunction", "Id": "<str>", "Manufacturer": "Intel Corporation", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions" } } Signed-off-by: Tony Lee <tony.lee@quantatw.com> Change-Id: I85a97e0370a5789e4526964272381a557ce942a0
2022-10-31LogService: Increase dump timestamp precisionClaire Weinan1-20/+4
This is a follow-on to "LogService: Increase Fault Log timestamp precision" [1]. Since microsecond precision timestamp support for other dump types (in addition to FaultLog) have recently been added in phosphor-debug-collector (see "Populate timestamps with microsecond precision" [2]), we now update bmcweb to expose these timestamps with microsecond precision. Dump entry "Created" timestamps are based on the "Elapsed" property of the D-Bus interface xyz.openbmc_project.Time.EpochTime [3], which is defined as time elapsed since the epoch in microseconds. Client impact: Dump entry "Created" timestamps are shown with microsecond precision instead of second precision, for entries of all dump types (not just FaultLog). Tested: Forced creation of a system dump entry from BMC console: ``` busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/system xyz.openbmc_project.Dump.NewDump Notify ut 1 2 ``` Retrieved the entry individually and as part of its collection: ``` curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries/1 curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries ``` Before change: `"Created": "2022-10-25T22:56:13+00:00",` After change: `"Created": "2022-10-25T22:56:13.271157+00:00",` Redfish Service Validator passed on the following URI trees: /redfish/v1/Managers/bmc/LogServices/Dump/Entries /redfish/v1/Managers/bmc/LogServices/FaultLog/Entries /redfish/v1/Systems/system/LogServices/Dump/Entries [1] https://github.com/openbmc/bmcweb/commit/c6fecdabd58b4c380caf1b83801ad4eb54922fff [2] https://github.com/openbmc/phosphor-debug-collector/commit/c0ab9d43d5e19123cca1a1592ee07fc064b84199 [3] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Time/EpochTime.interface.yaml Signed-off-by: Claire Weinan <cweinan@google.com> Change-Id: Ia1682d09cf196c63da7d236df31695be5a5ad34b
2022-10-29Fix privileges on default handlersEd Tanous1-2/+8
Regardless of what privileges are allowed on a resource, we should almost always be pulling from the PrivilegeRegistry for the information. This corrects the handlers in redfish_v1.hpp. Namely that JsonSchemaCollection now pulls from the generated privilege registry files, and the 404 handler now requires a valid login to hit the route. This allows 401 to be returned on routes that would 404. Arguably users should not be able to see what routes bmcweb implements if they are not authenticated. Marking the 404 route as login is largely ceremonial and for documentation, because there is a separate check for a user being authenticated. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4c03b0ae05d9fb7712d6ec3b6f2feaf034ca0750
2022-10-26redfish.hpp: fix header pathNan Zhou1-34/+34
This must be historical reason that we use relative path in these includes. Given that redfish-core/lib is already in include path, these relative paths are not necessary. Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ia6b6be8a7aded98c96cdca150467bc7d825230af
2022-10-25certificate: Allow deleting LDAP client certificateJiaqing Zhao1-0/+21
Users should be able to delete LDAP client certificate, and phosphor- certificate-manager already supports this. This patch adds the Redfish API endpoint for it. Tested: DELETE /redfish/v1/AccountService/LDAP/Certificates/1 removes the LDAP client certificate installed on system. Change-Id: If1c082c78c404b5877e74ba50de3a970cd823a90 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-10-21Implements PowerSubsystem schemaChicago Duan3-0/+69
This commit implements the Redfish PowerSubsystem schema and collects default property values. PowerSupplies will be implemented in the next commit. ref: https://www.dmtf.org/sites/default/files/standards/documents/ DSP0268_2022.2.pdf (6.86 PowerSubsystem 1.1.0) https://redfish.dmtf.org/schemas/v1/PowerSupply.v1_1_0.json Tested: Validator and UT passes 1. curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem", "@odata.type": "#PowerSubsystem.v1_1_0.PowerSubsystem", "Id": "PowerSubsystem", "Name": "Power Subsystem", "Status": { "Health": "OK", "State": "Enabled" } } 2. bad chassisID curl -k -H "X-Auth-Token: $token" -X GET https://${bmc} /redfish/v1/Chassis/badchassisID/PowerSubsystem/ PowerSupplies/powersupply0 { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type Chassis named badchassisID was not found.", "MessageArgs": [ "Chassis", "badchassisID" ], "MessageId": "Base.1.13.1.ResourceNotFound", "MessageSeverity": "Critical", "Resolution": "Provide a valid resource identifier and resubmit the request." } ], "code": "Base.1.13.1.ResourceNotFound", "message": "The requested resource of type Chassis named badchassisID was not found." } } Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: I6885b1777082538eceaf7ea85a8f69966459ee43
2022-10-19Revert "NetworkProtocol: Support NetworkSuppliedServers property"Gunnar Mills1-25/+7
This reverts commit 525fc07224884d3640e5c4a1b6a551aee024f7bd. As discussed in discord, https://gerrit.openbmc.org/c/openbmc/openbmc/+/57931 is a legit fail. [1] https://discord.com/channels/775381525260664832/776550056391606352/1030497797121777768 The validator is failing due to: ERROR - NetworkSuppliedServers not defined in Complex NTPManagerNetworkProtocol.v1_2_0.NTPProtocol (check version, spelling and casing) Since the bmcweb bump merged, seeing validator fails in openbmc/openbmc. Revert, get the validator passing again, will open an issue with redfish since this looks like an issue with the schema itself. Tested: None. Change-Id: Ie8046c93eaf2f69c71eb5162dacb961032f9366c Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2022-10-18Add EnvironmentMetrics schemaGeorge Liu1-0/+1
Based on DSP8010_2022.2 and adds the EnvironmentMetrics schema. Tested: built bmcweb successfully and validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I994b48c544edc22a6bf99187b536f3e51e10b052
2022-10-18pcie: fixed filpped empty checkNan Zhou1-1/+1
It's obvious that we want to skip if the string is empty, not if it is valid. Tested: code compiles. Trivial change. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I892e81fb0f87a8999eb880100fd284419054eece
2022-10-18pcie: fix Members@odata.countNan Zhou1-1/+1
I believe this was a typo. We shouldn't return when a deviceId is not found. Tested: s7106 doesn't have PCIe backend configured. I tested it on a downstream system and Members@odata.count shows up. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I38491caf8998fac5fafa0c0f07396cf32066348b
2022-10-14NetworkProtocol: Support NetworkSuppliedServers propertySunitha Harish1-7/+25
There was no way to differentiate between the static and DHCP assigned NTP servers. Networkd and Dbus has added support for StaticNTPServers to save the static configuration. PATCH command will now set the StaticNTPServers property at the backend. NTPServers property will contain network supplied dynamic NTP Servers at the system. Tested by: 1. PATCH /redfish/v1/Managers/bmc/NetworkProtocol -d '{"NTP":{"NTPServers": [<ip>]}}' Verify that this adds the NTPs server to the NetworkProtocol 2. Enable DHCP to fetch NTP servers list from the DHCP server. Verify that they are listed when GET on NetworkProtocol as below "NTP": { "NTPServers": [ <static ntp server ip> ], "NetworkSuppliedServers": [ <dynamic ntp server ip> ], "ProtocolEnabled": true }, 3. Redfish validator run Signed-off-by: sunharis <sunithaharish04@gmail.com> Change-Id: Ifac77485485839292b770d36def35da17d723c4e
2022-10-12header cleanupsNan Zhou1-1/+1
This commit fixed several places (but not all) where wrong include directory is specified and prevent the clean up in the chidren changes. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Ibbba62e2c0cfe3583a65f1befa1b233bd3eebf19
2022-10-11bmcweb: Add strictAccountTypes error messageShantappa Teekappanavar2-0/+30
Error message to be thrown when StrictAccountTypes is true and the specified value(s) for AccountTypes or OEMAccountTypes was not accepted. Testing: strictAccountTypes() error message was tested while testing redfish PATCH API for patching AccountTypes. Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com> Change-Id: I13abcd142ddfb04a2a187c9373fa996ecfe987a1
2022-10-11CreateDump: Accept dump object pathAsmitha Karunanithi1-38/+176
This commit contains changes to accept the object path instead of the dumpId for user-initiated dumps. Earlier a task would be started to monitor the 'interfaces added' signal when a new dump object is created. Now, this change checks if the created dump object has implemented Progress interface, if yes, then the 'Status' property is used to track the dump creation progress. Else, task will be marked completed. With this change failed dumps will now be returning an internal error back to the user, as a part of the task message. The createDump dbus call has been changed in the backend to accept additional arguments with the below commits: [1] https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/36331 [2] https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-debug-collector/+/37792 [3] https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/44380 This commit also bumps up the task timeout. During system boot, the BMC dump takes more than 3 minutes to complete and task expires with a timeout. This commit increases this timeout to be 6 minutes. Tested-By: * POST https://${bmc}/redfish/v1/Managers/bmc/LogServices/Dump/Actions/ LogService.CollectDiagnosticData -d '{"DiagnosticDataType":"Manager"}' => A task will be returned as the redfish response * GET https://${bmc}/redfish/v1/TaskService/Tasks/1 => Get on the task URI to verify the task status for success and failure scenarios Signed-off-by: Asmitha Karunanithi <asmitk01@in.ibm.com> Change-Id: I1686823a86eae836f770c19f33ffb21c98dd79ef
2022-10-10log_service: Fix error message for non-existing log entriesJiaqing Zhao1-21/+13
When requesting a log extry that does not exist on system, a 404 Not Found HTTP status code and corresponding ResourceNotFound error message should be returned. Current code mistakenly uses ResourceMissingAtURI error which should be used for referencing a non-existing resource in request properties. Tested: Verified requesting on a non-existing now responds with HTTP 404 and NotFound message manually. (This cannot be checked with Redfish Service Validator.) Change-Id: I3ef525eec3622918921bb9eb0b93fb6195c1a5b9 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-10-10Adds LastStateTime in Redfish BootProgressHieu Huynh1-0/+35
The LastStateTime is the last time the BootProgress property was updated. It is defined by BootProgressUpdate D-bus [1]. This commit is to support this. [1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml//xyz/openbmc_project/State/Boot/Progress.interface.yaml#L11 Tested: 1. Set boot progress code # ipmitool raw 0x2c 0x02 0xae 0x01 0x00 0x00 0x00 0x00 0x10 0x01 \ 0x00 0x00 2. Check the progress code from the Redfish interface "BootProgress": { "LastState": "OEM", "LastStateTime": "2022-10-10T04:21:08.416796+00:00" } Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com> Change-Id: I0834887e159970d5775dbfbf7753196b1e1cec29
2022-10-07Move ClientID parameter out of OEMEd Tanous1-5/+23
In 2022.2, Redfish added support for the Context parameter on the Session Resource. This parameter has the same function that the OemSession.ClientId field served. This commit moves all the existing ClientId code to produce Context as well. Functionally, this has one important difference, in that Context in Redfish is optionally provided by the user, which means we need to omit it if not given by the user. The old implementation left it set to empty string (""). Because of this, a few minor interfaces need to change to use std::optional. Existing uses of clientId are moved to using value_or("") to keep the same behavior as before. Tested: curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\": \"0penBmc\"}" https://192.168.7.2/redfish/v1/SessionService/Sessions Returns a Session object with no Context key present curl --insecure -X POST -d "{\"UserName\": \"root\", \"Password\": \"0penBmc\", \"Context\": \"Foobar\"}" https://192.168.7.2/redfish/v1/SessionService/Sessions Returns a Session object with: "Context": "Foobar" Subsequent Gets of /redfish/v1/SessionService/Sessions/<sid> return the same session objects, both with and without Context. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I4df358623f93f3e6cb659e99970ad909cefebc62
2022-10-06Remove support for scaling parameter sensorsEd Tanous1-36/+4
Scaling parameters on integer value sensors were removed from phosphor-dbus-interfaces a long time ago[1] in lieu of double parameters. It has been several years since that change, and to the projects knowlege, all sensor daemons either never produced an int64 type, or have since been converted to producing double. Bmcweb kept compatibility for some time during the transition, but these days it is just unused code. Remove it. Tested: Redfish-service-validator passes. [1] https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/11739 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie64b093f7b787c169613bb0ff2d9f96fba8dda1a
2022-10-05ethernet: Change the behavior of setting VLANEnableJiaqing Zhao1-16/+15
In current implementation, setting VLANEnable to true does nothing while setting to false will essentially delete the VLAN from system, which is not a reasonable behavior for Redfish. PATCH requests should never delete a resource. This patch changes the behavior to changing the NICEnabled property of VLAN interface, which essentially enables/ disables the VLAN interface. Tested: Verified PATCH {"VLANEnable": false} no longer deletes the interface and the NICEnabled property on DBus is successfully changed. Change-Id: I8c47f6f2987fed576ba36c215f29bc03c6e9182b Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-10-05ethernet: Remove parseInterfaceData() for VLANJiaqing Zhao1-19/+7
The parseInterfaceData() for VLAN simply writes some properties to the response. Move the code to the GET handler for better readability and remove an extra check for vlanID. Tested: Verified VLAN properties are shown normally at /redfish/v1/Managers/bmc /EthernetInterfaces/eth0/VLANs/eth0_1 Change-Id: I93ed6e230b5b74eead18775725fd8ae8295b17d5 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-10-05Add PowerSubsystem PowerSupply and PowerSupplyCollection schemaChicago Duan1-0/+3
Add schemas for PowerSubsystem PowerSupply and PowerSupplyCollection. Tested: built bmcweb successfully and validator passes. Signed-off-by: Chicago Duan <duanzhijia01@inspur.com> Change-Id: I913d690108e30c841d5dec5fa37c7b9cee43f7c1
2022-10-04Make routes start matching RedfishEd Tanous7-116/+510
This is preliminary patch to set up the route handling such that it's ready for the addition of multiple hosts, multiple managers in the future. Routes previously took the form of /redfish/v1/Systems/system which essentially hardcoded the name "system" into a number of places. As the stack evolves to support multiple systems, this needs to change. This patchset changes all the ComputerSystem resources to the form: /redfish/v1/Systems/<str> and adds 404 checks to each route such that they will be handled properly still. This means that as we evolve our multi-host support, each individual route can be moved one at a time to support multi-host. In the future, moving these to redfish-spec-defined routing would likely mean that we could generate this code in the future at some point, which reduces the likelihood that people do it incorrectly. This patch currently sets the resource id and resource type in the resourceNotFound message to empty string (""). This handling is still arguably more correct than what we had before, which just returned 404 with an empty payload, although this will be corrected in the future. Tested: None yet. RFC to see if this is a pattern we'd like to propogate Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If9c07ad69f5287bb054645f460d7e370d433dc27
2022-10-04certificate: Add deleteCertificate functionJiaqing Zhao1-11/+20
This patch adds deleteCertificate function to delete an installed cert, which is used in current DELETE TrustStore cert handler and incoming DELETE LDAP client store cert handler. Compared to having two lambdas, it reduces code redundancy and has slightly smaller compressed binary size (~700B). Tested: Code move only, DELETE /redfish/v1/Managers/bmc/Truststore/Certificates /<id> works exactly the same as before. Change-Id: I93c07845e4be3c0304b3c3e8ff4249885c9ab908 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-10-03certificate: Replace lambda with inline functionJiaqing Zhao2-750/+728
For API endpoints, it is suggested to break out the entire handlers into a function, and not rely on a lambda at all. This brings more readability as it reduces indents. Tested: Code compiles, and Redfish Service Validator passed. Change-Id: I5132149c00b6f553931dae562b83bc7aee678105 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-09-30Make the schemas.hpp generated file #include arrayEd Tanous1-0/+1
The script missed a #include. Add it. Tested: Code compiles. Header change only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib38a46d8e97e4aadb596b4ff68795cea06e62fde
2022-09-30Add Fan and FanCollection schemaGeorge Liu1-0/+2
Based on DSP8010_2022.2 and adds the schema of Fan and FanCollection. Tested: built bmcweb successfully and validator passes Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Id1867a6f19d47d0fb1d686d650f7d936c33b5284
2022-09-29Redfish: Add resolution propertyVijay Lobo1-12/+27
This property is used to provide suggestions on how to resolve the situation that caused the log entry. Services can replace the resolution defined in the message registry with a more specific resolution in a log entry. Tested: curl command was run with a resolution property set in the d-bus object curl -k -X GET https://$bmc:18080/redfish/v1/Systems/system/\ LogServices/EventLog/Entries "Members": [ { "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", "@odata.type": "#LogEntry.v1_9_0.LogEntry", "AdditionalDataURI": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1/attachment", "Created": "2022-08-05T18:44:34.201+00:00", "EntryType": "Event", "Id": "1", "Message": "xyz.openbmc_project.State.Error.CriticalServiceFailure", "Modified": "2022-08-05T18:44:34.201+00:00", "Name": "System Event Log Entry", "Resolution": "1. Priority: High, Procedure: BMC0002\n", "Resolved": false, "Severity": "Critical" }, ... ] Signed-off-by: Vijay Lobo <vijaylobo@gmail.com> Change-Id: Ia28e97c17c1b9bd0e29b681727c3e36563ca7922 Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
2022-09-28treewide: change EM's ObjectManager pathNan Zhou2-2/+4
EntityManager moves its ObjectManager in commit [1], this patch is to change accordingly. Please see [1] for why we made that change. [1] https://gerrit.openbmc.org/c/openbmc/entity-manager/+/57279 Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: Idf5657463d54022f53d12e860483d06b5c5c7ccd
2022-09-27Bump timeout for code update fileGunnar Mills1-1/+1
This 10 second timeout is for the write, untar, inotify fire, and creation of a software D-Bus object. IBM has large images for its p10bmc, 125M and growing. We have seen this take longer than 10 seconds on a AST2600. Bump this timeout to 25 seconds. Most of the 10 seconds seems to be the untar. This default 10 seconds is only used for the http upload path. TFTP already bumps this timeout to 600 seconds. [1] https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/update_service.hpp#L488 Could have instead added the 25 seconds to the monitorForSoftwareAvailable call but figured having the default be 25 is reasonable. [1] https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/update_service.hpp#L530 On a fail: ``` Sep 07 12:15:01 p10bmc phosphor-version-software-manager[752]: Untaring /tmp/images/69fe6e22-2bd0-42c4-be69-7f388debc6d1 to /tmp/images/imageHaTO5K Sep 07 12:15:08 p10bmc bmcweb[2299]: (2022-09-07 12:15:08) [ERROR "update_service.hpp":392] Timed out waiting for firmware object being created Sep 07 12:15:08 p10bmc bmcweb[2299]: (2022-09-07 12:15:08) [ERROR "update_service.hpp":394] FW image may has already been uploaded to server Sep 07 12:15:08 p10bmc bmcweb[2299]: (2022-09-07 12:15:08) [CRITICAL "error_messages.cpp":233] Internal Error ../git/redfish-core/include/../lib/update_service.hpp(403:49) `redfish::monitorForSoftwareAvailable(const std::shared_ptr<bmcweb::AsyncResp>&, const crow::Request&, const string&, int)::<lambda(const boost::system::error_code&)>`: ``` Tested: On a BMC hitting this, saw the Internal Error on upload without this change. With this change, the update now works. Change-Id: I47940f074ac42ceb59011411b79679ff4c8360d6 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2022-09-27Retrieve userGroups Information ("AccountTypes")Abhishek Patel1-2/+72
This commit enhances the redfish API to retrieve userGroups information for each user account. "Redfish" is always enabled in each user role. That's why it was hardcoded into JSON response data in the old redfish API, where now it gets retrieved using dbus interface xyz.openbmc_project.User.Attributes. UserGroups. UserGroups retrieve data are "redfish", "ssh", "web", and "ipmi", where redfish DMTF Schema has predefined enum type as described below. "AccountTypes": { "enum":["Redfish", "SNMP", "OEM", "HostConsole", "ManagerConsole", "IPMI", "KVMIP", "VirtualMedia", "WebUI"] } Here UserGroups ssh is mapped with two AccountTypes "HostConsole", "ManagerConsole". - Redfish ManagerConsole == SSH to port 22 == Phosphor User manager Phosphor “ssh” privilege - Redfish HostConsole == SSH to port 2200 (host console), Which OpenBMC implements using the Phosphor User manager Phosphor “ssh” privilege. The 'web' group does not control access to the web interface, and doesn't appear to do anything. The 'redfish' in the UserGroups is mapped to both Redfish and WebUI AccountTypes even when there is no 'web' group in the UserGroups. Test: Pass Redfish Service Validator $ curl -k -X GET https://$bmc@r5:18080/redfish/v1/AccountService/Accounts/webuser { ... "AccountTypes": [ "Redfish", "WebUI" ], ... Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com> Change-Id: Iaa9b6c07b3d26e8994be28a50c22437e0bc9bc8f Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
2022-09-22Fix content-type return behavior for */*Ed Tanous1-2/+2
An HTTP header of Accepts: */* throws a big wrench into our implementation for a couple reasons. First, because it's the default in a lot of commonly-used libraries, and second, because clients use it when they certainly don't mean what the specification says it should mean "ie, I accept ANY type". This commit tries to address some of that, by making an explicit option for content-type="ANY" and pushes it to the individual callers to handle explicitly as if it were yet another type. In most protocols, there's a "most common" representation, so protocols are free to use that, or to explicitly handle it, and require that the user be explicit. Tested: Redfish Protocol Validator no longer locks up. (TBD, getting bugs filed with protocol validator for this missing Accepts header). For ServiceRoot GET /redfish/v1 Accepts: application/json - returns json GET /redfish/v1 Accepts: */* - returns json GET /redfish/v1 Accepts: text/html - returns html GET /redfish/v1 no-accepts header - returns json Redfish-service-validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iae6711ae587115d3e159a48a6fc46a903ed6c403
2022-09-22Memory: Fix the missing fields in Dimm ResponseNikhil Namjoshi1-3/+4
The Dimm response has some missing fields i.e. Manufacturer and FirmwareRevision, due to some properties not being unpacked. This commit fixes that issue. Tested: Redfish validator passed Dimm Response before fix shows missing Manufacturer and FirmwareRevision fields ``` wget -qO- http://localhost:80/redfish/v1/Systems/system/Memory/dimm0 "@odata.id": "/redfish/v1/Systems/system/Memory/dimm0", "@odata.type": "#Memory.v1_11_0.Memory", "AllowedSpeedsMHz": [], "BaseModuleType": "...", "BusWidthBits": ..., "CapacityMiB": ....., "DataWidthBits": .., "ErrorCorrection": ".....", <<<======= Missing FirmwareRevision field "Id": "dimm0", "Links": { "Chassis": { "@odata.id": "...." } }, "Location": { "PartLocation": { "LocationType": "Slot", "ServiceLabel": "DIMM6" } }, <<<<==== Missing Manufacturer field "MemoryDeviceType": "...", "MemoryType": "....", "Model": "", "Name": "DIMM Slot", "OperatingSpeedMhz": ...., "PartNumber": "......", "RankCount": ...., "SerialNumber": "....", "SparePartNumber": "..", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } ``` Dimm Response after fix shows Manufacturer and FirmwareRevision fields present ``` wget -qO- http://localhost:80/redfish/v1/Systems/system/Memory/dimm0 { "@odata.id": "/redfish/v1/Systems/system/Memory/dimm0", "@odata.type": "#Memory.v1_11_0.Memory", "AllowedSpeedsMHz": [], "BaseModuleType": "....", "BusWidthBits": ..., "CapacityMiB": ...., "DataWidthBits": ..., "ErrorCorrection": "...", "FirmwareRevision": "...", "Id": "dimm0", "Links": { "Chassis": { "@odata.id": "...." } }, "Location": { "PartLocation": { "LocationType": "Slot", "ServiceLabel": "DIMM6" } }, "Manufacturer": "....", "MemoryDeviceType": "...", "MemoryType": "...", "Model": "", "Name": "DIMM Slot", "OperatingSpeedMhz": ..., "PartNumber": "...", "RankCount": ..., "SerialNumber": ".....", "SparePartNumber": "...", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } ``` Signed-off-by: Nikhil Namjoshi <nikhilnamjoshi@google.com> Change-Id: I4de83a5038fe77e19a1b8b16e479348677fb30c1
2022-09-22treewide: reorganize unit testsNan Zhou14-2291/+0
Like other C++ projects, unit tests normally are in a separate repo and respect the folder structure of the file under test. This commit deleted all "ut" folder and move tests to a "test" folder. The test folder also has similar structure as the main folder. This commit also made neccessary include changes to make codes compile. Unused tests are untouched. Tested: unit test passed. Reference: [1] https://github.com/grpc/grpc/tree/master/test [2] https://github.com/boostorg/core/tree/414dfb466878af427d33b36e6ccf84d21c0e081b/test [3] Many other OpenBMC repos: https://github.com/openbmc/entity-manager/tree/master/test [4] https://stackoverflow.com/questions/2360734/whats-a-good-directory-structure-for-larger-c-projects-using-makefile Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I4521c7ef5fa03c47cca5c146d322bbb51365ee96
2022-09-21LogService: System dump calls common dump handlersClaire Weinan2-83/+129
This patchset transitions System dump route handlers to the new style of calling common dump handlers via std::bind_front() instead of defining a lambda. BMC dump and FaultLog dump were previously transitioned to the new style (see "LogService: Add support for Fault Log" at https://gerrit.openbmc.org/c/openbmc/bmcweb/+/53175). Note that System dump wasn't using a common dump handler for outputting its LogService info (/redfish/v1/Systems/system/LogServices/Dump/) before, so calling the common handler here is new. No expected client impact. Tested: Get System dump LogService info: curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/ (Diffed the ouput before and after applying this patchset and confirmed they were equivalent except for the "DateTime", as expected. Also added unit tests for getting dump LogService info.) Create System dump entry. (Existing code for creating an entry via the Redfish LogService action CollectDiagnosticData isn't currently working for System dump, so instead directly call the corresponding D-Bus method by running the following from the BMC console): busctl call xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/system xyz.openbmc_project.Dump.Create CreateDump a{sv} 0 Get Entry: curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries/1 Get Entry Collection: curl -k -H "X-Auth-Token: $token" -X GET http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries Delete Entry: curl -k -H "X-Auth-Token: $token" -X DELETE http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Entries/1 Clear Log: curl -k -H "X-Auth-Token: $token" -X POST http://${bmc}/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog Redfish Service Validator succeeded on the following URI tree: /redfish/v1/Systems/system/LogServices/Dump Signed-off-by: Claire Weinan <cweinan@google.com> Change-Id: I5d66da17794c29672be8713481018bf3ce397ddf
2022-09-21registries: iwyuNan Zhou5-5/+16
Made the auto-generated headers and the openbmc registry include what they use. Also alligned the include style. Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I6577d5e12bc02da3bd7bf5780f89a4860b314e19
2022-09-21privilege registry: simplify writing headersNan Zhou4-5/+5
This patch reused similar patterns in |REGISTRY_HEADER| so that the python code is more readable. It also moved the clang-format off macro and warning a bit in so they are all consistent with each other. Tested: code compiles. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: If18de0d9f89088f9b5732613ecf59520650bb11a
2022-09-21query: propogate errors for expandNan Zhou4-1/+263
The existing code doesn't propogate errors of subqueries correctly. This commit corrects the behavior, so that the final response gets all error message of subqueries and the "highest priority" HTTP code. DMTF doesn't specify how expand queries handle error codes, since using subqueries is an implementation choice that we made in this project. What we did here follows existing behavior of this project, and follows the error message section of the Redfish spec; [1] https://redfish.dmtf.org/schemas/DSP0266_1.15.1.html#error-responses As for now, this commit uses the worst HTTP code among all the error code. See query_param.hpp, function |propogateErrorCode| for detailed order of the errror codes. Tested: 1. this is difficult to test, but I hijacked the code so it returns errors in TaskServices, then I verified that "/redfish/v1?$expand=." correctly returns 500 and the gets the error message set. 2. unit test so that when there are multiple errors, the final response gets a generate error message. Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I0c1ebdd9015f389801db9150d687027485f1203c
2022-09-17Aggregation: Ignore JsonSchemas and fix prefixesCarson Labrado1-16/+44
We don't want to aggregate JsonSchemas as-is since it can introduce problems related to inconsistent versions between the aggregating and satellite BMCs. For now we will just assume that the aggregating BMC will match all satellite BMCs in terms of schemas and versions. There was also an edge case where we are not adding prefixes to "Uri" keys. These are used by Registries resources. Now we make a case- insensitive check to see if a key ends with "uri" in order to determine if we need to add the prefix to the resource ID. Tested: Requests to /redfish/v1/JsonSchemas only show schemas on the aggregating BMC. Responses from /redfish/v1/Registries/<id> now contain the aggregation prefix in the value associated with the "Uri" key. ~# curl localhost/redfish/v1/Registries/5B247A_TaskEvent { ... "Location": [ { ... "Uri": "/redfish/v1/Registries/5B247A_TaskEvent/TaskEvent" } ], ... } Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I935785740c05ad0ac3e8c682a72ae1d1419054a8
2022-09-17Fix regression on expand handlingEd Tanous1-5/+16
It was found that as part of c1d019a6056a2a0ef50e577b3139ab5a8dc49355 Sensor optimization We missed updating the odata.id for the expand case. This wasn't really found because most clients either use expand, or they don't, and depending on which path you take, both paths are valid. With that said, we should be following the spec here, and returning the same result regardless of whether we're being processed as expand or not. This patchset is a little rough, and probably should be iterated on. TODO (at a later date). Try to get a tool that can detect these failures. Tested: Tested by @Carson to resolve the regression. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ieed7796895a3c5937fd901d5afa7dd4ea0693099
2022-09-16processor: Don't display DBus defaultsBrad Bishop1-8/+17
EffectiveFamily, EffectiveModel, MicrocodeInfo, Id, and SparePartNumber all have default values specified in the OpenBMC DBus data model. Do not populate these attributes as outlined in DBUS_USAGE.md. Tested: Compiled. bmcweb does not crash at startup. Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com> Change-Id: I8bfb7a8fef28d2ab6a7d77fb809c0b3e51e368f8
2022-09-16memory.hpp: Add High Bandwidth Memory v3 (HBM3)Tyson Tuckerbear1-0/+4
This follows the addition in phosphor-dbus-interfaces. Signed-off-by: Tyson Tuckerbear <ttucker@google.com> Change-Id: I8a448b8fa02b7d657d55e1cc35506cd9ca1d5961
2022-09-13Improve content typeEd Tanous1-2/+6
We have a number of specialized content-type functions for varying levels of degree, and most of them rely on quite a few strings. This commit changes them to consolidate on two APIs. isContentTypeSupported, which as the name implies, takes a single content type, and returns a bool about whether or not that content type is allowed. getPreferedContentType, which takes an array of multiple options, and fine the first one in the list that matches the clients expected string. These two functions makes these functions more able to be reused in the future, and don't require specialized entries for each possible type or combination of types that we need to check for. Tested: Unit tests passing. Pretty good coverage. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8b976d0cefec5f24e62fbbfae33d12cc803cb373
2022-09-12Remove nlohmann brace initializationEd Tanous17-135/+170
There's a few last places (outside of tests) where we still use nlohmann brace initialization. Per the transforms we've been doing, move these to constructing the objects explicitly, using operator[], nlohmann::object_t and nlohmann::array_t. Theses were found by manual inspection grepping for all uses of nlohmann::json. This is done to reduce binary size and reduce the number of intermediate objects being constructed. This commit saves a trivial amount of size (~4KB, Half a percent of total) and in addition but makes our construction consistent. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I7478479a9fdc41b254eef325002d413c1fb411a0
2022-09-09ethernet: Bump EthernetInterface schema 1.4.1 -> 1.6.0Jiaqing Zhao2-2/+4
EthernetInterface v1.6.0 adds EthernetInterfaceType property indicating the type (either Physical or Virtual) of an interface. This property will be used by the incoming change #53186 which exposes VLAN interface as EthernetInterface. Since the "VLANs" property deprecated from v1.7.0 is still needed for creating/deleting VLAN interfaces, bmcweb won't bump to a newer schema version until Redfish spec defines a better way for it. Tested: Redfish validator passed. Change-Id: I9e005e10b0b38046a2a222264b01c6e6223ebf31 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2022-09-09clang-tidy: fix misc warningsPatrick Williams3-2/+4
The following error reports have started to be reported by clang-tidy: * readability-qualified-auto - add 'const' to `auto&` iterators * bugprone-use-after-move - add break in loop after element is found Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5314559f62f58aa032d4c74946b8e3e4ce6be808