blob: 2acd439cea79a074b945824559954eebc9b5bbcb [file] [log] [blame]
George Keishing5e870cd2016-08-24 10:05:47 -05001*** Settings ***
2Documentation Trigger code update to a target BMC.
3... Execution Method :
4... python -m robot -v OPENBMC_HOST:<hostname>
5... -v FILE_PATH:<path/*all.tar> update_bmc.robot
6...
7... Code update method BMC using REST
8... Update work flow sequence:
9... - User input BMC File existence check
10... - Ping Test and REST authentication
George Keishing8db0e1b2016-10-20 13:46:54 -050011... - Set Host Power host setting Policy to RESTORE_LAST_STATE
12... On reboot this policy would ensure the BMC comes
13... online and stays at HOST_POWERED_OFF state.
George Keishingdc5aa58e92016-09-27 01:35:11 -050014... - Issue poweroff
George Keishing0bd59f12016-12-14 10:39:21 -060015... - Prune archived journal logs
George Keishingdc5aa58e92016-09-27 01:35:11 -050016... - Prepare for Update
George Keishingdc5aa58e92016-09-27 01:35:11 -050017... - Wait for BMC to come online clean
George Keishing1b150202016-09-29 08:51:58 -050018... - Wait for BMC_READY state
George Keishing5e870cd2016-08-24 10:05:47 -050019... - Apply preserve BMC Network setting
20... - SCP image to BMC
21... - Activate the flash image
22... - Warm Reset BMC to activate code
23... - Wait for BMC to come online time out 30 minutes
24... - Version check post update
Rahul Maheshwari724e5912017-04-20 06:04:37 -050025... - Identify REST url post update
George Keishing5e870cd2016-08-24 10:05:47 -050026
Michael Walsh5ce98052017-04-12 16:40:31 -050027Library ../../lib/gen_robot_keyword.py
28Library String
Sweta Potthuri3a8ae262017-03-10 00:02:09 -060029
Michael Walsh5ce98052017-04-12 16:40:31 -050030Resource code_update_utils.robot
Michael Walsh5ce98052017-04-12 16:40:31 -050031Resource ../../lib/state_manager.robot
32Resource ../../lib/utils.robot
Rahul Maheshwari724e5912017-04-20 06:04:37 -050033Resource ../../lib/list_utils.robot
Michael Walsh5ce98052017-04-12 16:40:31 -050034Resource ../../lib/openbmc_ffdc.robot
35Resource ../../extended/obmc_boot_test_resource.robot
36
37Test Teardown Run Key FFDC On Test Case Fail
George Keishing5e870cd2016-08-24 10:05:47 -050038
39*** Variables ***
40
Michael Walsh5ce98052017-04-12 16:40:31 -050041${QUIET} ${1}
42# Boot failures are not acceptable so we set the threshold to 0.
43${boot_fail_threshold} ${0}
44
45${FILE_PATH} ${EMPTY}
46${FORCE_UPDATE} ${0}
Rahul Maheshwari724e5912017-04-20 06:04:37 -050047${REST_URL_FILE_PATH} ${EMPTY}
George Keishing80dd5af2017-02-08 07:01:25 -060048
49# There are two reboots issued by code update.
Michael Walsh5ce98052017-04-12 16:40:31 -050050${MAX_BOOT_COUNT} ${2}
George Keishing5e870cd2016-08-24 10:05:47 -050051
Gunnar Mills7c8923f2016-12-12 21:19:52 -060052*** Test Cases ***
George Keishing5e870cd2016-08-24 10:05:47 -050053
Sivas SRRaca55712016-12-21 04:32:35 -060054Test Basic BMC Performance Before Code Update
55 [Documentation] Check performance of memory, CPU & file system of BMC.
56 [Tags] Test_Basic_BMC_Performance_Before_Code_Update
57 Open Connection And Log In
58 Check BMC CPU Performance
59 Check BMC Mem Performance
60 Check BMC File System Performance
61
Sivas SRR01262bd2017-03-19 10:00:23 -050062Check Core Dump Exist Before Code Update
63 [Documentation] Check core dump existence on BMC before code update.
64 [Tags] Check_Core_Dump_Exist_Before_Code_Update
65 Check For Core Dumps
66
Rahul Maheshwari724e5912017-04-20 06:04:37 -050067Check URLs Before Code Update
68 [Documentation] Check available URLs before code update.
69 [Tags] Check_URLs_Before_Code_Update
Rahul Maheshwari13256d92017-06-15 10:05:40 -050070
Rahul Maheshwari724e5912017-04-20 06:04:37 -050071 ${url_list}= Get URL List ${OPENBMC_BASE_URI}
72 Set Global Variable ${URL_BEFORE_CU} ${url_list}
73
Rahul Maheshwari13256d92017-06-15 10:05:40 -050074 ${bmc_version}= Get BMC Version
75 Set Suite Variable ${bmc_version_before} ${bmc_version}
76
Sivas SRRaca55712016-12-21 04:32:35 -060077Initiate Code Update BMC
Michael Walsh5ce98052017-04-12 16:40:31 -050078 [Documentation] Initiate a code update on the BMC.
Sivas SRRaca55712016-12-21 04:32:35 -060079 [Tags] Initiate_Code_Update_BMC
George Keishing5e870cd2016-08-24 10:05:47 -050080
George Keishing830211e2017-07-19 08:44:07 -050081 ${status}= Run Keyword If '${LAST_KNOWN_GOOD_VERSION}' != '${EMPTY}'
82 ... Run Keyword And Return Status
83 ... Validate BMC Version ${LAST_KNOWN_GOOD_VERSION}
George Keishingfb10f492017-03-07 21:34:18 -060084
George Keishing830211e2017-07-19 08:44:07 -050085 Run Keyword if '${status}' == '${True}'
86 ... Pass Execution The BMC already has the requested build loaded so no further action will be taken.
George Keishing50787fc2016-09-21 03:44:26 -050087
George Keishing5e785822017-04-04 10:15:50 -050088 # Enable user to bypass prerequisite operations.
89 # Use cases for if BMC is not in working state.
90 Run Keyword If ${FORCE_UPDATE} == ${0}
91 ... Prepare BMC For Update
George Keishing2582bee2016-11-17 21:41:49 -060092
Michael Walsh5ce98052017-04-12 16:40:31 -050093 Run Key U Preserve BMC Network Setting
94 Run Key SCP Tar Image File To BMC \ ${FILE_PATH}
95 Run Key Activate BMC Flash Image
96 Run Key U OBMC Boot Test \ OBMC Reboot (off)
97 Run Key U Check Boot Count And Time
George Keishing80dd5af2017-02-08 07:01:25 -060098 Run Keyword If ${BOOT_COUNT} == ${1}
Michael Walsh5ce98052017-04-12 16:40:31 -050099 ... Log Boot time not updated by kernel. level=WARN
Sivas SRRea85d1f2016-11-13 22:44:28 -0600100
George Keishinga126e212017-03-24 08:07:17 -0500101Install BMC Debug Tarball
102 [Documentation] Install the downloaded debug tarball on BMC.
103 [Tags] Install_BMC_Debug_Tarball
104 Run Keyword If '${DEBUG_TARBALL_PATH}' != '${EMPTY}'
105 ... Install Debug Tarball On BMC ${DEBUG_TARBALL_PATH}
106
Rahul Maheshwari724e5912017-04-20 06:04:37 -0500107Compare URLs Before And After Code Update
108 [Documentation] Compare URLs before and after code update.
109 [Tags] Compare_URLs_Before_And_After_Code_Update
110
Rahul Maheshwari13256d92017-06-15 10:05:40 -0500111 ${bmc_version}= Get BMC Version
112 Set Suite Variable ${bmc_version_after} ${bmc_version}
113
114 # Exit test for same firmware version.
115 Pass Execution If '${bmc_version_before}' == '${bmc_version_after}'
116 ... Same BMC firmware version found
117
Rahul Maheshwari724e5912017-04-20 06:04:37 -0500118 ${url_after_cu}= Get URL List ${OPENBMC_BASE_URI}
119 Compare URL List After Code Update ${URL_BEFORE_CU} ${url_after_cu}
George Keishinga126e212017-03-24 08:07:17 -0500120
Sivas SRRaca55712016-12-21 04:32:35 -0600121Test Basic BMC Performance At Ready State
122 [Documentation] Check performance of memory, CPU & file system of BMC.
123 [Tags] Test_Basic_BMC_Performance_At_Ready_State
George Keishing128643a2016-12-15 11:36:46 -0600124 Open Connection And Log In
Sivas SRRea85d1f2016-11-13 22:44:28 -0600125 Check BMC CPU Performance
126 Check BMC Mem Performance
Sivas SRRaca55712016-12-21 04:32:35 -0600127 Check BMC File System Performance
128
Sivas SRR01262bd2017-03-19 10:00:23 -0500129Check Core Dump Exist After Code Update
130 [Documentation] Check core dump existence on BMC after code update.
131 [Tags] Check_Core_Dump_Exist_After_Code_Update
132 Check For Core Dumps
133
134Enable Core Dump File Size To Be Unlimited
135 [Documentation] Set core dump file size to unlimited.
136 [Tags] Enable_Core_Dump_File_size_To_Be_unlimited
137 Set Core Dump File Size Unlimited
138
George Keishing80dd5af2017-02-08 07:01:25 -0600139*** Keywords ***
140
George Keishing5e785822017-04-04 10:15:50 -0500141Prepare BMC For Update
142 [Documentation] Prerequisite operation before code update.
143 Check Boot Count And Time
144 Prune Journal Log
145 Power Off Request
Michael Walshfdc5ced2017-08-17 13:15:15 -0500146 Set BMC Power Policy RESTORE_LAST_STATE
George Keishingd85b28f2017-08-17 00:31:54 -0500147
George Keishing5e785822017-04-04 10:15:50 -0500148 Prepare For Update
149 Check If BMC is Up 20 min 10 sec
150 Check Boot Count And Time
151
152 # Temporary fix for lab migration for driver which is booted with
153 # BMC state "/xyz/openbmc_project/state/BMC0/".
154 ${status}= Run Keyword And Return Status Temp BMC URI Check
155 Run Keyword If '${status}' == '${False}'
156 ... Wait For BMC Ready
157 ... ELSE Wait For Temp BMC Ready
158
George Keishing80dd5af2017-02-08 07:01:25 -0600159Check Boot Count And Time
160 [Documentation] Check for unexpected reboots.
161 Set BMC Reset Reference Time
162 Log To Console \n Boot Count: ${BOOT_COUNT}
163 Log To Console \n Boot Time: ${BOOT_TIME}
164 Run Keyword If ${BOOT_COUNT} > ${MAX_BOOT_COUNT}
165 ... Log Phantom Reboot!!! Unexpected reboot detected level=WARN
166
George Keishing3cb1ade2017-03-23 09:03:06 -0500167Temp BMC URI Check
168 [Documentation] Check for transient "BMC0" interface.
169 ${resp}= Openbmc Get Request /xyz/openbmc_project/state/BMC0/
170 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
171
172Check Temp BMC State
173 [Documentation] BMC state should be "Ready".
174 # quiet - Suppress REST output logging to console.
175 ${state}=
176 ... Read Attribute /xyz/openbmc_project/state/BMC0/ CurrentBMCState
177 Should Be Equal Ready ${state.rsplit('.', 1)[1]}
178
179Wait For Temp BMC Ready
180 [Documentation] Check for BMC "Ready" until timedout.
181 Wait Until Keyword Succeeds
182 ... 10 min 10 sec Check Temp BMC State
183
Rahul Maheshwari724e5912017-04-20 06:04:37 -0500184Compare URL List After Code Update
185 [Documentation] Compare URL list before and after code update.
186 [Arguments] ${url_before_cu} ${url_after_cu}
187 # Description of arguments:
188 # url_before_cu List of URLs available before code update.
189 # url_after_cu List of URLs available after code update.
190
191 ${url_removed_list}= Subtract Lists ${url_before_cu} ${url_after_cu}
192 ${url_added_list}= Subtract Lists ${url_after_cu} ${url_before_cu}
193 Log ${url_removed_list}
194 Log ${url_added_list}
195
196 Return From Keyword If '${REST_URL_FILE_PATH}' == '${EMPTY}'
197
Rahul Maheshwari13256d92017-06-15 10:05:40 -0500198 # Create file with BMC firmware version before and after code update.
199 # i.e. <Before_Version>--<After_Version>
200 # Example v1.99.6-141-ge662190--v1.99.6-141-ge664242
201
202 ${file_name}= Catenate SEPARATOR=--
203 ... ${bmc_version_before} ${bmc_version_after}
204 ${REST_URL_FILE}= Catenate ${REST_URL_FILE_PATH}/${file_name}
205 Create File ${REST_URL_FILE} URL Removed${\n}
206
Rahul Maheshwari724e5912017-04-20 06:04:37 -0500207 Return From Keyword If
208 ... ${url_removed_list} == [] and ${url_added_list} == []
209
Rahul Maheshwari13256d92017-06-15 10:05:40 -0500210 Create File ${REST_URL_FILE} URL Removed${\n}
211 Append To File ${REST_URL_FILE} [${url_removed_list}]
212 Append To File ${REST_URL_FILE} ${\n}URL Added${\n}
213 Append To File ${REST_URL_FILE} [${url_added_list}]