blob: da8ad89eecc6bd5c4114a06ab497a66bf2eef1f1 [file] [log] [blame]
Michael Walsh98d56d12018-09-19 16:05:00 -05001*** Settings ***
Steven Sombar15d1b9d2018-09-26 11:39:24 -05002Documentation Verify openbmctool.py functionality.
Michael Walsh98d56d12018-09-19 16:05:00 -05003
Steven Sombar15d1b9d2018-09-26 11:39:24 -05004# This module tests the functionality of openbmctool.py.
5# The following tests are perfomed:
6#
7# FRU status
8# FRU print
9# FRU list
10# FRU list of a single FRU
11# sensors print
12# sensors list
13# sensors list of a single sensor
14# health check
15# service data
16#
17# It is the responsibility of the user to include openbmctool.py's
18# directory PATH in $PATH.
19#
20# Test Parameters:
21# OPENBMC_HOST The BMC host name or IP address.
22# OPENBMC_USERNAME The username to login to the BMC.
23# OPENBMC_PASSWORD Password for OPENBMC_USERNAME.
24
25# TODO:
26# chassis tests
27# sel tests
28# dump
29# bmc (same as mc)
30# gardclear
31# firmware commands
32
33
34Library String
35Library OperatingSystem
36Library ../lib/gen_print.py
37Library ../lib/gen_robot_print.py
38Library ../lib/openbmctool_utils.py
39Library ../lib/gen_misc.py
40Resource ../syslib/utils_os.robot
41Resource ../lib/resource.txt
42
43
44Suite Setup Suite Setup Execution
45
Michael Walsh98d56d12018-09-19 16:05:00 -050046
47*** Variables ***
48
Steven Sombar15d1b9d2018-09-26 11:39:24 -050049${min_number_items} ${30}
50${min_number_sensors} ${15}
51
Michael Walsh98d56d12018-09-19 16:05:00 -050052
53*** Test Cases ***
54
Steven Sombar15d1b9d2018-09-26 11:39:24 -050055Verify Openbmctool FRU Commands
56 [Documentation] Verify FRU commands work.
57 [Tags] Verify_Openbmctool_FRU_Commands
Michael Walsh98d56d12018-09-19 16:05:00 -050058
Steven Sombar15d1b9d2018-09-26 11:39:24 -050059 Verify FRU Status
60 Verify FRU Print
61 Verify FRU List
62 # Verify FRU List With Single FRU
63 # Known issue - openbmctool.py FRU list with single FRU is not working yet.
64 # See https://github.com/openbmc/openbmc-tools/issues/32.
65
66
67Verify Openbmctool Sensors Commands
68 [Documentation] Verify sensors commands work.
69 [Tags] Verify_Openbmctool_Sensors_Commands
70
71 Verify Sensors Print
72 Verify Sensors List
73 # Verify Sensors List With Single Sensor
74 # Known issue - openbmctool.py sensors list with single sensor is
75 # not working yet. See https://github.com/openbmc/openbmc-tools/issues/33.
76
77
78Verify Openbmctool Health Check Commands
79 [Documentation] Verify health check command works.
80 [Tags] Verify_Openbmctool_Health_Check_Commands
81
82 Verify Health Check
83
84
85Verify Openbmctool Service Data Commands
86 [Documentation] Verify collect service data command works.
87 [Tags] Verify_Openbmctool_Service Data Commands
88
89 Verify Collect Service Data
90
91
92*** Keywords ***
93
94
95Verify FRU Status
96 [Documentation] Verify that the 'fru status' command works.
97
98 ${fru_status}= Get Fru Status
99 ${num_frus}= Get Length ${fru_status}
100 Rprint Vars num_frus
101 Check Greater Than Minimum ${num_frus} ${min_number_items} frus
102
103
104Verify FRU Print
105 [Documentation] Verify that the 'fru print' command works.
106
107 ${rc} ${num_frus}= Openbmctool Execute Command
108 ... fru print | wc -l
109 Rprint Vars num_frus
110 Check Greater Than Minimum ${num_frus} ${min_number_items} frus
111
112
113Verify FRU List
114 [Documentation] Verify that the 'fru list' command works.
115
116 # Note: The output from 'fru list' is the same as 'fru print'.
117 ${rc} ${num_frus}= Openbmctool Execute Command
118 ... fru list | wc -l
119 Rprint Vars num_frus
120 Check Greater Than Minimum ${num_frus} ${min_number_items} frus
121
122
123Verify FRU List With Single FRU
124 [Documentation] Verify that 'fru list' with parameter works.
125
126 # Get the name of one FRU, in this case the first one listed.
127 ${fru_status}= Get Fru Status
128 ${fruname}= Set Variable ${fru_status[0]['component']}
129 Rprint Vars fruname
130 Should Not Be Empty ${fruname} msg=Could not find a FRU.
131 # Get a fru list specifiying just the FRU.
132 ${rc} ${output}= Openbmctool Execute Command
133 ... fru list ${fruname} | wc -l
134 ${fru_detail}= Convert to Integer ${output}
135 Rprint Vars fru_detail
136 Should Be True ${fru_detail} <= ${min_number_items}
137 ... msg=Too many lines reported for fru status ${fruname}
138 Should Be True ${fru_detail} > ${4}
139 ... msg=Too few lines reported for fru status ${fruname}
140
141
142Verify Sensors Print
143 [Documentation] Verify that sensors print works.
144
145 ${sensor_status}= Get Sensors Print
146 ${num_sensors}= Get Length ${sensor_status}
Michael Walsh98d56d12018-09-19 16:05:00 -0500147 Rprint Vars num_sensors
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500148 Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors
149
150
151Verify Sensors List
152 [Documentation] Verify that sensors list works.
153
154 # Note: The output from 'sensors list' is the same as 'sensors print'.
155 ${sensor_status}= Get Sensors List
156 ${num_sensors}= Get Length ${sensor_status}
157 Rprint Vars num_sensors
158 Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors
159
160
161Verify Sensors List With Single Sensor
162 [Documentation] Verify that sensors list with parameter works.
163
164 ${sensor}= Set Variable ambient
165 ${rc} ${num_sensors}= Openbmctool Execute Command
166 ... sensors list ${sensor} | wc -l
167 Rprint Vars sensor num_sensors
168 ${num_sensors}= Convert to Integer ${num_sensors}
169 Should Be True ${num_sensors} < ${10}
170 ... msg=Too many lines reported for list sensor ${sensor}
171
172
173Verify Health Check
174 [Documentation] Verify health_check operation.
175
176 ${rc} ${health}= Openbmctool Execute Command health_check
177 Rprint Vars health
178 # Sample output:
179 # Hardware Status: OK
180 # Performance: OK
181 # Instead of OK could also say Degraded or Critical.
182 Should Contain ${health} Hardware Status:
183 ... msg=No hardware status reported by health_check.
184 Should Contain ${health} Performance:
185 ... msg=No performance reported by health_check.
186
187
188Verify Collect Service Data
189 [Documentation] Verify collect_service_data operation.
190
191 ${rc} ${service_data}= Openbmctool Execute Command collect_service_data
192 Rprint Vars service_data
193 # Sample output:
194 # Inventory collected and stored in /tmp/127.0.0.1/inventory.txt
195 # Sensor readings collected and stored in /tmp/127.0.0.1/sensorReadings.txt
196 # System LED status collected and stored in /tmp/127.0.0.1/ledStatus.txt
197 # sel short list collected and stored in /tmp/127.0.0.1/SELshortlist.txt
198 # fully parsed sels collected and stored in /tmp/127.0.0.1/parsedSELs.txt
199 # Attempting to get a full BMC enumeration
200 # RAW BMC data collected and saved into /tmp/127.0.0.1/bmcFullRaw.txt
201 # Collecting bmc dump files
202 # data collection complete
203 Should Contain ${service_data} inventory.txt
204 ... msg=No inventory.txt collected by collect_service_data.
205 Should Contain ${service_data} sensorReadings.txt
206 ... msg=No sensorReadings.txt reported by health_check.
207 Should Contain ${service_data} ledStatus.txt
208 ... msg=No ledStatus.txt reported by health_check.
209 Should Contain ${service_data} SELshortlist.txt
210 ... msg=No SELshortlist.txt reported by health_check.
211 Should Contain ${service_data} parsedSELs.txt
212 ... msg=No parsedSELs.txt reported by health_check.
213 Should Contain ${service_data} bmcFullRaw.txt
214 ... msg=No bmcFullRaw.txt reported by health_check.
215 Should Contain ${service_data} data collection complete
216 ... msg='data collection complete' not reported by health_check.
217
218
219Check Greater Than Minimum
220 [Documentation] Value should be greater than minimum, otherwise fail.
221 [Arguments] ${value_to_test} ${minimum_value} ${label}
222
223 # Description of argument(s):
224 # value_to_test Value to compare to the minimum.
225 # minimum_value The minimum acceptable value.
226 # label Name to print if failure.
227
228 ${value_to_test}= Convert to Integer ${value_to_test}
229 Should Be True ${value_to_test} > ${minimum_value}
230 ... msg=There should be at least ${minimum_value} ${label}.
231
232
233Suite Setup Execution
234 [Documentation] Verify connectivity to run openbmctool commands.
235
236 # Verify connectivity to the BMC host.
237 ${bmc_version}= Run Keyword And Ignore Error Get BMC Version
238 Run Keyword If '${bmc_version[0]}' == 'FAIL' Fail
239 ... msg=Could not connect to BMC ${OPENBMC_HOST} to get firmware version.
240
241 # Verify can find the openbmctool.
242 ${openbmctool_file_path}= which openbmctool.py
243 Rprintn
244 Rprint Vars openbmctool_file_path
245
246 # Get the version number from openbmctool.
247 ${openbmctool_version}= Get Openbmctool Version
248
249 Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]