blob: b2399d4bd5f36fbbfeac2355edfc528341de471c [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 Sombar3839c8c2019-09-09 14:39:45 -050043Resource ../lib/esel_utils.robot
Steven Sombar130a04f2017-07-16 10:02:37 -050044Library ../syslib/utils_keywords.py
Steven Sombarb6749a62017-10-06 08:34:23 -050045Library ../lib/utils_files.py
Steven Sombar3ecb6892018-03-23 11:41:08 -050046Library ../lib/logging_utils.py
Steven Sombare0be9152018-08-08 08:22:53 -050047Library ../syslib/utils_os.py
George Keishingffbe8ce2017-05-04 12:08:54 -050048
Steven Sombar16dba512017-10-20 07:20:08 -050049Suite Setup Run Keyword Start SOL Console Logging
George Keishingdc1691d2017-12-07 12:17:46 -060050Test Setup Test Setup Execution
51Test Teardown Test Teardown Execution
George Keishing8b082fd2017-05-03 13:42:39 -050052
Steven Sombar6f9d41d2017-08-08 13:35:30 -050053
George Keishing8b082fd2017-05-03 13:42:39 -050054*** Variables ****
55
Steven Sombar130a04f2017-07-16 10:02:37 -050056${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050057${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
58${json_final_file_path} ${EXECDIR}/os_inventory_final.json
59${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombara2f166c2017-08-02 14:22:45 -050060${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050061${INV_IGNORE_LIST} size
Steven Sombar2c97f812017-10-31 09:55:13 -050062${PREV_INV_FILE_PATH} NONE
George Keishingffbe8ce2017-05-04 12:08:54 -050063
Steven Sombar377a2cd2019-04-09 11:42:56 -050064${rest_keyword} REST
65
Steven Sombar3839c8c2019-09-09 14:39:45 -050066# Error log Severities to ignore when checking Error Logs.
Steven Sombard6365f12019-04-02 09:38:29 -050067@{ESEL_WHITELIST}
68... xyz.openbmc_project.Logging.Entry.Level.Informational
69
Steven Sombar6f9d41d2017-08-08 13:35:30 -050070
Steven Sombar3839c8c2019-09-09 14:39:45 -050071
George Keishing8b082fd2017-05-03 13:42:39 -050072*** Test Cases ***
73
74Hard Bootme Test
75 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050076 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050077
Michael Walshc108e422019-03-28 12:27:18 -050078 Printn
Michael Walsh0d5f96a2019-05-20 10:09:57 -050079 Rprint Vars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
Steven Sombar2c97f812017-10-31 09:55:13 -050080 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050081
Steven Sombar2c97f812017-10-31 09:55:13 -050082 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
83 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050084
Steven Sombar2c97f812017-10-31 09:55:13 -050085 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050086 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050087
88 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050089 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050090
Steven Sombar2c97f812017-10-31 09:55:13 -050091 # Estimate the time required for a single iteration loop.
92 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
93 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
94 Set Suite Variable ${loop_body_seconds} children=true
95 # And save it in printable (compact) format.
96 ${estimated_loop_time}= Convert Time
97 ... ${loop_body_seconds} result_format=compact
98 Set Suite Variable ${estimated_loop_time} children=true
99
100 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
101 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
102 Set Suite Variable ${est_seconds_left} children=true
103
Steven Sombar130a04f2017-07-16 10:02:37 -0500104 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -0500105
106
107*** Keywords ***
108
Steven Sombar16dba512017-10-20 07:20:08 -0500109
Steven Sombar130a04f2017-07-16 10:02:37 -0500110Run HTX Exerciser
111 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -0500112 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -0500113 # - Power on.
114 # - Establish SSH connection session.
115 # - Do inventory collection, compare with
116 # previous inventory run if applicable.
117 # - Create HTX mdt profile.
118 # - Run HTX exerciser.
119 # - Check HTX status for errors.
120 # - Do inventory collection, compare with
121 # previous inventory run.
122 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500123
Steven Sombar16dba512017-10-20 07:20:08 -0500124 Set Suite Variable ${iteration} ${iteration + 1}
125 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500126 ${estimated_time_remaining}= Convert Time
127 ... ${est_seconds_left} result_format=compact
Michael Walshc108e422019-03-28 12:27:18 -0500128 Printn
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500129 Rprint Vars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500130
Steven Sombar377a2cd2019-04-09 11:42:56 -0500131 Run Keyword ${rest_keyword} Power On stack_mode=skip
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500132 Run Key U Sleep \ 15s
George Keishingffbe8ce2017-05-04 12:08:54 -0500133
134 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500135 Login To OS
136
Steven Sombara2f166c2017-08-02 14:22:45 -0500137 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500138 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500139 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500140
George Keishing13f44e52017-05-12 15:28:12 -0500141 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
142 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500143
George Keishing13f44e52017-05-12 15:28:12 -0500144 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500145
146 Loop HTX Health Check
147
George Keishingffbe8ce2017-05-04 12:08:54 -0500148 Shutdown HTX Exerciser
149
Steven Sombara2f166c2017-08-02 14:22:45 -0500150 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500151 ... Do Inventory And Compare ${json_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500152 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500153
Steven Sombar377a2cd2019-04-09 11:42:56 -0500154 Run Keyword ${rest_keyword} Power Off
George Keishingffbe8ce2017-05-04 12:08:54 -0500155
George Keishingae5d9782017-06-12 13:35:59 -0500156 # Close all SSH and REST active sessions.
157 Close All Connections
158 Flush REST Sessions
159
Michael Walshc108e422019-03-28 12:27:18 -0500160 Print Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500161
Steven Sombar16dba512017-10-20 07:20:08 -0500162 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500163
164 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
165 Set Suite Variable ${est_seconds_left} children=true
166 ${estimated_time_remaining}= Convert Time
167 ... ${est_seconds_left} result_format=compact
168
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500169 Rprint Vars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500170
George Keishing13f44e52017-05-12 15:28:12 -0500171
Steven Sombara2f166c2017-08-02 14:22:45 -0500172Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500173 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500174 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500175 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500176 # inventory_file_path The file to receive the inventory snapshot.
177 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500178
179 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500180 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500181 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500182 ... ${PREV_INV_FILE_PATH}
183 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
184 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500185
186
187Compare Json Inventory Files
188 [Documentation] Compare JSON inventory files.
189 [Arguments] ${file1} ${file2}
190 # Description of argument(s):
191 # file1 A file that has an inventory snapshot in JSON format.
192 # file2 A file that has an inventory snapshot, to compare with file1.
193
Steven Sombarb6749a62017-10-06 08:34:23 -0500194 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500195 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500196 Run Keyword If '${diff_rc}' != '${0}'
197 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
Michael Walshc108e422019-03-28 12:27:18 -0500198 ... ELSE Print Timen Inventoy check: No differences found.
Steven Sombar130a04f2017-07-16 10:02:37 -0500199
200
201Report Inventory Mismatch
202 [Documentation] Report inventory mismatch.
203 [Arguments] ${diff_rc} ${json_diff_file_path}
204 # Description of argument(s):
205 # diff_rc The failing return code from the difference check.
206 # json_diff_file_path The file that has the latest inventory snapshot.
207
Steven Sombara2216d22017-08-09 12:18:00 -0500208 Log To Console Significant difference in inventory found, rc=${diff_rc}
209 Log To Console Differences are listed in file: no_newline=true
210 Log To Console ${json_diff_file_path}
211 Log To Console File Contents:
212 Wait Until Created ${json_diff_file_path}
213 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
214 Log ${file_contents} level=WARN
215 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500216
217
George Keishing8b082fd2017-05-03 13:42:39 -0500218Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500219 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500220 Repeat Keyword ${HTX_DURATION}
221 ... Run Keywords Check HTX Run Status
Steven Sombar3839c8c2019-09-09 14:39:45 -0500222 ... AND Check For Error Logs ${ESEL_WHITELIST}
George Keishing8b082fd2017-05-03 13:42:39 -0500223 ... AND Sleep ${HTX_INTERVAL}
224
225
Steven Sombar0278b132018-01-09 14:41:32 -0600226Test Setup Execution
227 [Documentation] Do the initial test setup.
228
Steven Sombarac687c42018-08-09 13:39:36 -0500229 ${bmc_version} ${stderr} ${rc}= BMC Execute Command
230 ... cat /etc/os-release
Michael Walshc108e422019-03-28 12:27:18 -0500231 Printn
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500232 Rprint Vars bmc_version
Steven Sombare0be9152018-08-08 08:22:53 -0500233
George Keishing559f8382018-10-28 02:17:49 -0500234 ${pnor_version}= Get Host Software Objects Details
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500235 Rprint Vars pnor_version
Steven Sombare0be9152018-08-08 08:22:53 -0500236
Steven Sombar377a2cd2019-04-09 11:42:56 -0500237 ${is_redfish}= Run Keyword And Return Status Redfish.Login
238 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
239 Rprint Vars rest_keyword
240 Set Suite Variable ${rest_keyword} children=true
241
242 Run Keyword ${rest_keyword} Power On stack_mode=skip
243
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500244 Run Key U Sleep \ 15s
Steven Sombar0278b132018-01-09 14:41:32 -0600245 Delete All Error Logs
246 Tool Exist htxcmdline
247
Steven Sombarac687c42018-08-09 13:39:36 -0500248 ${os_release_info}= Get OS Release Info
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500249 Rprint Vars os_release_info fmt=1
Steven Sombarac687c42018-08-09 13:39:36 -0500250
Steven Sombar0278b132018-01-09 14:41:32 -0600251 # Shutdown if HTX is running.
Steven Sombar3ecb6892018-03-23 11:41:08 -0500252 ${status}= Is HTX Running
Steven Sombar0278b132018-01-09 14:41:32 -0600253 Run Keyword If '${status}' == 'True'
254 ... Shutdown HTX Exerciser
255
256
George Keishingdc1691d2017-12-07 12:17:46 -0600257Test Teardown Execution
Steven Sombare0be9152018-08-08 08:22:53 -0500258 [Documentation] Do the post-test teardown.
George Keishingffbe8ce2017-05-04 12:08:54 -0500259
George Keishing1a23b692017-05-06 12:19:41 -0500260 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500261 Run Keyword If
262 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500263 ... Shutdown HTX Exerciser
264
George Keishingae5d9782017-06-12 13:35:59 -0500265 ${keyword_buf}= Catenate Stop SOL Console Logging
266 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
267 Run Key ${keyword_buf}
268
George Keishingffbe8ce2017-05-04 12:08:54 -0500269 FFDC On Test Case Fail
270 Close All Connections