blob: 2ce02ceb138c93fa4f2ff47d1f0df0820ad431a5 [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 Sombar6f9d41d2017-08-08 13:35:30 -050063
George Keishing8b082fd2017-05-03 13:42:39 -050064*** Test Cases ***
65
66Hard Bootme Test
67 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050068 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050069
Steven Sombar48ad01d2017-08-17 14:17:37 -050070 Rprintn
Steven Sombar2c97f812017-10-31 09:55:13 -050071 Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
72 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050073
Steven Sombar2c97f812017-10-31 09:55:13 -050074 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
75 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050076
Steven Sombar2c97f812017-10-31 09:55:13 -050077 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050078 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050079
80 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050081 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050082
Steven Sombar2c97f812017-10-31 09:55:13 -050083 # Estimate the time required for a single iteration loop.
84 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
85 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
86 Set Suite Variable ${loop_body_seconds} children=true
87 # And save it in printable (compact) format.
88 ${estimated_loop_time}= Convert Time
89 ... ${loop_body_seconds} result_format=compact
90 Set Suite Variable ${estimated_loop_time} children=true
91
92 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
93 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
94 Set Suite Variable ${est_seconds_left} children=true
95
Steven Sombar130a04f2017-07-16 10:02:37 -050096 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050097
98
99*** Keywords ***
100
Steven Sombar16dba512017-10-20 07:20:08 -0500101
Steven Sombar130a04f2017-07-16 10:02:37 -0500102Run HTX Exerciser
103 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -0500104 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -0500105 # - Power on.
106 # - Establish SSH connection session.
107 # - Do inventory collection, compare with
108 # previous inventory run if applicable.
109 # - Create HTX mdt profile.
110 # - Run HTX exerciser.
111 # - Check HTX status for errors.
112 # - Do inventory collection, compare with
113 # previous inventory run.
114 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500115
Steven Sombar16dba512017-10-20 07:20:08 -0500116 Set Suite Variable ${iteration} ${iteration + 1}
117 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500118 ${estimated_time_remaining}= Convert Time
119 ... ${est_seconds_left} result_format=compact
120 Rprintn
121 Rpvars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500122
Steven Sombar0278b132018-01-09 14:41:32 -0600123 REST Power On stack_mode=skip
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500124 Run Key U Sleep \ 15s
George Keishingffbe8ce2017-05-04 12:08:54 -0500125
126 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500127 Login To OS
128
Steven Sombara2f166c2017-08-02 14:22:45 -0500129 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500130 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500131 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500132
George Keishing13f44e52017-05-12 15:28:12 -0500133 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
134 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500135
George Keishing13f44e52017-05-12 15:28:12 -0500136 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500137
138 Loop HTX Health Check
139
George Keishingffbe8ce2017-05-04 12:08:54 -0500140 Shutdown HTX Exerciser
141
Steven Sombara2f166c2017-08-02 14:22:45 -0500142 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500143 ... Do Inventory And Compare ${json_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500144 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500145
George Keishingffbe8ce2017-05-04 12:08:54 -0500146 Power Off Host
147
George Keishingae5d9782017-06-12 13:35:59 -0500148 # Close all SSH and REST active sessions.
149 Close All Connections
150 Flush REST Sessions
151
George Keishingffbe8ce2017-05-04 12:08:54 -0500152 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500153
Steven Sombar16dba512017-10-20 07:20:08 -0500154 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500155
156 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
157 Set Suite Variable ${est_seconds_left} children=true
158 ${estimated_time_remaining}= Convert Time
159 ... ${est_seconds_left} result_format=compact
160
161 Rpvars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500162
George Keishing13f44e52017-05-12 15:28:12 -0500163
Steven Sombara2f166c2017-08-02 14:22:45 -0500164Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500165 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500166 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500167 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500168 # inventory_file_path The file to receive the inventory snapshot.
169 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500170
171 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500172 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500173 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500174 ... ${PREV_INV_FILE_PATH}
175 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
176 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500177
178
179Compare Json Inventory Files
180 [Documentation] Compare JSON inventory files.
181 [Arguments] ${file1} ${file2}
182 # Description of argument(s):
183 # file1 A file that has an inventory snapshot in JSON format.
184 # file2 A file that has an inventory snapshot, to compare with file1.
185
Steven Sombarb6749a62017-10-06 08:34:23 -0500186 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500187 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500188 Run Keyword If '${diff_rc}' != '${0}'
189 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
Steven Sombar3ecb6892018-03-23 11:41:08 -0500190 ... ELSE Rprint Timen Inventoy check: No differences found.
Steven Sombar130a04f2017-07-16 10:02:37 -0500191
192
193Report Inventory Mismatch
194 [Documentation] Report inventory mismatch.
195 [Arguments] ${diff_rc} ${json_diff_file_path}
196 # Description of argument(s):
197 # diff_rc The failing return code from the difference check.
198 # json_diff_file_path The file that has the latest inventory snapshot.
199
Steven Sombara2216d22017-08-09 12:18:00 -0500200 Log To Console Significant difference in inventory found, rc=${diff_rc}
201 Log To Console Differences are listed in file: no_newline=true
202 Log To Console ${json_diff_file_path}
203 Log To Console File Contents:
204 Wait Until Created ${json_diff_file_path}
205 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
206 Log ${file_contents} level=WARN
207 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500208
209
Steven Sombar7cc95a32018-11-05 15:01:06 -0600210Check For ESELs
211 [Documentation] Terminate if there is an eSEL.
212 ${error_logs}= Get Error Logs
Steven Sombar021cbc42019-03-28 11:49:21 -0500213 ${num_error_logs}= Get Length ${error_logs}
214 Rprint Vars num_error_logs
215 Run Keyword If ${num_error_logs} != 0 Run Keywords
Steven Sombar7cc95a32018-11-05 15:01:06 -0600216 ... Print Error Logs ${error_logs}
217 ... AND Fail msg=Terminating run due to BMC error log(s).
218
219
George Keishing8b082fd2017-05-03 13:42:39 -0500220Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500221 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500222 Repeat Keyword ${HTX_DURATION}
223 ... Run Keywords Check HTX Run Status
Steven Sombar7cc95a32018-11-05 15:01:06 -0600224 ... AND Check For ESELs
George Keishing8b082fd2017-05-03 13:42:39 -0500225 ... AND Sleep ${HTX_INTERVAL}
226
227
Steven Sombar0278b132018-01-09 14:41:32 -0600228Test Setup Execution
229 [Documentation] Do the initial test setup.
230
Steven Sombarac687c42018-08-09 13:39:36 -0500231 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
232 ... cat /etc/os-release
233 Rprintn
234 Rpvars bmc_version
Steven Sombare0be9152018-08-08 08:22:53 -0500235
George Keishing559f8382018-10-28 02:17:49 -0500236 ${pnor_version}= Get Host Software Objects Details
Steven Sombare0be9152018-08-08 08:22:53 -0500237 Rpvars pnor_version
238
Steven Sombar0278b132018-01-09 14:41:32 -0600239 REST Power On stack_mode=skip
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500240 Run Key U Sleep \ 15s
Steven Sombar0278b132018-01-09 14:41:32 -0600241 Delete All Error Logs
242 Tool Exist htxcmdline
243
Steven Sombarac687c42018-08-09 13:39:36 -0500244 ${os_release_info}= Get OS Release Info
245 Rpvars 1 os_release_info
246
Steven Sombar0278b132018-01-09 14:41:32 -0600247 # Shutdown if HTX is running.
Steven Sombar3ecb6892018-03-23 11:41:08 -0500248 ${status}= Is HTX Running
Steven Sombar0278b132018-01-09 14:41:32 -0600249 Run Keyword If '${status}' == 'True'
250 ... Shutdown HTX Exerciser
251
252
George Keishingdc1691d2017-12-07 12:17:46 -0600253Test Teardown Execution
Steven Sombare0be9152018-08-08 08:22:53 -0500254 [Documentation] Do the post-test teardown.
George Keishingffbe8ce2017-05-04 12:08:54 -0500255
George Keishing1a23b692017-05-06 12:19:41 -0500256 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500257 Run Keyword If
258 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500259 ... Shutdown HTX Exerciser
260
George Keishingae5d9782017-06-12 13:35:59 -0500261 ${keyword_buf}= Catenate Stop SOL Console Logging
262 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
263 Run Key ${keyword_buf}
264
George Keishingffbe8ce2017-05-04 12:08:54 -0500265 FFDC On Test Case Fail
266 Close All Connections