blob: 6e583ba2ee006fbc1954d668667a3ae825cb54a1 [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
Steven Sombaraaf72c42017-09-05 12:02:00 -050014Resource ../lib/utils.robot
Chris Austenb29d2e82016-06-07 12:25:35 -050015
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050016Suite Setup Setup The Suite
Rahul Maheshwari06174f22017-03-06 03:17:09 -060017Test Setup Open Connection And Log In
18Test Teardown Post Test Case Execution
Chris Austenb29d2e82016-06-07 12:25:35 -050019
20*** Variables ***
Sweta Potthuriaf741cb2017-07-04 09:41:17 -050021
22${stack_mode} skip
23${model}= ${OPENBMC_MODEL}
Chris Austenb29d2e82016-06-07 12:25:35 -050024
25*** Test Cases ***
26Verify connection
27 Execute new Command echo "hello"
28 Response Should Be Equal "hello"
29
30Execute ipmi BT capabilities command
George Keishingcac24c72016-09-23 04:44:19 -050031 [Tags] Execute_ipmi_BT_capabilities_command
Chris Austenb29d2e82016-06-07 12:25:35 -050032 Run IPMI command 0x06 0x36
33 response Should Be Equal " 01 40 40 0a 01"
34
Sridevi Ramesh83f5c592017-01-20 04:35:13 -060035Execute Set Sensor Boot Count
36 [Tags] Execute_Set_Sensor_Boot_Count
37
Gunnar Mills1cd544d2016-12-06 11:19:22 -060038 ${uri}= Get System component BootCount
39 ${x}= Get Sensor Number ${uri}
Chris Austenb29d2e82016-06-07 12:25:35 -050040
41 Run IPMI command 0x04 0x30 ${x} 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00 0x00
42 Read the Attribute ${uri} value
Gunnar Mills1cd544d2016-12-06 11:19:22 -060043 ${val}= convert to integer 53
Chris Austenb29d2e82016-06-07 12:25:35 -050044 Response Should Be Equal ${val}
45
Rahul Maheshwarieb1f6db2017-04-27 06:32:53 -050046Verify OCC Power Supply Redundancy
47 [Documentation] Check if OCC's power supply is set to not redundant.
48 [Tags] Verify_OCC_Power_Supply_Redundancy
49 ${uri}= Get System Component PowerSupplyRedundancy
50
51 Read The Attribute ${uri} value
52 Response Should Be Equal Disabled
53
54Verify OCC Power Supply Derating Value
55 [Documentation] Check if OCC's power supply derating value
56 ... is set correctly to a constant value 10.
57 [Tags] Verify_OCC_Power_Supply_Derating_Value
58
59 ${uri}= Get System Component PowerSupplyDerating
60
61 Read The Attribute ${uri} value
62 Response Should Be Equal ${10}
63
Rahul Maheshwarica368e52017-05-04 05:01:49 -050064
65Verify Enabling OCC Turbo Setting Via IPMI
66 [Documentation] Set and verify OCC's turbo allowed on enable.
67 # The allowed value for turbo allowed:
68 # True - To enable turbo allowed.
69 # False - To disable turbo allowed.
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050070 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwarica368e52017-05-04 05:01:49 -050071 [Tags] Verify_Enabling_OCC_Turbo_Setting_Via_IPMI
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050072 [Teardown] Restore System Configuration
Rahul Maheshwarica368e52017-05-04 05:01:49 -050073
74 ${uri}= Get System Component TurboAllowed
75 ${sensor_num}= Get Sensor Number ${uri}
76
77 ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE}
78 ... 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00
79 Run IPMI Command ${ipmi_cmd}
80
81 Read The Attribute ${uri} value
82 Response Should Be Equal True
83
84
85Verify Disabling OCC Turbo Setting Via IPMI
86 [Documentation] Set and verify OCC's turbo allowed on disable.
87 # The allowed value for turbo allowed:
88 # True - To enable turbo allowed.
89 # False - To disable turbo allowed.
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050090 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwarica368e52017-05-04 05:01:49 -050091 [Tags] Verify_Disabling_OCC_Turbo_Setting_Via_IPMI
Sweta Potthuri7e5dc592017-07-03 06:10:02 -050092 [Teardown] Restore System Configuration
Rahul Maheshwarica368e52017-05-04 05:01:49 -050093
94 ${uri}= Get System Component TurboAllowed
95 ${sensor_num}= Get Sensor Number ${uri}
96
97 ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE}
98 ... 0x00 0x00 0x00 0x01 0x00 0x00 0x20 0x00
99 Run IPMI Command ${ipmi_cmd}
100
101 Read The Attribute ${uri} value
102 Response Should Be Equal False
103
104
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500105Verify Setting OCC Turbo Via REST
106 [Documentation] Verify enabling and disabling OCC's turbo allowed
107 ... via REST.
108 # The allowed value for turbo allowed:
109 # True - To enable turbo allowed.
110 # False - To disable turbo allowed.
111
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500112 [Setup] Turbo Setting Test Case Setup
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500113 [Tags] Verify_Setting_OCC_Turbo_Via_REST
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500114 [Teardown] Restore System Configuration
Rahul Maheshwaria3fdba42017-05-30 06:44:04 -0500115
116 Set Turbo Setting Via REST False
117 ${setting}= Read Turbo Setting Via REST
118 Should Be Equal ${setting} False
119
120 Set Turbo Setting Via REST True
121 ${setting}= Read Turbo Setting Via REST
122 Should Be Equal ${setting} True
123
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500124io_board Present
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500125 [Tags] io_board_Present
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600126 ${uri}= Get System component io_board
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500127 Read The Attribute ${uri} present
128 Response Should Be Equal True
129
130io_board Fault
Rahul Maheshwarif8119102016-10-05 01:15:56 -0500131 [Tags] io_board_Fault
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600132 ${uri}= Get System component io_board
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500133 Read The Attribute ${uri} fault
134 Response Should Be Equal False
Chris Austenb29d2e82016-06-07 12:25:35 -0500135
136*** Keywords ***
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500137
138Setup The Suite
Steven Sombaraaf72c42017-09-05 12:02:00 -0500139 [Documentation] Initial suite setup.
George Keishingf1426682017-07-12 23:17:17 -0500140
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500141 # Boot Host.
142 REST Power On
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500143
144 Open Connection And Log In
George Keishingab1bd922016-12-05 05:29:59 -0600145 ${resp}= Read Properties ${OPENBMC_BASE_URI}enumerate timeout=30
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500146 Set Suite Variable ${SYSTEM_INFO} ${resp}
147 log Dictionary ${resp}
148
Sweta Potthuri7e5dc592017-07-03 06:10:02 -0500149Turbo Setting Test Case Setup
150 [Documentation] Open Connection and turbo settings
151
152 Open Connection And Log In
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500153 ${setting}= Read Turbo Setting Via REST
154 Set Global Variable ${TURBO_SETTING} ${setting}
155
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500156Get System component
157 [Arguments] ${type}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600158 ${list}= Get Dictionary Keys ${SYSTEM_INFO}
159 ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${type}[0-9]*$
160 ${url}= Get From List ${resp} 0
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600161 [Return] ${url}
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500162
Chris Austenb29d2e82016-06-07 12:25:35 -0500163Execute new Command
Gunnar Mills38032802016-12-12 13:43:40 -0600164 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500165 ${output}= Execute Command ${args}
166 set test variable ${OUTPUT} "${output}"
167
168response Should Be Equal
Gunnar Mills38032802016-12-12 13:43:40 -0600169 [Arguments] ${args}
Chris Austenb29d2e82016-06-07 12:25:35 -0500170 Should Be Equal ${OUTPUT} ${args}
171
172Response Should Be Empty
173 Should Be Empty ${OUTPUT}
174
Gunnar Mills56b32892016-11-14 13:56:17 -0600175Read the Attribute
Gunnar Mills38032802016-12-12 13:43:40 -0600176 [Arguments] ${uri} ${parm}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600177 ${output}= Read Attribute ${uri} ${parm}
Chris Austenb29d2e82016-06-07 12:25:35 -0500178 set test variable ${OUTPUT} ${output}
179
180Get Sensor Number
Gunnar Mills38032802016-12-12 13:43:40 -0600181 [Arguments] ${name}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600182 ${x}= get sensor ${OPENBMC_MODEL} ${name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600183 [Return] ${x}
Chris Austenb29d2e82016-06-07 12:25:35 -0500184
185Get Inventory Sensor Number
Gunnar Mills38032802016-12-12 13:43:40 -0600186 [Arguments] ${name}
Gunnar Mills1cd544d2016-12-06 11:19:22 -0600187 ${x}= get inventory sensor ${OPENBMC_MODEL} ${name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -0600188 [Return] ${x}
Rahul Maheshwari06174f22017-03-06 03:17:09 -0600189
190Post Test Case Execution
191 [Documentation] Do the post test teardown.
192 ... 1. Capture FFDC on test failure.
193 ... 2. Close all open SSH connections.
194
195 FFDC On Test Case Fail
196 Close All Connections
Rahul Maheshwarica368e52017-05-04 05:01:49 -0500197
198Restore System Configuration
199 [Documentation] Restore System Configuration.
200
201 Open Connection And Log In
202 Set Turbo Setting Via REST ${TURBO_SETTING}
203 Close All Connections