summaryrefslogtreecommitdiff
path: root/redfish-core
AgeCommit message (Collapse)AuthorFilesLines
2023-06-16Move PCIe functions to common fileLakshmi Yadlapati3-99/+103
Move redfishPcieGenerationFromDbus, called from both pcie.hpp and pcie_slots.hpp, and busSlotTypeToRf functions, called from pcie_slots.hpp, to a common PCIe utility file. In the future commit, when integrating PCIeSlot with PCIeDevice, we will call the busSlotTypeToRf function from pcie.hpp, so having it in the common utility file will make it readily available. Tested: build successful, no additional testing needed. Change-Id: I6286bd5547ddafa6eac4f224ac56f6d790a44c7a Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-06-16Add ServiceLabel information for PowerSupplyGeorge Liu1-0/+26
This commit is to add Location/PartLocation/ServiceLabel information according to the Redfish PowerSupply schema. If the `xyz.openbmc_project.Inventory.Decorator.LocationCode` interface does not exist, the ServiceLabel information property is not displayed. ref: http://redfish.dmtf.org/schemas/v1/PowerSupply.v1_5_0.json Tested: Validator passes curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0 { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0", "@odata.type": "#PowerSupply.v1_5_0.PowerSupply", "FirmwareVersion": "383239323732", "Id": "powersupply0", "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.WZS00F6-E0" } }, "Manufacturer": "", "Model": "51E9", "Name": "powersupply0", "PartNumber": "03KP466", "SerialNumber": "YL10KY26E073", "SparePartNumber": "03FP378", "Status": { "Health": "OK" } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: Icd0c21719bb01f481a8cd4c56bdb1a9ee047b047
2023-06-15Fix regression in @odata failure pathsEd Tanous2-2/+17
5b224921d765a93c5f93a6012109a9a748ef7cd4 and a1e0871d2425b3f42d0e5893d548593e5ed576b Added code to handle links looked correct in review, but the deduplication of the HEAD methods now causes the return code of setUpRedfishRoute to be ignored. This means that query parameter or other header failures don't stop the request, which is bad. Tested: GET /redfish/v1 (ie ServiceRoot) returns the correct header. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iec01051221550747a7b99da5eb7713e18394d530
2023-06-15Add FirmwareVersion For PowerSupplyGeorge Liu1-0/+25
This commit is to add firmware version information according to the Redfish PowerSupply schema. If the `xyz.openbmc_project.Software.Version` interface does not exist, the firmware version information property is not displayed. ref: http://redfish.dmtf.org/schemas/v1/PowerSupply.v1_5_0.json Tested: Validator passes curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0 { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0", "@odata.type": "#PowerSupply.v1_5_0.PowerSupply", "FirmwareVersion": "383239323732", "Id": "powersupply0", "Manufacturer": "", "Model": "51E9", "Name": "powersupply0", "PartNumber": "03KP466", "SerialNumber": "YL10KY26E073", "SparePartNumber": "03FP378", "Status": { "Health": "OK" } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I3ced467faf49d08c46a8b9bb2aa722f35353c811
2023-06-14Add asset information for PowerSupplyGeorge Liu1-0/+69
This commit is to add asset information according to the Redfish PowerSupply schema. If the `xyz.openbmc_project.Inventory.Decorator.Asset` interface does not exist, the asset information property is not displayed. ref: http://redfish.dmtf.org/schemas/v1/PowerSupply.v1_5_0.json Tested: Validator passes curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0 { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0", "@odata.type": "#PowerSupply.v1_5_0.PowerSupply", "Id": "powersupply0", "Manufacturer": "", "Model": "51E9", "Name": "powersupply0", "PartNumber": "03KP466", "SerialNumber": "YL10KY26E073", "SparePartNumber": "03FP378", "Status": { "Health": "OK" } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I83f1a9375f83e3470089cb2b5207db9665cc69df
2023-06-13Make redfish::messages rely on typesafe structuresEd Tanous2-40/+66
The previous patches modified these fields one at a time, for the cases where we had code calling these in odd ways. This commit goes and effects the same change on the rest of the message handlers where it makes sense. Any input to a message function that mentions a "value" replaces the value with a nlohmann::json object, to make calling this code easier. The one exception is StringValueTooLong, which by definition, requires the input value to be a string, so that is left as string_view intentionally. Tested: Dead unused code. Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I00b9804b2aadf5584032be91a0ee53b9a94a7430
2023-06-13Make propertyValueIncorrect typesafeEd Tanous3-8/+9
Similar to the previous patches, make propertyValueIncorrect accept a nlohmann::json object as input. This removes the need for the dump() call, which oddly enough, in our one usage, was actually incorrect, and could cause bmcweb to throw an exception in parsing in theory. Tested: Only used in one error condition. Code compiles. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ie35d61101c2db88b16d42d71e66bceef540e8429
2023-06-13Make propertyValueFormatError more typesafeEd Tanous6-40/+23
Similar to other patches, make propertyValueFormatError accept a nlohmann::json object, which removes a lot of the unsafe dump code that we have littered about. Tested: No easy to replicate error. Code is identical to previous patchsets. Inspection and code compilation only. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ic9d0f196b6e198073189f744b738db7ffa2f1b74
2023-06-13Make propertyValueTypeError more typesafeEd Tanous6-46/+21
Similar to the prior patchset in this series, propertyValueTypeError can be moved to safer constructs. This ensures that we are minimizing how many places we are calling dump() from, and allows us to reduce the amount of code written for error handling. Tested: PATCH /redfish/v1/SessionService {"SessionTimeout": "foo"} Returns PropertyValueTypeError in the same behavior as prior to this patch. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Iddff4b787f35c49bf923663d61bba156687f358c
2023-06-13Make propertyValueNotInList typesafeEd Tanous7-22/+19
The error codes for this function accept a string_view, which has caused a number of cases of users of this function to call dump() to_string() and all manner of other conversions. Considering that dump() is something that's difficult to call correctly, and overly wordy, it would be ideal if the message code just handled that for us. Therefore, this commit changes the prototype to include a nlohmann::json object as an argument instead of string_view, then audits the codebase for all uses, and moves them to a more normalized usage, which allows the calling code to call "dump" for them. Tested: PATCH /redfish/v1/SessionService {"SessionTimeout": 1} Returns the PropertyValueNotInList error as it did before. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If62909072db1f067ad1f8aa590bb716c84181219
2023-06-13Move registry code out of event service managerEd Tanous2-25/+29
This code was added into the registries namespace, from event service manager. It is operating on registries, it belongs in the registry header. Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I89e830dde185178b1d2e52b18a1a0a2baa4e0fb3
2023-06-13Add Status information for Power SupplyGeorge Liu1-8/+83
This commit is to add PowerSupply State/Health status according to the Redfish PowerSupply schema. If the `xyz.openbmc_project.Inventory.Item` interface does not exist, the state status property is set to default "Present". If the `xyz.openbmc_project.State.Decorator.OperationalStatus` interface does not exist, the health status property is set to default "OK". ref: http://redfish.dmtf.org/schemas/v1/PowerSupply.v1_5_0.json Code that updates the OperationalStatus for all the inventory https://github.com/openbmc/openpower-vpd-parser/blob/ \ 3fb026386546cfd288ab4f86156c9aa0ffa145d6/ibm_vpd_app.cpp#L620 Tested: Validator passes curl -k -H "X-Auth-Token: $token" -X GET https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0 { "@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/ PowerSupplies/powersupply0", "@odata.type": "#PowerSupply.v1_5_0.PowerSupply", "Id": "powersupply0", "Name": "powersupply0", "Status": { "Health": "OK" "State": "Enabled" } } Signed-off-by: George Liu <liuxiwei@inspur.com> Change-Id: I121b665a4e605024644cc7c9392f88a71703481e Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
2023-06-13chassis: Pass ec by referenceWilly Tu1-1/+1
Remove passing ec by value for getProperty. Change-Id: I9070ca7035fead14faa236eb1b17937ffe13045b Signed-off-by: Willy Tu <wltu@google.com>
2023-06-13Add content type check in the update serviceNinad Palsule1-15/+31
The content type check is required in the update service. This may be a security issue. The correct content types to update service are multipart/form-data and application/octet-stream. The multipart content type was missing from the contentTypes array which is added in this drop. Added couple of test cases. Tested: 1) Make sure that update service content type application/octet-stream are working correctly. $ curl -k -H 'X-Auth-Token: THIbp1G0DiNVj3JrCZMf' -H 'Content-Type: \ application/octet-stream' -X POST \ -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update { "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" 2) Make sure that update service content type multipart/form-data are working correctly. $ curl -k -H 'X-Auth-Token: Vc7KBgM6z3uMs1G7uVqu' \ -H Content-Type:multipart/form-data \ -F 'UpdateParameters={"Targets":["/redfish/v1/Managers/bmc"], \ "@Redfish.OperationApplyTime":"Immediate"};type=application/json'\ -F 'UpdateFile=@obmc-phosphor-image-p10bmc.ext4.mmc.tar; \ type=application/octet-stream' \ https://${bmc}/redfish/v1/UpdateService/update { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The request completed successfully.", "MessageArgs": [], "MessageId": "Base.1.16.0.Success", "MessageSeverity": "OK", "Resolution": "None" } ], "@odata.id": "/redfish/v1/TaskService/Tasks/0", "@odata.type": "#Task.v1_4_3.Task", "Id": "0", "TaskState": "Running", "TaskStatus": "OK" 3) Make sure that command fails when content type is missing. $ curl -k -H 'X-Auth-Token: vH3B88sh323sfy0YG8eN' -H Content-Type: \ -X POST -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update Bad Request [INFO "http_connection.hpp":201] Request: 0x177f920 HTTP/1.1 POST \ /redfish/v1/UpdateService/update ::ffff:x.x.xx.xxx | [DEBUG "update_service.hpp":687] doPost: contentType= [DEBUG "update_service.hpp":692] Bad content type specified: 4) Make sure that command fails when wrong cotent type specified. $ curl -k -H 'X-Auth-Token: OQzODMaR0G29AjpD2YmT' -H 'Content-Type: \ application/octet-json' -X POST \ -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update Bad Request [INFO "http_connection.hpp":201] Request: 0x17a69d0 HTTP/1.1 POST \ /redfish/v1/UpdateService/update ::ffff:x.x.xx.xxx | [DEBUG "update_service.hpp":687] doPost: contentType=application/octet-json [DEBUG "update_service.hpp":720] Bad content type specified: application/octet-json 5) Make sure that command fails when header is not specified. $ curl -k -H 'X-Auth-Token: Z1AEXg075qGKi0xISu6o' -X POST \ -T ./obmc-phosphor-image-everest.ext4.mmc.tar \ https://${bmc}/redfish/v1/UpdateService/update Bad Request [INFO "http_connection.hpp":201] Request: 0x17a69d0 HTTP/1.1 \ POST /redfish/v1/UpdateService/update ::ffff:x.x.xx.xxx | [DEBUG "update_service.hpp":687] doPost: contentType= [DEBUG "update_service.hpp":692] Bad content type specified: Change-Id: I48b709b6219debfed9ff60dd46ab87652e5a1fe5 Signed-off-by: Ninad Palsule <ninad@linux.ibm.com>
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