summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
2023-06-12storage: add support for multiple storagesWilly Tu2-18/+195
Updated Storage resource to `#Storage.v1_9_1.Storage` to support the change. Follow the Swordfish spec to setup the Storage relationship[1]. There will now be two Storage Collection `/redfish/v1/Stroage` and `/redfish/v1/Systems/system/Storage`. The storage in `/Storage` will be treated as a subsystem and only link to the `/Systems/system/Storage` under `Links/StorageServices` resource. The `/Storage` won't contain Drives or StorageControllers. Tested: Passed Redfish Validator for related resources. ``` *** /redfish/v1/Storage/storage_1 INFO - Type (Storage.v1_7_1.Storage), GET SUCCESS (time: 0) WARNING - StorageControllers: The given property is deprecated: This property has been deprecated in favor of Controllers to allow for storage controllers to be represented as their own resources. INFO - Attempt 1 of /redfish/v1/Chassis/chassis0/Drives/drive0 INFO - Response Time for GET to /redfish/v1/Chassis/chassis_0/Drives/drive_0: 0.07591272401623428 seconds. INFO - PASS INFO - ``` Chassis ``` wget -qO- http://localhost:80/redfish/v1/Chassis/chassis0 { "@odata.id": "/redfish/v1/Chassis/chassis0", "@odata.type": "#Chassis.v1_14_0.Chassis", "Id": "chassis0", "Links": { "Storage": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0" } ], "Storage@odata.count": 1 }, "Name": "chassis0", }} ``` Storage Collection ``` wget -qO- http://localhost:80/redfish/v1/Storage { "@odata.id": "/redfish/v1/Storage", "@odata.type": "#StorageCollection.StorageCollection", "Members": [ { "@odata.id": "/redfish/v1/Storage/storage0" } ], "Members@odata.count": 1, "Name": "Storage Collection" } wget -qO- http://localhost:80/redfish/v1/Systems/system/Storage { "@odata.id": "/redfish/v1/Systems/system/Storage", "@odata.type": "#StorageCollection.StorageCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0" } ], "Members@odata.count": 1, "Name": "Storage Collection" } ``` Storage ``` wget -qO- http://localhost:80/redfish/v1/Storage/storage0 { "@odata.id": "/redfish/v1/Storage/storage0", "@odata.type": "#Storage.v1_9_1.Storage", "Id": "storage0", "Links": { "StorageServices": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0" } ], "StorageServices@odata.count": 1 }, "Name": "Storage", "Status": { "State": "Enabled" } } wget -qO- http://localhost:80/redfish/v1/Systems/system/Storage/storage0 { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0", "@odata.type": "#Storage.v1_9_1.Storage", "Drives": [ { "@odata.id": "/redfish/v1/Chassis/chassis0/Drives/drive0" } ], "Drives@odata.count": 1, "Id": "storage0", "Name": "Storage",[1] "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "StorageControllers": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/storage0#/StorageControllers/0", "@odata.type": "#Storage.v1_7_0.StorageController", "MemberId": "controller", "Name": "controller", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } } ] } ``` [1] https://www.snia.org/sites/default/files/technical-work/swordfish/draft/v1.2.2/pdf/Swordfish_v1.2.2_NVMeMappingGuide.pdf#page=17 Change-Id: Ib81b68e7f61b817d4dfa4ed2f27afd6e74e8ce58 Signed-off-by: Tom Tung <shes050117@gmail.com> Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-12Break out storage methodsEd Tanous1-228/+248
Change-Id: I2128e223f6c2d07d5c8e5a865921468a7510faf2 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-12query: Fix default expand level with delegatedWilly Tu2-19/+35
With delegate expand, the default expand level is -= `queryCapabilities.canDelegateExpandLevel`. This creates an overlap of expand process between delegate expand vs. default expand. With query.expandLevel = 2 -> query.expandLevel = 1 and delegated.expandLevel = 1. Both delegated and default expand will try to only expand of level one instead of level 2 for the default. The code in https://github.com/openbmc/bmcweb/blob/479e899d5f57a67647f83b7f615d2c8565290bcf/redfish-core/include/utils/query_param.hpp#L583-L597 stated that the level with "@odata.id" + other property is treated as a seperate level. So with `query.expandLevel = 1` it just loop through the id that was already expanded and is noop. Tested: Before: /redfish/v1/Chassis/BMC/Sensors?$expand=.($levels=2) returns the same result as level=1. Needs level=3 to expand to the next level. The RelatedItem in here doesn't get expanded with level=2. ``` wget -qO- 'http://localhost:80/redfish/v1/Chassis/BMC/Sensors?$expand=.($levels=1)' ... { "@odata.id": "/redfish/v1/Chassis/BMC/Sensors/temperature_DIMMXX", "@odata.type": "#Sensor.v1_2_0.Sensor", "Id": "temperature_DIMMXX", "Name": "DIMMXX", "Reading": 30.0, "ReadingRangeMax": 127.0, "ReadingRangeMin": -128.0, "ReadingType": "Temperature", "ReadingUnits": "Cel", "RelatedItem": [ { "@odata.id": "/redfish/v1/Systems/system/Memory/dimmXX" } ], "Status": { "Health": "OK", "State": "Enabled" }, "Thresholds": { "LowerCaution": { "Reading": null }, "LowerCritical": { "Reading": null }, "UpperCaution": { "Reading": 93.0 }, "UpperCritical": { "Reading": 95.0 } } } ], "Members@odata.count": 242, "Name": "Sensors" } ``` After: level=2 was able to expand to the next level. Change-Id: I542177a94a33f8df7afbb68837f3a53b86140c86 Signed-off-by: Willy Tu <wltu@google.com>
2023-06-09Fix Error log entries to WarningMyung Bae3-4/+5
Some logging entries are categorized as ERROR, but they would better be as WARNING. 1) ``` $ curl -k -X GET https://${bmc}:18080/redfish/v1/Managers/bmc/LogServices/Dump/Entries/INVALID { .... "code": "Base.1.13.0.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } }% (2023-06-01 23:29:40) [ERROR "log_services.hpp":665] Can't find Dump Entry (2023-06-01 23:29:40) [CRITICAL "error_messages.cpp":282] Internal Error \ ../../../../../../../../../bmcweb/redfish-core/lib/log_services.hpp(666:36) \ `redfish::getDumpEntryById(const std::shared_ptr<bmcweb::AsyncResp>&, const std::string&, \ const std::string&)::<lambda(const boost::system::error_code&, const dbus::utility::ManagedObjectType&)>`: ``` 2) ``` $ curl -k -X GET https://${bmc}:18080/redfish/v1/UpdateService/FirmwareInventory/INVALID (2023-05-31 15:03:38) [ERROR "update_service.hpp":1010] Input swID X1cd6ce5fZ not found! ``` Tested: - Set bmcweb-logging=error to obtain Error or higher logs - Run the above commands and watch out logs - Redfish validator passed and see whether there are unexpected error or higher level logs Change-Id: I5f14eedd68fd3454cdf2a5b2f34442a7718e718a Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-06-09Consistently name AsyncResp variablesEd Tanous17-961/+1012
In about half of our code, AsyncResp objects take the name asyncResp, and in the other half they take the name aResp. While the difference between them is negligeble and arbitrary, having two naming conventions makes it more difficult to do automated changes over time via grep. This commit was generated automtatically with the command: git grep -l 'aResp' | xargs sed -i 's|aResp|asyncResp|g' Tested: Code compiles. Change-Id: Id363437b6a78f51e91cbf60aa0a0c2286f36a037 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-09Remove unused includeEd Tanous1-1/+0
This code has never used strands. Tested: Code compiles Change-Id: I59a204fe3f3a26b2a9a8ede990335c58889fb7e6 Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-09POST EthernetInterfaceCollection for VLANJiaqing Zhao1-0/+128
With EthernetInterface 1.9.0, creation of VLAN interface is done by POST EthernetInterfaceCollection. This patch implements the POST handler to do so. Tested: * With valid RelatedInterfaces and VLANId provided, new VLAN interface is successfully created. * Creating VLAN over another VLAN or non-existent interface returns error. * Creating an existing VLAN returns ResourceAlreadyExists error. * Invalid RelatedInterfaces links are rejected. Change-Id: I6b1064193eccf7ec487b43139a73d9932b6eea84 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-09Implement DELETE EthernetInterface for VLANJiaqing Zhao1-0/+54
After using EthernetInterface to represent a VLAN interface, DELETE handler is required for deleting VLAN interfaces. Tested: * VLAN interfaces can be deleted successfully via DELETE request. * Deleting a physical interface returns ResourceCannotBeDeleted error. * Deleting a non-existent interface returns ResourceNotFound error. Change-Id: Ib22063eb3ddea0614c390ba83d4e6af29d007165 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-09Expose VLAN interfaces as EthernetInterfaceJiaqing Zhao1-10/+31
In OpenBMC, VLAN is a virtual interface that has its own configuration like IP address. Redfish schema 2021.2+ also suggests using individual EthernetInterface to show VLAN information. This patch exposes VLAN interfaces as EthernetInterface for configuring them. Now bmcweb also shows BMC VLAN interfaces under /redfish/v1/Managers /bmc/EthernetInterfaces. Fixes bmcweb issue #79 (Unable configure IP on VLAN interface via redfish). Tested: * Both physical and VLAN interfaces are now in the interface collection * Only VLAN interfaces have the VLAN property and RelatedInterfaces property pointing to its parent interface * IP address of both physical and VLAN interfaces can be modified by PATCH request successfully * Redfish validator passed Change-Id: I608892275cfbef4af8e7a03a10d67a9c2fa3ff53 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-08ethernet: Bump EthernetInterface schema 1.6.0 -> 1.9.0Jiaqing Zhao2-4/+2
After removing all usages of VLanNetworkInterface that deprecated in EthernetInterface 1.7.0, time to bump it to 1.9.0 for implementing the new API design. Tested: Redfish validator passed. Change-Id: Ia89d56a1325918c23ce54c9b8c0dde4342e32764 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-06-08Remove usage of deprecated VLanNetworkInterfaceJiaqing Zhao2-291/+0
In Redfish Schema (DSP2046) 2022.3 introduces EthernetInterface 1.9.0 that allows creating VLAN interface by POST EthernetInterface [1] instead of using the deprecated VLanNetworkInterface. This patch removes all current usage of VLanNetworkInterface. This patchest (topic:redfish-ethernet-1.9) introduces breaking API changes to current VLAN management features. All deprecated VLAN APIs are removed, VLAN interfaces will be managed in the same way as the EthernetInterface Resource, except they can be created or deleted. Since webui-vue has not implemented anything related to VLAN yet, it is not impacted. Solves the issue mentioned in 188cb6294105 ("ethernet: Bump EthernetInterface schema 1.4.1 -> 1.6.0") [1] https://redfishforum.com/thread/619 Tested: Redfish validator passed on a board with VLAN interface. No VLAN interface is exposed in Redfish. Change-Id: I9b243a5bb0f07642aa60bc13a622e862f62ee871 Signed-off-by: Jiaqing Zhao <jiaqing.zhao@intel.com>
2023-06-08storage: Support new StorageControllerWilly Tu2-149/+245
Move Storage to v1.13.0. The Storage schema moved StorageControllers to its own resource + collection and deprecated the existing StorageControllers property in Storage. A link to the collection has been added in Storage instead. The StorageController and StorageControllerCollection are added based on the old resource as specified in https://redfish.dmtf.org/schemas/v1/Storage.v1_14_0.json Added the new StorageController to remove the deprecated `Storage/StorageControllers`. This will have the same functionility as the existing StorageController with the exception that HealthPopulate is not supported right now. There will be no customer impact (other than Health resource). The clients will now need to get the StorageController collection and then Storagecontroller instead of directly from Storage. Tested: RedfishValidator passed for Storage ``` *** /redfish/v1/Systems/system/Storage INFO - Attempt 1 of /redfish/v1/Systems/system/Storage INFO - Response Time for GET to /redfish/v1/Systems/system/Storage: 0.04373445897363126 seconds. INFO - Type (StorageCollection.StorageCollection), GET SUCCESS (time: 0:00:00.044128) INFO - Attempt 1 of /redfish/v1/Systems/system/Storage/1 INFO - Response Time for GET to /redfish/v1/Systems/system/Storage/1: 0.3353928590659052 seconds. INFO - PASS INFO - *** /redfish/v1/Systems/system/Storage/1 INFO - Type (Storage.v1_13_0.Storage), GET SUCCESS (time: 0:00:00.335720) *** /redfish/v1/Systems/system/Storage/1/Controllers INFO - Type (StorageControllerCollection.StorageControllerCollection), GET SUCCESS (time: 0:00:00.046414) INFO - Attempt 1 of /redfish/v1/Systems/system/Storage/1/Controllers/cpld INFO - Response Time for GET to /redfish/v1/Systems/system/Storage/1/Controllers/cpld: 0.05196243803948164 seconds. INFO - Attempt 1 of /redfish/v1/Systems/system/Storage/1/Controllers/morristown INFO - Response Time for GET to /redfish/v1/Systems/system/Storage/1/Controllers/morristown: 0.05082511808723211 seconds. INFO - PASS INFO - ... *** /redfish/v1/Systems/system/Storage/1/Controllers/controller_0 INFO - Type (StorageController.v1_6_0.StorageController), GET SUCCESS (time: 0:00:00.052223) INFO - PASS INFO - *** /redfish/v1/Systems/system/Storage/1/Controllers/controller_1 INFO - Type (StorageController.v1_6_0.StorageController), GET SUCCESS (time: 0:00:00.051165) INFO - PASS INFO - ``` ``` wget -qO - http://localhost:80/redfish/v1/Systems/system/Storage/1/Controllers { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Controllers", "@odata.type": "#StorageControllerCollection.StorageControllerCollection", "Members": [ { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Controllers/controller_0" }, { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Controllers/controller_1" } ], "Members@odata.count": 2, "Name": "Storage Controller Collection" } ``` ``` wget -qO - http://localhost:80/redfish/v1/Systems/system/Storage/1/Controllers/controller_1 { "@odata.id": "/redfish/v1/Systems/system/Storage/1/Controllers/controller_1", "@odata.type": "#StorageController.v1_6_0.StorageController", "Id": "cpld", "Name": "cpld", "Status": { "State": "Enabled" } } ``` Change-Id: I1c171514d5613f93d283d764ffb69b16dc3ba74d Signed-off-by: Willy Tu <wltu@google.com>
2023-06-08hex_units: Fix Werror=conversionWilly Tu1-2/+2
Convert all types to uint8_t to not hit the conversion warning. Change-Id: Ia535ca0a2f4045cbde06a2f8f8eaad9570a0f4a5 Signed-off-by: Willy Tu <wltu@google.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-08Remove urlEncodeEd Tanous1-2/+6
All new uses should be using boost::urls::url now. This was the last usage. Tested: Logged into webui, and observed the correct URL behavior. In browser window /foobar Forwarded to /?next=/foobar#/login Which is correct. Note, this is different behavior slightly than before. It was found that the URI precedence goes query string THEN fragment, rather than the other way around that we had it. This was flagged when moving over to boost url structures. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ifb354537d71a43c531d7d380dd889cf646731e39
2023-06-07Add AccountTypes in POST Accounts serviceNinad Palsule1-10/+61
This drop adds support to specify AccountTypes at the time of user creation. Made sure that HostConsole is only supported for user with administrator role. Testing: $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["HostConsole"]}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully.", "MessageArgs": [], "MessageId": "Base.1.13.0.Created", "MessageSeverity": "OK", "Resolution": "None." } ] } $ curl -k https://root:0penBmc@bmc1:443/redfish/v1/AccountService/Accounts/user99 { "@odata.id": "/redfish/v1/AccountService/Accounts/user99", "@odata.type": "#ManagerAccount.v1_7_0.ManagerAccount", "AccountTypes": [ "HostConsole" ], "Description": "User Account", "Enabled": true, "Id": "user99", "Links": { "Role": { "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" } }, "Locked": false, "Locked@Redfish.AllowableValues": [ "false" ], "Name": "User Account", "Password": null, "PasswordChangeRequired": false, "RoleId": "Administrator", "StrictAccountTypes": true, "UserName": "user99" } Also ran following testcases: $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["HostConsole"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Operator", "AccountTypes": ["HostConsole"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "ReadOnly", "AccountTypes": ["HostConsole"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["ManagerConsole"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["Redfish"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["WebUI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["IPMI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["Redfish", "IPMI", "HostConsole", "ManagerConsole", "WebUI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["Redfish", "HostConsole", "ManagerConsole", "WebUI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["Redfish", "ManagerConsole", "WebUI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["Redfish", "HostConsole", "WebUI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Administrator", "AccountTypes": ["IPMI", "HostConsole", "ManagerConsole"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "Operator", "AccountTypes": ["Redfish", "ManagerConsole", "WebUI"]}' $ curl -k -X POST https://${bmc}/redfish/v1/AccountService/Accounts -d '{"UserName": "user99", "Password": "0penBmc0", "RoleId": "ReadOnly", "AccountTypes": ["Redfish", "ManagerConsole", "WebUI"]}' Change-Id: I19ff994e712bcfaf827a5f8dd02a752a6ab92214 Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>
2023-06-07PATCH userGroups Information ("AccountTypes")Abhishek Patel1-16/+142
This commit enhances the redfish API to set and unset userGroups information for each user account. Users with ConfigureUsers level privilege can patch (Set and Unset) AccountTypes of each user role. In addition, a user with "ConfigureSelf" level privilege can only set or Update their password. "Redfish" is always enabled in each user role. However, "ConfigureUsers" can disable other user redfish services. But if "ConfigureUsers" try to disable its redfish service, that generates an error. In this commit, users can enable and disable "redfish", "ssh", "hostconsole" and "ipmi" services from each user where ssh is a special case. 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. To enable redfish User Group both of these account types should be specified, and none to disable it. Tested: Testing was done using curl command with ConfigureUsers and ConfigureSelf. $ curl -k -X PATCH https://$bmc:18080/redfish/v1/AccountService/Accounts/webuser -d '{"AccountTypes": ["Redfish", "WebUI", "ManagerConsole", "HostConsole"]}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request completed successfully.", "MessageArgs": [], "MessageId": "Base.1.13.0.Success", "MessageSeverity": "OK", "Resolution": "None" } ] } Also ran following cases: $ curl -k -X PATCH https://${bmc}/redfish/v1/AccountService/Accounts/user99 -d '{"AccountTypes": ["HostConsole"]}' $ curl -k -X PATCH https://${bmc}/redfish/v1/AccountService/Accounts/user99 -d '{"AccountTypes": ["IPMI"]}' $ curl -k -X PATCH https://${bmc}/redfish/v1/AccountService/Accounts/user99 -d '{"AccountTypes": ["Redfish", "WebUI"]}' $ curl -k -X PATCH https://${bmc}/redfish/v1/AccountService/Accounts/user99 -d '{"AccountTypes": ["ManagerConsole"]}' $ curl -k -X PATCH https://${bmc}/redfish/v1/AccountService/Accounts/user99 -d '{"AccountTypes": ["Redfish", "IPMI", "HostConsole", "ManagerConsole", "WebUI"]}' { "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "There are insufficient privileges for the account or credentials associated with the current session to perform the requested operation.", "MessageArgs": [], "MessageId": "Base.1.13.0.InsufficientPrivilege", "MessageSeverity": "Critical", "Resolution": "Either abandon the operation or change the associated access rights and resubmit the request if the operation failed." } ], "code": "Base.1.13.0.InsufficientPrivilege", "message": "There are insufficient privileges for the account or credentials associated with the current session to perform the requested operation." } $ curl -k -H 'X-Auth-Token: IpnCBj1Lozh53Jhzxu7T' -X PATCH https://${bmc}/redfish/v1/AccountService/Accounts/user999 -d '{"Password":"0penBmc123"}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request completed successfully.", "MessageArgs": [], "MessageId": "Base.1.13.0.Success", "MessageSeverity": "OK", "Resolution": "None" } ] Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com> Signed-off-by: Abhishek Patel <Abhishek.Patel@ibm.com> Change-Id: I1a0344ca45556b820bb77c3dcb459f27eb032501 Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
2023-06-06bmc-ready: provide special error return on BMCNotReadyAndrew Geissler2-25/+86
A new feature has been proposed[1] and implemented[2] which can be optionally enabled on a system to not allow a chassis or host power on operation when the BMC is not in a "Ready" state. In those situations, if a power on operation is requested, the D-Bus error response will be a specific BMCNotReady error. In those situations, respond to the user with a more targeted error asking them to retry in 10 seconds. The 10s retry is based on my experience with OpenBMC based systems, the longest time between bmcweb being up and running and BMC Ready is around 30s. Tested: - Enabled BMC Ready feature, manually put BMC in NotReady state, and requested a: ``` /redfish/v1/Chassis/chassis/Actions/Chassis.Reset -d '{"ResetType": "PowerCycle"}' ``` - Confirmed new response message: ``` "Message": "The service is temporarily unavailable. Retry in 10 seconds." ``` - Stopped Chassis state service and verified expected "internal service error" on same request - Ran similar test with Systems/system/Actions/ComputerSystem.Reset API - Confirmed good paths still worked as expected [1]: https://lists.ozlabs.org/pipermail/openbmc/2023-May/033383.html [2]: https://gerrit.openbmc.org/q/topic:bmc-ready-check Change-Id: I6a6e5774c96b4f37c794ba49a5e06d3e51156d09 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2023-06-05Add SSE style subscription support to eventserviceAppaRao Puli5-32/+149
This commit adds the SSE style eventservice subscription style event Using this, end user can subscribe for Redfish event logs using GET on SSE uris from browser. Tested: - From Browser did GET on above SSE URI and generated some Redfish event logs(power cycle) and saw redfish event logs streaming on browser. - After SSE registration, Check Subscription collections and GET on individual subscription and saw desired response. - Ran RedfishValidation and its passed. Change-Id: I7f4b7a34974080739c4ba968ed570489af0474de Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com> Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-05Implement HEAD for metricsEd Tanous1-3/+44
These got missed in the initial patchset. Add them Tested: At the end of the series. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I120986fb0afc34d5e0572d2cc2e1d8ff6994ee3c
2023-06-05Break out metric report definition getEd Tanous1-22/+25
In the same way we're doing other places. Tested: THe last commit of the series will be tested. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I177e61dd3741f3885516a2f645a7039d274786cb
2023-06-02Move getPCIeDeviceList to pcie_utilLakshmi Yadlapati3-42/+78
Currently, getPCIeDeviceList is only used by systems.hpp to obtain the list of PCIe devices. However, there are plans to use this function in other parts of the PCIe code as well. To better organize our code and make the function more reusable, this commit moves getPCIeDeviceList to pcie_util.hpp, a common location for PCIe-related utilities. Tested: ''' curl -k https://$bmc/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem", "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } }, ..... ..... "PCIeDevices": [ { "@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" }, { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card10" }, ..... { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card9" } ], "PCIeDevices@odata.count": 20, ..... ..... ''' Change-Id: I3aaa5b55e8574929154ffd743db53da6fbaeb75d Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-06-02Remove duplicated stringValueTooLongEd Tanous2-30/+0
This prototype got added twice, once with int as a value, and once with size_t. This builds fine in 64 bit, but in 32 bit, fails. Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie3de779330d768cdd84d5647d242d5fe447d2a85
2023-06-01Input parameter validation for Event SubscriptionAppaRao Puli3-0/+92
User input must be validated to avoid the out-of-memory issue. This commit adds the size check on input parameters such as Context, Destination and Header field while create or update the EventDestination. Added a generic error message "PropertySizeExceeded" in message registry which is used as response when size limit is exceeded. Tested - Validated using POST on Event Subscription. - When Context, Destination and Headers were too long, received a error message denoting the same. Change-Id: Ibab847ce0c99f445a76e6d3aee8074428bb7d30f Signed-off-by: AppaRao Puli <apparao.puli@intel.com> Signed-off-by: Ayushi Smriti <smriti.ayushi@intel.com> Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-01Update base registriesEd Tanous2-116/+299
Update Base registry to 1.16.0, and Resource Event registry to 1.3.0 Patch was generated automatically. Tested: Code builds. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie9c15a657459cf7ec7fa5b4bf89460049fbce554
2023-06-01chassis: consistently log error on internal failsAndrew Geissler1-5/+7
Debugging internalError responses from bmcweb has been a consistent pain point for us. It does help to at least have the boost error code logged to the journal. Ensure the error code is logged to the journal consistently within the chassis file. If this commit makes sense to the maintainers then I will work on making this consistent in other files at a later date. Tested: - Verified it compiled and one of the error paths traced the appropriate boost error code. Change-Id: I76b7644bc18e76fff69595fb5f1bc23d257563e9 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
2023-06-01Fix bmcweb coredump by Non-existent PCIeFunctionIdMyung Bae1-2/+8
When a non-existent PCIeFunctionId is queried, bmcweb returns the success but with the incorrect output. ``` curl -k -X GET https://${bmc}:18080/redfish/v1/Systems/system/PCIeDevices/pcie_card1/PCIeFunctions/12 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1/PCIeFunctions/12", "@odata.type": "#PCIeFunction.v1_2_3.PCIeFunction", "FunctionId": 12, "Id": "12", "Links": { "PCIeDevice": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card1" } }, "Name": "PCIe Function" }% ``` This should be resulted as ``` "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type PCIeFunction named '12' was not found.", ``` Change-Id: If6a1453e3e549e07b6961ff80ebf37b0537e2b7c Signed-off-by: Myung Bae <myungbae@us.ibm.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-06-01Replace atoiEd Tanous1-11/+15
Atoi has the potential to cause crashes if users request non-integer pcie function numbers. Replace with functional code. Tested: WIP Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I6742ff6b69e6df4a4afae26610effa01f2450b1b
2023-06-01Fix NotFound Sensors to report as 404Myung Bae1-2/+8
Sensors that are not found are incorrectly reported as internal Server error and its logging is done as Error. . It will be changed to 404 - Not found and its logging will be WARNING. ``` redfishtool raw GET -r ${bmc} -u admin -p 0penBmc0 -S Always /redfish/v1/Chassis/chassis/Sensors/temperature_PCIE_1_Temp_invalid redfishtool: Transport: Response Error: status_code: 500 -- Internal Server Error redfishtool: raw: Error getting response curl -k -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/temperature_PCIE_1_Temp_invalid { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/temperature_PCIE_1_Temp_invalid", "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request failed due to an internal service error. The service is still operational.", "MessageArgs": [], "MessageId": "Base.1.13.0.InternalError", "MessageSeverity": "Critical", "Resolution": "Resubmit the request. If the problem persists, consider resetting the service." } ], "code": "Base.1.13.0.InternalError", "message": "The request failed due to an internal service error. The service is still operational." } }% ``` Its logging is ``` redfishtool: Transport: Response Error: status_code: 500 -- Internal Server Error(2023-05-31 15:16:43) [CRITICAL "error_messages.cpp":282] Internal Error ../../../../../../../../../bmcweb/redfish-core/lib/sensors.hpp(2928:36) `redfish::sensors::handleSensorGet(App&, const crow::Request&, const std::shared_ptr<bmcweb::AsyncResp>&, const std::string&, const std::string&)::<lambda(const boost::system::error_code&, const dbus::utility::MapperGetObject&)>`: (2023-05-31 15:16:43) [ERROR "sensors.hpp":2929] Sensor getSensorPaths resp_handler: Dbus error generic:5 ``` The expected behavior will be ``` redfishtool raw GET -r ${bmc} -u admin -p 0penBmc0 -S Always /redfish/v1/Chassis/chassis/Sensors/temperature_PCIE_1_Temp_invalid redfishtool: Transport: Response Error: status_code: 404 -- Not Found curl -k -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/temperature_PCIE_1_Temp_invalid { "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/temperature_PCIE_1_Temp_invalid", "error": { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type temperature_PCIE_1_Temp_invalid named 'Sensor' was not found.", "MessageArgs": [ "temperature_PCIE_1_Temp_invalid", "Sensor" ], "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 temperature_PCIE_1_Temp_invalid named 'Sensor' was not found." } }% ``` Its logging will be: ``` (2023-05-31 20:17:55) [WARNING "sensors.hpp":2928] Sensor not found from getSensorPaths ``` Change-Id: I5a51c1b5c0125b5396068311602964d4e249e297 Signed-off-by: Myung Bae <myungbae@us.ibm.com>
2023-05-31Disabled processor and memory summary statusNinad Palsule1-42/+69
Redfish deprecated the Processor/Memory Summary Status (state, health, healthrollup) attributes. Please refer to redfish spec for more details: https://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_20_0.json Initially I tried to fix the summary status issues, (https://gerrit.openbmc.org/c/openbmc/bmcweb/+/60663) But later it was decided that we should also remove these attributes from the bmcweb code. Here is a link to discussion on discord: https://discord.com/channels/775381525260664832/855566794994221117/1093939076710793296 This drop hides these attributes under defined BMCWEB_ENABLE_PROC_MEM_STATUS. This option is disabled by default. These attributes will be permanently removed from code in 1Q 2024 (in 8-9 months). Testing: - Redfish validator passed excepted couple of failures but those are failing without my changes too. - Make sure that summary status for memory and processor is not seen in the output. Without fix: ------------ ''' $ curl -s -k https://${bmc}/redfish/v1/Systems/system ..... "MemorySummary": { "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "TotalSystemMemoryGiB": 256 }, ..... "ProcessorSummary": { "CoreCount": 20, "Count": 4, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } }, ..... '''' With fix: --------- ''' "MemorySummary": { "TotalSystemMemoryGiB": 256 }, ..... "ProcessorSummary": { "CoreCount": 20, "Count": 4 }, ..... '''' - Turned on BMCWEB_ALLOW_DEPRECATED_PROC_MEM_STATUS flag and made sure that properties are shown again. Change-Id: I1e0ee386bd4f365599afcf46e5d587285af635ad Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-05-31health: Add option to disable health-populateWilly Tu7-76/+120
The Health populate calls GetManagedObjects at `/` which can take a lot of time. Add the option to disable to improve performance if it is not needed. Tested: ``` $ meson build -Dhealth-populate=disabled ... User defined options backend : ninja health-populate : disabled ``` Build passed. Health Status removed. Some resource still create HealthPopulate, but does not populate. It will require further refactoring to clean it out. Testing on `/redfish/v1/Chassis?$expand=.($levels=1)` On 14 chassis, from about 2.5 seconds to 400 ms. :) Before: ``` Getting times for chassis Getting good line count with wget -q -O- localhost:80/redfish/v1/Chassis?$expand=.($levels=1) Line count: 980 17:05:56: real 0m2.908s user 0m0.000s sys 0m0.030s 17:05:59: real 0m2.414s user 0m0.010s sys 0m0.010s 17:05:03: real 0m3.410s user 0m0.000s sys 0m0.020s 17:05:09: real 0m2.372s user 0m0.000s sys 0m0.010s 17:05:13: real 0m3.407s user 0m0.010s sys 0m0.000s 17:05:19: real 0m2.420s user 0m0.010s sys 0m0.000s 17:05:23: real 0m3.463s user 0m0.010s sys 0m0.000s 17:05:29: real 0m2.414s user 0m0.000s sys 0m0.010s 17:05:33: real 0m2.843s user 0m0.010s sys 0m0.010s 17:05:38: real 0m2.512s user 0m0.000s sys 0m0.020s 17:05:42: real 0m2.474s user 0m0.000s sys 0m0.010s 17:05:47: real 0m2.557s user 0m0.010s sys 0m0.010s 17:05:52: real 0m2.439s user 0m0.020s sys 0m0.000s 17:05:56: real 0m3.127s user 0m0.010s sys 0m0.000s 17:05:01: real 0m2.563s user 0m0.020s sys 0m0.000s 17:05:06: real 0m2.392s user 0m0.020s sys 0m0.020s 17:05:10: real 0m2.405s user 0m0.020s sys 0m0.000s 17:05:15: real 0m2.514s user 0m0.010s sys 0m0.010s 17:05:19: real 0m2.809s user 0m0.020s sys 0m0.010s 17:05:24: real 0m2.944s user 0m0.010s sys 0m0.010s 17:05:29: real 0m2.537s user 0m0.010s sys 0m0.000s 17:05:34: real 0m3.290s user 0m0.000s sys 0m0.000s 17:05:39: real 0m2.601s user 0m0.040s sys 0m0.000s 17:05:43: real 0m2.398s user 0m0.010s sys 0m0.040s 17:05:48: real 0m2.664s user 0m0.000s sys 0m0.020s 17:05:53: real 0m2.323s user 0m0.010s sys 0m0.000s 17:05:57: real 0m3.033s user 0m0.000s sys 0m0.010s 17:05:02: real 0m3.243s user 0m0.000s sys 0m0.010s 17:05:07: real 0m2.604s user 0m0.010s sys 0m0.010s 17:05:12: real 0m2.813s user 0m0.010s sys 0m0.010s 17:05:17: real 0m2.325s user 0m0.020s sys 0m0.000s 17:05:21: real 0m2.577s user 0m0.010s sys 0m0.000s 17:05:26: real 0m2.882s user 0m0.030s sys 0m0.000s 17:05:31: real 0m2.572s user 0m0.000s sys 0m0.020s 17:05:35: real 0m2.678s user 0m0.010s sys 0m0.010s 17:05:40: real 0m2.656s user 0m0.010s sys 0m0.010s 17:05:45: real 0m2.921s user 0m0.020s sys 0m0.000s 17:05:49: real 0m2.723s user 0m0.000s sys 0m0.020s 17:05:54: real 0m2.910s user 0m0.010s sys 0m0.010s 17:05:59: real 0m2.601s user 0m0.020s sys 0m0.000s 17:05:04: real 0m2.615s user 0m0.000s sys 0m0.000s ``` After: ``` Getting times for chassis Getting good line count with wget -q -O- localhost:80/redfish/v1/Chassis?$expand=.($levels=1) Line count: 980 16:04:43: real 0m0.188s user 0m0.020s sys 0m0.000s 16:04:43: real 0m0.195s user 0m0.010s sys 0m0.000s 16:04:45: real 0m0.219s user 0m0.010s sys 0m0.000s 16:04:48: real 0m0.226s user 0m0.020s sys 0m0.000s 16:04:50: real 0m0.208s user 0m0.020s sys 0m0.010s 16:04:52: real 0m0.226s user 0m0.010s sys 0m0.010s 16:04:54: real 0m0.419s user 0m0.000s sys 0m0.010s 16:04:57: real 0m0.222s user 0m0.010s sys 0m0.020s 16:04:59: real 0m0.194s user 0m0.000s sys 0m0.010s 16:04:01: real 0m0.191s user 0m0.010s sys 0m0.010s 16:04:04: real 0m0.276s user 0m0.010s sys 0m0.020s 16:04:06: real 0m0.183s user 0m0.020s sys 0m0.000s 16:04:08: real 0m0.193s user 0m0.040s sys 0m0.000s 16:04:10: real 0m0.406s user 0m0.020s sys 0m0.010s 16:04:13: real 0m0.317s user 0m0.000s sys 0m0.000s 16:04:15: real 0m0.442s user 0m0.005s sys 0m0.005s 16:04:18: real 0m0.226s user 0m0.010s sys 0m0.000s 16:04:20: real 0m0.217s user 0m0.020s sys 0m0.000s 16:04:22: real 0m0.200s user 0m0.010s sys 0m0.030s 16:04:24: real 0m0.423s user 0m0.010s sys 0m0.010s 16:04:27: real 0m0.203s user 0m0.020s sys 0m0.010s 16:04:29: real 0m0.433s user 0m0.000s sys 0m0.000s 16:04:31: real 0m0.318s user 0m0.020s sys 0m0.000s 16:04:34: real 0m1.206s user 0m0.000s sys 0m0.010s 16:04:37: real 0m0.403s user 0m0.000s sys 0m0.020s 16:04:39: real 0m0.353s user 0m0.010s sys 0m0.000s 16:04:42: real 0m0.291s user 0m0.000s sys 0m0.030s 16:04:44: real 0m0.742s user 0m0.020s sys 0m0.010s 16:04:47: real 0m0.369s user 0m0.010s sys 0m0.000s 16:04:49: real 0m0.215s user 0m0.020s sys 0m0.000s 16:04:52: real 0m0.204s user 0m0.000s sys 0m0.010s 16:04:54: real 0m0.418s user 0m0.000s sys 0m0.000s 16:04:56: real 0m0.215s user 0m0.000s sys 0m0.010s 16:04:58: real 0m0.202s user 0m0.010s sys 0m0.010s 16:04:01: real 0m0.202s user 0m0.010s sys 0m0.010s 16:04:03: real 0m0.212s user 0m0.010s sys 0m0.000s 16:04:05: real 0m0.694s user 0m0.010s sys 0m0.010s 16:04:08: real 0m0.201s user 0m0.010s sys 0m0.010s 16:04:10: real 0m0.230s user 0m0.000s sys 0m0.020s 16:04:12: real 0m0.206s user 0m0.010s sys 0m0.010s 16:04:15: real 0m0.446s user 0m0.010s sys 0m0.010s ``` Change-Id: I90b242e2cd24973420de871fedf9793dd1e310f3 Signed-off-by: Willy Tu <wltu@google.com>
2023-05-30Allow async resolver to be optionalEd Tanous3-28/+25
This commit adds a meson option to allow selecting which dns resolver bmcweb uses. There are use cases, like Open Compute Project Inband Management Agent, that would require not using dbus, which would require us to fall back to the asio resolver. This commit makes the existing asio resolver constructor, and async_resolve methods match the equivalents in asio (which we intended to do anyway), then adds a macro and configure option for being able to select which resolver backend to rely on. Tested: Code can now compile without sdbusplus. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3220214367179f131a60082bdfaf7e725d35c125
2023-05-30Break out methodsEd Tanous1-31/+33
"Like we do other places.. blah" Tested: Top commit was tested. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8a254067f97569a4d07817796b89a95cd768ff18
2023-05-30Add support for POST on TriggersCollectionSzymon Dompke3-63/+750
Added POST method on /redfish/v1/TelemetryService/Triggers uri, which creates new trigger in telemetry service, by using dbus call AddTrigger. By DMTF, most of the properties are not required, and as such are treated as optional. Some values can be deduced from others (like 'MetricType', depending on 'DiscreteTriggers' or 'NumericThresholds'). All properties provided in POST body by user will be verified against each other, and errors will be raised. Few examples of such situations: - 'MetricType' is set to 'Discrete' but 'NumericThresholds' was passed. - 'MetricType' is set to 'Numeric' but "DiscreteTriggers' or 'DiscreteTriggerCondition' were passed - 'DiscreteTriggerCondition' is set to 'Specified' but 'DiscreteTriggers' is an empty array or was not passed. - 'DiscreteTriggerCondition' is set to 'Changed' but 'DiscreteTriggers' is passed and is not an empty array. Example 1 – Trigger with discrete values: ``` { "Id": "TestTrigger", "MetricType": "Discrete", "TriggerActions": [ "RedfishEvent" ], "DiscreteTriggerCondition": "Specified", "DiscreteTriggers": [ { "Value": "55.88", "DwellTime": "PT0.001S", "Severity": "Warning" }, { "Name": "My discrete trigger", "Value": "55.88", "DwellTime": "PT0.001S", "Severity": "OK" }, { "Value": "55.88", "DwellTime": "PT0.001S", "Severity": "Critical" } ], "MetricProperties": [ "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading" ], "Links": { "MetricReportDefinitions": [] } } Example 2 – trigger with numeric threshold: { "Id": "TestTrigger2", "Name": "My Numeric Trigger", "MetricType": "Numeric", "TriggerActions": [ "RedfishEvent", "RedfishMetricReport" ], "NumericThresholds": { "UpperCritical": { "Reading": 50, "Activation": "Increasing", "DwellTime": "PT0.001S" }, "UpperWarning": { "Reading": 48.1, "Activation": "Increasing", "DwellTime": "PT0.004S" } }, "MetricProperties": [ "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/0/Reading", "/redfish/v1/Chassis/AC_Baseboard/Thermal#/Fans/17/Reading" ], "Links": { "MetricReportDefinitions": [ "/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetrics", "/redfish/v1/TelemetryService/MetricReportDefinitions/PowerMetricStats", "/redfish/v1/TelemetryService/MetricReportDefinitions/PlatformPowerUsage" ] } } ``` Tested: - Triggers were successfully created with above example message bodies. This can be checked by calling: 'busctl tree xyz.openbmc_project.Telemetry'. - Expected errors were returned for messages with incorrect or mutually exclusive properties and incorrect values. - Redfish service validator is passing. Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> Change-Id: Ief8c76de8aa660ae0d2dbe4610c26a28186a290a
2023-05-26Set HidePayload on Task when payload is nullArun Thomas Baby1-0/+3
The task payload object can be null in certain cases. As per the schema for Task, there is a standard property Hidepayload which can be set to true at this case. Setting this property as true in the response body when Payload is nil. Tested: Created a task without creating the task payload object and able to see Hidepayload as true in response body. Change-Id: I370d1eb9b5b96adb56cff2216b467357b0b34b42 Signed-off-by: Arun Thomas Baby <arunx.thomas.baby.baby.mathew@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com>
2023-05-26json utility: add sortNan Zhou1-0/+103
This commit adds a utility function |sortJsonArrayByKey|. It can sort an json array by value of a given key of each element. Use cases includes: 1. sort the MemberCollection by @odata.id Tested: 1. unit test passed; Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Idc175fab3af5c6102a5a3439b712b659ecb76468
2023-05-26Make all std::regex instances staticEd Tanous1-2/+2
Per [1] we really shouldn't be using regex. In the cases we do, it's a HUUUUUGE performance benefit to be compiling the regex ONCE. The only downside is a slight increase in memory usage. [1]: https://github.com/openbmc/bmcweb/issues/176 Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8644b8a07810349fb60bfa0258a13e815912a38e
2023-05-26Don't push non finite numbers to RedfishEd Tanous1-0/+14
Redfish Sensor schema is based around Edm.Number, which doesn't have an allowance for things like infinity, -infinity, or NAN. Because these are theoretically possible in the dbus interfaces, we need to omit the properties if they are set to anything that Redfish doesn't support. Because the DBus sensor Value interface relies on NAN to represent unavailable, this is explicitly set to null in the json response. This behavior was discussed with DMTF in a forum meeting, and is the protocol-correct behavior for handling unavailable numbers. All other number-assigning dbus properties are omitted from the response, to show that they are "not supported" if they produce out-of-range values. Tested: Unclear if there are any implementations that do this to test against. Code inspection only. Redfish-service-validator passes (on previous patchset). Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ia3dde24cd604b0bb5dc596e7b8a6461a4b339b71
2023-05-25Handle AccountService D-bus errorsRavi Teja1-8/+57
Currently LDAP configuration D-bus errors are not mapped to Redfish Errors, so returing internalError irrespective of D-bus error. This commit handles InvalidArgument D-bus error for LDAP config Tested By: Configure LDAP with various invalid arguments. Signed-off-by: Ravi Teja <raviteja28031990@gmail.com> Change-Id: I6adaedd936fb3d9d906750649792a4d414b54b73
2023-05-25update service: use getCollectionMembersJohn Edward Broadbent1-39/+6
There are some cases that getCollectionMembers can be leveraged Tested: GET https://127.0.0.1:443/redfish/v1/UpdateService/FirmwareInventory/ Returns the same result. Redfish service validator passes. Signed-off-by: John Edward Broadbent <jebr@google.com> Change-Id: I417bc08cffd24c6c95abaf86013002ce705d20a4
2023-05-25Fix some includesEd Tanous2-2/+3
System includes should be included with <>, in-tree includes should be included with "". This was found manually, with the help of the following grep statement[1]. git grep -o -h "#include .*" | sort | uniq Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I1a6b2a5ba35ccbbb61c67b7c4b036a2d7b3a36a3
2023-05-25Refactor processor/memory state related codeNinad Palsule1-118/+132
- Moved code around to bring state related code close to each other - Separated long memory lambda function. Tested: - Ran: Compared output of following command before and after change and it matched. $ curl -s -k https://${bmc}/redfish/v1/Systems/system { "@odata.id": "/redfish/v1/Systems/system", "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem", "Actions": { "#ComputerSystem.Reset": { "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo", "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset" } }, | | "Manufacturer": "", "Memory": { "@odata.id": "/redfish/v1/Systems/system/Memory" }, "MemorySummary": { "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "TotalSystemMemoryGiB": 0 }, | | "ProcessorSummary": { "CoreCount": 32, "Count": 4, "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } }, "Processors": { "@odata.id": "/redfish/v1/Systems/system/Processors" }, Change-Id: Ib72f272eca4ff79e26fe29033c989896a5b9154d Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>
2023-05-25Fix the Redfish validator fail for StorageGeorge Liu1-16/+37
This commit fixes the problem that Redfish Validator has not passed because of the analytical URL failure (Redfish/V1/Systems/System/System/Storage/1/Drives/Media0). Redfish validator error message: ``` *** /redfish/v1/Systems/system/Storage/1 INFO - Type (Storage.v1_7_1.Storage), GET SUCCESS \ (time: 0:00:00.184274) INFO - Attempt 1 of /redfish/v1/Systems/system/Storage/1/ \ Drives/media0 INFO - Response Time for GET to /redfish/v1/Systems/system/Storage/ \ 1/Drives/media0: 0.15951547500117158 seconds. ERROR - Drives: GET of resource at URI /redfish/v1/Systems/system/ \ Storage/1/Drives/media0 returned HTTP error. Check URI. INFO - FAIL... INFO - *** /redfish/v1/Systems/system/Storage/1/Drives/media0 ERROR - URI did not return resource /redfish/v1/Systems/system/ \ Storage/1/Drives/media0 ``` Tested: Redfish validator passes. Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I1c7ff0e8103ce2e65cd3d73f6ef20abfe70a01b5
2023-05-25Processor: Add processor throttle statusChris Cain1-3/+103
- Update Processor Schema to 18.0 - Add processor throttle status and cause https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/63063 Throttled: An indication of whether the processor is throttled. ThrottledCauses: An array of reasons that the processor is throttled. Ran validator and no new errors were found. Change-Id: Ia4a58ae0f26ffc6177f418420ba45063471323da Signed-off-by: Chris Cain <cjcain@us.ibm.com>
2023-05-25Update DIMM memorySizeInKB to be in size_tAnthony1-3/+5
Following the changes in https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/41870 where `MemorySizeInKB` type changed from `uint32` to `size`. Tested: On a 64-bit system, MemorySizeInKB has type `t`, which is uint64. ``` .MemorySizeInKB property t 33554432 emits-change writable ``` Before: ``` [ERROR "dbus_utils.hpp":21] DBUS property error in property: MemorySizeInKB, reason: 1 --- ~# curl localhost/redfish/v1/Systems/system -s \ | grep -A7 MemorySummary "MemorySummary": { "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Disabled" }, "TotalSystemMemoryGiB": 0 }, ``` After: ``` ~# curl localhost/redfish/v1/Systems/system -s \ | grep -A7 MemorySummary "MemorySummary": { "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" }, "TotalSystemMemoryGiB": 64 }, ``` Change-Id: Ifc66d4cf78ea81629957091bc4f3b407aa96355a Signed-off-by: Anthony <anthonyhkf@google.com>
2023-05-24Add Links/Triggers to MetricReportDefinitionSzymon Dompke1-1/+49
This change is adding Triggers property to Links when GET is called on MetricReportDefinition. It contains array of @odata.id pointing to Trigger resource if it is also linking to given MRD. Testing done: - Links/Trigger property is returned by GET request on /redfish/v1/TelemetryService/MetricReportDefinitions/<str>/ Signed-off-by: Szymon Dompke <szymon.dompke@intel.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I5accf4b50324437b0b185003200078ad2c7020b0
2023-05-24Add check for "quiesced" bmc manager stateEd Tanous1-25/+42
The bmc now supports the Quiesced state, which is tracked using systemd targets. Previously, the bmc startup state was determined by systemd alone. The old systemd startup behavior is retained, but if the bmc is found to be started, this commit also check the quiesced target to determine if we should set that state as well. This allows phosphor-state-manager users to have a state that works for the quiesced use case, while avoiding race conditions on startup, or having to impose a hard dependency on phosphor-state-manager, which we know some users do not use. The reasons for not using phosphor-state-manager are outside of the scope of this commit. In comparison to the alternative: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/50318 This actually seems to have a smaller diff, so while there's some concern about adding complexity to bmcweb, this seems like this patch gets us the same behavior with slightly less code. Tested: Loaded onto a p10bmc and see this new state. systemctl start obmc-bmc-service-quiesce@0.target root@xxx:~# obmcutil state CurrentBMCState : xyz.openbmc_project.State.BMC.BMCState.Quiesced curl -k https://$bmc/redfish/v1/Managers/bmc ... "Status": { "Health": "Critical", "State": "Quiesced" }, Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I718b8ad0a43327051cb5fdf0da59a1ccfbde9940 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
2023-05-23Switched bmcweb to use new telemetry service APIKrzysztof Grobelny5-122/+548
Added support for multiple MetricProperties. Added support for new parameters: CollectionTimeScope, CollectionDuration. ReadingParameters was not yet changed in telemetry backend, instead temporary property ReadingParametersFutureVersion was introduced. Once bmcweb is adapted to use ReadingParametersFutureVersion this property will be renamed in backend to ReadingParameters. Then bmcweb will change to use ReadingParameters. Then ReadingParametersFutureVersion will be removed from backend and everything will be exactly like described in phosphor-dbus-interfaces without introducing breaking changes. Related change in phosphor-dbus-interfaces [1], [2]. This change needs to be bumped together with [3]. Tested: - It is possible to create MetricReportDefinitions with multiple MetricProperties. - Stub values for new parameters are correctly passed to telemetry service. - All existing telemetry service functionalities remain unchanged. [1]: https://github.com/openbmc/phosphor-dbus-interfaces/commit/4f9c09144b60edc015291d2c120fc5b33aa0bec2 [2]: https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/60750 [3]: https://gerrit.openbmc.org/c/openbmc/telemetry/+/58229 Change-Id: I2cd17069e3ea015c8f5571c29278f1d50536272a Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com> Signed-off-by: Lukasz Kazmierczak <lukasz.kazmierczak@intel.com>
2023-05-23Use human sort for EthernetInterfacesEd Tanous1-0/+5
Much like we've done for the other collections, we should be sorting these such that humans can use them. This commit reorders the EthernetInterfacesCollection to report in numerical order. In redfish, these collections are considered sets, so therefore order is irrelevant to software, but keeping these things useful for humans is important, therefore it's a pretty trivial change to order them in a way that humans expect (1, 2, 3, etc). Tested: GET /redfish/v1/Managers/bmc/EthernetInterfaces Returns interfaces in eth0 then eth1. Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic48f9be5366afee49fc9fec77a3bb194ab25577d
2023-05-22Update schema packs to 2023.1Ed Tanous18-1/+326
Redfish just released 2023.1, pull it in and update the packs. This commit was generated automatically using update_schemas.py Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I8faad8392af88aa7fc3a4fd73c8e0ec3bede56e5
2023-05-20Added new pre-defined usergroup called hostconsoleNinad Palsule5-28/+93
The new pre-defined usergroup named "hostconsole" is added to differentiate access between host console and manager console. The only users allowed to interact with host console are part of the "hostconsole" group and they are in an administrator role. Note: The changes are spread across multiple repositories listed under "Related commits:" The bmcweb changes to incorporate new group are as follows: - The new user is added in the hostconsole group only if it has an administrative role. - The ssh usergroup is only translated to ManagerConsole redfish group and hostconsole usergroup is translated to HostConsole redfish group. - The following changes are made to check the privileges for host console access - The new OEM privilege "OpenBMCHostConsole" added for host console access. This privilege is not shared externally hence it is not documented. - Updated obmc_console BMCWEB_ROUTE to use the new privilege. - Router functions now save user role and user groups in the session - getUserPrivileges() function now takes session reference instead of user role. This function now also checks for the user group "hostconsole" and add the new privilege if user is member of this group. - Updated all callers of the getUserPrivileges to pass session reference. - Added test to validate that new privilege is set correctly. Tested: Loaded code on the system and validated that; - New user gets added in hostconsole group. NOTE: Prior to this commit all groups are assigned to new user. This drop does not change that behavior. - Access from the web gui is only available for users in hostconsole group. Used IBM internal simulator called simics to test this. This simulator allows accessing openbmc from GUI. - Checked the role collection and there is no change. $ curl -k -H "X-Auth-Token: $TOKEN" -X GET \ https://${bmc}/redfish/v1/AccountService/Roles $ curl -k -H "X-Auth-Token: $TOKEN" -X GET \ https://${bmc}/redfish/v1/AccountService/Roles/Administrator $ curl -k -H "X-Auth-Token: $TOKEN" -X GET \ https://${bmc}/redfish/v1/AccountService/Roles/ReadOnly $ curl -k -H "X-Auth-Token: $TOKEN" -X GET \ https://${bmc}/redfish/v1/AccountService/Roles/Operator - HostConsole is in AccountType when hostconsole group is present in UserGroups D-Bus property $ id user99 uid=1006(user99) gid=100(users) groups=1000(priv-admin),1005(web),\ 1006(redfish),1013(hostconsole),100(users) $ curl -k https://${bmc}/redfish/v1/AccountService/Accounts/user99 { "@odata.id": "/redfish/v1/AccountService/Accounts/user99", "@odata.type": "#ManagerAccount.v1_4_0.ManagerAccount", "AccountTypes": [ "HostConsole", "Redfish", "WebUI", "ManagerConsole" ], "Description": "User Account", "Enabled": true, "Id": "user99", "Links": { "Role": { "@odata.id": "/redfish/v1/AccountService/Roles/Administrator" } }, "Locked": false, "Locked@Redfish.AllowableValues": [ "false" ], "Name": "User Account", "Password": null, "PasswordChangeRequired": false, "RoleId": "Administrator", "UserName": "user99" - The hostconsole group is not present for readonly or operator users and also made sure that console access is not provided. This testing is done one the system and console access was tried by modifying the https://github.com/openbmc/bmcweb/blob/master/scripts/websocket_test.py + curl -k https://${bmc}/redfish/v1/AccountService/Accounts/user99 { "@odata.id": "/redfish/v1/AccountService/Accounts/user99", "@odata.type": "#ManagerAccount.v1_4_0.ManagerAccount", "AccountTypes": [ "IPMI", "Redfish", "WebUI", "ManagerConsole" ], "Description": "User Account", "Enabled": true, "Id": "user99", "Links": { "Role": { "@odata.id": "/redfish/v1/AccountService/Roles/ReadOnly" } }, "Locked": false, "Locked@Redfish.AllowableValues": [ "false" ], "Name": "User Account", "Password": null, "PasswordChangeRequired": false, "RoleId": "ReadOnly", "UserName": "user99" [INFO "http_connection.hpp":209] Request: 0x150ac38 HTTP/1.1 GET /console0 ::ffff:x.x.xx.xxx [DEBUG "routing.hpp":1265] Matched rule (upgrade) '/console0' 1 / 2 [DEBUG "routing.hpp":1084] userName = user99 userRole = priv-user [DEBUG "routing.hpp":1123] IsUserPrivileged: group=ipmi [DEBUG "routing.hpp":1123] IsUserPrivileged: group=redfish [DEBUG "routing.hpp":1123] IsUserPrivileged: group=ssh [DEBUG "routing.hpp":1123] IsUserPrivileged: group=web [DEBUG "routing.hpp":93] checkPrivileges: BASE USER: Login [DEBUG "routing.hpp":93] checkPrivileges: BASE USER: ConfigureSelf [DEBUG "routing.hpp":113] checkPrivileges: OEM REQUIRED: OpenBMCHostConsole [ERROR "routing.hpp":1192] Insufficient Privilege + curl -k https://${bmc}/redfish/v1/AccountService/Accounts/user99 { "@odata.id": "/redfish/v1/AccountService/Accounts/user99", "@odata.type": "#ManagerAccount.v1_4_0.ManagerAccount", "AccountTypes": [ "IPMI", "Redfish", "WebUI", "ManagerConsole" ], "Description": "User Account", "Enabled": true, "Id": "user99", "Links": { "Role": { "@odata.id": "/redfish/v1/AccountService/Roles/Operator" } }, "Locked": false, "Locked@Redfish.AllowableValues": [ "false" ], "Name": "User Account", "Password": null, "PasswordChangeRequired": false, "RoleId": "Operator", "UserName": "user99" [INFO "http_connection.hpp":209] Request: 0x21c7c38 HTTP/1.1 GET /console0 ::ffff:x.x.xx.xxx [DEBUG "routing.hpp":1265] Matched rule (upgrade) '/console0' 1 / 2 [DEBUG "routing.hpp":1084] userName = user99 userRole = priv-operator [DEBUG "routing.hpp":1123] IsUserPrivileged: group=ipmi [DEBUG "routing.hpp":1123] IsUserPrivileged: group=redfish [DEBUG "routing.hpp":1123] IsUserPrivileged: group=ssh [DEBUG "routing.hpp":1123] IsUserPrivileged: group=web [DEBUG "routing.hpp":93] checkPrivileges: BASE USER: Login [DEBUG "routing.hpp":93] checkPrivileges: BASE USER: ConfigureComponents [DEBUG "routing.hpp":93] checkPrivileges: BASE USER: ConfigureSelf [DEBUG "routing.hpp":113] checkPrivileges: OEM REQUIRED: OpenBMCHostConsole [ERROR "routing.hpp":1192] Insufficient Privilege Related commits: NOTE: docs, openbmc, obmc-console changes are already merged. bmcweb and phosphor-user-manager will be merged together. docs: https://gerrit.openbmc.org/c/openbmc/docs/+/60968 phosphor-user-manager: https://gerrit.openbmc.org/c/openbmc/phosphor-user-manager/+/61583 openbmc: https://gerrit.openbmc.org/c/openbmc/openbmc/+/61582 obmc-console: https://gerrit.openbmc.org/c/openbmc/obmc-console/+/61581 bmcweb: https://gerrit.openbmc.org/c/openbmc/bmcweb/+/61580 Change-Id: Ia5a33dafc9a76444e6a8e74e752f0f90cb0a31c8 Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>