blob: 8dd89a1d2ae7dc7649cfffdab073eec023219551 [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
39Library ../syslib/utils_keywords.py
Steven Sombarb6749a62017-10-06 08:34:23 -050040Library ../lib/utils_files.py
George Keishingffbe8ce2017-05-04 12:08:54 -050041
Steven Sombar16dba512017-10-20 07:20:08 -050042Suite Setup Run Keyword Start SOL Console Logging
George Keishingffbe8ce2017-05-04 12:08:54 -050043Test Setup Pre Test Case Execution
44Test Teardown Post Test Case Execution
George Keishing8b082fd2017-05-03 13:42:39 -050045
Steven Sombar6f9d41d2017-08-08 13:35:30 -050046
George Keishing8b082fd2017-05-03 13:42:39 -050047*** Variables ****
48
Steven Sombar130a04f2017-07-16 10:02:37 -050049${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050050${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
51${json_final_file_path} ${EXECDIR}/os_inventory_final.json
52${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombara2f166c2017-08-02 14:22:45 -050053${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050054${INV_IGNORE_LIST} size
Steven Sombar2c97f812017-10-31 09:55:13 -050055${PREV_INV_FILE_PATH} NONE
George Keishingffbe8ce2017-05-04 12:08:54 -050056
Steven Sombar6f9d41d2017-08-08 13:35:30 -050057
George Keishing8b082fd2017-05-03 13:42:39 -050058*** Test Cases ***
59
60Hard Bootme Test
61 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050062 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050063
Steven Sombar48ad01d2017-08-17 14:17:37 -050064 Rprintn
Steven Sombar2c97f812017-10-31 09:55:13 -050065 Rpvars HTX_DURATION HTX_LOOP HTX_INTERVAL CHECK_INVENTORY
66 ... INV_IGNORE_LIST PREV_INV_FILE_PATH
Steven Sombar48ad01d2017-08-17 14:17:37 -050067
Steven Sombar2c97f812017-10-31 09:55:13 -050068 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
69 ... OperatingSystem.File Should Exist ${PREV_INV_FILE_PATH}
Steven Sombar48ad01d2017-08-17 14:17:37 -050070
Steven Sombar2c97f812017-10-31 09:55:13 -050071 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050072 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar2c97f812017-10-31 09:55:13 -050073
74 # Set up the iteration (loop) counter.
Steven Sombar16dba512017-10-20 07:20:08 -050075 Set Suite Variable ${iteration} ${0} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050076
Steven Sombar2c97f812017-10-31 09:55:13 -050077 # Estimate the time required for a single iteration loop.
78 # HTX_DURATION + 10 minutes for OS boot, HTX startup, shutdown.
79 ${loop_body_seconds}= Add Time To Time ${HTX_DURATION} 10m
80 Set Suite Variable ${loop_body_seconds} children=true
81 # And save it in printable (compact) format.
82 ${estimated_loop_time}= Convert Time
83 ... ${loop_body_seconds} result_format=compact
84 Set Suite Variable ${estimated_loop_time} children=true
85
86 # Estimated time remaining = loop_body_seconds * HTX_LOOP + 5m
87 ${est_seconds_left}= Evaluate ${loop_body_seconds}*${HTX_LOOP}+(5*60)
88 Set Suite Variable ${est_seconds_left} children=true
89
Steven Sombar130a04f2017-07-16 10:02:37 -050090 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050091
92
93*** Keywords ***
94
Steven Sombar16dba512017-10-20 07:20:08 -050095
Steven Sombar130a04f2017-07-16 10:02:37 -050096Run HTX Exerciser
97 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050098 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050099 # - Power on.
100 # - Establish SSH connection session.
101 # - Do inventory collection, compare with
102 # previous inventory run if applicable.
103 # - Create HTX mdt profile.
104 # - Run HTX exerciser.
105 # - Check HTX status for errors.
106 # - Do inventory collection, compare with
107 # previous inventory run.
108 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -0500109
Steven Sombar16dba512017-10-20 07:20:08 -0500110 Set Suite Variable ${iteration} ${iteration + 1}
111 ${loop_count}= Catenate Starting iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500112 ${estimated_time_remaining}= Convert Time
113 ... ${est_seconds_left} result_format=compact
114 Rprintn
115 Rpvars loop_count estimated_loop_time estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500116
George Keishingffbe8ce2017-05-04 12:08:54 -0500117 Boot To OS
118
119 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500120 Login To OS
121
Steven Sombara2f166c2017-08-02 14:22:45 -0500122 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500123 ... Do Inventory And Compare ${json_initial_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500124 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500125
George Keishing13f44e52017-05-12 15:28:12 -0500126 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
127 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500128
George Keishing13f44e52017-05-12 15:28:12 -0500129 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500130
131 Loop HTX Health Check
132
George Keishingffbe8ce2017-05-04 12:08:54 -0500133 Shutdown HTX Exerciser
134
Steven Sombara2f166c2017-08-02 14:22:45 -0500135 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500136 ... Do Inventory And Compare ${json_final_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500137 ... ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500138
George Keishingffbe8ce2017-05-04 12:08:54 -0500139 Power Off Host
140
George Keishingae5d9782017-06-12 13:35:59 -0500141 # Close all SSH and REST active sessions.
142 Close All Connections
143 Flush REST Sessions
144
George Keishingffbe8ce2017-05-04 12:08:54 -0500145 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500146
Steven Sombar16dba512017-10-20 07:20:08 -0500147 ${loop_count}= Catenate Ending iteration: ${iteration}
Steven Sombar2c97f812017-10-31 09:55:13 -0500148
149 ${est_seconds_left}= Evaluate ${est_seconds_left}-${loop_body_seconds}
150 Set Suite Variable ${est_seconds_left} children=true
151 ${estimated_time_remaining}= Convert Time
152 ... ${est_seconds_left} result_format=compact
153
154 Rpvars loop_count estimated_time_remaining
Steven Sombar16dba512017-10-20 07:20:08 -0500155
George Keishing13f44e52017-05-12 15:28:12 -0500156
Steven Sombara2f166c2017-08-02 14:22:45 -0500157Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500158 [Documentation] Do inventory and compare.
Steven Sombar2c97f812017-10-31 09:55:13 -0500159 [Arguments] ${inventory_file_path} ${PREV_INV_FILE_PATH}
Steven Sombar130a04f2017-07-16 10:02:37 -0500160 # Description of argument(s):
Steven Sombar2c97f812017-10-31 09:55:13 -0500161 # inventory_file_path The file to receive the inventory snapshot.
162 # PREV_INV_FILE_PATH The previous inventory to compare with.
Steven Sombar130a04f2017-07-16 10:02:37 -0500163
164 Create JSON Inventory File ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500165 Run Keyword If '${PREV_INV_FILE_PATH}' != 'NONE'
Steven Sombar130a04f2017-07-16 10:02:37 -0500166 ... Compare Json Inventory Files ${inventory_file_path}
Steven Sombar2c97f812017-10-31 09:55:13 -0500167 ... ${PREV_INV_FILE_PATH}
168 ${PREV_INV_FILE_PATH}= Set Variable ${inventory_file_path}
169 Set Suite Variable ${PREV_INV_FILE_PATH} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -0500170
171
172Compare Json Inventory Files
173 [Documentation] Compare JSON inventory files.
174 [Arguments] ${file1} ${file2}
175 # Description of argument(s):
176 # file1 A file that has an inventory snapshot in JSON format.
177 # file2 A file that has an inventory snapshot, to compare with file1.
178
Steven Sombarb6749a62017-10-06 08:34:23 -0500179 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500180 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500181 Run Keyword If '${diff_rc}' != '${0}'
182 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
183
184
185Report Inventory Mismatch
186 [Documentation] Report inventory mismatch.
187 [Arguments] ${diff_rc} ${json_diff_file_path}
188 # Description of argument(s):
189 # diff_rc The failing return code from the difference check.
190 # json_diff_file_path The file that has the latest inventory snapshot.
191
Steven Sombara2216d22017-08-09 12:18:00 -0500192 Log To Console Significant difference in inventory found, rc=${diff_rc}
193 Log To Console Differences are listed in file: no_newline=true
194 Log To Console ${json_diff_file_path}
195 Log To Console File Contents:
196 Wait Until Created ${json_diff_file_path}
197 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
198 Log ${file_contents} level=WARN
199 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500200
201
George Keishing8b082fd2017-05-03 13:42:39 -0500202Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500203 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500204 Repeat Keyword ${HTX_DURATION}
205 ... Run Keywords Check HTX Run Status
206 ... AND Sleep ${HTX_INTERVAL}
207
208
George Keishingffbe8ce2017-05-04 12:08:54 -0500209Post Test Case Execution
210 [Documentation] Do the post test teardown.
211 # 1. Shut down HTX exerciser if test Failed.
212 # 2. Capture FFDC on test failure.
213 # 3. Close all open SSH connections.
214
George Keishing1a23b692017-05-06 12:19:41 -0500215 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500216 Run Keyword If
217 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500218 ... Shutdown HTX Exerciser
219
George Keishingae5d9782017-06-12 13:35:59 -0500220 ${keyword_buf}= Catenate Stop SOL Console Logging
221 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
222 Run Key ${keyword_buf}
223
George Keishingffbe8ce2017-05-04 12:08:54 -0500224 FFDC On Test Case Fail
225 Close All Connections