blob: 202188509d9990b6918ca082f2a391520314c6ab [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
Steven Sombara2216d22017-08-09 12:18:00 -050064 Set Suite Variable &{ignore_dict} children=true
Steven Sombar130a04f2017-07-16 10:02:37 -050065
66 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050067
68
69*** Keywords ***
70
Steven Sombar130a04f2017-07-16 10:02:37 -050071Run HTX Exerciser
72 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050073 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050074 # - Power on.
75 # - Establish SSH connection session.
76 # - Do inventory collection, compare with
77 # previous inventory run if applicable.
78 # - Create HTX mdt profile.
79 # - Run HTX exerciser.
80 # - Check HTX status for errors.
81 # - Do inventory collection, compare with
82 # previous inventory run.
83 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -050084
85 Boot To OS
86
87 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -050088 Login To OS
89
Steven Sombara2f166c2017-08-02 14:22:45 -050090 Run Keyword If '${CHECK_INVENTORY}' == 'True'
Steven Sombar130a04f2017-07-16 10:02:37 -050091 ... Do Inventory And Compare ${json_initial_file_path}
92 ... ${last_inventory_file_path}
93
George Keishing13f44e52017-05-12 15:28:12 -050094 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
95 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050096
George Keishing13f44e52017-05-12 15:28:12 -050097 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050098
99 Loop HTX Health Check
100
George Keishingffbe8ce2017-05-04 12:08:54 -0500101 Shutdown HTX Exerciser
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_final_file_path}
105 ... ${last_inventory_file_path}
106
George Keishingffbe8ce2017-05-04 12:08:54 -0500107 Power Off Host
108
George Keishingae5d9782017-06-12 13:35:59 -0500109 # Close all SSH and REST active sessions.
110 Close All Connections
111 Flush REST Sessions
112
George Keishingffbe8ce2017-05-04 12:08:54 -0500113 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500114
George Keishing13f44e52017-05-12 15:28:12 -0500115
Steven Sombara2f166c2017-08-02 14:22:45 -0500116Do Inventory And Compare
Steven Sombar130a04f2017-07-16 10:02:37 -0500117 [Documentation] Do inventory and compare.
118 [Arguments] ${inventory_file_path} ${last_inventory_file_path}
119 # Description of argument(s):
120 # inventory_file_path The file to receive the inventory snapshot.
121 # last_inventory_file_path The previous inventory to compare with.
122
123 Create JSON Inventory File ${inventory_file_path}
124 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
125 ... Compare Json Inventory Files ${inventory_file_path}
126 ... ${last_inventory_file_path}
127 ${last_inventory_file_path}= Set Variable ${inventory_file_path}
128 Set Suite Variable ${last_inventory_file_path} children=true
129
130
131Compare Json Inventory Files
132 [Documentation] Compare JSON inventory files.
133 [Arguments] ${file1} ${file2}
134 # Description of argument(s):
135 # file1 A file that has an inventory snapshot in JSON format.
136 # file2 A file that has an inventory snapshot, to compare with file1.
137
138 ${diff_rc}= JSON_Inv_File_Diff_Check ${file1}
139 ... ${file2} ${json_diff_file_path} ${ignore_dict}
140 Run Keyword If '${diff_rc}' != '${0}'
141 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
142
143
144Report Inventory Mismatch
145 [Documentation] Report inventory mismatch.
146 [Arguments] ${diff_rc} ${json_diff_file_path}
147 # Description of argument(s):
148 # diff_rc The failing return code from the difference check.
149 # json_diff_file_path The file that has the latest inventory snapshot.
150
Steven Sombara2216d22017-08-09 12:18:00 -0500151 Log To Console Significant difference in inventory found, rc=${diff_rc}
152 Log To Console Differences are listed in file: no_newline=true
153 Log To Console ${json_diff_file_path}
154 Log To Console File Contents:
155 Wait Until Created ${json_diff_file_path}
156 ${file_contents}= OperatingSystem.Get File ${json_diff_file_path}
157 Log ${file_contents} level=WARN
158 Fail Significant difference in inventory found, rc=${diff_rc}
Steven Sombar130a04f2017-07-16 10:02:37 -0500159
160
George Keishing8b082fd2017-05-03 13:42:39 -0500161Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500162 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500163 Repeat Keyword ${HTX_DURATION}
164 ... Run Keywords Check HTX Run Status
165 ... AND Sleep ${HTX_INTERVAL}
166
167
George Keishingffbe8ce2017-05-04 12:08:54 -0500168Post Test Case Execution
169 [Documentation] Do the post test teardown.
170 # 1. Shut down HTX exerciser if test Failed.
171 # 2. Capture FFDC on test failure.
172 # 3. Close all open SSH connections.
173
George Keishing1a23b692017-05-06 12:19:41 -0500174 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500175 Run Keyword If
176 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500177 ... Shutdown HTX Exerciser
178
George Keishingae5d9782017-06-12 13:35:59 -0500179 ${keyword_buf}= Catenate Stop SOL Console Logging
180 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
181 Run Key ${keyword_buf}
182
George Keishingffbe8ce2017-05-04 12:08:54 -0500183 FFDC On Test Case Fail
184 Close All Connections