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> |
| 5 | ... -v IMAGE_FILE_PATH:<path/*.tar> code_update.robot |
| 6 | ... |
| 7 | ... Code update method BMC |
| 8 | ... Update work flow sequence: |
| 9 | ... - Upload image via REST |
| 10 | ... - Verify that the file exists on the BMC |
| 11 | ... - Check software "Activation" status to be "Ready" |
| 12 | ... - Set "Requested Activation" to "Active" |
| 13 | ... - Wait for code update to complete |
| 14 | ... - Verify the new version |
| 15 | |
| 16 | #TODO: Move test_uploadimage.py to lib/ |
| 17 | Library ../test_uploadimage.py |
| 18 | Library code_update.py |
| 19 | Library OperatingSystem |
| 20 | Variables ../../data/variables.py |
| 21 | Resource code_update_utils.robot |
| 22 | Resource ../lib/rest_client.robot |
| 23 | Resource ../lib/openbmc_ffdc.robot |
| 24 | |
| 25 | Test Teardown Code Update Teardown |
| 26 | |
| 27 | *** Variables *** |
| 28 | |
| 29 | ${QUIET} ${1} |
| 30 | ${version_id} ${EMPTY} |
| 31 | ${upload_dir_path} /tmp/images/ |
| 32 | ${image_version} ${EMPTY} |
| 33 | ${image_purpose} ${EMPTY} |
| 34 | ${activation_state} ${EMPTY} |
| 35 | ${requested_state} ${EMPTY} |
| 36 | ${IMAGE_FILE_PATH} ${EMPTY} |
| 37 | |
| 38 | *** Test Cases *** |
| 39 | |
| 40 | REST PNOR Code Update |
| 41 | [Documentation] Do a PNOR code update by uploading image on BMC via REST. |
| 42 | [Tags] REST_PNOR_Code_Update |
| 43 | |
| 44 | OperatingSystem.File Should Exist ${IMAGE_FILE_PATH} |
| 45 | ${IMAGE_VERSION}= Get Version Tar ${IMAGE_FILE_PATH} |
| 46 | |
| 47 | ${image_data}= OperatingSystem.Get Binary File ${IMAGE_FILE_PATH} |
| 48 | Upload Image To BMC /upload/image data=${image_data} |
| 49 | ${ret}= Verify Image Upload |
| 50 | Should Be True ${ret} |
| 51 | |
| 52 | # Verify the image is 'READY' to be activated. |
| 53 | ${software_state}= Read Properties ${SOFTWARE_VERSION}${version_id} |
| 54 | Should Be Equal As Strings &{software_state}[Activation] ${READY} |
| 55 | |
| 56 | # Request the image to be activated. |
| 57 | ${args}= Create Dictionary data=${REQUESTED_ACTIVE} |
| 58 | Write Attribute ${SOFTWARE_VERSION}${version_id} |
| 59 | ... RequestedActivation data=${args} |
| 60 | ${software_state}= Read Properties ${SOFTWARE_VERSION}${version_id} |
| 61 | Should Be Equal As Strings &{software_state}[RequestedActivation] |
| 62 | ... ${REQUESTED_ACTIVE} |
| 63 | |
| 64 | # Verify code update was successful and Activation state is Active. |
| 65 | Wait For Activation State Change ${version_id} ${ACTIVATING} |
| 66 | ${software_state}= Read Properties ${SOFTWARE_VERSION}${version_id} |
| 67 | Should Be Equal As Strings &{software_state}[Activation] ${ACTIVE} |
| 68 | |
| 69 | *** Keywords *** |
| 70 | |
| 71 | Code Update Teardown |
| 72 | [Documentation] Do code update test case teardown. |
| 73 | |
| 74 | #TODO: Use the Delete interface instead once delivered |
| 75 | Open Connection And Log In |
| 76 | Execute Command On BMC rm -rf /tmp/images/* |
| 77 | |
| 78 | Close All Connections |
| 79 | FFDC On Test Case Fail |
| 80 | |
| 81 | Get PNOR Extended Version |
| 82 | [Documentation] Return the PNOR extended version. |
| 83 | ... Description of arguments: |
| 84 | ... path Path of the MANIFEST file |
| 85 | [Arguments] ${path} |
| 86 | |
| 87 | Open Connection And Log In |
| 88 | ${version}= Execute Command On BMC |
| 89 | ... "grep \"extended_version=\" " + ${path} |
| 90 | [return] ${version.split(",")} |