blob: 799e38f71f5441219486249da6ebd6c4eb4d04f7 [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">
6... -v IMAGE_FILE_PATH:<path/*.tar> host_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 that software "Activation" is set to "Ready"
13... - Set "Requested Activation" to "Active"
14... - Wait for code update to complete
15... - Verify the new version
16
17Library ../../lib/bmc_ssh_utils.py
18Library ../../lib/code_update_utils.py
19Variables ../../data/variables.py
20Resource ../../lib/boot_utils.robot
21Resource code_update_utils.robot
22Resource ../../lib/code_update_utils.robot
George Keishing1eb85f52017-08-30 22:55:13 -050023Resource ../../lib/openbmc_ffdc.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050024Resource ../../lib/state_manager.robot
George Keishing1eb85f52017-08-30 22:55:13 -050025Resource ../../lib/dump_utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050026
George Keishing00715492017-08-18 11:46:37 -050027Test Teardown Code Update Test Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050028
29*** Variables ***
30
31${QUIET} ${1}
32${IMAGE_FILE_PATH} ${EMPTY}
33${DELETE_OLD_PNOR_IMAGES} false
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050034${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050035
36*** Test Cases ***
37
38REST Host Code Update
39 [Documentation] Do a PNOR code update by uploading image on BMC via REST.
George Keishing00715492017-08-18 11:46:37 -050040 # 1. Delete error logs if there is any.
41 # 1. Do code update.
42 # 2. Do post update the following:
43 # - Collect FFDC if error log exist and delete error logs.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050044 [Tags] REST_Host_Code_Update
45 [Setup] Code Update Setup
46
47 Upload And Activate Image ${IMAGE_FILE_PATH}
48 OBMC Reboot (off)
49
50
George Keishing00715492017-08-18 11:46:37 -050051
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050052Post Update Boot To OS
53 [Documentation] Boot the host OS
54 [Tags] Post_Update_Boot_To_OS
55 [Teardown] Stop SOL Console Logging
56
57 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
58 ... Fail Code update failed. No need to boot to OS.
59 Start SOL Console Logging
George Keishing00715492017-08-18 11:46:37 -050060 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050061 REST Power On
62
63
64Host Image Priority Attribute Test
65 [Documentation] Set "Priority" attribute.
66 [Tags] Host_Image_Priority_Attribute_Test
67 [Template] Temporarily Set PNOR Attribute
68
69 # Property Value
70 Priority ${0}
71 Priority ${1}
72 Priority ${127}
73
74
75Set RequestedActivation To None
76 [Documentation] Set the RequestedActivation of the image to None and
77 ... verify that it is in fact set to None.
78 [Tags] Set_RequestedActivation_To_None
79
80 ${software_objects}= Get Software Objects
81 Set Host Software Property @{software_objects}[0] RequestedActivation
82 ... ${REQUESTED_NONE}
83 ${software_properties}= Get Host Software Property @{software_objects}[0]
84 Should Be Equal As Strings &{software_properties}[RequestedActivation]
85 ... ${REQUESTED_NONE}
86
87
88Set RequestedActivation And Activation To Invalid Value
89 [Documentation] Set the RequestedActivation and Activation propreties of
90 ... the image to an invalid value and verify that it was not
91 ... changed.
92 [Template] Set Property To Invalid Value And Verify No Change
93 [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value
94
95 # Property Version Type
96 RequestedActivation ${VERSION_PURPOSE_HOST}
97 Activation ${VERSION_PURPOSE_HOST}
98
99
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500100Upload And Activate Multiple Host Images
101 [Documentation] Upload another PNOR image and verify that its state is
102 ... different from all others.
103 [Tags] Upload_And_Activate_Multiple_Host_Images
104 [Template] Activate Image And Verify No Duplicate Priorities
105 [Setup] Upload And Activate Multiple BMC Images Setup
106
107 # Image File Path Image Purpose
108 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST}
109
110
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500111Delete Host Image
112 [Documentation] Delete a PNOR image from the BMC and PNOR flash chip.
113 [Tags] Delete_Host_Image
114 [Setup] Initiate Host PowerOff
115
116 ${software_objects}= Get Software Objects
117 ... version_type=${VERSION_PURPOSE_HOST}
118 ${num_images}= Get Length ${software_objects}
119 Should Be True 0 < ${num_images}
120 ... msg=There are no PNOR images on the BMC to delete.
121 Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST}
122
123
124*** Keywords ***
125
126Temporarily Set PNOR Attribute
127 [Documentation] Update the PNOR attribute value.
128 [Arguments] ${attribute_name} ${attribute_value}
129
130 # Description of argument(s):
131 # attribute_name Host software attribute name (e.g. "Priority").
132 # attribute_value Value to be written.
133
134 ${image_ids}= Get Software Objects
135 ${init_host_properties}= Get Host Software Property ${image_ids[0]}
136 ${initial_priority}= Set Variable ${init_host_properties["Priority"]}
137
138 Set Host Software Property ${image_ids[0]} ${attribute_name}
139 ... ${attribute_value}
140
141 ${cur_host_properties}= Get Host Software Property ${image_ids[0]}
142 Should Be Equal As Integers ${cur_host_properties["Priority"]}
143 ... ${attribute_value}
144
145 # Revert to to initial value.
146 Set Host Software Property
147 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
148
149
150Code Update Setup
151 [Documentation] Do code update test case setup.
George Keishing1eb85f52017-08-30 22:55:13 -0500152 # - Clean up all existing BMC dumps.
153 # - Clean up all currently install PNOR images.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500154
George Keishing1eb85f52017-08-30 22:55:13 -0500155 Delete All Dumps
George Keishing00715492017-08-18 11:46:37 -0500156 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500157 Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
158 ... Delete All PNOR Images
159
160
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500161Upload And Activate Multiple BMC Images Setup
162 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
163
164 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
165
166
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500167Get PNOR Extended Version
168 [Documentation] Return the PNOR extended version.
169 [Arguments] ${manifest_path}
170
171 # Description of argument(s):
172 # manifest_path Path of the MANIFEST file
173 # (e.g. "/tmp/images/abc123/MANIFEST").
174
175 ${version}= BMC Execute Command
176 ... grep extended_version= ${manifest_path}
177 [return] ${version.split(",")}
George Keishing00715492017-08-18 11:46:37 -0500178
179
180Code Update Test Teardown
181 [Documentation] Do code update test case teardown.
182 # 1. Collect FFDC if test case failed.
183 # 2. Collect FFDC if test PASS but error log exists.
184
185 FFDC On Test Case Fail
186 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC