George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 1 | *** Settings *** |
Joy Onyerikwu | dbfe97d | 2019-03-11 19:44:56 -0500 | [diff] [blame] | 2 | Documentation Verify that Redfish software inventory can be collected. |
| 3 | |
George Keishing | 2db7bca | 2019-02-14 13:03:08 -0600 | [diff] [blame] | 4 | Resource ../../lib/resource.robot |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 5 | Resource ../../lib/bmc_redfish_resource.robot |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 6 | Resource ../../lib/openbmc_ffdc.robot |
Sushil Singh | 5bd5002 | 2021-06-03 07:11:59 -0500 | [diff] [blame] | 7 | Resource ../../lib/redfish_code_update_utils.robot |
George Keishing | 40f7664 | 2019-07-01 02:09:33 -0500 | [diff] [blame] | 8 | Library ../../lib/gen_robot_valid.py |
George Keishing | 3298d5c | 2019-02-12 06:59:25 -0600 | [diff] [blame] | 9 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 10 | Test Setup Test Setup Execution |
| 11 | Test Teardown Test Teardown Execution |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 12 | |
| 13 | *** Test Cases *** |
| 14 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 15 | Verify Redfish Update Service Enabled |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 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 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 25 | ${resp}= Redfish.Get /redfish/v1/UpdateService |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 26 | Should Be Equal As Strings ${resp.dict["ServiceEnabled"]} ${True} |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 27 | |
| 28 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 29 | Verify Redfish Software Inventory Collection |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 30 | [Documentation] Verify software inventory collection member and object entries. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 31 | [Tags] Verify_Redfish_Software_Inventory_Collection |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 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 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 51 | ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 52 | |
| 53 | Should Be True ${resp.dict["Members@odata.count"]} >= ${1} |
| 54 | Length Should Be ${resp.dict["Members"]} ${resp.dict["Members@odata.count"]} |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 55 | |
| 56 | |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 57 | Redfish Software Inventory Status Check |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 58 | [Documentation] Get firmware inventory entries and do health check status. |
George Keishing | 5ee33d9 | 2019-02-02 12:33:25 -0600 | [diff] [blame] | 59 | [Tags] Redfish_Software_Inventory_Status_Check |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 60 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 61 | ${resp}= Redfish.Get /redfish/v1/UpdateService/FirmwareInventory |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 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 | |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 68 | FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]} |
| 69 | ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]} |
George Keishing | c5fab99 | 2019-02-02 08:50:37 -0600 | [diff] [blame] | 70 | # Example: |
| 71 | # "Status": { |
| 72 | # "Health": "OK", |
| 73 | # "HealthRollup": "OK", |
| 74 | # "State": "Enabled" |
| 75 | # }, |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 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 |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 80 | |
| 81 | |
Sivas SRR | d099d36 | 2019-03-07 03:33:03 -0600 | [diff] [blame] | 82 | Verify 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 |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 100 | FOR ${entry} IN RANGE 0 ${resp.dict["Members@odata.count"]} |
| 101 | ${resp_resource}= Redfish.Get ${resp.dict["Members"][${entry}]["@odata.id"]} |
Sivas SRR | d099d36 | 2019-03-07 03:33:03 -0600 | [diff] [blame] | 102 | # 3rd comparison of BMC version and verify FirmwareInventory bmc version. |
| 103 | # Example: |
| 104 | # "Version": 2.7.0-dev-19-g9b44ea7 |
Sushil Singh | 5062114 | 2020-06-16 11:12:21 -0500 | [diff] [blame] | 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 |
Sivas SRR | d099d36 | 2019-03-07 03:33:03 -0600 | [diff] [blame] | 108 | |
George Keishing | 40f7664 | 2019-07-01 02:09:33 -0500 | [diff] [blame] | 109 | Verify 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 | |
George Keishing | e4d4142 | 2019-12-12 11:17:03 -0600 | [diff] [blame] | 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'] |
George Keishing | 40f7664 | 2019-07-01 02:09:33 -0500 | [diff] [blame] | 130 | |
| 131 | |
Sushil Singh | 5bd5002 | 2021-06-03 07:11:59 -0500 | [diff] [blame] | 132 | Verify 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 | |
George Keishing | 1b8865c | 2019-07-04 12:16:49 -0500 | [diff] [blame] | 146 | Verify 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 | |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 155 | *** Keywords *** |
| 156 | |
| 157 | Test Setup Execution |
| 158 | [Documentation] Do test case setup tasks. |
| 159 | |
| 160 | Redfish.Login |
| 161 | |
| 162 | |
| 163 | Test Teardown Execution |
| 164 | [Documentation] Do the post test teardown. |
| 165 | |
| 166 | FFDC On Test Case Fail |
| 167 | Redfish.Logout |