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 | |
| 17 | #TODO: Move test_uploadimage.py to lib/ |
| 18 | Library ../test_uploadimage.py |
| 19 | Library code_update.py |
| 20 | Library OperatingSystem |
| 21 | Variables ../../data/variables.py |
| 22 | Resource code_update_utils.robot |
| 23 | Resource ../lib/rest_client.robot |
| 24 | Resource ../lib/openbmc_ffdc.robot |
| 25 | |
| 26 | Test Teardown Code Update Teardown |
| 27 | |
| 28 | *** Variables *** |
| 29 | |
| 30 | ${QUIET} ${1} |
| 31 | ${version_id} ${EMPTY} |
| 32 | ${upload_dir_path} /tmp/images/ |
| 33 | ${image_version} ${EMPTY} |
| 34 | ${image_purpose} ${EMPTY} |
| 35 | ${activation_state} ${EMPTY} |
| 36 | ${requested_state} ${EMPTY} |
| 37 | ${IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 38 | ${DELETE_OLD_PNOR_IMAGES} false |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 39 | |
| 40 | *** Test Cases *** |
| 41 | |
Charles Paul Hofer | 9a5c722 | 2017-08-03 18:21:08 -0500 | [diff] [blame] | 42 | REST Host Code Update |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 43 | [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] | 44 | [Tags] REST_Host_Code_Update |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 45 | [Setup] Code Update Setup |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 46 | |
| 47 | OperatingSystem.File Should Exist ${IMAGE_FILE_PATH} |
| 48 | ${IMAGE_VERSION}= Get Version Tar ${IMAGE_FILE_PATH} |
| 49 | |
| 50 | ${image_data}= OperatingSystem.Get Binary File ${IMAGE_FILE_PATH} |
| 51 | Upload Image To BMC /upload/image data=${image_data} |
| 52 | ${ret}= Verify Image Upload |
| 53 | Should Be True ${ret} |
| 54 | |
| 55 | # Verify the image is 'READY' to be activated. |
George Keishing | ff1e3ec | 2017-07-20 01:58:21 -0500 | [diff] [blame] | 56 | ${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id} |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 57 | Should Be Equal As Strings &{software_state}[Activation] ${READY} |
| 58 | |
| 59 | # Request the image to be activated. |
| 60 | ${args}= Create Dictionary data=${REQUESTED_ACTIVE} |
George Keishing | ff1e3ec | 2017-07-20 01:58:21 -0500 | [diff] [blame] | 61 | Write Attribute ${SOFTWARE_VERSION_URI}${version_id} |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 62 | ... RequestedActivation data=${args} |
George Keishing | ff1e3ec | 2017-07-20 01:58:21 -0500 | [diff] [blame] | 63 | ${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id} |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 64 | Should Be Equal As Strings &{software_state}[RequestedActivation] |
| 65 | ... ${REQUESTED_ACTIVE} |
| 66 | |
| 67 | # Verify code update was successful and Activation state is Active. |
| 68 | Wait For Activation State Change ${version_id} ${ACTIVATING} |
George Keishing | ff1e3ec | 2017-07-20 01:58:21 -0500 | [diff] [blame] | 69 | ${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id} |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 70 | Should Be Equal As Strings &{software_state}[Activation] ${ACTIVE} |
| 71 | |
| 72 | *** Keywords *** |
| 73 | |
Charles Paul Hofer | 2c73164 | 2017-08-03 18:13:27 -0500 | [diff] [blame] | 74 | Code Update Setup |
| 75 | [Documentation] Do code update test case setup. |
| 76 | |
| 77 | Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}' |
| 78 | ... Delete All PNOR Images |
| 79 | |
Saqib Khan | bb8b63f | 2017-05-24 10:58:01 -0500 | [diff] [blame] | 80 | Code Update Teardown |
| 81 | [Documentation] Do code update test case teardown. |
| 82 | |
| 83 | #TODO: Use the Delete interface instead once delivered |
| 84 | Open Connection And Log In |
| 85 | Execute Command On BMC rm -rf /tmp/images/* |
| 86 | |
| 87 | Close All Connections |
| 88 | FFDC On Test Case Fail |
| 89 | |
| 90 | Get PNOR Extended Version |
| 91 | [Documentation] Return the PNOR extended version. |
| 92 | ... Description of arguments: |
| 93 | ... path Path of the MANIFEST file |
| 94 | [Arguments] ${path} |
| 95 | |
| 96 | Open Connection And Log In |
| 97 | ${version}= Execute Command On BMC |
| 98 | ... "grep \"extended_version=\" " + ${path} |
| 99 | [return] ${version.split(",")} |