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} |
| 37 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 38 | *** Test Cases *** |
| 39 | |
| 40 | Redfish Code Update With ApplyTime OnReset |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 41 | [Documentation] Update the firmware image with ApplyTime of OnReset. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 42 | [Tags] Redfish_Code_Update_With_ApplyTime_OnReset |
| 43 | [Template] Redfish Update Firmware |
| 44 | |
| 45 | # policy |
| 46 | OnReset |
| 47 | |
| 48 | |
| 49 | Redfish Code Update With ApplyTime Immediate |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 50 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 51 | [Tags] Redfish_Code_Update_With_ApplyTime_Immediate |
| 52 | [Template] Redfish Update Firmware |
| 53 | |
| 54 | # policy |
| 55 | Immediate |
| 56 | |
| 57 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 58 | Redfish Code Update With Multiple Firmware |
George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 59 | [Documentation] Update the firmware image with ApplyTime of Immediate. |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 60 | [Tags] Redfish_Code_Update_With_Multiple_Firmware |
| 61 | [Template] Redfish Multiple Upload Image And Check Progress State |
| 62 | |
| 63 | # policy image_file_path alternate_image_file_path |
| 64 | Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 65 | |
| 66 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 67 | 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] | 68 | [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] | 69 | [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] | 70 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 71 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 72 | |
| 73 | ${post_code_update_actions}= Get Post Boot Action |
| 74 | ${state}= Get Pre Reboot State |
| 75 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 76 | |
| 77 | Redfish.Login |
| 78 | # change to backup image and reset the BMC. |
| 79 | Switch Backup Firmware Image To Functional |
| 80 | Wait For Reboot start_boot_seconds=${state['epoch_seconds']} |
| 81 | |
| 82 | # verify modified admin password on backup image. |
| 83 | Redfish.Login admin_user 0penBmc123 |
| 84 | Redfish.Logout |
| 85 | |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 86 | |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 87 | Verify If The Modified Admin Credential Is Valid Post Update |
Sushil Singh | 5166ebd | 2021-05-31 01:24:16 -0500 | [diff] [blame] | 88 | [Documentation] Verify updated admin credential remain same post code update image. |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 89 | [Tags] Verify_If_The_Modified_Admin_Credential_Is_Valid_Post_Update |
Anves Kumar rayankula | 7ed1ae8 | 2021-02-03 04:19:46 -0600 | [diff] [blame] | 90 | [Setup] Create Users With Different Roles users=${USERS} force=${True} |
| 91 | [Teardown] Run Keywords Redfish.Login AND Delete BMC Users Via Redfish users=${USERS} |
| 92 | |
| 93 | Expire And Update New Password Via Redfish ${ADMIN[0]} ${ADMIN[1]} 0penBmc123 |
| 94 | |
| 95 | Redfish.Login |
| 96 | # Flash latest firmware using redfish. |
| 97 | Redfish Update Firmware OnReset |
| 98 | |
| 99 | # verify modified admin credentails on latest image. |
| 100 | Redfish.Login admin_user 0penBmc123 |
| 101 | Redfish.Logout |
| 102 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 103 | *** Keywords *** |
| 104 | |
| 105 | Suite Setup Execution |
| 106 | [Documentation] Do the suite setup. |
| 107 | |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 108 | Valid File Path IMAGE_FILE_PATH |
| 109 | Redfish.Login |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 110 | Redfish Delete All BMC Dumps |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 111 | Redfish Purge Event Log |
| 112 | |
| 113 | |
| 114 | Redfish Update Firmware |
| 115 | [Documentation] Update the BMC firmware via redfish interface. |
| 116 | [Arguments] ${apply_time} |
| 117 | |
| 118 | # Description of argument(s): |
| 119 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 120 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 121 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 122 | ${state}= Get Pre Reboot State |
| 123 | Rprint Vars state |
Sushil Singh | 6f86f17 | 2019-10-30 11:36:25 -0500 | [diff] [blame] | 124 | Set ApplyTime policy=${apply_Time} |
| 125 | Redfish Upload Image And Check Progress State |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 126 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
Sushil Singh | f7674a5 | 2019-11-19 00:36:15 -0600 | [diff] [blame] | 127 | Redfish.Login |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 128 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | 811ffae | 2019-10-23 05:16:22 -0500 | [diff] [blame] | 129 | Verify Get ApplyTime ${apply_time} |
Sushil Singh | cdebdd5 | 2019-08-14 15:29:24 -0500 | [diff] [blame] | 130 | |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 131 | |
| 132 | Redfish Multiple Upload Image And Check Progress State |
| 133 | [Documentation] Update multiple BMC firmware via redfish interface and check status. |
| 134 | [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} |
| 135 | |
| 136 | # Description of argument(s): |
| 137 | # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 138 | # IMAGE_FILE_PATH The path to BMC image file. |
| 139 | # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file. |
| 140 | |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 141 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | ffbfedf | 2019-10-17 15:58:25 -0500 | [diff] [blame] | 142 | Valid File Path ALTERNATE_IMAGE_FILE_PATH |
| 143 | ${state}= Get Pre Reboot State |
| 144 | Rprint Vars state |
| 145 | |
| 146 | Set ApplyTime policy=${apply_time} |
| 147 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH} |
| 148 | |
| 149 | ${first_image_id}= Get Latest Image ID |
| 150 | Rprint Vars first_image_id |
| 151 | Sleep 5s |
| 152 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH} |
| 153 | |
| 154 | ${second_image_id}= Get Latest Image ID |
| 155 | Rprint Vars second_image_id |
| 156 | |
| 157 | Check Image Update Progress State |
| 158 | ... match_state='Updating', 'Disabled' image_id=${second_image_id} |
| 159 | |
| 160 | Check Image Update Progress State |
| 161 | ... match_state='Updating' image_id=${first_image_id} |
| 162 | |
| 163 | Wait Until Keyword Succeeds 8 min 20 sec |
| 164 | ... Check Image Update Progress State |
| 165 | ... match_state='Enabled' image_id=${first_image_id} |
Sushil Singh | b13fc36 | 2020-02-06 03:40:56 -0600 | [diff] [blame] | 166 | Run Key ${post_code_update_actions['BMC image']['${apply_time}']} |
| 167 | Redfish.Login |
| 168 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |