blob: 27ee44eeee35e6d4b69be79901a776d9fd545d32 [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 -060045OCC Active Sensor On Enabled
46 [Tags] OCC_Active_Sensor_On_Enabled
47
Gunnar Mills1cd544d2016-12-06 11:19:22 -060048 ${uri}= Get System component OccStatus
49 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050050
51 Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00
52 Read The Attribute ${uri} value
53 Response Should Be Equal Enabled
54
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060055OCC Active Sensor On Disabled
56 [Tags] OCC_Active_Sensor_On_Disabled
57
Gunnar Mills1cd544d2016-12-06 11:19:22 -060058 ${uri}= Get System component OccStatus
59 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050060
61 Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
62 Read The Attribute ${uri} value
63 Response Should Be Equal Disabled
64
Rahul Maheshwarieb1f6db2017-04-27 06:32:53 -050065Verify OCC Power Supply Redundancy
66 [Documentation] Check if OCC's power supply is set to not redundant.
67 [Tags] Verify_OCC_Power_Supply_Redundancy
68 ${uri}= Get System Component PowerSupplyRedundancy
69
70 Read The Attribute ${uri} value
71 Response Should Be Equal Disabled
72
73Verify OCC Power Supply Derating Value
74 [Documentation] Check if OCC's power supply derating value
75 ... is set correctly to a constant value 10.
76 [Tags] Verify_OCC_Power_Supply_Derating_Value
77
78 ${uri}= Get System Component PowerSupplyDerating
79
80 Read The Attribute ${uri} value
81 Response Should Be Equal ${10}
82
Rahul Maheshwarica368e52017-05-04 05:01:49 -050083
84Verify Enabling OCC Turbo Setting Via IPMI
85 [Documentation] Set and verify OCC's turbo allowed on enable.
86 # The allowed value for turbo allowed:
87 # True - To enable turbo allowed.
88 # False - To disable turbo allowed.
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050089 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwarica368e52017-05-04 05:01:49 -050090 [Tags] Verify_Enabling_OCC_Turbo_Setting_Via_IPMI
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050091 [Teardown] Restore System Configuration
Rahul Maheshwarica368e52017-05-04 05:01:49 -050092
93 ${uri}= Get System Component TurboAllowed
94 ${sensor_num}= Get Sensor Number ${uri}
95
96 ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE}
97 ... 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
98 Run IPMI Command ${ipmi_cmd}
99
100 Read The Attribute ${uri} value
101 Response Should Be Equal True
102
103
104Verify Disabling OCC Turbo Setting Via IPMI
105 [Documentation] Set and verify OCC's turbo allowed on disable.
106 # The allowed value for turbo allowed:
107 # True - To enable turbo allowed.
108 # False - To disable turbo allowed.
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500109 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500110 [Tags] Verify_Disabling_OCC_Turbo_Setting_Via_IPMI
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500111 [Teardown] Restore System Configuration
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500112
113 ${uri}= Get System Component TurboAllowed
114 ${sensor_num}= Get Sensor Number ${uri}
115
116 ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE}
117 ... 0x00 0x00 0x00 0x01 0x00 0x00 0x20 0x00
118 Run IPMI Command ${ipmi_cmd}
119
120 Read The Attribute ${uri} value
121 Response Should Be Equal False
122
123
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500124Verify Setting OCC Turbo Via REST
125 [Documentation] Verify enabling and disabling OCC's turbo allowed
126 ... via REST.
127 # The allowed value for turbo allowed:
128 # True - To enable turbo allowed.
129 # False - To disable turbo allowed.
130
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500131 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500132 [Tags] Verify_Setting_OCC_Turbo_Via_REST
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500133 [Teardown] Restore System Configuration
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500134
135 Set Turbo Setting Via REST False
136 ${setting}= Read Turbo Setting Via REST
137 Should Be Equal ${setting} False
138
139 Set Turbo Setting Via REST True
140 ${setting}= Read Turbo Setting Via REST
141 Should Be Equal ${setting} True
142
Chris Austenb29d2e82016-06-07 12:25:35 -0500143Chassis Present
Sridevi Ramesh83f5c592017-01-20 04:35:13 -0600144 [Tags] Chassis_Present
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500145
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600146 ${uri}= Get System component chassis
George Keishingab1bd922016-12-05 05:29:59 -0600147 Read The Attribute
148 ... ${INVENTORY_URI}system/chassis present
Chris Austenb29d2e82016-06-07 12:25:35 -0500149 Response Should Be Equal True
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500150
Chris Austenb29d2e82016-06-07 12:25:35 -0500151Chassis Fault
Sridevi Ramesh83f5c592017-01-20 04:35:13 -0600152 [Tags] Chassis_Fault
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600153 ${uri}= Get System component chassis
George Keishingab1bd922016-12-05 05:29:59 -0600154 Read The Attribute
155 ... ${INVENTORY_URI}system/chassis fault
Chris Austenb29d2e82016-06-07 12:25:35 -0500156 Response Should Be Equal False
Chris Austenb29d2e82016-06-07 12:25:35 -0500157
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500158io_board Present
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500159 [Tags] io_board_Present
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600160 ${uri}= Get System component io_board
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500161 Read The Attribute ${uri} present
162 Response Should Be Equal True
163
164io_board Fault
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500165 [Tags] io_board_Fault
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600166 ${uri}= Get System component io_board
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500167 Read The Attribute ${uri} fault
168 Response Should Be Equal False
Chris Austenb29d2e82016-06-07 12:25:35 -0500169
170*** Keywords ***
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500171
172Setup The Suite
George Keishinga7433222017-03-23 23:47:11 -0500173 [Documentation] Do the initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500174
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500175 # Boot Host.
176 REST Power On
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500177
178 Open Connection And Log In
George Keishingab1bd922016-12-05 05:29:59 -0600179 ${resp}= Read Properties ${OPENBMC_BASE_URI}enumerate timeout=30
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500180 Set Suite Variable ${SYSTEM_INFO} ${resp}
181 log Dictionary ${resp}
182
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500183Turbo Setting Test Case Setup
184 [Documentation] Open Connection and turbo settings
185
186 Open Connection And Log In
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500187 ${setting}= Read Turbo Setting Via REST
188 Set Global Variable ${TURBO_SETTING} ${setting}
189
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500190Get System component
191 [Arguments] ${type}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600192 ${list}= Get Dictionary Keys ${SYSTEM_INFO}
193 ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${type}[0-9]*$
194 ${url}= Get From List ${resp} 0
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600195 [Return] ${url}
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500196
Chris Austenb29d2e82016-06-07 12:25:35 -0500197Execute new Command
Gunnar Mills38032802016-12-12 13:43:40 -0600198 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500199 ${output}= Execute Command ${args}
200 set test variable ${OUTPUT} "${output}"
201
202response Should Be Equal
Gunnar Mills38032802016-12-12 13:43:40 -0600203 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500204 Should Be Equal ${OUTPUT} ${args}
205
206Response Should Be Empty
207 Should Be Empty ${OUTPUT}
208
Gunnar Mills56b32892016-11-14 13:56:17 -0600209Read the Attribute
Gunnar Mills38032802016-12-12 13:43:40 -0600210 [Arguments] ${uri} ${parm}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600211 ${output}= Read Attribute ${uri} ${parm}
Chris Austenb29d2e82016-06-07 12:25:35 -0500212 set test variable ${OUTPUT} ${output}
213
214Get Sensor Number
Gunnar Mills38032802016-12-12 13:43:40 -0600215 [Arguments] ${name}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600216 ${x}= get sensor ${OPENBMC_MODEL} ${name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600217 [Return] ${x}
Chris Austenb29d2e82016-06-07 12:25:35 -0500218
219Get Inventory Sensor Number
Gunnar Mills38032802016-12-12 13:43:40 -0600220 [Arguments] ${name}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600221 ${x}= get inventory sensor ${OPENBMC_MODEL} ${name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600222 [Return] ${x}
Rahul Maheshwari06174f22017-03-06 03:17:09 -0600223
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500224Read Turbo Setting Via REST
225 [Documentation] Return turbo allowed setting.
226
227 ${resp}= OpenBMC Get Request ${SENSORS_URI}host/TurboAllowed
228 ${jsondata}= To JSON ${resp.content}
229 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
230 [Return] ${jsondata["data"]["value"]}
231
232Set Turbo Setting Via REST
233 [Documentation] Set turbo setting via REST.
234 [Arguments] ${setting}
235 # Description of argument(s):
236 # setting Value which needs to be set.(i.e. False or True)
237
238 ${valueDict}= Create Dictionary data=${setting}
239 Write Attribute ${SENSORS_URI}host/TurboAllowed value data=${valueDict}
240
Rahul Maheshwari06174f22017-03-06 03:17:09 -0600241Post Test Case Execution
242 [Documentation] Do the post test teardown.
243 ... 1. Capture FFDC on test failure.
244 ... 2. Close all open SSH connections.
245
246 FFDC On Test Case Fail
247 Close All Connections
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500248
249Restore System Configuration
250 [Documentation] Restore System Configuration.
251
252 Open Connection And Log In
253 Set Turbo Setting Via REST ${TURBO_SETTING}
254 Close All Connections