blob: 741c16bd65480392a2a5bdfc67343054099c2aa1 [file] [log] [blame]
Saqib Khanbb8b63f2017-05-24 10:58:01 -05001*** Settings ***
2Documentation 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/
17Library ../test_uploadimage.py
18Library code_update.py
19Library OperatingSystem
20Variables ../../data/variables.py
21Resource code_update_utils.robot
22Resource ../lib/rest_client.robot
23Resource ../lib/openbmc_ffdc.robot
24
25Test 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
40REST 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.
George Keishingff1e3ec2017-07-20 01:58:21 -050053 ${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id}
Saqib Khanbb8b63f2017-05-24 10:58:01 -050054 Should Be Equal As Strings &{software_state}[Activation] ${READY}
55
56 # Request the image to be activated.
57 ${args}= Create Dictionary data=${REQUESTED_ACTIVE}
George Keishingff1e3ec2017-07-20 01:58:21 -050058 Write Attribute ${SOFTWARE_VERSION_URI}${version_id}
Saqib Khanbb8b63f2017-05-24 10:58:01 -050059 ... RequestedActivation data=${args}
George Keishingff1e3ec2017-07-20 01:58:21 -050060 ${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id}
Saqib Khanbb8b63f2017-05-24 10:58:01 -050061 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}
George Keishingff1e3ec2017-07-20 01:58:21 -050066 ${software_state}= Read Properties ${SOFTWARE_VERSION_URI}${version_id}
Saqib Khanbb8b63f2017-05-24 10:58:01 -050067 Should Be Equal As Strings &{software_state}[Activation] ${ACTIVE}
68
69*** Keywords ***
70
71Code 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
81Get 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(",")}