Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Update the PNOR code on a target BMC. |
| 3 | ... Execution Method: |
| 4 | ... python -m robot -v OPENBMC_HOST:<hostname> |
| 5 | ... -v DELETE_OLD_PNOR_IMAGES:<"true" or "false"> |
Charles Paul Hofer | a567316 | 2017-08-30 09:49:16 -0500 | [diff] [blame] | 6 | ... -v IMAGE_FILE_PATH:<path/*.tar> |
| 7 | ... -v ALTERNATE_IMAGE_FILE_PATH:<path/*.tar> |
| 8 | ... host_code_update.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 9 | ... |
| 10 | ... Code update method BMC |
| 11 | ... Update work flow sequence: |
| 12 | ... - Upload image via REST |
| 13 | ... - Verify that the file exists on the BMC |
| 14 | ... - Check that software "Activation" is set to "Ready" |
| 15 | ... - Set "Requested Activation" to "Active" |
| 16 | ... - Wait for code update to complete |
| 17 | ... - Verify the new version |
| 18 | |
| 19 | Library ../../lib/bmc_ssh_utils.py |
| 20 | Library ../../lib/code_update_utils.py |
| 21 | Variables ../../data/variables.py |
| 22 | Resource ../../lib/boot_utils.robot |
| 23 | Resource code_update_utils.robot |
| 24 | Resource ../../lib/code_update_utils.robot |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 25 | Resource ../../lib/openbmc_ffdc.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 26 | Resource ../../lib/state_manager.robot |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 27 | Resource ../../lib/dump_utils.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 28 | |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 29 | Test Teardown Code Update Test Teardown |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 30 | |
George Keishing | 09712a1 | 2017-10-16 12:52:42 -0500 | [diff] [blame] | 31 | Force Tags Host_Code_Update |
| 32 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 33 | *** Variables *** |
| 34 | |
| 35 | ${QUIET} ${1} |
| 36 | ${IMAGE_FILE_PATH} ${EMPTY} |
| 37 | ${DELETE_OLD_PNOR_IMAGES} false |
Charles Paul Hofer | 51b54c0 | 2017-09-13 22:13:49 -0500 | [diff] [blame] | 38 | ${DELETE_OLD_GUARD_FILE} false |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 39 | ${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 40 | |
| 41 | *** Test Cases *** |
| 42 | |
| 43 | REST Host Code Update |
| 44 | [Documentation] Do a PNOR code update by uploading image on BMC via REST. |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 45 | # 1. Delete error logs if there is any. |
| 46 | # 1. Do code update. |
| 47 | # 2. Do post update the following: |
| 48 | # - Collect FFDC if error log exist and delete error logs. |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 49 | [Tags] REST_Host_Code_Update |
| 50 | [Setup] Code Update Setup |
| 51 | |
Sweta Potthuri | 8c7ada4 | 2018-01-15 05:05:59 -0600 | [diff] [blame] | 52 | Run Keyword And Ignore Error List Installed Images Host |
| 53 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 54 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 55 | OBMC Reboot (off) |
| 56 | |
| 57 | |
| 58 | Post Update Boot To OS |
| 59 | [Documentation] Boot the host OS |
| 60 | [Tags] Post_Update_Boot_To_OS |
Charles Paul Hofer | 0c4a87d | 2017-10-11 17:27:40 -0500 | [diff] [blame] | 61 | [Setup] Start SOL Console Logging |
George Keishing | da6bace | 2017-09-14 07:42:27 -0500 | [diff] [blame] | 62 | [Teardown] Run Keywords Stop SOL Console Logging |
| 63 | ... AND Code Update Test Teardown |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 64 | |
| 65 | Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL' |
| 66 | ... Fail Code update failed. No need to boot to OS. |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 67 | Delete Error Logs |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 68 | REST Power On |
Charles Paul Hofer | e43fb2f | 2017-09-26 15:36:18 -0500 | [diff] [blame] | 69 | Verify Running Host Image ${IMAGE_FILE_PATH} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 70 | |
| 71 | |
Charles Paul Hofer | 7c6e752 | 2017-10-18 17:09:27 -0500 | [diff] [blame] | 72 | REST Host Code Update While OS Is Running |
| 73 | [Documentation] Do a PNOR code update while the host is running. |
| 74 | [Tags] REST_Host_Code_Update_While_OS_Is_Running |
Charles Paul Hofer | 4e8c09b | 2017-11-03 14:59:05 -0500 | [diff] [blame] | 75 | [Teardown] Run Keywords REST Power Off stack_mode=skip |
| 76 | ... AND Code Update Test Teardown |
Charles Paul Hofer | 7c6e752 | 2017-10-18 17:09:27 -0500 | [diff] [blame] | 77 | |
| 78 | Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL' |
| 79 | ... Fail Cannot boot the OS. |
| 80 | |
| 81 | REST Power On stack_mode=skip |
George Keishing | 72373f8 | 2017-11-20 09:18:41 -0600 | [diff] [blame] | 82 | Upload And Activate Image |
| 83 | ... ${ALTERNATE_IMAGE_FILE_PATH} skip_if_active=true |
Charles Paul Hofer | 7c6e752 | 2017-10-18 17:09:27 -0500 | [diff] [blame] | 84 | REST Power On stack_mode=normal |
| 85 | Verify Running Host Image ${ALTERNATE_IMAGE_FILE_PATH} |
| 86 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 87 | Host Image Priority Attribute Test |
| 88 | [Documentation] Set "Priority" attribute. |
| 89 | [Tags] Host_Image_Priority_Attribute_Test |
| 90 | [Template] Temporarily Set PNOR Attribute |
| 91 | |
| 92 | # Property Value |
| 93 | Priority ${0} |
| 94 | Priority ${1} |
| 95 | Priority ${127} |
George Keishing | 97ecb27 | 2017-09-12 04:30:20 -0500 | [diff] [blame] | 96 | Priority ${255} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 97 | |
| 98 | |
Charles Paul Hofer | 42f1746 | 2017-09-12 14:09:32 -0500 | [diff] [blame] | 99 | Host Set Priority To Invalid Values |
| 100 | [Documentation] Attempt to set the priority of an image to an invalid |
| 101 | ... value and expect an error. |
| 102 | [Tags] Host_Set_Priority_To_Invalid_Values |
| 103 | [Template] Set Priority To Invalid Value And Expect Error |
| 104 | |
| 105 | # Version Type Priority |
| 106 | ${VERSION_PURPOSE_HOST} ${-1} |
| 107 | ${VERSION_PURPOSE_HOST} ${256} |
| 108 | |
| 109 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 110 | Set RequestedActivation To None |
| 111 | [Documentation] Set the RequestedActivation of the image to None and |
| 112 | ... verify that it is in fact set to None. |
| 113 | [Tags] Set_RequestedActivation_To_None |
| 114 | |
| 115 | ${software_objects}= Get Software Objects |
| 116 | Set Host Software Property @{software_objects}[0] RequestedActivation |
| 117 | ... ${REQUESTED_NONE} |
| 118 | ${software_properties}= Get Host Software Property @{software_objects}[0] |
| 119 | Should Be Equal As Strings &{software_properties}[RequestedActivation] |
| 120 | ... ${REQUESTED_NONE} |
| 121 | |
| 122 | |
| 123 | Set RequestedActivation And Activation To Invalid Value |
| 124 | [Documentation] Set the RequestedActivation and Activation propreties of |
| 125 | ... the image to an invalid value and verify that it was not |
| 126 | ... changed. |
| 127 | [Template] Set Property To Invalid Value And Verify No Change |
| 128 | [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value |
| 129 | |
| 130 | # Property Version Type |
| 131 | RequestedActivation ${VERSION_PURPOSE_HOST} |
| 132 | Activation ${VERSION_PURPOSE_HOST} |
| 133 | |
| 134 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 135 | Upload And Activate Multiple Host Images |
| 136 | [Documentation] Upload another PNOR image and verify that its state is |
| 137 | ... different from all others. |
| 138 | [Tags] Upload_And_Activate_Multiple_Host_Images |
| 139 | [Template] Activate Image And Verify No Duplicate Priorities |
| 140 | [Setup] Upload And Activate Multiple BMC Images Setup |
| 141 | |
| 142 | # Image File Path Image Purpose |
| 143 | ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST} |
| 144 | |
| 145 | |
Charles Paul Hofer | a567316 | 2017-08-30 09:49:16 -0500 | [diff] [blame] | 146 | Set Same Priority For Multiple Host Images |
| 147 | [Documentation] Attempt to set the priority to be the same for two PNOR |
| 148 | ... images and verify that the priorities are not the same. |
| 149 | [Tags] Set_Same_Priority_For_Multiple_Host_Images |
| 150 | |
| 151 | Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL' |
| 152 | ... Fail Activation of alternate image failed. Cannot set priority. |
| 153 | Set Same Priority For Multiple Images ${VERSION_PURPOSE_HOST} |
| 154 | |
| 155 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 156 | Delete Host Image |
| 157 | [Documentation] Delete a PNOR image from the BMC and PNOR flash chip. |
| 158 | [Tags] Delete_Host_Image |
| 159 | [Setup] Initiate Host PowerOff |
| 160 | |
| 161 | ${software_objects}= Get Software Objects |
| 162 | ... version_type=${VERSION_PURPOSE_HOST} |
| 163 | ${num_images}= Get Length ${software_objects} |
| 164 | Should Be True 0 < ${num_images} |
| 165 | ... msg=There are no PNOR images on the BMC to delete. |
| 166 | Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST} |
| 167 | |
| 168 | |
| 169 | *** Keywords *** |
| 170 | |
| 171 | Temporarily Set PNOR Attribute |
| 172 | [Documentation] Update the PNOR attribute value. |
| 173 | [Arguments] ${attribute_name} ${attribute_value} |
| 174 | |
| 175 | # Description of argument(s): |
| 176 | # attribute_name Host software attribute name (e.g. "Priority"). |
| 177 | # attribute_value Value to be written. |
| 178 | |
| 179 | ${image_ids}= Get Software Objects |
| 180 | ${init_host_properties}= Get Host Software Property ${image_ids[0]} |
| 181 | ${initial_priority}= Set Variable ${init_host_properties["Priority"]} |
| 182 | |
| 183 | Set Host Software Property ${image_ids[0]} ${attribute_name} |
| 184 | ... ${attribute_value} |
| 185 | |
| 186 | ${cur_host_properties}= Get Host Software Property ${image_ids[0]} |
| 187 | Should Be Equal As Integers ${cur_host_properties["Priority"]} |
| 188 | ... ${attribute_value} |
| 189 | |
| 190 | # Revert to to initial value. |
| 191 | Set Host Software Property |
| 192 | ... ${image_ids[0]} ${attribute_name} ${initial_priority} |
| 193 | |
| 194 | |
| 195 | Code Update Setup |
| 196 | [Documentation] Do code update test case setup. |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 197 | # - Clean up all existing BMC dumps. |
| 198 | # - Clean up all currently install PNOR images. |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 199 | |
Charles Paul Hofer | b926408 | 2017-09-29 15:00:19 -0500 | [diff] [blame] | 200 | Run Keyword And Ignore Error Smart Power Off |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 201 | Delete All Dumps |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 202 | Delete Error Logs |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 203 | Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}' |
| 204 | ... Delete All PNOR Images |
Charles Paul Hofer | 51b54c0 | 2017-09-13 22:13:49 -0500 | [diff] [blame] | 205 | Run Keyword If 'true' == '${DELETE_OLD_GUARD_FILE}' BMC Execute Command |
| 206 | ... rm -f /var/lib/phosphor-software-manager/pnor/prsv/GUARD |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 207 | |
| 208 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 209 | Upload And Activate Multiple BMC Images Setup |
| 210 | [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. |
| 211 | |
| 212 | Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} |
Charles Paul Hofer | 4e8c09b | 2017-11-03 14:59:05 -0500 | [diff] [blame] | 213 | Delete All PNOR Images |
George Keishing | 72373f8 | 2017-11-20 09:18:41 -0600 | [diff] [blame] | 214 | Upload And Activate Image ${IMAGE_FILE_PATH} skip_if_active=true |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 215 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 216 | Get PNOR Extended Version |
| 217 | [Documentation] Return the PNOR extended version. |
| 218 | [Arguments] ${manifest_path} |
| 219 | |
| 220 | # Description of argument(s): |
| 221 | # manifest_path Path of the MANIFEST file |
| 222 | # (e.g. "/tmp/images/abc123/MANIFEST"). |
| 223 | |
| 224 | ${version}= BMC Execute Command |
| 225 | ... grep extended_version= ${manifest_path} |
| 226 | [return] ${version.split(",")} |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 227 | |
| 228 | |
| 229 | Code Update Test Teardown |
| 230 | [Documentation] Do code update test case teardown. |
| 231 | # 1. Collect FFDC if test case failed. |
| 232 | # 2. Collect FFDC if test PASS but error log exists. |
| 233 | |
| 234 | FFDC On Test Case Fail |
| 235 | Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC |