blob: cd3e77999c3e71612629bcc7a2a6cd80e7d23e5d [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
2Documentation This example demonstrates executing commands on a remote machine
3... and getting their output and the return code.
4...
5... Notice how connections are handled as part of the suite setup and
6... teardown. This saves some time when executing several test cases.
7
Rahul Maheshwari06174f22017-03-06 03:17:09 -06008Resource ../lib/rest_client.robot
9Resource ../lib/ipmi_client.robot
10Resource ../lib/openbmc_ffdc.robot
George Keishinga7433222017-03-23 23:47:11 -050011Resource ../lib/state_manager.robot
Rahul Maheshwari06174f22017-03-06 03:17:09 -060012Library ../data/model.py
Sweta Potthuriaf741cb2017-07-04 09:41:17 -050013Resource ../lib/boot_utils.robot
Chris Austenb29d2e82016-06-07 12:25:35 -050014
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050015Suite Setup Setup The Suite
Rahul Maheshwari06174f22017-03-06 03:17:09 -060016Test Setup Open Connection And Log In
17Test Teardown Post Test Case Execution
Chris Austenb29d2e82016-06-07 12:25:35 -050018
19*** Variables ***
Sweta Potthuriaf741cb2017-07-04 09:41:17 -050020
21${stack_mode} skip
22${model}= ${OPENBMC_MODEL}
Chris Austenb29d2e82016-06-07 12:25:35 -050023
24*** Test Cases ***
25Verify connection
26 Execute new Command echo "hello"
27 Response Should Be Equal "hello"
28
29Execute ipmi BT capabilities command
George Keishingcac24c72016-09-23 04:44:19 -050030 [Tags] Execute_ipmi_BT_capabilities_command
Chris Austenb29d2e82016-06-07 12:25:35 -050031 Run IPMI command 0x06 0x36
32 response Should Be Equal " 01 40 40 0a 01"
33
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060034Execute Set Sensor Boot Count
35 [Tags] Execute_Set_Sensor_Boot_Count
36
Gunnar Mills1cd544d2016-12-06 11:19:22 -060037 ${uri}= Get System component BootCount
38 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050039
40 Run IPMI command 0x04 0x30 ${x} 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00 0x00
41 Read the Attribute ${uri} value
Gunnar Mills1cd544d2016-12-06 11:19:22 -060042 ${val}= convert to integer 53
Chris Austenb29d2e82016-06-07 12:25:35 -050043 Response Should Be Equal ${val}
44
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060045Set Sensor Boot Progress
46 [Tags] Set_Sensor_Boot_Progress
47
Gunnar Mills1cd544d2016-12-06 11:19:22 -060048 ${uri}= Get System component BootProgress
49 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050050
51 Run IPMI command 0x04 0x30 ${x} 0xa9 0x00 0x04 0x00 0x00 0x00 0x00 0x14 0x00
52 Read the Attribute ${uri} value
53 Response Should Be Equal FW Progress, Baseboard Init
54
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060055Set Sensor Boot Progress Longest String
56 [Tags] Set_Sensor_Boot_Progress_Longest_String
Gunnar Mills1cd544d2016-12-06 11:19:22 -060057 ${uri}= Get System component BootProgress
58 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050059
60 Run IPMI command 0x04 0x30 ${x} 0xa9 0x00 0x04 0x00 0x00 0x00 0x00 0x0e 0x00
61 Read The Attribute ${uri} value
62 Response Should Be Equal FW Progress, Docking station attachment
63
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060064Boot Progress Sensor FW Hang Unspecified Error
65 [Tags] Boot_Progress_Sensor_FW_Hang_Unspecified_Error
66
Gunnar Mills1cd544d2016-12-06 11:19:22 -060067 ${uri}= Get System component BootProgress
68 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050069
70 Run IPMI command 0x04 0x30 ${x} 0xa9 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00
71 Read The Attribute ${uri} value
72 Response Should Be Equal FW Hang, Unspecified
73
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060074Boot Progress FW Hang State
75 [Tags] Boot_Progress_FW_Hang_State
76
Gunnar Mills1cd544d2016-12-06 11:19:22 -060077 ${uri}= Get System component BootProgress
78 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050079
80 Run IPMI command 0x04 0x30 ${x} 0xa9 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
81 Read The Attribute ${uri} value
82 Response Should Be Equal POST Error, unknown
83
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060084OS Status Sensor Boot Completed Progress
85 [Tags] OS_Status_Sensor_Boot_Completed_Progress
86
Gunnar Mills1cd544d2016-12-06 11:19:22 -060087 ${uri}= Get System component OperatingSystemStatus
88 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050089
90 Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
91 Read The Attribute ${uri} value
92 Response Should Be Equal Boot completed (00)
93
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060094OS Status Sensor Progress
95 [Tags] OS_Status_Sensor_Progress
96
Gunnar Mills1cd544d2016-12-06 11:19:22 -060097 ${uri}= Get System component OperatingSystemStatus
98 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050099
100 Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x04 0x00 0x00 0x00 0x00 0x20 0x00
101 Read The Attribute ${uri} value
102 Response Should Be Equal PXE boot completed
103
Sridevi Ramesh83f5c592017-01-20 04:35:13 -0600104OCC Active Sensor On Enabled
105 [Tags] OCC_Active_Sensor_On_Enabled
106
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600107 ${uri}= Get System component OccStatus
108 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500109
110 Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00
111 Read The Attribute ${uri} value
112 Response Should Be Equal Enabled
113
Sridevi Ramesh83f5c592017-01-20 04:35:13 -0600114OCC Active Sensor On Disabled
115 [Tags] OCC_Active_Sensor_On_Disabled
116
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600117 ${uri}= Get System component OccStatus
118 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -0500119
120 Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
121 Read The Attribute ${uri} value
122 Response Should Be Equal Disabled
123
Rahul Maheshwarieb1f6db2017-04-27 06:32:53 -0500124Verify OCC Power Supply Redundancy
125 [Documentation] Check if OCC's power supply is set to not redundant.
126 [Tags] Verify_OCC_Power_Supply_Redundancy
127 ${uri}= Get System Component PowerSupplyRedundancy
128
129 Read The Attribute ${uri} value
130 Response Should Be Equal Disabled
131
132Verify OCC Power Supply Derating Value
133 [Documentation] Check if OCC's power supply derating value
134 ... is set correctly to a constant value 10.
135 [Tags] Verify_OCC_Power_Supply_Derating_Value
136
137 ${uri}= Get System Component PowerSupplyDerating
138
139 Read The Attribute ${uri} value
140 Response Should Be Equal ${10}
141
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500142
143Verify Enabling OCC Turbo Setting Via IPMI
144 [Documentation] Set and verify OCC's turbo allowed on enable.
145 # The allowed value for turbo allowed:
146 # True - To enable turbo allowed.
147 # False - To disable turbo allowed.
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500148 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500149 [Tags] Verify_Enabling_OCC_Turbo_Setting_Via_IPMI
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500150 [Teardown] Restore System Configuration
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500151
152 ${uri}= Get System Component TurboAllowed
153 ${sensor_num}= Get Sensor Number ${uri}
154
155 ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE}
156 ... 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
157 Run IPMI Command ${ipmi_cmd}
158
159 Read The Attribute ${uri} value
160 Response Should Be Equal True
161
162
163Verify Disabling OCC Turbo Setting Via IPMI
164 [Documentation] Set and verify OCC's turbo allowed on disable.
165 # The allowed value for turbo allowed:
166 # True - To enable turbo allowed.
167 # False - To disable turbo allowed.
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500168 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500169 [Tags] Verify_Disabling_OCC_Turbo_Setting_Via_IPMI
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500170 [Teardown] Restore System Configuration
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500171
172 ${uri}= Get System Component TurboAllowed
173 ${sensor_num}= Get Sensor Number ${uri}
174
175 ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE}
176 ... 0x00 0x00 0x00 0x01 0x00 0x00 0x20 0x00
177 Run IPMI Command ${ipmi_cmd}
178
179 Read The Attribute ${uri} value
180 Response Should Be Equal False
181
182
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500183Verify Setting OCC Turbo Via REST
184 [Documentation] Verify enabling and disabling OCC's turbo allowed
185 ... via REST.
186 # The allowed value for turbo allowed:
187 # True - To enable turbo allowed.
188 # False - To disable turbo allowed.
189
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500190 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500191 [Tags] Verify_Setting_OCC_Turbo_Via_REST
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500192 [Teardown] Restore System Configuration
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500193
194 Set Turbo Setting Via REST False
195 ${setting}= Read Turbo Setting Via REST
196 Should Be Equal ${setting} False
197
198 Set Turbo Setting Via REST True
199 ${setting}= Read Turbo Setting Via REST
200 Should Be Equal ${setting} True
201
Chris Austenb29d2e82016-06-07 12:25:35 -0500202Chassis Present
Sridevi Ramesh83f5c592017-01-20 04:35:13 -0600203 [Tags] Chassis_Present
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500204
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600205 ${uri}= Get System component chassis
George Keishingab1bd922016-12-05 05:29:59 -0600206 Read The Attribute
207 ... ${INVENTORY_URI}system/chassis present
Chris Austenb29d2e82016-06-07 12:25:35 -0500208 Response Should Be Equal True
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500209
Chris Austenb29d2e82016-06-07 12:25:35 -0500210Chassis Fault
Sridevi Ramesh83f5c592017-01-20 04:35:13 -0600211 [Tags] Chassis_Fault
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600212 ${uri}= Get System component chassis
George Keishingab1bd922016-12-05 05:29:59 -0600213 Read The Attribute
214 ... ${INVENTORY_URI}system/chassis fault
Chris Austenb29d2e82016-06-07 12:25:35 -0500215 Response Should Be Equal False
Chris Austenb29d2e82016-06-07 12:25:35 -0500216
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500217io_board Present
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500218 [Tags] io_board_Present
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600219 ${uri}= Get System component io_board
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500220 Read The Attribute ${uri} present
221 Response Should Be Equal True
222
223io_board Fault
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500224 [Tags] io_board_Fault
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600225 ${uri}= Get System component io_board
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500226 Read The Attribute ${uri} fault
227 Response Should Be Equal False
Chris Austenb29d2e82016-06-07 12:25:35 -0500228
229*** Keywords ***
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500230
231Setup The Suite
George Keishinga7433222017-03-23 23:47:11 -0500232 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500233
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500234 # Boot Host.
235 REST Power On
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500236
237 Open Connection And Log In
George Keishingab1bd922016-12-05 05:29:59 -0600238 ${resp}= Read Properties ${OPENBMC_BASE_URI}enumerate timeout=30
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500239 Set Suite Variable ${SYSTEM_INFO} ${resp}
240 log Dictionary ${resp}
241
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500242Turbo Setting Test Case Setup
243 [Documentation] Open Connection and turbo settings
244
245 Open Connection And Log In
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500246 ${setting}= Read Turbo Setting Via REST
247 Set Global Variable ${TURBO_SETTING} ${setting}
248
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500249Get System component
250 [Arguments] ${type}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600251 ${list}= Get Dictionary Keys ${SYSTEM_INFO}
252 ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${type}[0-9]*$
253 ${url}= Get From List ${resp} 0
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600254 [Return] ${url}
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500255
Chris Austenb29d2e82016-06-07 12:25:35 -0500256Execute new Command
Gunnar Mills38032802016-12-12 13:43:40 -0600257 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500258 ${output}= Execute Command ${args}
259 set test variable ${OUTPUT} "${output}"
260
261response Should Be Equal
Gunnar Mills38032802016-12-12 13:43:40 -0600262 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500263 Should Be Equal ${OUTPUT} ${args}
264
265Response Should Be Empty
266 Should Be Empty ${OUTPUT}
267
Gunnar Mills56b32892016-11-14 13:56:17 -0600268Read the Attribute
Gunnar Mills38032802016-12-12 13:43:40 -0600269 [Arguments] ${uri} ${parm}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600270 ${output}= Read Attribute ${uri} ${parm}
Chris Austenb29d2e82016-06-07 12:25:35 -0500271 set test variable ${OUTPUT} ${output}
272
273Get Sensor Number
Gunnar Mills38032802016-12-12 13:43:40 -0600274 [Arguments] ${name}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600275 ${x}= get sensor ${OPENBMC_MODEL} ${name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600276 [Return] ${x}
Chris Austenb29d2e82016-06-07 12:25:35 -0500277
278Get Inventory Sensor Number
Gunnar Mills38032802016-12-12 13:43:40 -0600279 [Arguments] ${name}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600280 ${x}= get inventory sensor ${OPENBMC_MODEL} ${name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600281 [Return] ${x}
Rahul Maheshwari06174f22017-03-06 03:17:09 -0600282
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500283Read Turbo Setting Via REST
284 [Documentation] Return turbo allowed setting.
285
286 ${resp}= OpenBMC Get Request ${SENSORS_URI}host/TurboAllowed
287 ${jsondata}= To JSON ${resp.content}
288 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
289 [Return] ${jsondata["data"]["value"]}
290
291Set Turbo Setting Via REST
292 [Documentation] Set turbo setting via REST.
293 [Arguments] ${setting}
294 # Description of argument(s):
295 # setting Value which needs to be set.(i.e. False or True)
296
297 ${valueDict}= Create Dictionary data=${setting}
298 Write Attribute ${SENSORS_URI}host/TurboAllowed value data=${valueDict}
299
Rahul Maheshwari06174f22017-03-06 03:17:09 -0600300Post Test Case Execution
301 [Documentation] Do the post test teardown.
302 ... 1. Capture FFDC on test failure.
303 ... 2. Close all open SSH connections.
304
305 FFDC On Test Case Fail
306 Close All Connections
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500307
308Restore System Configuration
309 [Documentation] Restore System Configuration.
310
311 Open Connection And Log In
312 Set Turbo Setting Via REST ${TURBO_SETTING}
313 Close All Connections