blob: f0a0fbad4842fc23199e89a8f58724026046de68 [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 Sombar2c97f812017-10-31 09:55:13 -050015# $HTX_LOOP times checking for errors every $HTX_INTERVAL.
16# Then allow extra time for OS Boot, HTX startup, shutdown.
Steven Sombar130a04f2017-07-16 10:02:37 -050017# HTX_KEEP_RUNNING If set to 1, this indicates that the HTX is to
Steven Sombar2c97f812017-10-31 09:55:13 -050018# continue running after an error was found.
Steven Sombara2f166c2017-08-02 14:22:45 -050019# CHECK_INVENTORY If set to 0 or False, OS inventory checking before
20# and after each HTX run will be disabled. This
Steven Sombar2c97f812017-10-31 09:55:13 -050021# parameter is optional. The default value is True.
Steven Sombara2f166c2017-08-02 14:22:45 -050022# PREV_INV_FILE_PATH The file path and name of an initial previous
23# inventory snapshot file in JSON format. Inventory
24# snapshots taken before and after each HTX run will
25# be compared to this file.
Steven Sombar2c97f812017-10-31 09:55:13 -050026# This parameter is optional. If not specified an
Steven Sombara2f166c2017-08-02 14:22:45 -050027# initial inventory snapshot will be taken before
28# HTX startup.
Steven Sombarb6749a62017-10-06 08:34:23 -050029# INV_IGNORE_LIST A comma-delimited list of strings that
Steven Sombar48ad01d2017-08-17 14:17:37 -050030# indicate what to ignore if there are inventory
Steven Sombarb6749a62017-10-06 08:34:23 -050031# differences, (e.g., processor "size").
Steven Sombar48ad01d2017-08-17 14:17:37 -050032# If differences are found during inventory checking
Steven Sombarb6749a62017-10-06 08:34:23 -050033# and those items are in this list, the
Steven Sombar48ad01d2017-08-17 14:17:37 -050034# differences will be ignored. This parameter is
35# optional. If not specified the default value is
Steven Sombarb6749a62017-10-06 08:34:23 -050036# "size".
Steven Sombar130a04f2017-07-16 10:02:37 -050037
38Resource ../syslib/utils_os.robot
George Keishingdc1691d2017-12-07 12:17:46 -060039Resource ../lib/openbmc_ffdc_utils.robot
Steven Sombar130a04f2017-07-16 10:02:37 -050040Library ../syslib/utils_keywords.py
Steven Sombarb6749a62017-10-06 08:34:23 -050041Library ../lib/utils_files.py
George Keishingffbe8ce2017-05-04 12:08:54 -050042
Steven Sombar16dba512017-10-20 07:20:08 -050043Suite Setup Run Keyword Start SOL Console Logging
George Keishingdc1691d2017-12-07 12:17:46 -060044Test Setup Test Setup Execution
45Test Teardown Test Teardown Execution
George Keishing8b082fd2017-05-03 13:42:39 -050046
Steven Sombar6f9d41d2017-08-08 13:35:30 -050047
George Keishing8b082fd2017-05-03 13:42:39 -050048*** Variables ****
49
Steven Sombar130a04f2017-07-16 10:02:37 -050050${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050051${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
52${json_final_file_path} ${EXECDIR}/os_inventory_final.json
53${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombara2f166c2017-08-02 14:22:45 -050054${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050055${INV_IGNORE_LIST} size
Steven Sombar2c97f812017-10-31 09:55:13 -050056${PREV_INV_FILE_PATH} NONE
George Keishingffbe8ce2017-05-04 12:08:54 -050057
Steven Sombar6f9d41d2017-08-08 13:35:30 -050058
George Keishing8b082fd2017-05-03 13:42:39 -050059*** Test Cases ***
60
61Hard Bootme Test
62 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050063 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050064
Steven Sombar48ad01d2017-08-17 14:17:37 -050065 Rprintn
Steven Sombar2c97f812017-10-31 09:55:13 -050066 Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
67 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050068
Steven Sombar2c97f812017-10-31 09:55:13 -050069 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
70 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050071
Steven Sombar2c97f812017-10-31 09:55:13 -050072 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050073 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050074
75 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050076 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050077
Steven Sombar2c97f812017-10-31 09:55:13 -050078 # Estimate the time required for a single iteration loop.
79 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
80 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
81 Set Suite Variable ${loop_body_seconds} children=true
82 # And save it in printable (compact) format.
83 ${estimated_loop_time}= Convert Time
84 ... ${loop_body_seconds} result_format=compact
85 Set Suite Variable ${estimated_loop_time} children=true
86
87 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
88 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
89 Set Suite Variable ${est_seconds_left} children=true
90
Steven Sombar130a04f2017-07-16 10:02:37 -050091 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050092
93
94*** Keywords ***
95
Steven Sombar16dba512017-10-20 07:20:08 -050096
Steven Sombar130a04f2017-07-16 10:02:37 -050097Run HTX Exerciser
98 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050099 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -0500100 # - Power on.
101 # - Establish SSH connection session.
102 # - Do inventory collection, compare with
103 # previous inventory run if applicable.
104 # - Create HTX mdt profile.
105 # - Run HTX exerciser.
106 # - Check HTX status for errors.
107 # - Do inventory collection, compare with
108 # previous inventory run.
109 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500110
Steven Sombar16dba512017-10-20 07:20:08 -0500111 Set Suite Variable ${iteration} ${iteration + 1}
112 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500113 ${estimated_time_remaining}= Convert Time
114 ... ${est_seconds_left} result_format=compact
115 Rprintn
116 Rpvars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500117
George Keishingffbe8ce2017-05-04 12:08:54 -0500118 Boot To OS
119
120 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500121 Login To OS
122
Steven Sombara2f166c2017-08-02 14:22:45 -0500123 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500124 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500125 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500126
George Keishing13f44e52017-05-12 15:28:12 -0500127 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
128 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500129
George Keishing13f44e52017-05-12 15:28:12 -0500130 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500131
132 Loop HTX Health Check
133
George Keishingffbe8ce2017-05-04 12:08:54 -0500134 Shutdown HTX Exerciser
135
Steven Sombara2f166c2017-08-02 14:22:45 -0500136 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500137 ... Do Inventory And Compare ${json_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500138 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500139
George Keishingdc1691d2017-12-07 12:17:46 -0600140 Error Logs Should Not Exist
George Keishingffbe8ce2017-05-04 12:08:54 -0500141 Power Off Host
142
George Keishingae5d9782017-06-12 13:35:59 -0500143 # Close all SSH and REST active sessions.
144 Close All Connections
145 Flush REST Sessions
146
George Keishingffbe8ce2017-05-04 12:08:54 -0500147 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500148
Steven Sombar16dba512017-10-20 07:20:08 -0500149 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500150
151 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
152 Set Suite Variable ${est_seconds_left} children=true
153 ${estimated_time_remaining}= Convert Time
154 ... ${est_seconds_left} result_format=compact
155
156 Rpvars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500157
George Keishing13f44e52017-05-12 15:28:12 -0500158
Steven Sombara2f166c2017-08-02 14:22:45 -0500159Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500160 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500161 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500162 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500163 # inventory_file_path The file to receive the inventory snapshot.
164 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500165
166 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500167 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500168 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500169 ... ${PREV_INV_FILE_PATH}
170 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
171 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500172
173
174Compare Json Inventory Files
175 [Documentation] Compare JSON inventory files.
176 [Arguments] ${file1} ${file2}
177 # Description of argument(s):
178 # file1 A file that has an inventory snapshot in JSON format.
179 # file2 A file that has an inventory snapshot, to compare with file1.
180
Steven Sombarb6749a62017-10-06 08:34:23 -0500181 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500182 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500183 Run Keyword If '${diff_rc}' != '${0}'
184 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
185
186
187Report Inventory Mismatch
188 [Documentation] Report inventory mismatch.
189 [Arguments] ${diff_rc} ${json_diff_file_path}
190 # Description of argument(s):
191 # diff_rc The failing return code from the difference check.
192 # json_diff_file_path The file that has the latest inventory snapshot.
193
Steven Sombara2216d22017-08-09 12:18:00 -0500194 Log To Console Significant difference in inventory found, rc=${diff_rc}
195 Log To Console Differences are listed in file: no_newline=true
196 Log To Console ${json_diff_file_path}
197 Log To Console File Contents:
198 Wait Until Created ${json_diff_file_path}
199 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
200 Log ${file_contents} level=WARN
201 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500202
203
George Keishing8b082fd2017-05-03 13:42:39 -0500204Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500205 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500206 Repeat Keyword ${HTX_DURATION}
207 ... Run Keywords Check HTX Run Status
208 ... AND Sleep ${HTX_INTERVAL}
209
210
George Keishingdc1691d2017-12-07 12:17:46 -0600211Test Teardown Execution
George Keishingffbe8ce2017-05-04 12:08:54 -0500212 [Documentation] Do the post test teardown.
213 # 1. Shut down HTX exerciser if test Failed.
214 # 2. Capture FFDC on test failure.
215 # 3. Close all open SSH connections.
216
George Keishing1a23b692017-05-06 12:19:41 -0500217 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500218 Run Keyword If
219 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500220 ... Shutdown HTX Exerciser
221
George Keishingae5d9782017-06-12 13:35:59 -0500222 ${keyword_buf}= Catenate Stop SOL Console Logging
223 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
224 Run Key ${keyword_buf}
225
George Keishingffbe8ce2017-05-04 12:08:54 -0500226 FFDC On Test Case Fail
227 Close All Connections