blob: 4f22f59d413253a2f8cbafd582f0581335722fb0 [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 Sombar130a04f2017-07-16 10:02:37 -050029
30Resource ../syslib/utils_os.robot
31Library ../syslib/utils_keywords.py
George Keishingffbe8ce2017-05-04 12:08:54 -050032
George Keishingae5d9782017-06-12 13:35:59 -050033Suite Setup Run Key Start SOL Console Logging
George Keishingffbe8ce2017-05-04 12:08:54 -050034Test Setup Pre Test Case Execution
35Test Teardown Post Test Case Execution
George Keishing8b082fd2017-05-03 13:42:39 -050036
37*** Variables ****
38
Steven Sombar130a04f2017-07-16 10:02:37 -050039${stack_mode} skip
40${json_initial_file_path} ${EXECDIR}/data/os_inventory_initial.json
41${json_final_file_path} ${EXECDIR}/data/os_inventory_final.json
42${json_diff_file_path} ${EXECDIR}/data/os_inventory_diff.json
43${last_inventory_file_path} ${EMPTY}
Steven Sombara2f166c2017-08-02 14:22:45 -050044${CHECK_INVENTORY} True
Steven Sombar130a04f2017-07-16 10:02:37 -050045&{ignore_dict} processor=size
George Keishingffbe8ce2017-05-04 12:08:54 -050046
George Keishing8b082fd2017-05-03 13:42:39 -050047*** Test Cases ***
48
49Hard Bootme Test
50 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050051 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050052
George Keishingffbe8ce2017-05-04 12:08:54 -050053 Rprintn
54 Rpvars HTX_DURATION HTX_INTERVAL
55
Steven Sombara2f166c2017-08-02 14:22:45 -050056 # Set last inventory file to PREV_INV_FILE_PATH otherwise set it
57 # to ${EMPTY}.
Steven Sombar130a04f2017-07-16 10:02:37 -050058 ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH}
59 ... ${EMPTY}
60
Steven Sombar130a04f2017-07-16 10:02:37 -050061 Set Suite Variable ${last_inventory_file_path} children=true
62
63 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050064
65
66*** Keywords ***
67
Steven Sombar130a04f2017-07-16 10:02:37 -050068Run HTX Exerciser
69 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050070 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050071 # - Power on.
72 # - Establish SSH connection session.
73 # - Do inventory collection, compare with
74 # previous inventory run if applicable.
75 # - Create HTX mdt profile.
76 # - Run HTX exerciser.
77 # - Check HTX status for errors.
78 # - Do inventory collection, compare with
79 # previous inventory run.
80 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -050081
82 Boot To OS
83
84 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -050085 Login To OS
86
Steven Sombara2f166c2017-08-02 14:22:45 -050087 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -050088 ... Do Inventory And Compare ${json_initial_file_path}
89 ... ${last_inventory_file_path}
90
George Keishing13f44e52017-05-12 15:28:12 -050091 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
92 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050093
George Keishing13f44e52017-05-12 15:28:12 -050094 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050095
96 Loop HTX Health Check
97
George Keishingffbe8ce2017-05-04 12:08:54 -050098 Shutdown HTX Exerciser
99
Steven Sombara2f166c2017-08-02 14:22:45 -0500100 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500101 ... Do Inventory And Compare ${json_final_file_path}
102 ... ${last_inventory_file_path}
103
George Keishingffbe8ce2017-05-04 12:08:54 -0500104 Power Off Host
105
George Keishingae5d9782017-06-12 13:35:59 -0500106 # Close all SSH and REST active sessions.
107 Close All Connections
108 Flush REST Sessions
109
George Keishingffbe8ce2017-05-04 12:08:54 -0500110 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500111
George Keishing13f44e52017-05-12 15:28:12 -0500112
Steven Sombara2f166c2017-08-02 14:22:45 -0500113Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500114 [Documentation] Do inventory and compare.
115 [Arguments] ${inventory_file_path} ${last_inventory_file_path}
116 # Description of argument(s):
117 # inventory_file_path The file to receive the inventory snapshot.
118 # last_inventory_file_path The previous inventory to compare with.
119
120 Create JSON Inventory File ${inventory_file_path}
121 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
122 ... Compare Json Inventory Files ${inventory_file_path}
123 ... ${last_inventory_file_path}
124 ${last_inventory_file_path}= Set Variable ${inventory_file_path}
125 Set Suite Variable ${last_inventory_file_path} children=true
126
127
128Compare Json Inventory Files
129 [Documentation] Compare JSON inventory files.
130 [Arguments] ${file1} ${file2}
131 # Description of argument(s):
132 # file1 A file that has an inventory snapshot in JSON format.
133 # file2 A file that has an inventory snapshot, to compare with file1.
134
135 ${diff_rc}= JSON_Inv_File_Diff_Check ${file1}
136 ... ${file2} ${json_diff_file_path} ${ignore_dict}
137 Run Keyword If '${diff_rc}' != '${0}'
138 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
139
140
141Report Inventory Mismatch
142 [Documentation] Report inventory mismatch.
143 [Arguments] ${diff_rc} ${json_diff_file_path}
144 # Description of argument(s):
145 # diff_rc The failing return code from the difference check.
146 # json_diff_file_path The file that has the latest inventory snapshot.
147
148 Log To Console Difference in inventory found, return code:
149 ... no_newline=true
150 Log to Console ${diff_rc}
151 Log to Console Differences are listed in file: no_newline=true
152 Log to Console ${json_diff_file_path}
153 Fail Inventory mismatch, rc=${diff_rc}
154
155
George Keishing8b082fd2017-05-03 13:42:39 -0500156Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500157 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500158 Repeat Keyword ${HTX_DURATION}
159 ... Run Keywords Check HTX Run Status
160 ... AND Sleep ${HTX_INTERVAL}
161
162
George Keishingffbe8ce2017-05-04 12:08:54 -0500163Post Test Case Execution
164 [Documentation] Do the post test teardown.
165 # 1. Shut down HTX exerciser if test Failed.
166 # 2. Capture FFDC on test failure.
167 # 3. Close all open SSH connections.
168
George Keishing1a23b692017-05-06 12:19:41 -0500169 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500170 Run Keyword If
171 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500172 ... Shutdown HTX Exerciser
173
George Keishingae5d9782017-06-12 13:35:59 -0500174 ${keyword_buf}= Catenate Stop SOL Console Logging
175 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
176 Run Key ${keyword_buf}
177
George Keishingffbe8ce2017-05-04 12:08:54 -0500178 FFDC On Test Case Fail
179 Close All Connections