blob: 360d3687308bfcfe76004ded6cbd367ce8b9a1c0 [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
Peter D Phan4a8b3bb2022-03-08 10:32:08 -060044Resource ../syslib/resource.robot
Steven Sombar130a04f2017-07-16 10:02:37 -050045Library ../syslib/utils_keywords.py
Steven Sombarb6749a62017-10-06 08:34:23 -050046Library ../lib/utils_files.py
Steven Sombar3ecb6892018-03-23 11:41:08 -050047Library ../lib/logging_utils.py
Steven Sombare0be9152018-08-08 08:22:53 -050048Library ../syslib/utils_os.py
George Keishingffbe8ce2017-05-04 12:08:54 -050049
sarandev37459c422023-11-09 01:17:42 -060050Suite Setup Run Keyword And Ignore Error Start SOL Console Logging
George Keishingdc1691d2017-12-07 12:17:46 -060051Test Setup Test Setup Execution
52Test Teardown Test Teardown Execution
George Keishing8b082fd2017-05-03 13:42:39 -050053
George Keishing87dc4422023-10-20 12:56:30 +053054Force Tags HTX_Hardbootme
Steven Sombar6f9d41d2017-08-08 13:35:30 -050055
George Keishing8b082fd2017-05-03 13:42:39 -050056*** Variables ****
57
Steven Sombar130a04f2017-07-16 10:02:37 -050058${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050059${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
60${json_final_file_path} ${EXECDIR}/os_inventory_final.json
61${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombara2f166c2017-08-02 14:22:45 -050062${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050063${INV_IGNORE_LIST} size
Steven Sombar2c97f812017-10-31 09:55:13 -050064${PREV_INV_FILE_PATH} NONE
George Keishingffbe8ce2017-05-04 12:08:54 -050065
Steven Sombar377a2cd2019-04-09 11:42:56 -050066${rest_keyword} REST
67
Steven Sombar3839c8c2019-09-09 14:39:45 -050068# Error log Severities to ignore when checking Error Logs.
George Keishing178d9bf2020-07-09 08:29:29 -050069@{ESEL_IGNORE_LIST}
Steven Sombard6365f12019-04-02 09:38:29 -050070... xyz.openbmc_project.Logging.Entry.Level.Informational
71
Steven Sombar6f9d41d2017-08-08 13:35:30 -050072
Steven Sombar3839c8c2019-09-09 14:39:45 -050073
George Keishing8b082fd2017-05-03 13:42:39 -050074*** Test Cases ***
75
76Hard Bootme Test
77 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050078 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050079
Michael Walshc108e422019-03-28 12:27:18 -050080 Printn
Michael Walsh0d5f96a2019-05-20 10:09:57 -050081 Rprint Vars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
Steven Sombar2c97f812017-10-31 09:55:13 -050082 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050083
Steven Sombar2c97f812017-10-31 09:55:13 -050084 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
85 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050086
Steven Sombar2c97f812017-10-31 09:55:13 -050087 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050088 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050089
90 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050091 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050092
Steven Sombar2c97f812017-10-31 09:55:13 -050093 # Estimate the time required for a single iteration loop.
94 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
95 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
96 Set Suite Variable ${loop_body_seconds} children=true
97 # And save it in printable (compact) format.
98 ${estimated_loop_time}= Convert Time
99 ... ${loop_body_seconds} result_format=compact
100 Set Suite Variable ${estimated_loop_time} children=true
101
102 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
103 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
104 Set Suite Variable ${est_seconds_left} children=true
105
Steven Sombar130a04f2017-07-16 10:02:37 -0500106 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -0500107
108
109*** Keywords ***
110
Steven Sombar16dba512017-10-20 07:20:08 -0500111
Steven Sombar130a04f2017-07-16 10:02:37 -0500112Run HTX Exerciser
113 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -0500114 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -0500115 # - Power on.
116 # - Establish SSH connection session.
117 # - Do inventory collection, compare with
118 # previous inventory run if applicable.
119 # - Create HTX mdt profile.
120 # - Run HTX exerciser.
121 # - Check HTX status for errors.
122 # - Do inventory collection, compare with
123 # previous inventory run.
124 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500125
Steven Sombar16dba512017-10-20 07:20:08 -0500126 Set Suite Variable ${iteration} ${iteration + 1}
127 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500128 ${estimated_time_remaining}= Convert Time
129 ... ${est_seconds_left} result_format=compact
Michael Walshc108e422019-03-28 12:27:18 -0500130 Printn
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500131 Rprint Vars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500132
Steven Sombar377a2cd2019-04-09 11:42:56 -0500133 Run Keyword ${rest_keyword} Power On stack_mode=skip
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500134 Run Key U Sleep \ 15s
George Keishingffbe8ce2017-05-04 12:08:54 -0500135
136 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500137 Login To OS
138
Steven Sombara2f166c2017-08-02 14:22:45 -0500139 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500140 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500141 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500142
George Keishing13f44e52017-05-12 15:28:12 -0500143 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
144 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500145
George Keishing13f44e52017-05-12 15:28:12 -0500146 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500147
148 Loop HTX Health Check
149
George Keishingffbe8ce2017-05-04 12:08:54 -0500150 Shutdown HTX Exerciser
151
Steven Sombara2f166c2017-08-02 14:22:45 -0500152 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500153 ... Do Inventory And Compare ${json_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500154 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500155
Steven Sombar377a2cd2019-04-09 11:42:56 -0500156 Run Keyword ${rest_keyword} Power Off
George Keishingffbe8ce2017-05-04 12:08:54 -0500157
George Keishingae5d9782017-06-12 13:35:59 -0500158 # Close all SSH and REST active sessions.
159 Close All Connections
160 Flush REST Sessions
161
Michael Walshc108e422019-03-28 12:27:18 -0500162 Print Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500163
Steven Sombar16dba512017-10-20 07:20:08 -0500164 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500165
166 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
167 Set Suite Variable ${est_seconds_left} children=true
168 ${estimated_time_remaining}= Convert Time
169 ... ${est_seconds_left} result_format=compact
170
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500171 Rprint Vars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500172
George Keishing13f44e52017-05-12 15:28:12 -0500173
Steven Sombara2f166c2017-08-02 14:22:45 -0500174Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500175 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500176 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500177 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500178 # inventory_file_path The file to receive the inventory snapshot.
179 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500180
181 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500182 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500183 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500184 ... ${PREV_INV_FILE_PATH}
185 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
186 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500187
188
189Compare Json Inventory Files
190 [Documentation] Compare JSON inventory files.
191 [Arguments] ${file1} ${file2}
192 # Description of argument(s):
193 # file1 A file that has an inventory snapshot in JSON format.
194 # file2 A file that has an inventory snapshot, to compare with file1.
195
Steven Sombarb6749a62017-10-06 08:34:23 -0500196 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500197 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500198 Run Keyword If '${diff_rc}' != '${0}'
199 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
Michael Walshc108e422019-03-28 12:27:18 -0500200 ... ELSE Print Timen Inventoy check: No differences found.
Steven Sombar130a04f2017-07-16 10:02:37 -0500201
202
203Report Inventory Mismatch
204 [Documentation] Report inventory mismatch.
205 [Arguments] ${diff_rc} ${json_diff_file_path}
206 # Description of argument(s):
207 # diff_rc The failing return code from the difference check.
208 # json_diff_file_path The file that has the latest inventory snapshot.
209
Steven Sombara2216d22017-08-09 12:18:00 -0500210 Log To Console Significant difference in inventory found, rc=${diff_rc}
211 Log To Console Differences are listed in file: no_newline=true
212 Log To Console ${json_diff_file_path}
213 Log To Console File Contents:
214 Wait Until Created ${json_diff_file_path}
215 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
216 Log ${file_contents} level=WARN
217 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500218
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
George Keishing178d9bf2020-07-09 08:29:29 -0500224 ... AND Check For Error Logs ${ESEL_IGNORE_LIST}
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
Michael Walshc108e422019-03-28 12:27:18 -0500233 Printn
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500234 Rprint Vars bmc_version
Steven Sombare0be9152018-08-08 08:22:53 -0500235
George Keishing1ad128c2021-10-28 09:38:37 -0500236 ${fw_version}= Get BMC Version
237 Rprint Vars fw_version
Steven Sombare0be9152018-08-08 08:22:53 -0500238
Steven Sombar377a2cd2019-04-09 11:42:56 -0500239 ${is_redfish}= Run Keyword And Return Status Redfish.Login
240 ${rest_keyword}= Set Variable If ${is_redfish} Redfish REST
241 Rprint Vars rest_keyword
242 Set Suite Variable ${rest_keyword} children=true
243
244 Run Keyword ${rest_keyword} Power On stack_mode=skip
245
Steven Sombar1ddc7c62018-06-01 11:55:34 -0500246 Run Key U Sleep \ 15s
George Keishing1ad128c2021-10-28 09:38:37 -0500247 Run Keyword And Ignore Error Delete All Error Logs
248 Run Keyword And Ignore Error Redfish Purge Event Log
Steven Sombar0278b132018-01-09 14:41:32 -0600249 Tool Exist htxcmdline
250
George Keishing1ad128c2021-10-28 09:38:37 -0500251 ${os_release_info}= utils_os.Get OS Release Info uname
Michael Walsh0d5f96a2019-05-20 10:09:57 -0500252 Rprint Vars os_release_info fmt=1
Steven Sombarac687c42018-08-09 13:39:36 -0500253
Steven Sombar0278b132018-01-09 14:41:32 -0600254 # Shutdown if HTX is running.
Steven Sombar3ecb6892018-03-23 11:41:08 -0500255 ${status}= Is HTX Running
Steven Sombar0278b132018-01-09 14:41:32 -0600256 Run Keyword If '${status}' == 'True'
257 ... Shutdown HTX Exerciser
258
259
George Keishingdc1691d2017-12-07 12:17:46 -0600260Test Teardown Execution
Steven Sombare0be9152018-08-08 08:22:53 -0500261 [Documentation] Do the post-test teardown.
George Keishingffbe8ce2017-05-04 12:08:54 -0500262
George Keishing1a23b692017-05-06 12:19:41 -0500263 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500264 Run Keyword If
265 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500266 ... Shutdown HTX Exerciser
267
George Keishingae5d9782017-06-12 13:35:59 -0500268 ${keyword_buf}= Catenate Stop SOL Console Logging
269 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
sarandev37459c422023-11-09 01:17:42 -0600270 Run Keyword And Ignore Error ${keyword_buf}
George Keishingae5d9782017-06-12 13:35:59 -0500271
George Keishingffbe8ce2017-05-04 12:08:54 -0500272 FFDC On Test Case Fail
273 Close All Connections