blob: c1b2fd5695d0438be679d17fc4565ef6b65ca475 [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 Sombar130a04f2017-07-16 10:02:37 -050041Library ../syslib/utils_keywords.py
Steven Sombarb6749a62017-10-06 08:34:23 -050042Library ../lib/utils_files.py
George Keishingffbe8ce2017-05-04 12:08:54 -050043
Steven Sombar16dba512017-10-20 07:20:08 -050044Suite Setup Run Keyword Start SOL Console Logging
George Keishingdc1691d2017-12-07 12:17:46 -060045Test Setup Test Setup Execution
46Test Teardown Test Teardown Execution
George Keishing8b082fd2017-05-03 13:42:39 -050047
Steven Sombar6f9d41d2017-08-08 13:35:30 -050048
George Keishing8b082fd2017-05-03 13:42:39 -050049*** Variables ****
50
Steven Sombar130a04f2017-07-16 10:02:37 -050051${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050052${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
53${json_final_file_path} ${EXECDIR}/os_inventory_final.json
54${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombara2f166c2017-08-02 14:22:45 -050055${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050056${INV_IGNORE_LIST} size
Steven Sombar2c97f812017-10-31 09:55:13 -050057${PREV_INV_FILE_PATH} NONE
George Keishingffbe8ce2017-05-04 12:08:54 -050058
Steven Sombar6f9d41d2017-08-08 13:35:30 -050059
George Keishing8b082fd2017-05-03 13:42:39 -050060*** Test Cases ***
61
62Hard Bootme Test
63 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050064 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050065
Steven Sombar48ad01d2017-08-17 14:17:37 -050066 Rprintn
Steven Sombar2c97f812017-10-31 09:55:13 -050067 Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
68 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050069
Steven Sombar2c97f812017-10-31 09:55:13 -050070 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
71 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050072
Steven Sombar2c97f812017-10-31 09:55:13 -050073 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050074 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050075
76 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050077 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050078
Steven Sombar2c97f812017-10-31 09:55:13 -050079 # Estimate the time required for a single iteration loop.
80 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
81 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
82 Set Suite Variable ${loop_body_seconds} children=true
83 # And save it in printable (compact) format.
84 ${estimated_loop_time}= Convert Time
85 ... ${loop_body_seconds} result_format=compact
86 Set Suite Variable ${estimated_loop_time} children=true
87
88 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
89 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
90 Set Suite Variable ${est_seconds_left} children=true
91
Steven Sombar130a04f2017-07-16 10:02:37 -050092 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050093
94
95*** Keywords ***
96
Steven Sombar16dba512017-10-20 07:20:08 -050097
Steven Sombar130a04f2017-07-16 10:02:37 -050098Run HTX Exerciser
99 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -0500100 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -0500101 # - Power on.
102 # - Establish SSH connection session.
103 # - Do inventory collection, compare with
104 # previous inventory run if applicable.
105 # - Create HTX mdt profile.
106 # - Run HTX exerciser.
107 # - Check HTX status for errors.
108 # - Do inventory collection, compare with
109 # previous inventory run.
110 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500111
Steven Sombar16dba512017-10-20 07:20:08 -0500112 Set Suite Variable ${iteration} ${iteration + 1}
113 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500114 ${estimated_time_remaining}= Convert Time
115 ... ${est_seconds_left} result_format=compact
116 Rprintn
117 Rpvars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500118
Steven Sombar0278b132018-01-09 14:41:32 -0600119 REST Power On stack_mode=skip
George Keishingffbe8ce2017-05-04 12:08:54 -0500120
121 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500122 Login To OS
123
Steven Sombara2f166c2017-08-02 14:22:45 -0500124 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500125 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500126 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500127
George Keishing13f44e52017-05-12 15:28:12 -0500128 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
129 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500130
George Keishing13f44e52017-05-12 15:28:12 -0500131 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500132
133 Loop HTX Health Check
134
George Keishingffbe8ce2017-05-04 12:08:54 -0500135 Shutdown HTX Exerciser
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_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500139 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500140
George Keishingdc1691d2017-12-07 12:17:46 -0600141 Error Logs Should Not Exist
George Keishingffbe8ce2017-05-04 12:08:54 -0500142 Power Off Host
143
George Keishingae5d9782017-06-12 13:35:59 -0500144 # Close all SSH and REST active sessions.
145 Close All Connections
146 Flush REST Sessions
147
George Keishingffbe8ce2017-05-04 12:08:54 -0500148 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500149
Steven Sombar16dba512017-10-20 07:20:08 -0500150 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500151
152 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
153 Set Suite Variable ${est_seconds_left} children=true
154 ${estimated_time_remaining}= Convert Time
155 ... ${est_seconds_left} result_format=compact
156
157 Rpvars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500158
George Keishing13f44e52017-05-12 15:28:12 -0500159
Steven Sombara2f166c2017-08-02 14:22:45 -0500160Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500161 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500162 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500163 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500164 # inventory_file_path The file to receive the inventory snapshot.
165 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500166
167 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500168 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500169 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500170 ... ${PREV_INV_FILE_PATH}
171 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
172 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500173
174
175Compare Json Inventory Files
176 [Documentation] Compare JSON inventory files.
177 [Arguments] ${file1} ${file2}
178 # Description of argument(s):
179 # file1 A file that has an inventory snapshot in JSON format.
180 # file2 A file that has an inventory snapshot, to compare with file1.
181
Steven Sombarb6749a62017-10-06 08:34:23 -0500182 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500183 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500184 Run Keyword If '${diff_rc}' != '${0}'
185 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
186
187
188Report Inventory Mismatch
189 [Documentation] Report inventory mismatch.
190 [Arguments] ${diff_rc} ${json_diff_file_path}
191 # Description of argument(s):
192 # diff_rc The failing return code from the difference check.
193 # json_diff_file_path The file that has the latest inventory snapshot.
194
Steven Sombara2216d22017-08-09 12:18:00 -0500195 Log To Console Significant difference in inventory found, rc=${diff_rc}
196 Log To Console Differences are listed in file: no_newline=true
197 Log To Console ${json_diff_file_path}
198 Log To Console File Contents:
199 Wait Until Created ${json_diff_file_path}
200 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
201 Log ${file_contents} level=WARN
202 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500203
204
George Keishing8b082fd2017-05-03 13:42:39 -0500205Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500206 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500207 Repeat Keyword ${HTX_DURATION}
208 ... Run Keywords Check HTX Run Status
209 ... AND Sleep ${HTX_INTERVAL}
210
211
Steven Sombar0278b132018-01-09 14:41:32 -0600212Test Setup Execution
213 [Documentation] Do the initial test setup.
214
215 REST Power On stack_mode=skip
216 Delete All Error Logs
217 Tool Exist htxcmdline
218
219 # Shutdown if HTX is running.
220 ${status}= Run Keyword And Return Status Is HTX Running
221 Run Keyword If '${status}' == 'True'
222 ... Shutdown HTX Exerciser
223
224
George Keishingdc1691d2017-12-07 12:17:46 -0600225Test Teardown Execution
George Keishingffbe8ce2017-05-04 12:08:54 -0500226 [Documentation] Do the post test teardown.
227 # 1. Shut down HTX exerciser if test Failed.
228 # 2. Capture FFDC on test failure.
229 # 3. Close all open SSH connections.
230
George Keishing1a23b692017-05-06 12:19:41 -0500231 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500232 Run Keyword If
233 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500234 ... Shutdown HTX Exerciser
235
George Keishingae5d9782017-06-12 13:35:59 -0500236 ${keyword_buf}= Catenate Stop SOL Console Logging
237 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
238 Run Key ${keyword_buf}
239
George Keishingffbe8ce2017-05-04 12:08:54 -0500240 FFDC On Test Case Fail
241 Close All Connections