Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Update firmware on a target BMC via Redifsh. |
| 3 | |
| 4 | # Test Parameters: |
| 5 | # IMAGE_FILE_PATH The path to the BMC image file. |
| 6 | # |
| 7 | # Firmware update states: |
| 8 | # Enabled Image is installed and either functional or active. |
| 9 | # Disabled Image installation failed or ready for activation. |
| 10 | # Updating Image installation currently in progress. |
| 11 | |
| 12 | Resource ../../lib/resource.robot |
| 13 | Resource ../../lib/bmc_redfish_resource.robot |
| 14 | Resource ../../lib/openbmc_ffdc.robot |
| 15 | Resource ../../lib/common_utils.robot |
| 16 | Resource ../../lib/code_update_utils.robot |
| 17 | Resource ../../lib/dump_utils.robot |
| 18 | Resource ../../lib/logging_utils.robot |
| 19 | Resource ../../lib/redfish_code_update_utils.robot |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 20 | Resource ../../lib/utils.robot |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 21 | Resource ../../lib/bmc_redfish_utils.robot |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 22 | Resource ../../lib/external_intf/management_console_utils.robot |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 23 | Library ../../lib/gen_robot_valid.py |
| 24 | Library ../../lib/tftp_update_utils.py |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 25 | Library ../../lib/gen_robot_keyword.py |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 26 | |
| 27 | Suite Setup Suite Setup Execution |
| 28 | Suite Teardown Redfish.Logout |
| 29 | Test Setup Printn |
| 30 | Test Teardown FFDC On Test Case Fail |
| 31 | |
| 32 | Force Tags BMC_Code_Update |
| 33 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 34 | *** Variables *** |
| 35 | |
| 36 | @{ADMIN} admin_user TestPwd123 |
| 37 | &{USERS} Administrator=${ADMIN} |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 38 | ${LOOP_COUNT} ${2} |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 39 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 40 | *** Test Cases *** |
| 41 | |
| 42 | Redfish Code Update With ApplyTime OnReset |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 43 | [Documentation] Update the firmware image with ApplyTime of OnReset. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 44 | [Tags] Redfish_Code_Update_With_ApplyTime_OnReset |
| 45 | [Template] Redfish Update Firmware |
| 46 | |
| 47 | # policy |
| 48 | OnReset |
| 49 | |
| 50 | |
| 51 | Redfish Code Update With ApplyTime Immediate |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 52 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 53 | [Tags] Redfish_Code_Update_With_ApplyTime_Immediate |
| 54 | [Template] Redfish Update Firmware |
| 55 | |
| 56 | # policy |
| 57 | Immediate |
| 58 | |
| 59 | |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 60 | Redfish Code Update Same Firmware Multiple Times |
| 61 | [Documentation] Multiple times update the firmware image for update service. |
| 62 | [Tags] Redfish_Code_Update_Same_Firmware_Multiple_Times |
| 63 | |
| 64 | ${temp_update_loop_count}= Evaluate ${LOOP_COUNT} + 1 |
| 65 | |
| 66 | FOR ${count} IN RANGE 1 ${temp_update_loop_count} |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 67 | Print Timen *************************************** |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 68 | Print Timen * The Current Loop Count is ${count} of ${LOOP_COUNT} * |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 69 | Print Timen *************************************** |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 70 | |
| 71 | Redfish Update Firmware apply_time=OnReset |
| 72 | END |
| 73 | |
| 74 | |
| 75 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 76 | Redfish Code Update With Multiple Firmware |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 77 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 78 | [Tags] Redfish_Code_Update_With_Multiple_Firmware |
| 79 | [Template] Redfish Multiple Upload Image And Check Progress State |
| 80 | |
| 81 | # policy image_file_path alternate_image_file_path |
| 82 | Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 83 | |
| 84 | |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 85 | Post BMC Reset Perform Redfish Code Update |
| 86 | [Documentation] Test to reset BMC at standby and then perform BMC firmware update and |
| 87 | ... ensure there is not error or dump logs post update. |
| 88 | [Tags] Post_BMC_Reset_Perform_Redfish_Code_Update |
| 89 | |
| 90 | Redfish Delete All BMC Dumps |
| 91 | Redfish Purge Event Log |
| 92 | |
| 93 | Redfish OBMC Reboot (off) |
| 94 | |
| 95 | Redfish Update Firmware apply_time=OnReset |
| 96 | |
| 97 | Event Log Should Not Exist |
| 98 | Redfish BMC Dump Should Not Exist |
| 99 | |
| 100 | Redfish Power Off |
| 101 | |
| 102 | |
| 103 | Post BMC Reset Perform Image Switched To Backup Multiple Times |
George Keishing | 0d930e9 | 2023-01-25 13:19:37 -0600 | [diff] [blame] | 104 | [Documentation] Test to reset BMC at standby and then perform switch |
| 105 | ... to backup image multiple times. |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 106 | ... Then ensure no event and dump logs exist. |
| 107 | [Tags] Post_BMC_Reset_Perform_Image_Switched_To_Backup_Multiple_Times |
| 108 | |
| 109 | Redfish Delete All BMC Dumps |
| 110 | Redfish Purge Event Log |
| 111 | |
| 112 | Redfish OBMC Reboot (off) |
| 113 | |
| 114 | ${temp_update_loop_count}= Evaluate ${LOOP_COUNT} + 1 |
| 115 | |
| 116 | FOR ${count} IN RANGE 1 ${temp_update_loop_count} |
| 117 | ${state}= Get Pre Reboot State |
| 118 | |
| 119 | # change to backup image and reset the BMC. |
| 120 | Switch Backup Firmware Image To Functional |
| 121 | |
| 122 | Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 123 | END |
| 124 | |
| 125 | Event Log Should Not Exist |
| 126 | Redfish BMC Dump Should Not Exist |
| 127 | |
| 128 | |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 129 | Verify Code Update Fails When Kernel Panic Occur |
| 130 | [Documentation] Ensure firmware update is un-successful when kernel panic |
| 131 | ... occur during ongoing firmware update. |
| 132 | [Tags] Verify_Code_Update_Fails_When_Kernel_Panic_Occur |
| 133 | |
| 134 | ${before_update_activeswimage}= Redfish.Get Attribute /redfish/v1/Managers/bmc Links |
| 135 | Rprint Vars before_update_activeswimage |
| 136 | |
| 137 | Set ApplyTime policy=OnReset |
| 138 | |
| 139 | ${task_inv_dict}= Get Task State from File |
| 140 | |
| 141 | ${file_bin_data}= OperatingSystem.Get Binary File ${image_file_path} |
| 142 | |
| 143 | Log To Console Start uploading image to BMC. |
| 144 | Upload Image To BMC ${REDFISH_BASE_URI}UpdateService timeout=${600} data=${file_bin_data} |
| 145 | Log To Console Completed image upload to BMC. |
| 146 | |
| 147 | Sleep 5 |
| 148 | |
| 149 | ${task_inv}= Check Task With Match TargetUri /redfish/v1/UpdateService |
| 150 | Rprint Vars task_inv |
| 151 | |
| 152 | Run Keyword Kernel Panic BMC Reset Operation |
| 153 | |
| 154 | Is BMC Unpingable |
| 155 | |
| 156 | Wait Until Keyword Succeeds 10 min 10 sec Is BMC Standby |
| 157 | |
| 158 | Redfish.Login |
| 159 | |
| 160 | ${after_update_activeswimage}= Redfish.Get Attribute /redfish/v1/Managers/bmc Links |
| 161 | Rprint Vars after_update_activeswimage |
| 162 | |
| 163 | Should Be Equal As Strings |
| 164 | ... ${before_update_activeswimage['ActiveSoftwareImage']['@odata.id']} |
| 165 | ... ${after_update_activeswimage['ActiveSoftwareImage']['@odata.id']} |
| 166 | |
| 167 | Verify Get ApplyTime OnReset |
| 168 | |
| 169 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 170 | Verify If The Modified Admin Credential Is Valid Post Image Switched To Backup |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 171 | [Documentation] Verify updated admin credential remain same post switch to back up image. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 172 | [Tags] Verify_If_The_Modified_Admin_Credential_Is_Valid_Post_Image_Switched_To_Backup |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 173 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 174 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 175 | |
| 176 | ${post_code_update_actions}= Get Post Boot Action |
| 177 | ${state}= Get Pre Reboot State |
| 178 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 179 | |
| 180 | Redfish.Login |
| 181 | # change to backup image and reset the BMC. |
| 182 | Switch Backup Firmware Image To Functional |
| 183 | Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 184 | |
| 185 | # verify modified admin password on backup image. |
| 186 | Redfish.Login admin_user 0penBmc123 |
| 187 | Redfish.Logout |
| 188 | |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 189 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 190 | Verify If The Modified Admin Credential Is Valid Post Update |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 191 | [Documentation] Verify updated admin credential remain same post code update image. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 192 | [Tags] Verify_If_The_Modified_Admin_Credential_Is_Valid_Post_Update |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 193 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 194 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 195 | |
| 196 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 197 | |
| 198 | Redfish.Login |
| 199 | # Flash latest firmware using redfish. |
| 200 | Redfish Update Firmware OnReset |
| 201 | |
| 202 | # verify modified admin credentails on latest image. |
| 203 | Redfish.Login admin_user 0penBmc123 |
| 204 | Redfish.Logout |
| 205 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 206 | *** Keywords *** |
| 207 | |
| 208 | Suite Setup Execution |
| 209 | [Documentation] Do the suite setup. |
| 210 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 211 | Valid File Path IMAGE_FILE_PATH |
| 212 | Redfish.Login |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 213 | |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 214 | Redfish Delete All BMC Dumps |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 215 | Redfish Purge Event Log |
| 216 | |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 217 | Redfish Power Off stack_mode=skip |
| 218 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 219 | |
| 220 | Redfish Update Firmware |
| 221 | [Documentation] Update the BMC firmware via redfish interface. |
| 222 | [Arguments] ${apply_time} |
| 223 | |
| 224 | # Description of argument(s): |
| 225 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 226 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 227 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 228 | ${state}= Get Pre Reboot State |
| 229 | Rprint Vars state |
Sushil Singh | 6f86f17 | 2019-10-30 11:36:25 -0500 | [diff] [blame] | 230 | Set ApplyTime policy=${apply_Time} |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 231 | |
| 232 | ${task_inv_dict}= Get Task State from File |
| 233 | |
| 234 | ${file_bin_data}= OperatingSystem.Get Binary File ${image_file_path} |
| 235 | |
| 236 | Log To Console Start uploading image to BMC. |
| 237 | Upload Image To BMC ${REDFISH_BASE_URI}UpdateService timeout=${600} data=${file_bin_data} |
| 238 | Log To Console Completed image upload to BMC. |
| 239 | |
| 240 | ${task_inv}= Check Task With Match TargetUri /redfish/v1/UpdateService |
| 241 | |
| 242 | Rprint Vars task_inv |
| 243 | |
| 244 | Wait Until Keyword Succeeds 5 min 10 sec |
| 245 | ... Verify Task Progress State ${task_inv} ${task_inv_dict['TaskCompleted']} |
| 246 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 247 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 248 | Redfish.Login |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 249 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | 811ffae | 2019-10-23 05:16:22 -0500 | [diff] [blame] | 250 | Verify Get ApplyTime ${apply_time} |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 251 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 252 | |
| 253 | Redfish Multiple Upload Image And Check Progress State |
| 254 | [Documentation] Update multiple BMC firmware via redfish interface and check status. |
| 255 | [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 256 | |
| 257 | # Description of argument(s): |
| 258 | # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 259 | # IMAGE_FILE_PATH The path to BMC image file. |
| 260 | # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file. |
| 261 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 262 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 263 | Valid File Path ALTERNATE_IMAGE_FILE_PATH |
| 264 | ${state}= Get Pre Reboot State |
| 265 | Rprint Vars state |
| 266 | |
| 267 | Set ApplyTime policy=${apply_time} |
| 268 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH} |
| 269 | |
| 270 | ${first_image_id}= Get Latest Image ID |
| 271 | Rprint Vars first_image_id |
| 272 | Sleep 5s |
| 273 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH} |
| 274 | |
| 275 | ${second_image_id}= Get Latest Image ID |
| 276 | Rprint Vars second_image_id |
| 277 | |
| 278 | Check Image Update Progress State |
| 279 | ... match_state='Updating', 'Disabled' image_id=${second_image_id} |
| 280 | |
| 281 | Check Image Update Progress State |
| 282 | ... match_state='Updating' image_id=${first_image_id} |
| 283 | |
| 284 | Wait Until Keyword Succeeds 8 min 20 sec |
| 285 | ... Check Image Update Progress State |
| 286 | ... match_state='Enabled' image_id=${first_image_id} |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 287 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
| 288 | Redfish.Login |
| 289 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 290 | |
| 291 | |