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