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"> |
| 6 | ... -v IMAGE_FILE_PATH:<path/*.tar> host_code_update.robot |
| 7 | ... |
| 8 | ... Code update method BMC |
| 9 | ... Update work flow sequence: |
| 10 | ... - Upload image via REST |
| 11 | ... - Verify that the file exists on the BMC |
| 12 | ... - Check that software "Activation" is set to "Ready" |
| 13 | ... - Set "Requested Activation" to "Active" |
| 14 | ... - Wait for code update to complete |
| 15 | ... - Verify the new version |
| 16 | |
| 17 | Library ../../lib/bmc_ssh_utils.py |
| 18 | Library ../../lib/code_update_utils.py |
| 19 | Variables ../../data/variables.py |
| 20 | Resource ../../lib/boot_utils.robot |
| 21 | Resource code_update_utils.robot |
| 22 | Resource ../../lib/code_update_utils.robot |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 23 | Resource ../../lib/openbmc_ffdc.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 24 | Resource ../../lib/state_manager.robot |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 25 | Resource ../../lib/dump_utils.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 26 | |
| 27 | Test Teardown FFDC On Test Case Fail |
| 28 | |
| 29 | *** Variables *** |
| 30 | |
| 31 | ${QUIET} ${1} |
| 32 | ${IMAGE_FILE_PATH} ${EMPTY} |
| 33 | ${DELETE_OLD_PNOR_IMAGES} false |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 34 | ${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 35 | |
| 36 | *** Test Cases *** |
| 37 | |
| 38 | REST Host Code Update |
| 39 | [Documentation] Do a PNOR code update by uploading image on BMC via REST. |
| 40 | [Tags] REST_Host_Code_Update |
| 41 | [Setup] Code Update Setup |
| 42 | |
| 43 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 44 | OBMC Reboot (off) |
| 45 | |
| 46 | |
| 47 | Post Update Boot To OS |
| 48 | [Documentation] Boot the host OS |
| 49 | [Tags] Post_Update_Boot_To_OS |
| 50 | [Teardown] Stop SOL Console Logging |
| 51 | |
| 52 | Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL' |
| 53 | ... Fail Code update failed. No need to boot to OS. |
| 54 | Start SOL Console Logging |
| 55 | REST Power On |
| 56 | |
| 57 | |
| 58 | Host Image Priority Attribute Test |
| 59 | [Documentation] Set "Priority" attribute. |
| 60 | [Tags] Host_Image_Priority_Attribute_Test |
| 61 | [Template] Temporarily Set PNOR Attribute |
| 62 | |
| 63 | # Property Value |
| 64 | Priority ${0} |
| 65 | Priority ${1} |
| 66 | Priority ${127} |
| 67 | |
| 68 | |
| 69 | Set RequestedActivation To None |
| 70 | [Documentation] Set the RequestedActivation of the image to None and |
| 71 | ... verify that it is in fact set to None. |
| 72 | [Tags] Set_RequestedActivation_To_None |
| 73 | |
| 74 | ${software_objects}= Get Software Objects |
| 75 | Set Host Software Property @{software_objects}[0] RequestedActivation |
| 76 | ... ${REQUESTED_NONE} |
| 77 | ${software_properties}= Get Host Software Property @{software_objects}[0] |
| 78 | Should Be Equal As Strings &{software_properties}[RequestedActivation] |
| 79 | ... ${REQUESTED_NONE} |
| 80 | |
| 81 | |
| 82 | Set RequestedActivation And Activation To Invalid Value |
| 83 | [Documentation] Set the RequestedActivation and Activation propreties of |
| 84 | ... the image to an invalid value and verify that it was not |
| 85 | ... changed. |
| 86 | [Template] Set Property To Invalid Value And Verify No Change |
| 87 | [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value |
| 88 | |
| 89 | # Property Version Type |
| 90 | RequestedActivation ${VERSION_PURPOSE_HOST} |
| 91 | Activation ${VERSION_PURPOSE_HOST} |
| 92 | |
| 93 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 94 | Upload And Activate Multiple Host Images |
| 95 | [Documentation] Upload another PNOR image and verify that its state is |
| 96 | ... different from all others. |
| 97 | [Tags] Upload_And_Activate_Multiple_Host_Images |
| 98 | [Template] Activate Image And Verify No Duplicate Priorities |
| 99 | [Setup] Upload And Activate Multiple BMC Images Setup |
| 100 | |
| 101 | # Image File Path Image Purpose |
| 102 | ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST} |
| 103 | |
| 104 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 105 | Delete Host Image |
| 106 | [Documentation] Delete a PNOR image from the BMC and PNOR flash chip. |
| 107 | [Tags] Delete_Host_Image |
| 108 | [Setup] Initiate Host PowerOff |
| 109 | |
| 110 | ${software_objects}= Get Software Objects |
| 111 | ... version_type=${VERSION_PURPOSE_HOST} |
| 112 | ${num_images}= Get Length ${software_objects} |
| 113 | Should Be True 0 < ${num_images} |
| 114 | ... msg=There are no PNOR images on the BMC to delete. |
| 115 | Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST} |
| 116 | |
| 117 | |
| 118 | *** Keywords *** |
| 119 | |
| 120 | Temporarily Set PNOR Attribute |
| 121 | [Documentation] Update the PNOR attribute value. |
| 122 | [Arguments] ${attribute_name} ${attribute_value} |
| 123 | |
| 124 | # Description of argument(s): |
| 125 | # attribute_name Host software attribute name (e.g. "Priority"). |
| 126 | # attribute_value Value to be written. |
| 127 | |
| 128 | ${image_ids}= Get Software Objects |
| 129 | ${init_host_properties}= Get Host Software Property ${image_ids[0]} |
| 130 | ${initial_priority}= Set Variable ${init_host_properties["Priority"]} |
| 131 | |
| 132 | Set Host Software Property ${image_ids[0]} ${attribute_name} |
| 133 | ... ${attribute_value} |
| 134 | |
| 135 | ${cur_host_properties}= Get Host Software Property ${image_ids[0]} |
| 136 | Should Be Equal As Integers ${cur_host_properties["Priority"]} |
| 137 | ... ${attribute_value} |
| 138 | |
| 139 | # Revert to to initial value. |
| 140 | Set Host Software Property |
| 141 | ... ${image_ids[0]} ${attribute_name} ${initial_priority} |
| 142 | |
| 143 | |
| 144 | Code Update Setup |
| 145 | [Documentation] Do code update test case setup. |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 146 | # - Clean up all existing BMC dumps. |
| 147 | # - Clean up all currently install PNOR images. |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 148 | |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 149 | Delete All Dumps |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 150 | Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}' |
| 151 | ... Delete All PNOR Images |
| 152 | |
| 153 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 154 | Upload And Activate Multiple BMC Images Setup |
| 155 | [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. |
| 156 | |
| 157 | Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} |
| 158 | |
| 159 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 160 | Get PNOR Extended Version |
| 161 | [Documentation] Return the PNOR extended version. |
| 162 | [Arguments] ${manifest_path} |
| 163 | |
| 164 | # Description of argument(s): |
| 165 | # manifest_path Path of the MANIFEST file |
| 166 | # (e.g. "/tmp/images/abc123/MANIFEST"). |
| 167 | |
| 168 | ${version}= BMC Execute Command |
| 169 | ... grep extended_version= ${manifest_path} |
| 170 | [return] ${version.split(",")} |