1*** Settings *** 2Documentation Verify that Redfish software inventory can be collected. 3 4Resource ../../lib/resource.robot 5Resource ../../lib/bmc_redfish_resource.robot 6Resource ../../lib/openbmc_ffdc.robot 7Resource ../../lib/redfish_code_update_utils.robot 8Library ../../lib/gen_robot_valid.py 9 10Test Setup Test Setup Execution 11Test Teardown Test Teardown Execution 12 13*** Test Cases *** 14 15Verify Redfish Update Service Enabled 16 [Documentation] Verify "ServiceEnabled" is enabled. 17 [Tags] Verify_Update_Service_Enabled 18 19 # Example: 20 # "HttpPushUri": "/redfish/v1/UpdateService", 21 # "Id": "UpdateService", 22 # "Name": "Update Service", 23 # "ServiceEnabled": true 24 25 ${resp}= Redfish.Get /redfish/v1/UpdateService 26 Should Be Equal As Strings ${resp.dict["ServiceEnabled"]} ${True} 27 28 29Verify Redfish Software Inventory Collection 30 [Documentation] Verify software inventory collection member and object entries. 31 [Tags] Verify_Redfish_Software_Inventory_Collection 32 33 # Example: 34 # { 35 # "@odata.type": "#SoftwareInventoryCollection.SoftwareInventoryCollection", 36 # "Members": [ 37 # { 38 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a3522998" 39 # }, 40 # { 41 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/a7c79f71" 42 # }, 43 # { 44 # "@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/ace821ef" 45 # } 46 # ], 47 # "Members@odata.count": 3, 48 # "Name": "Software Inventory Collection" 49 # } 50 51 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory 52 53 Should Be True ${resp.dict["Members@odata.count"]} >= ${1} 54 Length Should Be ${resp.dict["Members"]} ${resp.dict["Members@odata.count"]} 55 56 57Redfish Software Inventory Status Check 58 [Documentation] Get firmware inventory entries and do health check status. 59 [Tags] Redfish_Software_Inventory_Status_Check 60 61 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory 62 63 # Entries "Members@odata.count": 3, 64 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'} 65 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'} 66 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'} 67 68 FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]} 69 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]} 70 # Example: 71 # "Status": { 72 # "Health": "OK", 73 # "HealthRollup": "OK", 74 # "State": "Enabled" 75 # }, 76 Should Be Equal As Strings ${resp_resource.dict["Status"]["Health"]} OK 77 Should Be Equal As Strings ${resp_resource.dict["Status"]["HealthRollup"]} OK 78 Should Be Equal As Strings ${resp_resource.dict["Status"]["State"]} Enabled 79 END 80 81 82Verify BMC Version Matches With FirmwareInventory 83 [Documentation] Verify BMC version from FirmwareInventory same as in manager. 84 [Tags] Verify_BMC_Version_Matches_With_FirmwareInventory 85 86 ${bmc_manager}= Redfish.Get /redfish/v1/Managers/bmc 87 ${manager_bmc_version}= Get BMC Version 88 # Check for manager version and cat /etc/os-release. 89 Should Be Equal As Strings 90 ... ${bmc_manager.dict["FirmwareVersion"]} ${manager_bmc_version.strip('"')} 91 92 ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory 93 94 # Entries "Members@odata.count": 3, 95 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a3522998'} 96 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/a7c79f71'} 97 # {'@odata.id': '/redfish/v1/UpdateService/FirmwareInventory/ace821ef'} 98 99 ${actual_count}= Evaluate ${resp.dict["Members@odata.count"]}-1 100 FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]} 101 ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]} 102 # 3rd comparison of BMC version and verify FirmwareInventory bmc version. 103 # Example: 104 # "Version": 2.7.0-dev-19-g9b44ea7 105 Exit For Loop If '${resp_resource.dict["Version"]}' == '${manager_bmc_version.strip('"')}' 106 Run Keyword If '${entry}' == '${actual_count}' Fail BMC version not there in Firmware Inventory 107 END 108 109Verify UpdateService Supports TransferProtocol TFTP 110 [Documentation] Verify update service supported values have TFTP protocol. 111 [Tags] Verify_UpdateService_Supports_TransferProtocol_TFTP 112 113 # Example: 114 # "Actions": { 115 # "#UpdateService.SimpleUpdate": { 116 # "TransferProtocol@Redfish.AllowableValues": [ 117 # "TFTP" 118 # ], 119 # "target": "/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate" 120 # } 121 # }, 122 123 ${allowable_values}= Redfish.Get Attribute /redfish/v1/UpdateService Actions 124 125 Valid Value 126 ... allowable_values["#UpdateService.SimpleUpdate"]["TransferProtocol@Redfish.AllowableValues"][0] 127 ... valid_values=['TFTP'] 128 Valid Value allowable_values["#UpdateService.SimpleUpdate"]["target"] 129 ... valid_values=['/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate'] 130 131 132Verify Redfish Software Hex ID 133 [Documentation] Verify BMC images have valid 8-digit hex IDs. 134 [Tags] Verify_Redfish_Software_Hex_ID 135 136 ${sw_inv_dict}= Get Software Inventory State 137 138 FOR ${id_key} IN @{sw_inv_dict} 139 ${sw_inv}= Get From Dictionary ${sw_inv_dict} ${id_key} 140 Should Be Equal As Strings ${id_key} ${sw_inv['image_id']} 141 Length Should Be ${sw_inv['image_id']} ${8} 142 Should Match Regexp ${sw_inv['image_id']} [0-9a-f]* 143 END 144 145 146Verify Redfish BIOS Version 147 [Documentation] Get host firmware version from system inventory. 148 [Tags] Verify_Redfish_BIOS_Version 149 150 ${bios_version}= Redfish.Get Attribute /redfish/v1/Systems/system/ BiosVersion 151 ${pnor_version}= Get PNOR Version 152 Should Be Equal ${pnor_version} ${bios_version} 153 154 155*** Keywords *** 156 157Test Setup Execution 158 [Documentation] Do test case setup tasks. 159 160 Redfish.Login 161 162 163Test Teardown Execution 164 [Documentation] Do the post test teardown. 165 166 FFDC On Test Case Fail 167 Redfish.Logout 168