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 FirmwareInventory Is Updateable 147 [Documentation] Verify the redfish firmware inventory path is updateable. 148 [Tags] Verify_Redfish_FirmwareInventory_Is_Updateable 149 150 ${sw_member_list}= Redfish_Utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory 151 152 # sw_member_list: 153 # [0]: /redfish/v1/UpdateService/FirmwareInventory/98744d76 154 # [1]: /redfish/v1/UpdateService/FirmwareInventory/9a8028ec 155 # [2]: /redfish/v1/UpdateService/FirmwareInventory/acc9e073 156 157 FOR ${sw_member} IN @{sw_member_list} 158 ${resp}= Redfish.Get Attribute ${sw_member} Updateable 159 160 # Example: 161 # "Updateable": true, 162 163 Should Be Equal As Strings ${resp} True 164 165 END 166 167 168Verify Redfish Functional Version Is Same 169 [Documentation] Verify the redfish firmware inventory path version is same as redfish managers. 170 [Tags] Verify_Redfish_Functional_Version_Is_Same 171 172 # User defined state for software objects. 173 # Note: "Functional" term refers to firmware which system is currently booted with. 174 175 # sw_inv_dict: 176 # [b9101858]: 177 # [image_type]: BMC update 178 # [image_id]: b9101858 179 # [functional]: True 180 # [version]: 2.8.0-dev-150-g04508dc9f 181 182 ${sw_inv_dict}= Get Functional Firmware BMC image 183 ${sw_inv_dict}= Get Non Functional Firmware ${sw_inv_dict} True 184 185 # /redfish/v1/Managers/bmc 186 # "FirmwareVersion": "2.8.0-dev-150-g04508dc9f" 187 188 ${firmware_version}= Redfish.Get Attribute 189 ... ${REDFISH_BASE_URI}Managers/bmc FirmwareVersion 190 191 Should Be Equal ${sw_inv_dict['version']} ${firmware_version} 192 193 194Verify Redfish BIOS Version 195 [Documentation] Get host firmware version from system inventory. 196 [Tags] Verify_Redfish_BIOS_Version 197 198 ${bios_version}= Redfish.Get Attribute /redfish/v1/Systems/system/ BiosVersion 199 ${pnor_version}= Get PNOR Version 200 Should Be Equal ${pnor_version} ${bios_version} 201 202 203*** Keywords *** 204 205Test Setup Execution 206 [Documentation] Do test case setup tasks. 207 208 Redfish.Login 209 210 211Test Teardown Execution 212 [Documentation] Do the post test teardown. 213 214 FFDC On Test Case Fail 215 Redfish.Logout 216