blob: be2d92067af4d390789dfb80da8eae1f469ea947 [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.
19# CHECK_INVENTORY If set to 1, this enables OS inventory checking
20# before and after each HTX run. This parameter
21# is optional.
22# PREV_INV_FILE_PATH The file path and name of a previous inventory
23# snapshot file. After HTX start the system inventory
24# is compared to the contents of this file. Setting this
25# parameter is optional. CHECK_INVENTORY does not
26# need to be set if PREV_INV_FILE_PATH is set.
27
28Resource ../syslib/utils_os.robot
29Library ../syslib/utils_keywords.py
George Keishingffbe8ce2017-05-04 12:08:54 -050030
George Keishingae5d9782017-06-12 13:35:59 -050031Suite Setup Run Key Start SOL Console Logging
George Keishingffbe8ce2017-05-04 12:08:54 -050032Test Setup Pre Test Case Execution
33Test Teardown Post Test Case Execution
George Keishing8b082fd2017-05-03 13:42:39 -050034
35*** Variables ****
36
Steven Sombar130a04f2017-07-16 10:02:37 -050037${stack_mode} skip
38${json_initial_file_path} ${EXECDIR}/data/os_inventory_initial.json
39${json_final_file_path} ${EXECDIR}/data/os_inventory_final.json
40${json_diff_file_path} ${EXECDIR}/data/os_inventory_diff.json
41${last_inventory_file_path} ${EMPTY}
42${run_the_inventory} 0
43&{ignore_dict} processor=size
George Keishingffbe8ce2017-05-04 12:08:54 -050044
George Keishing8b082fd2017-05-03 13:42:39 -050045*** Test Cases ***
46
47Hard Bootme Test
48 [Documentation] Stress the system using HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050049 [Tags] Hard_Bootme_Test
George Keishing8b082fd2017-05-03 13:42:39 -050050
George Keishingffbe8ce2017-05-04 12:08:54 -050051 Rprintn
52 Rpvars HTX_DURATION HTX_INTERVAL
53
Steven Sombar130a04f2017-07-16 10:02:37 -050054 # Set last inventory file to PREV_INV_FILE_PATH otherwise set
55 # it to ${EMPTY}.
56 ${last_inventory_file_path}= Get Variable Value ${PREV_INV_FILE_PATH}
57 ... ${EMPTY}
58
59 # Set ${run_the_inventory} if PREV_INV_FILE_PATH was specified,
60 # else set ${run_the_inventory} from the ${CHECK_INVENTORY} parameter.
61 ${run_the_inventory}= Run Keyword If
62 ... '${last_inventory_file_path}' != '${EMPTY}' Set Variable ${1}
63 ... ELSE Run Keyword If '${last_inventory_file_path}' == '${EMPTY}'
64 ... Get Variable Value ${CHECK_INVENTORY} ${EMPTY}
65
66 Set Suite Variable ${run_the_inventory} children=true
67 Set Suite Variable ${last_inventory_file_path} children=true
68
69 Repeat Keyword ${HTX_LOOP} times Run HTX Exerciser
George Keishingffbe8ce2017-05-04 12:08:54 -050070
71
72*** Keywords ***
73
Steven Sombar130a04f2017-07-16 10:02:37 -050074Run HTX Exerciser
75 [Documentation] Run HTX exerciser.
George Keishingffbe8ce2017-05-04 12:08:54 -050076 # Test Flow:
Steven Sombar130a04f2017-07-16 10:02:37 -050077 # - Power on.
78 # - Establish SSH connection session.
79 # - Do inventory collection, compare with
80 # previous inventory run if applicable.
81 # - Create HTX mdt profile.
82 # - Run HTX exerciser.
83 # - Check HTX status for errors.
84 # - Do inventory collection, compare with
85 # previous inventory run.
86 # - Power off.
George Keishingffbe8ce2017-05-04 12:08:54 -050087
88 Boot To OS
89
90 # Post Power off and on, the OS SSH session needs to be established.
George Keishing8b082fd2017-05-03 13:42:39 -050091 Login To OS
92
Steven Sombar130a04f2017-07-16 10:02:37 -050093 Run Keyword If '${run_the_inventory}' != '${EMPTY}'
94 ... Do Inventory And Compare ${json_initial_file_path}
95 ... ${last_inventory_file_path}
96
George Keishing13f44e52017-05-12 15:28:12 -050097 Run Keyword If '${HTX_MDT_PROFILE}' == 'mdt.bu'
98 ... Create Default MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -050099
George Keishing13f44e52017-05-12 15:28:12 -0500100 Run MDT Profile
George Keishing8b082fd2017-05-03 13:42:39 -0500101
102 Loop HTX Health Check
103
George Keishingffbe8ce2017-05-04 12:08:54 -0500104 Shutdown HTX Exerciser
105
Steven Sombar130a04f2017-07-16 10:02:37 -0500106 Run Keyword If '${run_the_inventory}' != '${EMPTY}'
107 ... Do Inventory And Compare ${json_final_file_path}
108 ... ${last_inventory_file_path}
109
George Keishingffbe8ce2017-05-04 12:08:54 -0500110 Power Off Host
111
George Keishingae5d9782017-06-12 13:35:59 -0500112 # Close all SSH and REST active sessions.
113 Close All Connections
114 Flush REST Sessions
115
George Keishingffbe8ce2017-05-04 12:08:54 -0500116 Rprint Timen HTX Test ran for: ${HTX_DURATION}
George Keishing8b082fd2017-05-03 13:42:39 -0500117
George Keishing13f44e52017-05-12 15:28:12 -0500118
Steven Sombar130a04f2017-07-16 10:02:37 -0500119Do Inventory and Compare
120 [Documentation] Do inventory and compare.
121 [Arguments] ${inventory_file_path} ${last_inventory_file_path}
122 # Description of argument(s):
123 # inventory_file_path The file to receive the inventory snapshot.
124 # last_inventory_file_path The previous inventory to compare with.
125
126 Create JSON Inventory File ${inventory_file_path}
127 Run Keyword If '${last_inventory_file_path}' != '${EMPTY}'
128 ... Compare Json Inventory Files ${inventory_file_path}
129 ... ${last_inventory_file_path}
130 ${last_inventory_file_path}= Set Variable ${inventory_file_path}
131 Set Suite Variable ${last_inventory_file_path} children=true
132
133
134Compare Json Inventory Files
135 [Documentation] Compare JSON inventory files.
136 [Arguments] ${file1} ${file2}
137 # Description of argument(s):
138 # file1 A file that has an inventory snapshot in JSON format.
139 # file2 A file that has an inventory snapshot, to compare with file1.
140
141 ${diff_rc}= JSON_Inv_File_Diff_Check ${file1}
142 ... ${file2} ${json_diff_file_path} ${ignore_dict}
143 Run Keyword If '${diff_rc}' != '${0}'
144 ... Report Inventory Mismatch ${diff_rc} ${json_diff_file_path}
145
146
147Report Inventory Mismatch
148 [Documentation] Report inventory mismatch.
149 [Arguments] ${diff_rc} ${json_diff_file_path}
150 # Description of argument(s):
151 # diff_rc The failing return code from the difference check.
152 # json_diff_file_path The file that has the latest inventory snapshot.
153
154 Log To Console Difference in inventory found, return code:
155 ... no_newline=true
156 Log to Console ${diff_rc}
157 Log to Console Differences are listed in file: no_newline=true
158 Log to Console ${json_diff_file_path}
159 Fail Inventory mismatch, rc=${diff_rc}
160
161
George Keishing8b082fd2017-05-03 13:42:39 -0500162Loop HTX Health Check
George Keishingffbe8ce2017-05-04 12:08:54 -0500163 [Documentation] Run until HTX exerciser fails.
George Keishing8b082fd2017-05-03 13:42:39 -0500164 Repeat Keyword ${HTX_DURATION}
165 ... Run Keywords Check HTX Run Status
166 ... AND Sleep ${HTX_INTERVAL}
167
168
George Keishingffbe8ce2017-05-04 12:08:54 -0500169Post Test Case Execution
170 [Documentation] Do the post test teardown.
171 # 1. Shut down HTX exerciser if test Failed.
172 # 2. Capture FFDC on test failure.
173 # 3. Close all open SSH connections.
174
George Keishing1a23b692017-05-06 12:19:41 -0500175 # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
Steven Sombar130a04f2017-07-16 10:02:37 -0500176 Run Keyword If
177 ... '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
George Keishingffbe8ce2017-05-04 12:08:54 -0500178 ... Shutdown HTX Exerciser
179
George Keishingae5d9782017-06-12 13:35:59 -0500180 ${keyword_buf}= Catenate Stop SOL Console Logging
181 ... \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
182 Run Key ${keyword_buf}
183
George Keishingffbe8ce2017-05-04 12:08:54 -0500184 FFDC On Test Case Fail
185 Close All Connections