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 | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 22 | Library ../../lib/gen_robot_valid.py |
| 23 | Library ../../lib/tftp_update_utils.py |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 24 | Library ../../lib/gen_robot_keyword.py |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 25 | |
| 26 | Suite Setup Suite Setup Execution |
| 27 | Suite Teardown Redfish.Logout |
| 28 | Test Setup Printn |
| 29 | Test Teardown FFDC On Test Case Fail |
| 30 | |
| 31 | Force Tags BMC_Code_Update |
| 32 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 33 | *** Variables *** |
| 34 | |
| 35 | @{ADMIN} admin_user TestPwd123 |
| 36 | &{USERS} Administrator=${ADMIN} |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame^] | 37 | ${LOOP_COUNT} ${2} |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 38 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 39 | *** Test Cases *** |
| 40 | |
| 41 | Redfish Code Update With ApplyTime OnReset |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 42 | [Documentation] Update the firmware image with ApplyTime of OnReset. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 43 | [Tags] Redfish_Code_Update_With_ApplyTime_OnReset |
| 44 | [Template] Redfish Update Firmware |
| 45 | |
| 46 | # policy |
| 47 | OnReset |
| 48 | |
| 49 | |
| 50 | Redfish Code Update With ApplyTime Immediate |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 51 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 52 | [Tags] Redfish_Code_Update_With_ApplyTime_Immediate |
| 53 | [Template] Redfish Update Firmware |
| 54 | |
| 55 | # policy |
| 56 | Immediate |
| 57 | |
| 58 | |
Sushil Singh | c915f5e | 2022-12-21 08:18:31 -0600 | [diff] [blame^] | 59 | Redfish Code Update Same Firmware Multiple Times |
| 60 | [Documentation] Multiple times update the firmware image for update service. |
| 61 | [Tags] Redfish_Code_Update_Same_Firmware_Multiple_Times |
| 62 | |
| 63 | ${temp_update_loop_count}= Evaluate ${LOOP_COUNT} + 1 |
| 64 | |
| 65 | FOR ${count} IN RANGE 1 ${temp_update_loop_count} |
| 66 | Print Timen ************************************** |
| 67 | Print Timen * The Current Loop Count is ${count} of ${LOOP_COUNT} * |
| 68 | Print Timen ************************************** |
| 69 | |
| 70 | Redfish Update Firmware apply_time=OnReset |
| 71 | END |
| 72 | |
| 73 | |
| 74 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 75 | Redfish Code Update With Multiple Firmware |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 76 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 77 | [Tags] Redfish_Code_Update_With_Multiple_Firmware |
| 78 | [Template] Redfish Multiple Upload Image And Check Progress State |
| 79 | |
| 80 | # policy image_file_path alternate_image_file_path |
| 81 | Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 82 | |
| 83 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 84 | 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] | 85 | [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] | 86 | [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] | 87 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 88 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 89 | |
| 90 | ${post_code_update_actions}= Get Post Boot Action |
| 91 | ${state}= Get Pre Reboot State |
| 92 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 93 | |
| 94 | Redfish.Login |
| 95 | # change to backup image and reset the BMC. |
| 96 | Switch Backup Firmware Image To Functional |
| 97 | Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 98 | |
| 99 | # verify modified admin password on backup image. |
| 100 | Redfish.Login admin_user 0penBmc123 |
| 101 | Redfish.Logout |
| 102 | |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 103 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 104 | Verify If The Modified Admin Credential Is Valid Post Update |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 105 | [Documentation] Verify updated admin credential remain same post code update image. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 106 | [Tags] Verify_If_The_Modified_Admin_Credential_Is_Valid_Post_Update |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 107 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 108 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 109 | |
| 110 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 111 | |
| 112 | Redfish.Login |
| 113 | # Flash latest firmware using redfish. |
| 114 | Redfish Update Firmware OnReset |
| 115 | |
| 116 | # verify modified admin credentails on latest image. |
| 117 | Redfish.Login admin_user 0penBmc123 |
| 118 | Redfish.Logout |
| 119 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 120 | *** Keywords *** |
| 121 | |
| 122 | Suite Setup Execution |
| 123 | [Documentation] Do the suite setup. |
| 124 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 125 | Valid File Path IMAGE_FILE_PATH |
| 126 | Redfish.Login |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 127 | Redfish Delete All BMC Dumps |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 128 | Redfish Purge Event Log |
| 129 | |
| 130 | |
| 131 | Redfish Update Firmware |
| 132 | [Documentation] Update the BMC firmware via redfish interface. |
| 133 | [Arguments] ${apply_time} |
| 134 | |
| 135 | # Description of argument(s): |
| 136 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 137 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 138 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 139 | ${state}= Get Pre Reboot State |
| 140 | Rprint Vars state |
Sushil Singh | 6f86f17 | 2019-10-30 11:36:25 -0500 | [diff] [blame] | 141 | Set ApplyTime policy=${apply_Time} |
Sushil Singh | 1560e65 | 2022-08-03 13:25:01 -0500 | [diff] [blame] | 142 | |
| 143 | ${task_inv_dict}= Get Task State from File |
| 144 | |
| 145 | ${file_bin_data}= OperatingSystem.Get Binary File ${image_file_path} |
| 146 | |
| 147 | Log To Console Start uploading image to BMC. |
| 148 | Upload Image To BMC ${REDFISH_BASE_URI}UpdateService timeout=${600} data=${file_bin_data} |
| 149 | Log To Console Completed image upload to BMC. |
| 150 | |
| 151 | ${task_inv}= Check Task With Match TargetUri /redfish/v1/UpdateService |
| 152 | |
| 153 | Rprint Vars task_inv |
| 154 | |
| 155 | Wait Until Keyword Succeeds 5 min 10 sec |
| 156 | ... Verify Task Progress State ${task_inv} ${task_inv_dict['TaskCompleted']} |
| 157 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 158 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 159 | Redfish.Login |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 160 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | 811ffae | 2019-10-23 05:16:22 -0500 | [diff] [blame] | 161 | Verify Get ApplyTime ${apply_time} |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 162 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 163 | |
| 164 | Redfish Multiple Upload Image And Check Progress State |
| 165 | [Documentation] Update multiple BMC firmware via redfish interface and check status. |
| 166 | [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 167 | |
| 168 | # Description of argument(s): |
| 169 | # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 170 | # IMAGE_FILE_PATH The path to BMC image file. |
| 171 | # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file. |
| 172 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 173 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 174 | Valid File Path ALTERNATE_IMAGE_FILE_PATH |
| 175 | ${state}= Get Pre Reboot State |
| 176 | Rprint Vars state |
| 177 | |
| 178 | Set ApplyTime policy=${apply_time} |
| 179 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH} |
| 180 | |
| 181 | ${first_image_id}= Get Latest Image ID |
| 182 | Rprint Vars first_image_id |
| 183 | Sleep 5s |
| 184 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH} |
| 185 | |
| 186 | ${second_image_id}= Get Latest Image ID |
| 187 | Rprint Vars second_image_id |
| 188 | |
| 189 | Check Image Update Progress State |
| 190 | ... match_state='Updating', 'Disabled' image_id=${second_image_id} |
| 191 | |
| 192 | Check Image Update Progress State |
| 193 | ... match_state='Updating' image_id=${first_image_id} |
| 194 | |
| 195 | Wait Until Keyword Succeeds 8 min 20 sec |
| 196 | ... Check Image Update Progress State |
| 197 | ... match_state='Enabled' image_id=${first_image_id} |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 198 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
| 199 | Redfish.Login |
| 200 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |