Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Code update to a target BMC. |
| 3 | ... Execution Method: |
| 4 | ... python -m robot -v OPENBMC_HOST:<hostname> |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 5 | ... -v DELETE_OLD_PNOR_IMAGES:<"true" or "false"> |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 6 | ... -v IMAGE_FILE_PATH:<path/*.tar> 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 software "Activation" status to be "Ready" |
| 13 | ... - Set "Requested Activation" to "Active" |
| 14 | ... - Wait for code update to complete |
| 15 | ... - Verify the new version |
| 16 | |
Charles Paul Hofer | de7d408 | 2017-08-08 14:41:01 -0500 | [diff] [blame] | 17 | Library ../../lib/code_update_utils.py |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 18 | Variables ../../data/variables.py |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 19 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | d3fb592 | 2017-08-08 07:32:25 -0500 | [diff] [blame] | 20 | Resource ../../lib/code_update_utils.robot |
Charles Paul Hofer | e510082 | 2017-08-01 10:02:23 -0500 | [diff] [blame] | 21 | Resource ../../lib/boot_utils.robot |
Charles Paul Hofer | d68d0fa | 2017-08-17 13:51:24 -0500 | [diff] [blame] | 22 | Resource ../../lib/utils.robot |
| 23 | Resource code_update_utils.robot |
Charles Paul Hofer | da24d0a | 2017-08-09 15:03:40 -0500 | [diff] [blame] | 24 | Resource ../../lib/state_manager.robot |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 25 | |
Charles Paul Hofer | cef6199 | 2017-08-18 10:14:18 -0500 | [diff] [blame^] | 26 | Test Teardown FFDC On Test Case Fail |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 27 | |
| 28 | *** Variables *** |
| 29 | |
| 30 | ${QUIET} ${1} |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 31 | ${upload_dir_path} /tmp/images/ |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 32 | ${IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 33 | ${DELETE_OLD_PNOR_IMAGES} false |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 34 | |
| 35 | *** Test Cases *** |
| 36 | |
Charles Paul Hofer | 9a5c722 | 2017-08-03 18:21:08 -0500 | [diff] [blame] | 37 | REST Host Code Update |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 38 | [Documentation] Do a PNOR code update by uploading image on BMC via REST. |
Charles Paul Hofer | 9a5c722 | 2017-08-03 18:21:08 -0500 | [diff] [blame] | 39 | [Tags] REST_Host_Code_Update |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 40 | [Setup] Code Update Setup |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 41 | |
Charles Paul Hofer | cef6199 | 2017-08-18 10:14:18 -0500 | [diff] [blame^] | 42 | Upload And Activate Image ${IMAGE_FILE_PATH} |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 43 | |
Charles Paul Hofer | bdbabf1 | 2017-08-18 12:30:14 -0500 | [diff] [blame] | 44 | OBMC Reboot (off) |
Charles Paul Hofer | e510082 | 2017-08-01 10:02:23 -0500 | [diff] [blame] | 45 | |
| 46 | |
| 47 | Post Update Boot To OS |
| 48 | [Documentation] Boot the host OS |
| 49 | [Tags] Post_Update_Boot_To_OS |
Charles Paul Hofer | 9910841 | 2017-08-21 09:22:36 -0500 | [diff] [blame] | 50 | [Teardown] Stop SOL Console Logging |
Charles Paul Hofer | e510082 | 2017-08-01 10:02:23 -0500 | [diff] [blame] | 51 | |
| 52 | Run Keyword Unless '${PREV_TEST_STATUS}' == 'PASS' |
| 53 | ... Fail Code update failed. No need to boot to OS. |
Charles Paul Hofer | 9910841 | 2017-08-21 09:22:36 -0500 | [diff] [blame] | 54 | Start SOL Console Logging |
Charles Paul Hofer | e510082 | 2017-08-01 10:02:23 -0500 | [diff] [blame] | 55 | REST Power On |
| 56 | |
George Keishing | d3fb592 | 2017-08-08 07:32:25 -0500 | [diff] [blame] | 57 | |
| 58 | Host Image Priority Attribute Test |
| 59 | [Documentation] Set "Priority" attribute. |
| 60 | [Tags] Host_Image_Priority_Attribute_Test |
| 61 | [Template] Set PNOR Attribute |
| 62 | |
| 63 | # Property Value |
| 64 | Priority ${0} |
| 65 | Priority ${1} |
| 66 | Priority ${127} |
| 67 | |
Charles Paul Hofer | e510082 | 2017-08-01 10:02:23 -0500 | [diff] [blame] | 68 | |
Charles Paul Hofer | 12a7c1d | 2017-08-01 13:44:02 -0500 | [diff] [blame] | 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 | ${sw_objs}= Get Software Objects |
| 75 | Set Host Software Property @{sw_objs}[0] RequestedActivation |
| 76 | ... ${REQUESTED_NONE} |
| 77 | ${sw_props}= Get Host Software Property @{sw_objs}[0] |
| 78 | Should Be Equal As Strings &{sw_props}[RequestedActivation] |
| 79 | ... ${REQUESTED_NONE} |
| 80 | |
| 81 | |
| 82 | Set RequestedActivation To Invalid Value |
| 83 | [Documentation] Set the RequestedActivation proprety of the image to an |
| 84 | ... invalid value and verify that it was not changed. |
| 85 | [Template] Set Property To Invalid Value And Verify No Change |
| 86 | [Tags] Set_RequestedActivation_To_Invalid_Value |
| 87 | |
| 88 | # Property |
| 89 | RequestedActivation |
| 90 | |
| 91 | |
| 92 | Set Activation To Invalid Value |
| 93 | [Documentation] Set the Activation proprety of the image to an invalid |
| 94 | ... value and verify that it was not changed. |
| 95 | [Template] Set Property To Invalid Value And Verify No Change |
| 96 | [Tags] Set_Activation_To_Invalid_Value |
| 97 | |
| 98 | # Property |
| 99 | Activation |
| 100 | |
| 101 | |
Charles Paul Hofer | da24d0a | 2017-08-09 15:03:40 -0500 | [diff] [blame] | 102 | Delete Host Image |
| 103 | [Documentation] Delete a PNOR image from the BMC and PNOR flash chip. |
| 104 | [Tags] Delete_Host_Image |
| 105 | [Setup] Initiate Host PowerOff |
| 106 | |
| 107 | ${software_objects}= Get Software Objects |
| 108 | ... version_type=${VERSION_PURPOSE_HOST} |
| 109 | ${num_images}= Get Length ${software_objects} |
| 110 | Should Be True 0 < ${num_images} |
| 111 | ... msg=There are no PNOR images on the BMC to delete. |
| 112 | Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST} |
| 113 | |
| 114 | |
| 115 | Delete BMC Image |
| 116 | [Documentation] Delete a BMC image from the BMC flash chip. |
| 117 | [Tags] Delete_BMC_Image |
| 118 | |
| 119 | ${software_object}= Get Non Running BMC Software Object |
| 120 | Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC} |
| 121 | |
| 122 | |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 123 | *** Keywords *** |
| 124 | |
George Keishing | d3fb592 | 2017-08-08 07:32:25 -0500 | [diff] [blame] | 125 | Set PNOR Attribute |
| 126 | [Documentation] Update the attribute value. |
| 127 | [Arguments] ${attribute_name} ${value} |
| 128 | |
| 129 | # Description of argument(s): |
| 130 | # attribute_name Host software attribute name (e.g. "Priority"). |
| 131 | # value Value to be written. |
| 132 | |
| 133 | ${image_ids}= Get Software Objects |
| 134 | ${resp}= Get Host Software Property ${image_ids[0]} |
| 135 | ${initial_value}= Set Variable ${resp["Priority"]} |
| 136 | |
| 137 | Set Host Software Property ${image_ids[0]} ${attribute_name} ${value} |
| 138 | |
| 139 | ${resp}= Get Host Software Property ${image_ids[0]} |
| 140 | Should Be Equal As Integers ${resp["Priority"]} ${value} |
| 141 | |
| 142 | # Revert to to initial value. |
| 143 | Set Host Software Property |
| 144 | ... ${image_ids[0]} ${attribute_name} ${initial_value} |
| 145 | |
| 146 | |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 147 | Code Update Setup |
| 148 | [Documentation] Do code update test case setup. |
| 149 | |
| 150 | Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}' |
| 151 | ... Delete All PNOR Images |
| 152 | |
Charles Paul Hofer | 12a7c1d | 2017-08-01 13:44:02 -0500 | [diff] [blame] | 153 | |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 154 | Get PNOR Extended Version |
| 155 | [Documentation] Return the PNOR extended version. |
Charles Paul Hofer | 12a7c1d | 2017-08-01 13:44:02 -0500 | [diff] [blame] | 156 | [Arguments] ${path} |
| 157 | |
| 158 | # Description of argument(s): |
| 159 | # path Path of the MANIFEST file. |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 160 | |
| 161 | Open Connection And Log In |
| 162 | ${version}= Execute Command On BMC |
| 163 | ... "grep \"extended_version=\" " + ${path} |
| 164 | [return] ${version.split(",")} |