blob: 66fcfcb910cc47bce98da886c8bfad504f0fe843 [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.
10# HTX_DURATION Duration of HTX run, for example, 8 hours, or
11# 30 minutes.
12# HTX_LOOP The number of times to loop HTX.
13# HTX_INTERVAL The time delay between consecutive checks of HTX
14# status, for example, 30s.
15# In summary: Run HTX for $HTX_DURATION, looping
16# $HTX_LOOP times checking every $HTX_INTERVAL.
17# HTX_KEEP_RUNNING If set to 1, this indicates that the HTX is to
18# continue running after an error.
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
21# parameter is optional.
22# 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.
26# This parameter is optional. If not specified, an
27# 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 Sombarb6749a62017-10-06 08:34:23 -050042
43Suite Setup Run Keyword And Ignore Error Start SOL Console Logging
George Keishingffbe8ce2017-05-04 12:08:54 -050044Test Setup Pre Test Case Execution
45Test Teardown Post Test Case 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 Sombar130a04f2017-07-16 10:02:37 -050054${last_inventory_file_path} ${EMPTY}
Steven Sombara2f166c2017-08-02 14:22:45 -050055${CHECK_INVENTORY} True
Steven Sombarb6749a62017-10-06 08:34:23 -050056${INV_IGNORE_LIST} size
Steven Sombar48ad01d2017-08-17 14:17:37 -050057${PREV_INV_FILE_PATH} ${EMPTY}
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 Sombara2f166c2017-08-02 14:22:45 -050066 # Set last inventory file to PREV_INV_FILE_PATH otherwise set it
67 # to ${EMPTY}.
Steven Sombar130a04f2017-07-16 10:02:37 -050068 ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH}
69 ... ${EMPTY}
70
Steven Sombar48ad01d2017-08-17 14:17:37 -050071 Rprintn
72 Rpvars HTX_DURATION HTX_INTERVAL CHECK_INVENTORY INV_IGNORE_LIST
73 ... PREV_INV_FILE_PATH
74
75 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
76 ... OperatingSystem.File Should Exist ${last_inventory_file_path}
77
Steven Sombar130a04f2017-07-16 10:02:37 -050078 Set Suite Variable ${last_inventory_file_path} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050079 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050080
81 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050082
83
84*** Keywords ***
85
Steven Sombar130a04f2017-07-16 10:02:37 -050086Run HTX Exerciser
87 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050088 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050089 # - Power on.
90 # - Establish SSH connection session.
91 # - Do inventory collection, compare with
92 # previous inventory run if applicable.
93 # - Create HTX mdt profile.
94 # - Run HTX exerciser.
95 # - Check HTX status for errors.
96 # - Do inventory collection, compare with
97 # previous inventory run.
98 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -050099
100 Boot To OS
101
102 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500103 Login To OS
104
Steven Sombara2f166c2017-08-02 14:22:45 -0500105 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500106 ... Do Inventory And Compare ${json_initial_file_path}
107 ... ${last_inventory_file_path}
108
George Keishing13f44e52017-05-12 15:28:12 -0500109 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
110 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500111
George Keishing13f44e52017-05-12 15:28:12 -0500112 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500113
114 Loop HTX Health Check
115
George Keishingffbe8ce2017-05-04 12:08:54 -0500116 Shutdown HTX Exerciser
117
Steven Sombara2f166c2017-08-02 14:22:45 -0500118 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500119 ... Do Inventory And Compare ${json_final_file_path}
120 ... ${last_inventory_file_path}
121
George Keishingffbe8ce2017-05-04 12:08:54 -0500122 Power Off Host
123
George Keishingae5d9782017-06-12 13:35:59 -0500124 # Close all SSH and REST active sessions.
125 Close All Connections
126 Flush REST Sessions
127
George Keishingffbe8ce2017-05-04 12:08:54 -0500128 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500129
George Keishing13f44e52017-05-12 15:28:12 -0500130
Steven Sombara2f166c2017-08-02 14:22:45 -0500131Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500132 [Documentation] Do inventory and compare.
133 [Arguments] ${inventory_file_path} ${last_inventory_file_path}
134 # Description of argument(s):
135 # inventory_file_path The file to receive the inventory snapshot.
136 # last_inventory_file_path The previous inventory to compare with.
137
138 Create JSON Inventory File ${inventory_file_path}
139 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
140 ... Compare Json Inventory Files ${inventory_file_path}
141 ... ${last_inventory_file_path}
142 ${last_inventory_file_path}= Set Variable ${inventory_file_path}
143 Set Suite Variable ${last_inventory_file_path} children=true
144
145
146Compare Json Inventory Files
147 [Documentation] Compare JSON inventory files.
148 [Arguments] ${file1} ${file2}
149 # Description of argument(s):
150 # file1 A file that has an inventory snapshot in JSON format.
151 # file2 A file that has an inventory snapshot, to compare with file1.
152
Steven Sombarb6749a62017-10-06 08:34:23 -0500153 ${diff_rc}= File_Diff ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500154 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500155 Run Keyword If '${diff_rc}' != '${0}'
156 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
157
158
159Report Inventory Mismatch
160 [Documentation] Report inventory mismatch.
161 [Arguments] ${diff_rc} ${json_diff_file_path}
162 # Description of argument(s):
163 # diff_rc The failing return code from the difference check.
164 # json_diff_file_path The file that has the latest inventory snapshot.
165
Steven Sombara2216d22017-08-09 12:18:00 -0500166 Log To Console Significant difference in inventory found, rc=${diff_rc}
167 Log To Console Differences are listed in file: no_newline=true
168 Log To Console ${json_diff_file_path}
169 Log To Console File Contents:
170 Wait Until Created ${json_diff_file_path}
171 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
172 Log ${file_contents} level=WARN
173 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500174
175
George Keishing8b082fd2017-05-03 13:42:39 -0500176Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500177 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500178 Repeat Keyword ${HTX_DURATION}
179 ... Run Keywords Check HTX Run Status
180 ... AND Sleep ${HTX_INTERVAL}
181
182
George Keishingffbe8ce2017-05-04 12:08:54 -0500183Post Test Case Execution
184 [Documentation] Do the post test teardown.
185 # 1. Shut down HTX exerciser if test Failed.
186 # 2. Capture FFDC on test failure.
187 # 3. Close all open SSH connections.
188
George Keishing1a23b692017-05-06 12:19:41 -0500189 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500190 Run Keyword If
191 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500192 ... Shutdown HTX Exerciser
193
George Keishingae5d9782017-06-12 13:35:59 -0500194 ${keyword_buf}= Catenate Stop SOL Console Logging
195 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
196 Run Key ${keyword_buf}
197
George Keishingffbe8ce2017-05-04 12:08:54 -0500198 FFDC On Test Case Fail
199 Close All Connections