blob: ce7594ffc4b7e11372a241b18b266b7a425a6e83 [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
Steven Sombar6f9d41d2017-08-08 13:35:30 -050037
George Keishing8b082fd2017-05-03 13:42:39 -050038*** Variables ****
39
Steven Sombar130a04f2017-07-16 10:02:37 -050040${stack_mode} skip
Steven Sombar6f9d41d2017-08-08 13:35:30 -050041${json_initial_file_path} ${EXECDIR}/os_inventory_initial.json
42${json_final_file_path} ${EXECDIR}/os_inventory_final.json
43${json_diff_file_path} ${EXECDIR}/os_inventory_diff.json
Steven Sombar130a04f2017-07-16 10:02:37 -050044${last_inventory_file_path} ${EMPTY}
Steven Sombara2f166c2017-08-02 14:22:45 -050045${CHECK_INVENTORY} True
Steven Sombar130a04f2017-07-16 10:02:37 -050046&{ignore_dict} processor=size
George Keishingffbe8ce2017-05-04 12:08:54 -050047
Steven Sombar6f9d41d2017-08-08 13:35:30 -050048
George Keishing8b082fd2017-05-03 13:42:39 -050049*** Test Cases ***
50
51Hard Bootme Test
52 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050053 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050054
George Keishingffbe8ce2017-05-04 12:08:54 -050055 Rprintn
56 Rpvars HTX_DURATION HTX_INTERVAL
57
Steven Sombara2f166c2017-08-02 14:22:45 -050058 # Set last inventory file to PREV_INV_FILE_PATH otherwise set it
59 # to ${EMPTY}.
Steven Sombar130a04f2017-07-16 10:02:37 -050060 ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH}
61 ... ${EMPTY}
62
Steven Sombar130a04f2017-07-16 10:02:37 -050063 Set Suite Variable ${last_inventory_file_path} children=true
64
65 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050066
67
68*** Keywords ***
69
Steven Sombar130a04f2017-07-16 10:02:37 -050070Run HTX Exerciser
71 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050072 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050073 # - Power on.
74 # - Establish SSH connection session.
75 # - Do inventory collection, compare with
76 # previous inventory run if applicable.
77 # - Create HTX mdt profile.
78 # - Run HTX exerciser.
79 # - Check HTX status for errors.
80 # - Do inventory collection, compare with
81 # previous inventory run.
82 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -050083
84 Boot To OS
85
86 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -050087 Login To OS
88
Steven Sombara2f166c2017-08-02 14:22:45 -050089 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -050090 ... Do Inventory And Compare ${json_initial_file_path}
91 ... ${last_inventory_file_path}
92
George Keishing13f44e52017-05-12 15:28:12 -050093 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
94 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050095
George Keishing13f44e52017-05-12 15:28:12 -050096 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050097
98 Loop HTX Health Check
99
George Keishingffbe8ce2017-05-04 12:08:54 -0500100 Shutdown HTX Exerciser
101
Steven Sombara2f166c2017-08-02 14:22:45 -0500102 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -0500103 ... Do Inventory And Compare ${json_final_file_path}
104 ... ${last_inventory_file_path}
105
George Keishingffbe8ce2017-05-04 12:08:54 -0500106 Power Off Host
107
George Keishingae5d9782017-06-12 13:35:59 -0500108 # Close all SSH and REST active sessions.
109 Close All Connections
110 Flush REST Sessions
111
George Keishingffbe8ce2017-05-04 12:08:54 -0500112 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500113
George Keishing13f44e52017-05-12 15:28:12 -0500114
Steven Sombara2f166c2017-08-02 14:22:45 -0500115Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500116 [Documentation] Do inventory and compare.
117 [Arguments] ${inventory_file_path} ${last_inventory_file_path}
118 # Description of argument(s):
119 # inventory_file_path The file to receive the inventory snapshot.
120 # last_inventory_file_path The previous inventory to compare with.
121
122 Create JSON Inventory File ${inventory_file_path}
123 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
124 ... Compare Json Inventory Files ${inventory_file_path}
125 ... ${last_inventory_file_path}
126 ${last_inventory_file_path}= Set Variable ${inventory_file_path}
127 Set Suite Variable ${last_inventory_file_path} children=true
128
129
130Compare Json Inventory Files
131 [Documentation] Compare JSON inventory files.
132 [Arguments] ${file1} ${file2}
133 # Description of argument(s):
134 # file1 A file that has an inventory snapshot in JSON format.
135 # file2 A file that has an inventory snapshot, to compare with file1.
136
137 ${diff_rc}= JSON_Inv_File_Diff_Check ${file1}
138 ... ${file2} ${json_diff_file_path} ${ignore_dict}
139 Run Keyword If '${diff_rc}' != '${0}'
140 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
141
142
143Report Inventory Mismatch
144 [Documentation] Report inventory mismatch.
145 [Arguments] ${diff_rc} ${json_diff_file_path}
146 # Description of argument(s):
147 # diff_rc The failing return code from the difference check.
148 # json_diff_file_path The file that has the latest inventory snapshot.
149
150 Log To Console Difference in inventory found, return code:
151 ... no_newline=true
152 Log to Console ${diff_rc}
153 Log to Console Differences are listed in file: no_newline=true
154 Log to Console ${json_diff_file_path}
155 Fail Inventory mismatch, rc=${diff_rc}
156
157
George Keishing8b082fd2017-05-03 13:42:39 -0500158Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500159 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500160 Repeat Keyword ${HTX_DURATION}
161 ... Run Keywords Check HTX Run Status
162 ... AND Sleep ${HTX_INTERVAL}
163
164
George Keishingffbe8ce2017-05-04 12:08:54 -0500165Post Test Case Execution
166 [Documentation] Do the post test teardown.
167 # 1. Shut down HTX exerciser if test Failed.
168 # 2. Capture FFDC on test failure.
169 # 3. Close all open SSH connections.
170
George Keishing1a23b692017-05-06 12:19:41 -0500171 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500172 Run Keyword If
173 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500174 ... Shutdown HTX Exerciser
175
George Keishingae5d9782017-06-12 13:35:59 -0500176 ${keyword_buf}= Catenate Stop SOL Console Logging
177 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
178 Run Key ${keyword_buf}
179
George Keishingffbe8ce2017-05-04 12:08:54 -0500180 FFDC On Test Case Fail
181 Close All Connections