blob: 5b6fbdbab0231437abda8746eb4eb2aae8edc500 [file] [log] [blame]
George Keishing8b082fd2017-05-03 13:42:39 -05001*** Settings ***
George Keishing8b082fd2017-05-03 13:42:39 -05002
Steven Sombar130a04f2017-07-16 10:02:37 -05003Documentation Stress the system using HTX exerciser.
4
5# Test Parameters:
6# OPENBMC_HOST The BMC host name or IP address.
7# OS_HOST The OS host name or IP Address.
8# OS_USERNAME The OS login userid (usually root).
9# OS_PASSWORD The password for the OS login.
Steven Sombar2c97f812017-10-31 09:55:13 -050010# HTX_DURATION Duration of HTX run, for example, 2h, or 30m.
Steven Sombar130a04f2017-07-16 10:02:37 -050011# HTX_LOOP The number of times to loop HTX.
12# HTX_INTERVAL The time delay between consecutive checks of HTX
Steven Sombar2c97f812017-10-31 09:55:13 -050013# status, for example, 15m.
Steven Sombar130a04f2017-07-16 10:02:37 -050014# In summary: Run HTX for $HTX_DURATION, looping
Steven Sombar0278b132018-01-09 14:41:32 -060015# $HTX_LOOP times checking for errors every
16# $HTX_INTERVAL. Then allow extra time for OS
17# Boot, HTX startup, shutdown.
Steven Sombar130a04f2017-07-16 10:02:37 -050018# HTX_KEEP_RUNNING If set to 1, this indicates that the HTX is to
Steven Sombar2c97f812017-10-31 09:55:13 -050019# continue running after an error was found.
Steven Sombara2f166c2017-08-02 14:22:45 -050020# CHECK_INVENTORY If set to 0 or False, OS inventory checking before
21# and after each HTX run will be disabled. This
Steven Sombar2c97f812017-10-31 09:55:13 -050022# parameter is optional. The default value is True.
Steven Sombara2f166c2017-08-02 14:22:45 -050023# PREV_INV_FILE_PATH The file path and name of an initial previous
24# inventory snapshot file in JSON format. Inventory
25# snapshots taken before and after each HTX run will
26# be compared to this file.
Steven Sombar2c97f812017-10-31 09:55:13 -050027# This parameter is optional. If not specified an
Steven Sombara2f166c2017-08-02 14:22:45 -050028# initial inventory snapshot will be taken before
29# HTX startup.
Steven Sombarb6749a62017-10-06 08:34:23 -050030# INV_IGNORE_LIST A comma-delimited list of strings that
Steven Sombar48ad01d2017-08-17 14:17:37 -050031# indicate what to ignore if there are inventory
Steven Sombarb6749a62017-10-06 08:34:23 -050032# differences, (e.g., processor "size").
Steven Sombar48ad01d2017-08-17 14:17:37 -050033# If differences are found during inventory checking
Steven Sombarb6749a62017-10-06 08:34:23 -050034# and those items are in this list, the
Steven Sombar48ad01d2017-08-17 14:17:37 -050035# differences will be ignored. This parameter is
36# optional. If not specified the default value is
Steven Sombarb6749a62017-10-06 08:34:23 -050037# "size".
Steven Sombar130a04f2017-07-16 10:02:37 -050038
39Resource ../syslib/utils_os.robot
George Keishingdc1691d2017-12-07 12:17:46 -060040Resource ../lib/openbmc_ffdc_utils.robot
Steven Sombar3ecb6892018-03-23 11:41:08 -050041Resource ../lib/logging_utils.robot
George Keishing559f8382018-10-28 02:17:49 -050042Resource ../lib/code_update_utils.robot
Steven Sombar130a04f2017-07-16 10:02:37 -050043Library ../syslib/utils_keywords.py
Steven Sombarb6749a62017-10-06 08:34:23 -050044Library ../lib/utils_files.py
Steven Sombar3ecb6892018-03-23 11:41:08 -050045Library ../lib/logging_utils.py
Steven Sombare0be9152018-08-08 08:22:53 -050046Library ../syslib/utils_os.py
George Keishingffbe8ce2017-05-04 12:08:54 -050047
Steven Sombar16dba512017-10-20 07:20:08 -050048Suite Setup Run Keyword Start SOL Console Logging
George Keishingdc1691d2017-12-07 12:17:46 -060049Test Setup Test Setup Execution
50Test Teardown Test Teardown Execution
George Keishing8b082fd2017-05-03 13:42:39 -050051
Steven Sombar6f9d41d2017-08-08 13:35:30 -050052
George Keishing8b082fd2017-05-03 13:42:39 -050053*** Variables ****
54
Steven Sombar130a04f2017-07-16 10:02:37 -050055${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050056${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
57${json_final_file_path} ${EXECDIR}/os_inventory_final.json
58${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombara2f166c2017-08-02 14:22:45 -050059${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050060${INV_IGNORE_LIST} size
Steven Sombar2c97f812017-10-31 09:55:13 -050061${PREV_INV_FILE_PATH} NONE
George Keishingffbe8ce2017-05-04 12:08:54 -050062
Steven Sombard6365f12019-04-02 09:38:29 -050063# Error log Severities to ignore when checking for eSELs.
64@{ESEL_WHITELIST}
65... xyz.openbmc_project.Logging.Entry.Level.Informational
66
Steven Sombar6f9d41d2017-08-08 13:35:30 -050067
George Keishing8b082fd2017-05-03 13:42:39 -050068*** Test Cases ***
69
70Hard Bootme Test
71 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050072 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050073
Michael Walshc108e422019-03-28 12:27:18 -050074 Printn
Steven Sombar2c97f812017-10-31 09:55:13 -050075 Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
76 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050077
Steven Sombar2c97f812017-10-31 09:55:13 -050078 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
79 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050080
Steven Sombar2c97f812017-10-31 09:55:13 -050081 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050082 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050083
84 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050085 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050086
Steven Sombar2c97f812017-10-31 09:55:13 -050087 # Estimate the time required for a single iteration loop.
88 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
89 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
90 Set Suite Variable ${loop_body_seconds} children=true
91 # And save it in printable (compact) format.
92 ${estimated_loop_time}= Convert Time
93 ... ${loop_body_seconds} result_format=compact
94 Set Suite Variable ${estimated_loop_time} children=true
95
96 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
97 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
98 Set Suite Variable ${est_seconds_left} children=true
99
Steven Sombar130a04f2017-07-16 10:02:37 -0500100 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -0500101
102
103*** Keywords ***
104
Steven Sombar16dba512017-10-20 07:20:08 -0500105
Steven Sombar130a04f2017-07-16 10:02:37 -0500106Run HTX Exerciser
107 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -0500108 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -0500109 # - Power on.
110 # - Establish SSH connection session.
111 # - Do inventory collection, compare with
112 # previous inventory run if applicable.
113 # - Create HTX mdt profile.
114 # - Run HTX exerciser.
115 # - Check HTX status for errors.
116 # - Do inventory collection, compare with
117 # previous inventory run.
118 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500119
Steven Sombar16dba512017-10-20 07:20:08 -0500120 Set Suite Variable ${iteration} ${iteration + 1}
121 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500122 ${estimated_time_remaining}= Convert Time
123 ... ${est_seconds_left} result_format=compact
Michael Walshc108e422019-03-28 12:27:18 -0500124 Printn
Steven Sombar2c97f812017-10-31 09:55:13 -0500125 Rpvars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500126
Steven Sombar0278b132018-01-09 14:41:32 -0600127 REST Power On stack_mode=skip
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500128 Run Key U Sleep \ 15s
George Keishingffbe8ce2017-05-04 12:08:54 -0500129
130 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500131 Login To OS
132
Steven Sombara2f166c2017-08-02 14:22:45 -0500133 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500134 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500135 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500136
George Keishing13f44e52017-05-12 15:28:12 -0500137 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
138 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500139
George Keishing13f44e52017-05-12 15:28:12 -0500140 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500141
142 Loop HTX Health Check
143
George Keishingffbe8ce2017-05-04 12:08:54 -0500144 Shutdown HTX Exerciser
145
Steven Sombara2f166c2017-08-02 14:22:45 -0500146 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500147 ... Do Inventory And Compare ${json_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500148 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500149
George Keishingffbe8ce2017-05-04 12:08:54 -0500150 Power Off Host
151
George Keishingae5d9782017-06-12 13:35:59 -0500152 # Close all SSH and REST active sessions.
153 Close All Connections
154 Flush REST Sessions
155
Michael Walshc108e422019-03-28 12:27:18 -0500156 Print Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500157
Steven Sombar16dba512017-10-20 07:20:08 -0500158 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500159
160 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
161 Set Suite Variable ${est_seconds_left} children=true
162 ${estimated_time_remaining}= Convert Time
163 ... ${est_seconds_left} result_format=compact
164
165 Rpvars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500166
George Keishing13f44e52017-05-12 15:28:12 -0500167
Steven Sombara2f166c2017-08-02 14:22:45 -0500168Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500169 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500170 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500171 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500172 # inventory_file_path The file to receive the inventory snapshot.
173 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500174
175 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500176 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500177 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500178 ... ${PREV_INV_FILE_PATH}
179 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
180 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500181
182
183Compare Json Inventory Files
184 [Documentation] Compare JSON inventory files.
185 [Arguments] ${file1} ${file2}
186 # Description of argument(s):
187 # file1 A file that has an inventory snapshot in JSON format.
188 # file2 A file that has an inventory snapshot, to compare with file1.
189
Steven Sombarb6749a62017-10-06 08:34:23 -0500190 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500191 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500192 Run Keyword If '${diff_rc}' != '${0}'
193 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
Michael Walshc108e422019-03-28 12:27:18 -0500194 ... ELSE Print Timen Inventoy check: No differences found.
Steven Sombar130a04f2017-07-16 10:02:37 -0500195
196
197Report Inventory Mismatch
198 [Documentation] Report inventory mismatch.
199 [Arguments] ${diff_rc} ${json_diff_file_path}
200 # Description of argument(s):
201 # diff_rc The failing return code from the difference check.
202 # json_diff_file_path The file that has the latest inventory snapshot.
203
Steven Sombara2216d22017-08-09 12:18:00 -0500204 Log To Console Significant difference in inventory found, rc=${diff_rc}
205 Log To Console Differences are listed in file: no_newline=true
206 Log To Console ${json_diff_file_path}
207 Log To Console File Contents:
208 Wait Until Created ${json_diff_file_path}
209 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
210 Log ${file_contents} level=WARN
211 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500212
213
Steven Sombar7cc95a32018-11-05 15:01:06 -0600214Check For ESELs
Steven Sombard6365f12019-04-02 09:38:29 -0500215 [Documentation] Terminate if eSELs with Severity field not on WHITELIST.
216
217 Print Timen Checking eSEL Error Logs.
Steven Sombar7cc95a32018-11-05 15:01:06 -0600218 ${error_logs}= Get Error Logs
Steven Sombard6365f12019-04-02 09:38:29 -0500219
Steven Sombar021cbc42019-03-28 11:49:21 -0500220 ${num_error_logs}= Get Length ${error_logs}
221 Rprint Vars num_error_logs
Steven Sombard6365f12019-04-02 09:38:29 -0500222 Return From Keyword If ${num_error_logs} == ${0}
223
224 Print Error Logs
225
226 # Get a list of the severities of the error logs.
227 ${error_log_severities}= Nested Get Severity ${error_logs}
228 # Subtract the WHITELIST from the error_log_severities.
229 ${problem_error_logs}=
230 ... Evaluate list(set($error_log_severities) - set($ESEL_WHITELIST))
231 ${num_error_logs_not_on_whitelist}= Get Length ${problem_error_logs}
232
233 Return From Keyword If ${num_error_logs_not_on_whitelist} == ${0}
234
235 Rprint Vars ESEL_WHITELIST
236 Fail msg=Found error logs with Severity not matching ESEL_WHITELIST.
Steven Sombar7cc95a32018-11-05 15:01:06 -0600237
238
George Keishing8b082fd2017-05-03 13:42:39 -0500239Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500240 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500241 Repeat Keyword ${HTX_DURATION}
242 ... Run Keywords Check HTX Run Status
Steven Sombar7cc95a32018-11-05 15:01:06 -0600243 ... AND Check For ESELs
George Keishing8b082fd2017-05-03 13:42:39 -0500244 ... AND Sleep ${HTX_INTERVAL}
245
246
Steven Sombar0278b132018-01-09 14:41:32 -0600247Test Setup Execution
248 [Documentation] Do the initial test setup.
249
Steven Sombarac687c42018-08-09 13:39:36 -0500250 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
251 ... cat /etc/os-release
Michael Walshc108e422019-03-28 12:27:18 -0500252 Printn
Steven Sombarac687c42018-08-09 13:39:36 -0500253 Rpvars bmc_version
Steven Sombare0be9152018-08-08 08:22:53 -0500254
George Keishing559f8382018-10-28 02:17:49 -0500255 ${pnor_version}= Get Host Software Objects Details
Steven Sombare0be9152018-08-08 08:22:53 -0500256 Rpvars pnor_version
257
Steven Sombar0278b132018-01-09 14:41:32 -0600258 REST Power On stack_mode=skip
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500259 Run Key U Sleep \ 15s
Steven Sombar0278b132018-01-09 14:41:32 -0600260 Delete All Error Logs
261 Tool Exist htxcmdline
262
Steven Sombarac687c42018-08-09 13:39:36 -0500263 ${os_release_info}= Get OS Release Info
264 Rpvars 1 os_release_info
265
Steven Sombar0278b132018-01-09 14:41:32 -0600266 # Shutdown if HTX is running.
Steven Sombar3ecb6892018-03-23 11:41:08 -0500267 ${status}= Is HTX Running
Steven Sombar0278b132018-01-09 14:41:32 -0600268 Run Keyword If '${status}' == 'True'
269 ... Shutdown HTX Exerciser
270
271
George Keishingdc1691d2017-12-07 12:17:46 -0600272Test Teardown Execution
Steven Sombare0be9152018-08-08 08:22:53 -0500273 [Documentation] Do the post-test teardown.
George Keishingffbe8ce2017-05-04 12:08:54 -0500274
George Keishing1a23b692017-05-06 12:19:41 -0500275 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500276 Run Keyword If
277 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500278 ... Shutdown HTX Exerciser
279
George Keishingae5d9782017-06-12 13:35:59 -0500280 ${keyword_buf}= Catenate Stop SOL Console Logging
281 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
282 Run Key ${keyword_buf}
283
George Keishingffbe8ce2017-05-04 12:08:54 -0500284 FFDC On Test Case Fail
285 Close All Connections