blob: 0fd9e5b359b07d60d16302b939c78aadecf17720 [file] [log] [blame]
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05001*** Settings ***
2Documentation 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">
Charles Paul Hofera5673162017-08-30 09:49:16 -05006... -v IMAGE_FILE_PATH:<path/*.tar>
7... -v ALTERNATE_IMAGE_FILE_PATH:<path/*.tar>
8... host_code_update.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05009...
10... Code update method BMC
11... Update work flow sequence:
12... - Upload image via REST
13... - Verify that the file exists on the BMC
14... - Check that software "Activation" is set to "Ready"
15... - Set "Requested Activation" to "Active"
16... - Wait for code update to complete
17... - Verify the new version
18
19Library ../../lib/bmc_ssh_utils.py
20Library ../../lib/code_update_utils.py
21Variables ../../data/variables.py
22Resource ../../lib/boot_utils.robot
23Resource code_update_utils.robot
24Resource ../../lib/code_update_utils.robot
George Keishing1eb85f52017-08-30 22:55:13 -050025Resource ../../lib/openbmc_ffdc.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050026Resource ../../lib/state_manager.robot
George Keishing1eb85f52017-08-30 22:55:13 -050027Resource ../../lib/dump_utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050028
George Keishing00715492017-08-18 11:46:37 -050029Test Teardown Code Update Test Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050030
31*** Variables ***
32
33${QUIET} ${1}
34${IMAGE_FILE_PATH} ${EMPTY}
35${DELETE_OLD_PNOR_IMAGES} false
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050036${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050037
38*** Test Cases ***
39
40REST Host Code Update
41 [Documentation] Do a PNOR code update by uploading image on BMC via REST.
George Keishing00715492017-08-18 11:46:37 -050042 # 1. Delete error logs if there is any.
43 # 1. Do code update.
44 # 2. Do post update the following:
45 # - Collect FFDC if error log exist and delete error logs.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050046 [Tags] REST_Host_Code_Update
47 [Setup] Code Update Setup
48
49 Upload And Activate Image ${IMAGE_FILE_PATH}
50 OBMC Reboot (off)
51
52
George Keishing00715492017-08-18 11:46:37 -050053
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050054Post Update Boot To OS
55 [Documentation] Boot the host OS
56 [Tags] Post_Update_Boot_To_OS
57 [Teardown] Stop SOL Console Logging
58
59 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
60 ... Fail Code update failed. No need to boot to OS.
61 Start SOL Console Logging
George Keishing00715492017-08-18 11:46:37 -050062 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050063 REST Power On
64
65
66Host Image Priority Attribute Test
67 [Documentation] Set "Priority" attribute.
68 [Tags] Host_Image_Priority_Attribute_Test
69 [Template] Temporarily Set PNOR Attribute
70
71 # Property Value
72 Priority ${0}
73 Priority ${1}
74 Priority ${127}
75
76
77Set RequestedActivation To None
78 [Documentation] Set the RequestedActivation of the image to None and
79 ... verify that it is in fact set to None.
80 [Tags] Set_RequestedActivation_To_None
81
82 ${software_objects}= Get Software Objects
83 Set Host Software Property @{software_objects}[0] RequestedActivation
84 ... ${REQUESTED_NONE}
85 ${software_properties}= Get Host Software Property @{software_objects}[0]
86 Should Be Equal As Strings &{software_properties}[RequestedActivation]
87 ... ${REQUESTED_NONE}
88
89
90Set RequestedActivation And Activation To Invalid Value
91 [Documentation] Set the RequestedActivation and Activation propreties of
92 ... the image to an invalid value and verify that it was not
93 ... changed.
94 [Template] Set Property To Invalid Value And Verify No Change
95 [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value
96
97 # Property Version Type
98 RequestedActivation ${VERSION_PURPOSE_HOST}
99 Activation ${VERSION_PURPOSE_HOST}
100
101
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500102Upload And Activate Multiple Host Images
103 [Documentation] Upload another PNOR image and verify that its state is
104 ... different from all others.
105 [Tags] Upload_And_Activate_Multiple_Host_Images
106 [Template] Activate Image And Verify No Duplicate Priorities
107 [Setup] Upload And Activate Multiple BMC Images Setup
108
109 # Image File Path Image Purpose
110 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST}
111
112
Charles Paul Hofera5673162017-08-30 09:49:16 -0500113Set Same Priority For Multiple Host Images
114 [Documentation] Attempt to set the priority to be the same for two PNOR
115 ... images and verify that the priorities are not the same.
116 [Tags] Set_Same_Priority_For_Multiple_Host_Images
117
118 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
119 ... Fail Activation of alternate image failed. Cannot set priority.
120 Set Same Priority For Multiple Images ${VERSION_PURPOSE_HOST}
121
122
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500123Delete Host Image
124 [Documentation] Delete a PNOR image from the BMC and PNOR flash chip.
125 [Tags] Delete_Host_Image
126 [Setup] Initiate Host PowerOff
127
128 ${software_objects}= Get Software Objects
129 ... version_type=${VERSION_PURPOSE_HOST}
130 ${num_images}= Get Length ${software_objects}
131 Should Be True 0 < ${num_images}
132 ... msg=There are no PNOR images on the BMC to delete.
133 Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST}
134
135
136*** Keywords ***
137
138Temporarily Set PNOR Attribute
139 [Documentation] Update the PNOR attribute value.
140 [Arguments] ${attribute_name} ${attribute_value}
141
142 # Description of argument(s):
143 # attribute_name Host software attribute name (e.g. "Priority").
144 # attribute_value Value to be written.
145
146 ${image_ids}= Get Software Objects
147 ${init_host_properties}= Get Host Software Property ${image_ids[0]}
148 ${initial_priority}= Set Variable ${init_host_properties["Priority"]}
149
150 Set Host Software Property ${image_ids[0]} ${attribute_name}
151 ... ${attribute_value}
152
153 ${cur_host_properties}= Get Host Software Property ${image_ids[0]}
154 Should Be Equal As Integers ${cur_host_properties["Priority"]}
155 ... ${attribute_value}
156
157 # Revert to to initial value.
158 Set Host Software Property
159 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
160
161
162Code Update Setup
163 [Documentation] Do code update test case setup.
George Keishing1eb85f52017-08-30 22:55:13 -0500164 # - Clean up all existing BMC dumps.
165 # - Clean up all currently install PNOR images.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500166
George Keishing1eb85f52017-08-30 22:55:13 -0500167 Delete All Dumps
George Keishing00715492017-08-18 11:46:37 -0500168 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500169 Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
170 ... Delete All PNOR Images
171
172
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500173Upload And Activate Multiple BMC Images Setup
174 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
175
176 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
177
178
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500179Get PNOR Extended Version
180 [Documentation] Return the PNOR extended version.
181 [Arguments] ${manifest_path}
182
183 # Description of argument(s):
184 # manifest_path Path of the MANIFEST file
185 # (e.g. "/tmp/images/abc123/MANIFEST").
186
187 ${version}= BMC Execute Command
188 ... grep extended_version= ${manifest_path}
189 [return] ${version.split(",")}
George Keishing00715492017-08-18 11:46:37 -0500190
191
192Code Update Test Teardown
193 [Documentation] Do code update test case teardown.
194 # 1. Collect FFDC if test case failed.
195 # 2. Collect FFDC if test PASS but error log exists.
196
197 FFDC On Test Case Fail
198 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC