blob: d1a17967bde5d831545d9b3f87473626f1b2e287 [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 Sombar48ad01d2017-08-17 14:17:37 -050029# INV_IGNORE_LIST A comma-delimited list of colon-delimited pairs that
30# indicate what to ignore if there are inventory
31# differences. For example, "processor:size,network:speed"
32# If differences are found during inventory checking
33# and those items are in this string, the
34# differences will be ignored. This parameter is
35# optional. If not specified the default value is
36# "processor:size".
Steven Sombar130a04f2017-07-16 10:02:37 -050037
38Resource ../syslib/utils_os.robot
39Library ../syslib/utils_keywords.py
George Keishingffbe8ce2017-05-04 12:08:54 -050040
George Keishingae5d9782017-06-12 13:35:59 -050041Suite Setup Run Key Start SOL Console Logging
George Keishingffbe8ce2017-05-04 12:08:54 -050042Test Setup Pre Test Case Execution
43Test Teardown Post Test Case Execution
George Keishing8b082fd2017-05-03 13:42:39 -050044
Steven Sombar6f9d41d2017-08-08 13:35:30 -050045
George Keishing8b082fd2017-05-03 13:42:39 -050046*** Variables ****
47
Steven Sombar130a04f2017-07-16 10:02:37 -050048${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050049${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
50${json_final_file_path} ${EXECDIR}/os_inventory_final.json
51${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombar130a04f2017-07-16 10:02:37 -050052${last_inventory_file_path} ${EMPTY}
Steven Sombara2f166c2017-08-02 14:22:45 -050053${CHECK_INVENTORY} True
Steven Sombar48ad01d2017-08-17 14:17:37 -050054${INV_IGNORE_LIST} processor:size
55${PREV_INV_FILE_PATH} ${EMPTY}
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 Sombara2f166c2017-08-02 14:22:45 -050064 # Set last inventory file to PREV_INV_FILE_PATH otherwise set it
65 # to ${EMPTY}.
Steven Sombar130a04f2017-07-16 10:02:37 -050066 ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH}
67 ... ${EMPTY}
68
Steven Sombar48ad01d2017-08-17 14:17:37 -050069 Rprintn
70 Rpvars HTX_DURATION HTX_INTERVAL CHECK_INVENTORY INV_IGNORE_LIST
71 ... PREV_INV_FILE_PATH
72
73 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
74 ... OperatingSystem.File Should Exist ${last_inventory_file_path}
75
Steven Sombar130a04f2017-07-16 10:02:37 -050076 Set Suite Variable ${last_inventory_file_path} children=true
Steven Sombar48ad01d2017-08-17 14:17:37 -050077 Set Suite Variable ${INV_IGNORE_LIST} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050078
79 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050080
81
82*** Keywords ***
83
Steven Sombar130a04f2017-07-16 10:02:37 -050084Run HTX Exerciser
85 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050086 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050087 # - Power on.
88 # - Establish SSH connection session.
89 # - Do inventory collection, compare with
90 # previous inventory run if applicable.
91 # - Create HTX mdt profile.
92 # - Run HTX exerciser.
93 # - Check HTX status for errors.
94 # - Do inventory collection, compare with
95 # previous inventory run.
96 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -050097
98 Boot To OS
99
100 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -0500101 Login To OS
102
Steven Sombara2f166c2017-08-02 14:22:45 -0500103 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500104 ... Do Inventory And Compare ${json_initial_file_path}
105 ... ${last_inventory_file_path}
106
George Keishing13f44e52017-05-12 15:28:12 -0500107 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
108 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500109
George Keishing13f44e52017-05-12 15:28:12 -0500110 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500111
112 Loop HTX Health Check
113
George Keishingffbe8ce2017-05-04 12:08:54 -0500114 Shutdown HTX Exerciser
115
Steven Sombara2f166c2017-08-02 14:22:45 -0500116 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500117 ... Do Inventory And Compare ${json_final_file_path}
118 ... ${last_inventory_file_path}
119
George Keishingffbe8ce2017-05-04 12:08:54 -0500120 Power Off Host
121
George Keishingae5d9782017-06-12 13:35:59 -0500122 # Close all SSH and REST active sessions.
123 Close All Connections
124 Flush REST Sessions
125
George Keishingffbe8ce2017-05-04 12:08:54 -0500126 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500127
George Keishing13f44e52017-05-12 15:28:12 -0500128
Steven Sombara2f166c2017-08-02 14:22:45 -0500129Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500130 [Documentation] Do inventory and compare.
131 [Arguments] ${inventory_file_path} ${last_inventory_file_path}
132 # Description of argument(s):
133 # inventory_file_path The file to receive the inventory snapshot.
134 # last_inventory_file_path The previous inventory to compare with.
135
136 Create JSON Inventory File ${inventory_file_path}
137 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
138 ... Compare Json Inventory Files ${inventory_file_path}
139 ... ${last_inventory_file_path}
140 ${last_inventory_file_path}= Set Variable ${inventory_file_path}
141 Set Suite Variable ${last_inventory_file_path} children=true
142
143
144Compare Json Inventory Files
145 [Documentation] Compare JSON inventory files.
146 [Arguments] ${file1} ${file2}
147 # Description of argument(s):
148 # file1 A file that has an inventory snapshot in JSON format.
149 # file2 A file that has an inventory snapshot, to compare with file1.
150
151 ${diff_rc}= JSON_Inv_File_Diff_Check ${file1}
Steven Sombar48ad01d2017-08-17 14:17:37 -0500152 ... ${file2} ${json_diff_file_path} ${INV_IGNORE_LIST}
Steven Sombar130a04f2017-07-16 10:02:37 -0500153 Run Keyword If '${diff_rc}' != '${0}'
154 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
155
156
157Report Inventory Mismatch
158 [Documentation] Report inventory mismatch.
159 [Arguments] ${diff_rc} ${json_diff_file_path}
160 # Description of argument(s):
161 # diff_rc The failing return code from the difference check.
162 # json_diff_file_path The file that has the latest inventory snapshot.
163
Steven Sombara2216d22017-08-09 12:18:00 -0500164 Log To Console Significant difference in inventory found, rc=${diff_rc}
165 Log To Console Differences are listed in file: no_newline=true
166 Log To Console ${json_diff_file_path}
167 Log To Console File Contents:
168 Wait Until Created ${json_diff_file_path}
169 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
170 Log ${file_contents} level=WARN
171 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500172
173
George Keishing8b082fd2017-05-03 13:42:39 -0500174Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500175 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500176 Repeat Keyword ${HTX_DURATION}
177 ... Run Keywords Check HTX Run Status
178 ... AND Sleep ${HTX_INTERVAL}
179
180
George Keishingffbe8ce2017-05-04 12:08:54 -0500181Post Test Case Execution
182 [Documentation] Do the post test teardown.
183 # 1. Shut down HTX exerciser if test Failed.
184 # 2. Capture FFDC on test failure.
185 # 3. Close all open SSH connections.
186
George Keishing1a23b692017-05-06 12:19:41 -0500187 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500188 Run Keyword If
189 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500190 ... Shutdown HTX Exerciser
191
George Keishingae5d9782017-06-12 13:35:59 -0500192 ${keyword_buf}= Catenate Stop SOL Console Logging
193 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
194 Run Key ${keyword_buf}
195
George Keishingffbe8ce2017-05-04 12:08:54 -0500196 FFDC On Test Case Fail
197 Close All Connections