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