blob: 5203e60ff58c7589ce9e84a328f9faea126e42a7 [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.
George Keishing7c6342b2018-11-02 14:27:13 -05005# The following tests are performed:
Steven Sombar15d1b9d2018-09-26 11:39:24 -05006#
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
Steven Sombarbd049cb2018-10-07 20:40:39 -050016# remote logging
Steven Sombar15d1b9d2018-09-26 11:39:24 -050017#
18# It is the responsibility of the user to include openbmctool.py's
19# directory PATH in $PATH.
20#
21# Test Parameters:
22# OPENBMC_HOST The BMC host name or IP address.
23# OPENBMC_USERNAME The username to login to the BMC.
24# OPENBMC_PASSWORD Password for OPENBMC_USERNAME.
Steven Sombarbd049cb2018-10-07 20:40:39 -050025# LOGGING_HOST The hostname or IP address of the remote
26# logging server. The default value is
27# '10.10.10.10'.
28# LOGGING_PORT The port number for remote logging on the
29# LOGGING_HOST. The default value is '514'.
30
Steven Sombar15d1b9d2018-09-26 11:39:24 -050031
32# TODO:
33# chassis tests
34# sel tests
35# dump
36# bmc (same as mc)
37# gardclear
38# firmware commands
39
40
41Library String
42Library OperatingSystem
Steven Sombarfbc75392018-11-27 15:50:59 -060043Library ../../lib/gen_print.py
44Library ../../lib/gen_robot_print.py
45Library ../../lib/openbmctool_utils.py
46Library ../../lib/gen_misc.py
47Library ../../lib/gen_robot_valid.py
48Resource ../../syslib/utils_os.robot
49Resource ../../lib/resource.txt
Steven Sombar15d1b9d2018-09-26 11:39:24 -050050
51
52Suite Setup Suite Setup Execution
Steven Sombarbd049cb2018-10-07 20:40:39 -050053Test Setup Rprintn
Michael Walsh98d56d12018-09-19 16:05:00 -050054
55*** Variables ***
56
Steven Sombar15d1b9d2018-09-26 11:39:24 -050057${min_number_items} ${30}
58${min_number_sensors} ${15}
Steven Sombarbd049cb2018-10-07 20:40:39 -050059${LOGGING_HOST} 10.10.10.10
60${LOGGING_PORT} 514
Steven Sombar15d1b9d2018-09-26 11:39:24 -050061
Michael Walsh98d56d12018-09-19 16:05:00 -050062
63*** Test Cases ***
64
Steven Sombar15d1b9d2018-09-26 11:39:24 -050065Verify Openbmctool FRU Commands
66 [Documentation] Verify FRU commands work.
67 [Tags] Verify_Openbmctool_FRU_Commands
Michael Walsh98d56d12018-09-19 16:05:00 -050068
Steven Sombar15d1b9d2018-09-26 11:39:24 -050069 Verify FRU Status
70 Verify FRU Print
71 Verify FRU List
72 # Verify FRU List With Single FRU
73 # Known issue - openbmctool.py FRU list with single FRU is not working yet.
74 # See https://github.com/openbmc/openbmc-tools/issues/32.
75
76
77Verify Openbmctool Sensors Commands
78 [Documentation] Verify sensors commands work.
79 [Tags] Verify_Openbmctool_Sensors_Commands
80
81 Verify Sensors Print
82 Verify Sensors List
83 # Verify Sensors List With Single Sensor
84 # Known issue - openbmctool.py sensors list with single sensor is
85 # not working yet. See https://github.com/openbmc/openbmc-tools/issues/33.
86
87
88Verify Openbmctool Health Check Commands
89 [Documentation] Verify health check command works.
90 [Tags] Verify_Openbmctool_Health_Check_Commands
91
Steven Sombarbd049cb2018-10-07 20:40:39 -050092 ${health_results}= Get Health Check verify=${1}
93 Rprint Vars health_results
Steven Sombar15d1b9d2018-09-26 11:39:24 -050094
95
96Verify Openbmctool Service Data Commands
97 [Documentation] Verify collect service data command works.
Steven Sombarbd049cb2018-10-07 20:40:39 -050098 [Tags] Verify_Openbmctool_Service_Data_Commands
Steven Sombar15d1b9d2018-09-26 11:39:24 -050099
Steven Sombarbd049cb2018-10-07 20:40:39 -0500100 ${service_paths}= Collect Service Data verify=${1}
101 Rprint Vars service_paths
102
103
104Verify Openbmctool Remote Logging Operations
105 [Documentation] Verify logging commands work.
106 [Tags] Verify_Openbmctool_Remote_Logging_Operations
107
108 # Verify Logging View
109 ${remote_logging_view}= Get Remote Logging View verify=${True}
110
111 # Save previous remote logging settings, if any.
112 ${remote_config}= Get Remote Logging Settings
113
114 # Enable remote logging and verify.
115 Verify Logging Parameters ${LOGGING_HOST} ${LOGGING_PORT}
116
117 # Disable remote logging and verify. Disable will clear any
118 # previous settings.
119 Verify Logging Disable ${LOGGING_HOST}
120
121 # Set original parameters back, if any.
122 Run Keyword If ${remote_config}
123 ... Verify Logging Parameters
124 ... ${remote_config['Address']} ${remote_config['Port']}
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500125
126
127*** Keywords ***
128
129
130Verify FRU Status
131 [Documentation] Verify that the 'fru status' command works.
132
133 ${fru_status}= Get Fru Status
134 ${num_frus}= Get Length ${fru_status}
135 Rprint Vars num_frus
136 Check Greater Than Minimum ${num_frus} ${min_number_items} frus
137
138
139Verify FRU Print
140 [Documentation] Verify that the 'fru print' command works.
141
142 ${rc} ${num_frus}= Openbmctool Execute Command
143 ... fru print | wc -l
144 Rprint Vars num_frus
145 Check Greater Than Minimum ${num_frus} ${min_number_items} frus
146
147
148Verify FRU List
149 [Documentation] Verify that the 'fru list' command works.
150
151 # Note: The output from 'fru list' is the same as 'fru print'.
152 ${rc} ${num_frus}= Openbmctool Execute Command
153 ... fru list | wc -l
154 Rprint Vars num_frus
155 Check Greater Than Minimum ${num_frus} ${min_number_items} frus
156
157
158Verify FRU List With Single FRU
159 [Documentation] Verify that 'fru list' with parameter works.
160
161 # Get the name of one FRU, in this case the first one listed.
162 ${fru_status}= Get Fru Status
163 ${fruname}= Set Variable ${fru_status[0]['component']}
164 Rprint Vars fruname
165 Should Not Be Empty ${fruname} msg=Could not find a FRU.
George Keishing7c6342b2018-11-02 14:27:13 -0500166 # Get a fru list specifying just the FRU.
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500167 ${rc} ${output}= Openbmctool Execute Command
168 ... fru list ${fruname} | wc -l
169 ${fru_detail}= Convert to Integer ${output}
170 Rprint Vars fru_detail
171 Should Be True ${fru_detail} <= ${min_number_items}
172 ... msg=Too many lines reported for fru status ${fruname}
173 Should Be True ${fru_detail} > ${4}
174 ... msg=Too few lines reported for fru status ${fruname}
175
176
177Verify Sensors Print
178 [Documentation] Verify that sensors print works.
179
180 ${sensor_status}= Get Sensors Print
181 ${num_sensors}= Get Length ${sensor_status}
Michael Walsh98d56d12018-09-19 16:05:00 -0500182 Rprint Vars num_sensors
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500183 Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors
184
185
186Verify Sensors List
187 [Documentation] Verify that sensors list works.
188
189 # Note: The output from 'sensors list' is the same as 'sensors print'.
190 ${sensor_status}= Get Sensors List
191 ${num_sensors}= Get Length ${sensor_status}
192 Rprint Vars num_sensors
193 Check Greater Than Minimum ${num_sensors} ${min_number_sensors} sensors
194
195
196Verify Sensors List With Single Sensor
197 [Documentation] Verify that sensors list with parameter works.
198
199 ${sensor}= Set Variable ambient
200 ${rc} ${num_sensors}= Openbmctool Execute Command
201 ... sensors list ${sensor} | wc -l
202 Rprint Vars sensor num_sensors
203 ${num_sensors}= Convert to Integer ${num_sensors}
204 Should Be True ${num_sensors} < ${10}
205 ... msg=Too many lines reported for list sensor ${sensor}
206
207
Steven Sombarbd049cb2018-10-07 20:40:39 -0500208Verify Logging Parameters
209 [Documentation] Verify remote_logging_config.
210 [Arguments] ${log_host} ${log_port}
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500211
Steven Sombarbd049cb2018-10-07 20:40:39 -0500212 # Description of argument(s):
213 # log_host The host name or IP address of remote logging server.
214 # log_port The port number for remote logging on log_host.
215
216 ${rc} ${result}= Openbmctool Execute Command JSON
217 ... logging remote_logging_config -a ${log_host} -p ${log_port}
218 ... print_output=${False} ignore_err=${False}
219
220 ${remote_logging_view}= Get Remote Logging View verify=${True}
221
222 Rvalid Value remote_logging_view['Address'] valid_values=['${log_host}']
223 Rvalid Value remote_logging_view['Port'] valid_values=[int(${log_port})]
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500224
225
Steven Sombarbd049cb2018-10-07 20:40:39 -0500226Verify Logging Disable
227 [Documentation] Verify remote_logging disable
228 [Arguments] ${log_host}
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500229
Steven Sombarbd049cb2018-10-07 20:40:39 -0500230 # Description of argument(s):
231 # log_host The host name or IP address of remote logging server.
232
233 ${rc} ${result}= Openbmctool Execute Command JSON
234 ... logging remote_logging disable
235
236 ${remote_logging_view}= Get Remote Logging View verify=${True}
237 Rvalid Value remote_logging_view['Address'] valid_values=['']
238
239
240Get Remote Logging Settings
241 [Documentation] Return the remote config settings as a dictionary
242 ... if active. Otherwise, return ${False}.
243
244 ${remote_config}= Read Properties ${BMC_LOGGING_URI}config/remote
245 Return From Keyword If
246 ... '${remote_config["Address"]}' == '' or '${remote_config["Port"]}' == '0'
247 ... ${False}
248
249 [Return] ${remote_config}
Steven Sombar15d1b9d2018-09-26 11:39:24 -0500250
251
252Check Greater Than Minimum
253 [Documentation] Value should be greater than minimum, otherwise fail.
254 [Arguments] ${value_to_test} ${minimum_value} ${label}
255
256 # Description of argument(s):
257 # value_to_test Value to compare to the minimum.
258 # minimum_value The minimum acceptable value.
259 # label Name to print if failure.
260
261 ${value_to_test}= Convert to Integer ${value_to_test}
262 Should Be True ${value_to_test} > ${minimum_value}
263 ... msg=There should be at least ${minimum_value} ${label}.
264
265
266Suite Setup Execution
267 [Documentation] Verify connectivity to run openbmctool commands.
268
269 # Verify connectivity to the BMC host.
270 ${bmc_version}= Run Keyword And Ignore Error Get BMC Version
271 Run Keyword If '${bmc_version[0]}' == 'FAIL' Fail
272 ... msg=Could not connect to BMC ${OPENBMC_HOST} to get firmware version.
273
274 # Verify can find the openbmctool.
275 ${openbmctool_file_path}= which openbmctool.py
276 Rprintn
277 Rprint Vars openbmctool_file_path
278
279 # Get the version number from openbmctool.
280 ${openbmctool_version}= Get Openbmctool Version
281
282 Rprint Vars openbmctool_version OPENBMC_HOST bmc_version[1]