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 | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 23 | Resource ../../lib/bmc_network_utils.robot |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 24 | Resource ../../lib/certificate_utils.robot |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 25 | Library ../../lib/gen_robot_valid.py |
| 26 | Library ../../lib/tftp_update_utils.py |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 27 | Library ../../lib/gen_robot_keyword.py |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 28 | |
| 29 | Suite Setup Suite Setup Execution |
| 30 | Suite Teardown Redfish.Logout |
| 31 | Test Setup Printn |
| 32 | Test Teardown FFDC On Test Case Fail |
| 33 | |
George Keishing | 9899a90 | 2023-09-07 20:57:53 +0530 | [diff] [blame] | 34 | Force Tags Redfish_Bmc_Code_Update |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 35 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 36 | *** Variables *** |
| 37 | |
Sushil Singh | 759f148 | 2023-02-28 01:29:52 -0600 | [diff] [blame] | 38 | @{ADMIN} admin_user TestPwd123 |
| 39 | &{USERS} Administrator=${ADMIN} |
| 40 | ${LOOP_COUNT} ${2} |
| 41 | @{HOSTNAME} bmc_system01 bmc_system02 bmc_system03 bmc_system04 bmc_system05 |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 42 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 43 | *** Test Cases *** |
| 44 | |
| 45 | Redfish Code Update With ApplyTime OnReset |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 46 | [Documentation] Update the firmware image with ApplyTime of OnReset. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 47 | [Tags] Redfish_Code_Update_With_ApplyTime_OnReset |
| 48 | [Template] Redfish Update Firmware |
| 49 | |
| 50 | # policy |
| 51 | OnReset |
| 52 | |
| 53 | |
| 54 | Redfish Code Update With ApplyTime Immediate |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 55 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 56 | [Tags] Redfish_Code_Update_With_ApplyTime_Immediate |
| 57 | [Template] Redfish Update Firmware |
| 58 | |
| 59 | # policy |
| 60 | Immediate |
| 61 | |
| 62 | |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 63 | Redfish Code Update Same Firmware Multiple Times |
| 64 | [Documentation] Multiple times update the firmware image for update service. |
| 65 | [Tags] Redfish_Code_Update_Same_Firmware_Multiple_Times |
| 66 | |
| 67 | ${temp_update_loop_count}= Evaluate ${LOOP_COUNT} + 1 |
| 68 | |
| 69 | FOR ${count} IN RANGE 1 ${temp_update_loop_count} |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 70 | Print Timen *************************************** |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 71 | Print Timen * The Current Loop Count is ${count} of ${LOOP_COUNT} * |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 72 | Print Timen *************************************** |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame] | 73 | |
| 74 | Redfish Update Firmware apply_time=OnReset |
| 75 | END |
| 76 | |
| 77 | |
| 78 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 79 | Redfish Code Update With Multiple Firmware |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 80 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 81 | [Tags] Redfish_Code_Update_With_Multiple_Firmware |
| 82 | [Template] Redfish Multiple Upload Image And Check Progress State |
| 83 | |
| 84 | # policy image_file_path alternate_image_file_path |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 85 | OnReset ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 86 | |
| 87 | |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 88 | Post BMC Reset Perform Redfish Code Update |
| 89 | [Documentation] Test to reset BMC at standby and then perform BMC firmware update and |
| 90 | ... ensure there is not error or dump logs post update. |
| 91 | [Tags] Post_BMC_Reset_Perform_Redfish_Code_Update |
| 92 | |
| 93 | Redfish Delete All BMC Dumps |
| 94 | Redfish Purge Event Log |
| 95 | |
| 96 | Redfish OBMC Reboot (off) |
| 97 | |
| 98 | Redfish Update Firmware apply_time=OnReset |
| 99 | |
| 100 | Event Log Should Not Exist |
| 101 | Redfish BMC Dump Should Not Exist |
| 102 | |
| 103 | Redfish Power Off |
| 104 | |
| 105 | |
| 106 | Post BMC Reset Perform Image Switched To Backup Multiple Times |
George Keishing | 0d930e9 | 2023-01-25 13:19:37 -0600 | [diff] [blame] | 107 | [Documentation] Test to reset BMC at standby and then perform switch |
| 108 | ... to backup image multiple times. |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 109 | ... Then ensure no event and dump logs exist. |
| 110 | [Tags] Post_BMC_Reset_Perform_Image_Switched_To_Backup_Multiple_Times |
| 111 | |
| 112 | Redfish Delete All BMC Dumps |
| 113 | Redfish Purge Event Log |
| 114 | |
| 115 | Redfish OBMC Reboot (off) |
| 116 | |
| 117 | ${temp_update_loop_count}= Evaluate ${LOOP_COUNT} + 1 |
| 118 | |
| 119 | FOR ${count} IN RANGE 1 ${temp_update_loop_count} |
| 120 | ${state}= Get Pre Reboot State |
| 121 | |
| 122 | # change to backup image and reset the BMC. |
| 123 | Switch Backup Firmware Image To Functional |
| 124 | |
| 125 | Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 126 | END |
| 127 | |
| 128 | Event Log Should Not Exist |
| 129 | Redfish BMC Dump Should Not Exist |
| 130 | |
| 131 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 132 | 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] | 133 | [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] | 134 | [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] | 135 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 136 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 137 | |
| 138 | ${post_code_update_actions}= Get Post Boot Action |
| 139 | ${state}= Get Pre Reboot State |
| 140 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 141 | |
| 142 | Redfish.Login |
| 143 | # change to backup image and reset the BMC. |
| 144 | Switch Backup Firmware Image To Functional |
| 145 | Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 146 | |
| 147 | # verify modified admin password on backup image. |
| 148 | Redfish.Login admin_user 0penBmc123 |
| 149 | Redfish.Logout |
| 150 | |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 151 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 152 | Verify If The Modified Admin Credential Is Valid Post Update |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 153 | [Documentation] Verify updated admin credential remain same post code update image. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 154 | [Tags] Verify_If_The_Modified_Admin_Credential_Is_Valid_Post_Update |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 155 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 156 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 157 | |
| 158 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 159 | |
| 160 | Redfish.Login |
| 161 | # Flash latest firmware using redfish. |
| 162 | Redfish Update Firmware OnReset |
| 163 | |
| 164 | # verify modified admin credentails on latest image. |
| 165 | Redfish.Login admin_user 0penBmc123 |
| 166 | Redfish.Logout |
| 167 | |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 168 | |
| 169 | Redfish Code Update With Different Interrupted Operation |
| 170 | [Documentation] Ensure firmware update is successful when different interrupted operation executed |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 171 | ... i.e. change the hostname, updating https certificate and firmware update fail |
| 172 | ... when kernel panic. |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 173 | [Tags] Redfish_Code_Update_With_Different_Interrupted_Operation |
| 174 | [Template] Verify Redfish Code Update With Different Interrupted Operation |
| 175 | |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 176 | # operation count |
| 177 | host_name 1 |
| 178 | kernel_panic 1 |
| 179 | https_certificate 1 |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 180 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 181 | *** Keywords *** |
| 182 | |
| 183 | Suite Setup Execution |
| 184 | [Documentation] Do the suite setup. |
| 185 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 186 | Valid File Path IMAGE_FILE_PATH |
| 187 | Redfish.Login |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 188 | |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 189 | Redfish Delete All BMC Dumps |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 190 | Redfish Purge Event Log |
| 191 | |
Sushil Singh | c8526a2 | 2022-12-21 10:26:19 -0600 | [diff] [blame] | 192 | Redfish Power Off stack_mode=skip |
| 193 | |
Sushil Singh | 759f148 | 2023-02-28 01:29:52 -0600 | [diff] [blame] | 194 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 195 | Get Redfish Update Service URI |
| 196 | [Documentation] Get Redfish firmware update URI. |
Sushil Singh | 759f148 | 2023-02-28 01:29:52 -0600 | [diff] [blame] | 197 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 198 | ${update_url}= Redfish.Get Attribute ${REDFISH_BASE_URI}UpdateService HttpPushUri |
Sushil Singh | 759f148 | 2023-02-28 01:29:52 -0600 | [diff] [blame] | 199 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 200 | Log To Console Firmware update URI: ${update_url} |
| 201 | |
| 202 | [Return] ${update_url} |
Sushil Singh | 759f148 | 2023-02-28 01:29:52 -0600 | [diff] [blame] | 203 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 204 | |
| 205 | Redfish Update Firmware |
| 206 | [Documentation] Update the BMC firmware via redfish interface. |
| 207 | [Arguments] ${apply_time} |
| 208 | |
| 209 | # Description of argument(s): |
| 210 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 211 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 212 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 213 | ${state}= Get Pre Reboot State |
| 214 | Rprint Vars state |
Sushil Singh | 6f86f17 | 2019-10-30 11:36:25 -0500 | [diff] [blame] | 215 | Set ApplyTime policy=${apply_Time} |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 216 | |
| 217 | ${task_inv_dict}= Get Task State from File |
| 218 | |
| 219 | ${file_bin_data}= OperatingSystem.Get Binary File ${image_file_path} |
| 220 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 221 | |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 222 | Log To Console Start uploading image to BMC. |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 223 | |
| 224 | # URI : /redfish/v1/UpdateService |
| 225 | # "HttpPushUri": "/redfish/v1/UpdateService/update", |
| 226 | |
| 227 | ${redfish_update_uri}= Get Redfish Update Service URI |
| 228 | |
| 229 | ${resp}= Upload Image To BMC ${redfish_update_uri} timeout=${600} data=${file_bin_data} |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 230 | |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 231 | Log To Console Completed image upload to BMC. |
| 232 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 233 | Sleep 5s |
| 234 | |
| 235 | ${task_inv}= Check Task With Match TargetUri ${redfish_update_uri} |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 236 | |
| 237 | Rprint Vars task_inv |
| 238 | |
| 239 | Wait Until Keyword Succeeds 5 min 10 sec |
| 240 | ... Verify Task Progress State ${task_inv} ${task_inv_dict['TaskCompleted']} |
| 241 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 242 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 243 | Redfish.Login |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 244 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | 811ffae | 2019-10-23 05:16:22 -0500 | [diff] [blame] | 245 | Verify Get ApplyTime ${apply_time} |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 246 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 247 | |
| 248 | Redfish Multiple Upload Image And Check Progress State |
| 249 | [Documentation] Update multiple BMC firmware via redfish interface and check status. |
| 250 | [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 251 | |
| 252 | # Description of argument(s): |
| 253 | # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 254 | # IMAGE_FILE_PATH The path to BMC image file. |
| 255 | # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file. |
| 256 | |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 257 | |
| 258 | ${task_inv_dict}= Get Task State from File |
| 259 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 260 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 261 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 262 | Valid File Path ALTERNATE_IMAGE_FILE_PATH |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 263 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 264 | ${state}= Get Pre Reboot State |
| 265 | Rprint Vars state |
| 266 | |
| 267 | Set ApplyTime policy=${apply_time} |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 268 | |
| 269 | # URI : /redfish/v1/UpdateService |
| 270 | # "HttpPushUri": "/redfish/v1/UpdateService/update", |
| 271 | |
| 272 | ${redfish_update_uri}= Get Redfish Update Service URI |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 273 | |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 274 | ${file_bin_data1}= OperatingSystem.Get Binary File ${IMAGE_FILE_PATH} |
| 275 | ${file_bin_data2}= OperatingSystem.Get Binary File ${ALTERNATE_IMAGE_FILE_PATH} |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 276 | |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 277 | Log To Console Uploading first image. |
| 278 | ${resp1}= Upload Image To BMC ${redfish_update_uri} timeout=${600} data=${file_bin_data1} |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 279 | |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 280 | Log To Console Uploading second image. |
| 281 | ${resp2}= Upload Image To BMC ${redfish_update_uri} timeout=${600} data=${file_bin_data2} |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 282 | |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 283 | ${task_info2}= evaluate json.loads('''${resp2.content}''') json |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 284 | |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 285 | Sleep 3s |
| 286 | |
| 287 | ${task_inv2}= Get Task Inventory ${task_info2} |
George Keishing | 365dd46 | 2023-10-12 18:56:00 +0530 | [diff] [blame^] | 288 | Log ${task_inv2} |
Sushil Singh | 6209865 | 2023-08-31 09:14:50 -0500 | [diff] [blame] | 289 | |
| 290 | Wait Until Keyword Succeeds 5 min 10 sec |
| 291 | ... Verify Task Progress State ${task_inv2} ${task_inv_dict['TaskException']} |
| 292 | |
| 293 | ${task_info1}= evaluate json.loads('''${resp1.content}''') json |
| 294 | Log ${task_info1} |
| 295 | |
| 296 | ${task_inv1}= Get Task Inventory ${task_info1} |
| 297 | Log ${task_inv1} |
| 298 | |
| 299 | Wait Until Keyword Succeeds 5 min 10 sec |
| 300 | ... Verify Task Progress State ${task_inv1} ${task_inv_dict['TaskCompleted']} |
| 301 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 302 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
| 303 | Redfish.Login |
| 304 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | a83bba0 | 2023-01-18 08:43:45 -0600 | [diff] [blame] | 305 | |
| 306 | |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 307 | Run Configure BMC Hostname In Loop |
| 308 | [Documentation] Update hostname in loop. |
| 309 | [Arguments] ${count} |
| 310 | |
| 311 | # Description of argument(s): |
| 312 | # count Loop count. |
| 313 | |
| 314 | FOR ${index} IN RANGE ${count} |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 315 | Configure Hostname hostname=${HOSTNAME}[${index}] status_code=[${HTTP_OK}] |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 316 | END |
| 317 | |
| 318 | |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 319 | Redfish Update Certificate Upload In Loop |
| 320 | [Documentation] Upload HTTPS server certificate via Redfish and verify using OpenSSL. |
| 321 | [Arguments] ${count} |
| 322 | |
| 323 | # Description of argument(s): |
| 324 | # count Loop count. |
| 325 | |
| 326 | FOR ${index} IN RANGE ${count} |
| 327 | ${resp}= Run Keyword And Return Status Redfish.Get ${REDFISH_HTTPS_CERTIFICATE_URI}/1 valid_status_codes=[${HTTP_OK}] |
| 328 | Should Be Equal As Strings ${resp} ${True} |
| 329 | |
| 330 | ${cert_file_path}= Generate Certificate File Via Openssl Valid Certificate Valid Privatekey |
| 331 | ${bytes}= OperatingSystem.Get Binary File ${cert_file_path} |
| 332 | ${file_data}= Decode Bytes To String ${bytes} UTF-8 |
| 333 | |
| 334 | ${certificate_dict}= Create Dictionary |
| 335 | ... @odata.id=${REDFISH_HTTPS_CERTIFICATE_URI}/1 |
| 336 | ${payload}= Create Dictionary CertificateString=${file_data} |
| 337 | ... CertificateType=PEM CertificateUri=${certificate_dict} |
| 338 | |
| 339 | ${resp}= Redfish.Post /redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate |
| 340 | ... body=${payload} |
| 341 | |
| 342 | Verify Certificate Visible Via OpenSSL ${cert_file_path} |
| 343 | END |
| 344 | |
| 345 | |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 346 | Run Operation On BMC |
| 347 | [Documentation] Run operation on BMC. |
| 348 | [Arguments] ${operation} ${count} |
| 349 | |
| 350 | # Description of argument(s): |
| 351 | # operation If host_name then change hostname. |
| 352 | # count Loop count. |
| 353 | |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 354 | Run Keyword If '${operation}' == 'host_name' |
| 355 | ... Run Configure BMC Hostname In Loop count=${count} |
| 356 | ... ELSE IF '${operation}' == 'kernel_panic' |
| 357 | ... Run Keywords Kernel Panic BMC Reset Operation AND |
| 358 | ... Is BMC Unpingable |
| 359 | ... ELSE IF '${operation}' == 'https_certificate' |
| 360 | ... Redfish Update Certificate Upload In Loop count=${count} |
| 361 | ... ELSE |
| 362 | ... Fail msg=Operation not handled. |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 363 | |
| 364 | |
| 365 | Get Active Firmware Image |
| 366 | [Documentation] Return get active firmware image. |
| 367 | |
ganesanb | 4d43028 | 2023-04-27 14:33:23 +0000 | [diff] [blame] | 368 | ${active_image}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} Links |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 369 | Rprint Vars active_image |
| 370 | |
| 371 | [Return] ${active_image} |
| 372 | |
| 373 | |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 374 | Get New Image ID |
| 375 | [Documentation] Return the ID of the most recently extracted image. |
| 376 | |
| 377 | ${image_id}= Get Image Id Updating |
| 378 | |
| 379 | [Return] ${image_id} |
| 380 | |
| 381 | |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 382 | Verify Redfish Code Update With Different Interrupted Operation |
George Keishing | 4611b81 | 2023-02-16 09:44:33 -0600 | [diff] [blame] | 383 | [Documentation] Verify code update is successful when other operation |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 384 | ... getting executed i.e. change the hostname, updating http certificate |
| 385 | ... and code update will fail for kernel panic. |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 386 | [Arguments] ${operation} ${count} |
| 387 | |
| 388 | # Description of argument(s): |
| 389 | # operation host_name to change Hostname, kernel_panic to perform kernel panic. |
| 390 | # count Number of times loop will get executed. |
| 391 | |
| 392 | ${before_update_activeswimage}= Get Active Firmware Image |
| 393 | |
| 394 | ${post_code_update_actions}= Get Post Boot Action |
| 395 | |
| 396 | Set ApplyTime policy=OnReset |
| 397 | |
| 398 | ${task_inv_dict}= Get Task State from File |
| 399 | |
| 400 | ${file_bin_data}= OperatingSystem.Get Binary File ${image_file_path} |
| 401 | |
| 402 | Log To Console Start uploading image to BMC. |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 403 | |
| 404 | # URI : /redfish/v1/UpdateService |
| 405 | # "HttpPushUri": "/redfish/v1/UpdateService/update", |
| 406 | |
| 407 | ${redfish_update_uri}= Get Redfish Update Service URI |
| 408 | Upload Image To BMC ${redfish_update_uri} timeout=${600} data=${file_bin_data} |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 409 | Log To Console Completed image upload to BMC. |
| 410 | |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 411 | Sleep 5 |
| 412 | |
| 413 | ${image_id}= Get New Image ID |
| 414 | Rprint Vars image_id |
| 415 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 416 | ${task_inv}= Check Task With Match TargetUri ${redfish_update_uri} |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 417 | Rprint Vars task_inv |
| 418 | |
Sushil Singh | 514a840 | 2023-08-30 06:20:41 -0500 | [diff] [blame] | 419 | Wait Until Keyword Succeeds 2 min 10 sec |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 420 | ... Verify Task Progress State ${task_inv} ${task_inv_dict['TaskStarting']} |
| 421 | |
| 422 | Run Operation On BMC ${operation} ${count} |
| 423 | |
Sushil Singh | 1ee3c93 | 2023-02-24 01:58:09 -0600 | [diff] [blame] | 424 | IF '${operation}' == 'kernel_panic' |
| 425 | Wait Until Keyword Succeeds 10 min 10 sec Is BMC Standby |
| 426 | ELSE IF '${operation}' == 'host_name' |
| 427 | Wait Until Keyword Succeeds 5 min 10 sec |
| 428 | ... Verify Task Progress State ${task_inv} ${task_inv_dict['TaskCompleted']} |
| 429 | Run Key ${post_code_update_actions['BMC image']['OnReset']} |
| 430 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
| 431 | ELSE IF '${operation}' == 'https_certificate' |
| 432 | Check Image Update Progress State |
| 433 | ... match_state='Updating' image_id=${image_id} |
| 434 | Wait Until Keyword Succeeds 8 min 20 sec |
| 435 | ... Check Image Update Progress State |
| 436 | ... match_state='Enabled' image_id=${image_id} |
| 437 | Run Key ${post_code_update_actions['BMC image']['OnReset']} |
| 438 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
| 439 | ELSE |
| 440 | Fail msg=Operation not handled. |
| 441 | END |
Sushil Singh | 44bfc20 | 2023-02-08 09:53:36 -0600 | [diff] [blame] | 442 | |
| 443 | ${after_update_activeswimage}= Get Active Firmware Image |
| 444 | |
| 445 | ${status}= Run Keyword And Return Status Should Be Equal As Strings |
| 446 | ... ${before_update_activeswimage['ActiveSoftwareImage']['@odata.id']} |
| 447 | ... ${after_update_activeswimage['ActiveSoftwareImage']['@odata.id']} |
| 448 | |
| 449 | Run Keyword If '${operation}' == 'kernel_panic' |
| 450 | ... Should Be True ${status} |
| 451 | ... ELSE |
| 452 | ... Should Not Be True ${status} |
| 453 | |
| 454 | Verify Get ApplyTime OnReset |
| 455 | |