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 |
| 23 | Resource ../lib/openbmc_ffdc.robot |
| 24 | Resource ../../lib/state_manager.robot |
| 25 | |
| 26 | Test Teardown FFDC On Test Case Fail |
| 27 | |
| 28 | *** Variables *** |
| 29 | |
| 30 | ${QUIET} ${1} |
| 31 | ${IMAGE_FILE_PATH} ${EMPTY} |
| 32 | ${DELETE_OLD_PNOR_IMAGES} false |
| 33 | |
| 34 | *** Test Cases *** |
| 35 | |
| 36 | REST Host Code Update |
| 37 | [Documentation] Do a PNOR code update by uploading image on BMC via REST. |
| 38 | [Tags] REST_Host_Code_Update |
| 39 | [Setup] Code Update Setup |
| 40 | |
| 41 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 42 | OBMC Reboot (off) |
| 43 | |
| 44 | |
| 45 | Post Update Boot To OS |
| 46 | [Documentation] Boot the host OS |
| 47 | [Tags] Post_Update_Boot_To_OS |
| 48 | [Teardown] Stop SOL Console Logging |
| 49 | |
| 50 | Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL' |
| 51 | ... Fail Code update failed. No need to boot to OS. |
| 52 | Start SOL Console Logging |
| 53 | REST Power On |
| 54 | |
| 55 | |
| 56 | Host Image Priority Attribute Test |
| 57 | [Documentation] Set "Priority" attribute. |
| 58 | [Tags] Host_Image_Priority_Attribute_Test |
| 59 | [Template] Temporarily Set PNOR Attribute |
| 60 | |
| 61 | # Property Value |
| 62 | Priority ${0} |
| 63 | Priority ${1} |
| 64 | Priority ${127} |
| 65 | |
| 66 | |
| 67 | Set RequestedActivation To None |
| 68 | [Documentation] Set the RequestedActivation of the image to None and |
| 69 | ... verify that it is in fact set to None. |
| 70 | [Tags] Set_RequestedActivation_To_None |
| 71 | |
| 72 | ${software_objects}= Get Software Objects |
| 73 | Set Host Software Property @{software_objects}[0] RequestedActivation |
| 74 | ... ${REQUESTED_NONE} |
| 75 | ${software_properties}= Get Host Software Property @{software_objects}[0] |
| 76 | Should Be Equal As Strings &{software_properties}[RequestedActivation] |
| 77 | ... ${REQUESTED_NONE} |
| 78 | |
| 79 | |
| 80 | Set RequestedActivation And Activation To Invalid Value |
| 81 | [Documentation] Set the RequestedActivation and Activation propreties of |
| 82 | ... the image to an invalid value and verify that it was not |
| 83 | ... changed. |
| 84 | [Template] Set Property To Invalid Value And Verify No Change |
| 85 | [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value |
| 86 | |
| 87 | # Property Version Type |
| 88 | RequestedActivation ${VERSION_PURPOSE_HOST} |
| 89 | Activation ${VERSION_PURPOSE_HOST} |
| 90 | |
| 91 | |
| 92 | Delete Host Image |
| 93 | [Documentation] Delete a PNOR image from the BMC and PNOR flash chip. |
| 94 | [Tags] Delete_Host_Image |
| 95 | [Setup] Initiate Host PowerOff |
| 96 | |
| 97 | ${software_objects}= Get Software Objects |
| 98 | ... version_type=${VERSION_PURPOSE_HOST} |
| 99 | ${num_images}= Get Length ${software_objects} |
| 100 | Should Be True 0 < ${num_images} |
| 101 | ... msg=There are no PNOR images on the BMC to delete. |
| 102 | Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST} |
| 103 | |
| 104 | |
| 105 | *** Keywords *** |
| 106 | |
| 107 | Temporarily Set PNOR Attribute |
| 108 | [Documentation] Update the PNOR attribute value. |
| 109 | [Arguments] ${attribute_name} ${attribute_value} |
| 110 | |
| 111 | # Description of argument(s): |
| 112 | # attribute_name Host software attribute name (e.g. "Priority"). |
| 113 | # attribute_value Value to be written. |
| 114 | |
| 115 | ${image_ids}= Get Software Objects |
| 116 | ${init_host_properties}= Get Host Software Property ${image_ids[0]} |
| 117 | ${initial_priority}= Set Variable ${init_host_properties["Priority"]} |
| 118 | |
| 119 | Set Host Software Property ${image_ids[0]} ${attribute_name} |
| 120 | ... ${attribute_value} |
| 121 | |
| 122 | ${cur_host_properties}= Get Host Software Property ${image_ids[0]} |
| 123 | Should Be Equal As Integers ${cur_host_properties["Priority"]} |
| 124 | ... ${attribute_value} |
| 125 | |
| 126 | # Revert to to initial value. |
| 127 | Set Host Software Property |
| 128 | ... ${image_ids[0]} ${attribute_name} ${initial_priority} |
| 129 | |
| 130 | |
| 131 | Code Update Setup |
| 132 | [Documentation] Do code update test case setup. |
| 133 | |
| 134 | Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}' |
| 135 | ... Delete All PNOR Images |
| 136 | |
| 137 | |
| 138 | Get PNOR Extended Version |
| 139 | [Documentation] Return the PNOR extended version. |
| 140 | [Arguments] ${manifest_path} |
| 141 | |
| 142 | # Description of argument(s): |
| 143 | # manifest_path Path of the MANIFEST file |
| 144 | # (e.g. "/tmp/images/abc123/MANIFEST"). |
| 145 | |
| 146 | ${version}= BMC Execute Command |
| 147 | ... grep extended_version= ${manifest_path} |
| 148 | [return] ${version.split(",")} |