Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 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 Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 8 | Resource ../lib/rest_client.robot |
| 9 | Resource ../lib/ipmi_client.robot |
| 10 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | a743322 | 2017-03-23 23:47:11 -0500 | [diff] [blame] | 11 | Resource ../lib/state_manager.robot |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 12 | Library ../data/model.py |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 13 | Resource ../lib/boot_utils.robot |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 14 | Resource ../lib/utils.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 16 | Suite Setup Setup The Suite |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 17 | Test Setup Open Connection And Log In |
| 18 | Test Teardown Post Test Case Execution |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 19 | |
| 20 | *** Variables *** |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 21 | |
| 22 | ${stack_mode} skip |
| 23 | ${model}= ${OPENBMC_MODEL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | |
| 25 | *** Test Cases *** |
| 26 | Verify connection |
| 27 | Execute new Command echo "hello" |
| 28 | Response Should Be Equal "hello" |
| 29 | |
| 30 | Execute ipmi BT capabilities command |
George Keishing | cac24c7 | 2016-09-23 04:44:19 -0500 | [diff] [blame] | 31 | [Tags] Execute_ipmi_BT_capabilities_command |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 32 | Run IPMI command 0x06 0x36 |
| 33 | response Should Be Equal " 01 40 40 0a 01" |
| 34 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 35 | Execute Set Sensor Boot Count |
| 36 | [Tags] Execute_Set_Sensor_Boot_Count |
| 37 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 38 | ${uri}= Get System component BootCount |
| 39 | ${x}= Get Sensor Number ${uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 40 | |
| 41 | Run IPMI command 0x04 0x30 ${x} 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00 0x00 |
| 42 | Read the Attribute ${uri} value |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 43 | ${val}= convert to integer 53 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 44 | Response Should Be Equal ${val} |
| 45 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 46 | OCC Active Sensor On Enabled |
| 47 | [Tags] OCC_Active_Sensor_On_Enabled |
| 48 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 49 | ${uri}= Get System component OccStatus |
| 50 | ${x}= Get Sensor Number ${uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 51 | |
| 52 | Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x20 0x00 |
| 53 | Read The Attribute ${uri} value |
| 54 | Response Should Be Equal Enabled |
| 55 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 56 | OCC Active Sensor On Disabled |
| 57 | [Tags] OCC_Active_Sensor_On_Disabled |
| 58 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 59 | ${uri}= Get System component OccStatus |
| 60 | ${x}= Get Sensor Number ${uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 61 | |
| 62 | Run IPMI command 0x04 0x30 ${x} 0x00 0x00 0x01 0x00 0x00 0x00 0x00 0x20 0x00 |
| 63 | Read The Attribute ${uri} value |
| 64 | Response Should Be Equal Disabled |
| 65 | |
Rahul Maheshwari | eb1f6db | 2017-04-27 06:32:53 -0500 | [diff] [blame] | 66 | Verify OCC Power Supply Redundancy |
| 67 | [Documentation] Check if OCC's power supply is set to not redundant. |
| 68 | [Tags] Verify_OCC_Power_Supply_Redundancy |
| 69 | ${uri}= Get System Component PowerSupplyRedundancy |
| 70 | |
| 71 | Read The Attribute ${uri} value |
| 72 | Response Should Be Equal Disabled |
| 73 | |
| 74 | Verify OCC Power Supply Derating Value |
| 75 | [Documentation] Check if OCC's power supply derating value |
| 76 | ... is set correctly to a constant value 10. |
| 77 | [Tags] Verify_OCC_Power_Supply_Derating_Value |
| 78 | |
| 79 | ${uri}= Get System Component PowerSupplyDerating |
| 80 | |
| 81 | Read The Attribute ${uri} value |
| 82 | Response Should Be Equal ${10} |
| 83 | |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 84 | |
| 85 | Verify Enabling OCC Turbo Setting Via IPMI |
| 86 | [Documentation] Set and verify OCC's turbo allowed on enable. |
| 87 | # The allowed value for turbo allowed: |
| 88 | # True - To enable turbo allowed. |
| 89 | # False - To disable turbo allowed. |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 90 | [Setup] Turbo Setting Test Case Setup |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 91 | [Tags] Verify_Enabling_OCC_Turbo_Setting_Via_IPMI |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 92 | [Teardown] Restore System Configuration |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 93 | |
| 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 0x01 0x00 0x00 0x00 0x00 0x20 0x00 |
| 99 | Run IPMI Command ${ipmi_cmd} |
| 100 | |
| 101 | Read The Attribute ${uri} value |
| 102 | Response Should Be Equal True |
| 103 | |
| 104 | |
| 105 | Verify Disabling OCC Turbo Setting Via IPMI |
| 106 | [Documentation] Set and verify OCC's turbo allowed on disable. |
| 107 | # The allowed value for turbo allowed: |
| 108 | # True - To enable turbo allowed. |
| 109 | # False - To disable turbo allowed. |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 110 | [Setup] Turbo Setting Test Case Setup |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 111 | [Tags] Verify_Disabling_OCC_Turbo_Setting_Via_IPMI |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 112 | [Teardown] Restore System Configuration |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 113 | |
| 114 | ${uri}= Get System Component TurboAllowed |
| 115 | ${sensor_num}= Get Sensor Number ${uri} |
| 116 | |
| 117 | ${ipmi_cmd}= Catenate SEPARATOR= 0x04 0x30 ${sensor_num} 0x00${SPACE} |
| 118 | ... 0x00 0x00 0x00 0x01 0x00 0x00 0x20 0x00 |
| 119 | Run IPMI Command ${ipmi_cmd} |
| 120 | |
| 121 | Read The Attribute ${uri} value |
| 122 | Response Should Be Equal False |
| 123 | |
| 124 | |
Rahul Maheshwari | a3fdba4 | 2017-05-30 06:44:04 -0500 | [diff] [blame] | 125 | Verify Setting OCC Turbo Via REST |
| 126 | [Documentation] Verify enabling and disabling OCC's turbo allowed |
| 127 | ... via REST. |
| 128 | # The allowed value for turbo allowed: |
| 129 | # True - To enable turbo allowed. |
| 130 | # False - To disable turbo allowed. |
| 131 | |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 132 | [Setup] Turbo Setting Test Case Setup |
Rahul Maheshwari | a3fdba4 | 2017-05-30 06:44:04 -0500 | [diff] [blame] | 133 | [Tags] Verify_Setting_OCC_Turbo_Via_REST |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 134 | [Teardown] Restore System Configuration |
Rahul Maheshwari | a3fdba4 | 2017-05-30 06:44:04 -0500 | [diff] [blame] | 135 | |
| 136 | Set Turbo Setting Via REST False |
| 137 | ${setting}= Read Turbo Setting Via REST |
| 138 | Should Be Equal ${setting} False |
| 139 | |
| 140 | Set Turbo Setting Via REST True |
| 141 | ${setting}= Read Turbo Setting Via REST |
| 142 | Should Be Equal ${setting} True |
| 143 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 144 | Chassis Present |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 145 | [Tags] Chassis_Present |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 146 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 147 | ${uri}= Get System component chassis |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 148 | Read The Attribute |
| 149 | ... ${INVENTORY_URI}system/chassis present |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 150 | Response Should Be Equal True |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 151 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 152 | Chassis Fault |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 153 | [Tags] Chassis_Fault |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 154 | ${uri}= Get System component chassis |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 155 | Read The Attribute |
| 156 | ... ${INVENTORY_URI}system/chassis fault |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 157 | Response Should Be Equal False |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 158 | |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 159 | io_board Present |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 160 | [Tags] io_board_Present |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 161 | ${uri}= Get System component io_board |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 162 | Read The Attribute ${uri} present |
| 163 | Response Should Be Equal True |
| 164 | |
| 165 | io_board Fault |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 166 | [Tags] io_board_Fault |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 167 | ${uri}= Get System component io_board |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 168 | Read The Attribute ${uri} fault |
| 169 | Response Should Be Equal False |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 170 | |
| 171 | *** Keywords *** |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 172 | |
| 173 | Setup The Suite |
Steven Sombar | aaf72c4 | 2017-09-05 12:02:00 -0500 | [diff] [blame] | 174 | [Documentation] Initial suite setup. |
George Keishing | f142668 | 2017-07-12 23:17:17 -0500 | [diff] [blame] | 175 | |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 176 | # Boot Host. |
| 177 | REST Power On |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 178 | |
| 179 | Open Connection And Log In |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 180 | ${resp}= Read Properties ${OPENBMC_BASE_URI}enumerate timeout=30 |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 181 | Set Suite Variable ${SYSTEM_INFO} ${resp} |
| 182 | log Dictionary ${resp} |
| 183 | |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 184 | Turbo Setting Test Case Setup |
| 185 | [Documentation] Open Connection and turbo settings |
| 186 | |
| 187 | Open Connection And Log In |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 188 | ${setting}= Read Turbo Setting Via REST |
| 189 | Set Global Variable ${TURBO_SETTING} ${setting} |
| 190 | |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 191 | Get System component |
| 192 | [Arguments] ${type} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 193 | ${list}= Get Dictionary Keys ${SYSTEM_INFO} |
| 194 | ${resp}= Get Matches ${list} regexp=^.*[0-9a-z_].${type}[0-9]*$ |
| 195 | ${url}= Get From List ${resp} 0 |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 196 | [Return] ${url} |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 197 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 198 | Execute new Command |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 199 | [Arguments] ${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 200 | ${output}= Execute Command ${args} |
| 201 | set test variable ${OUTPUT} "${output}" |
| 202 | |
| 203 | response Should Be Equal |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 204 | [Arguments] ${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 205 | Should Be Equal ${OUTPUT} ${args} |
| 206 | |
| 207 | Response Should Be Empty |
| 208 | Should Be Empty ${OUTPUT} |
| 209 | |
Gunnar Mills | 56b3289 | 2016-11-14 13:56:17 -0600 | [diff] [blame] | 210 | Read the Attribute |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 211 | [Arguments] ${uri} ${parm} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 212 | ${output}= Read Attribute ${uri} ${parm} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 213 | set test variable ${OUTPUT} ${output} |
| 214 | |
| 215 | Get Sensor Number |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 216 | [Arguments] ${name} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 217 | ${x}= get sensor ${OPENBMC_MODEL} ${name} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 218 | [Return] ${x} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 219 | |
| 220 | Get Inventory Sensor Number |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 221 | [Arguments] ${name} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 222 | ${x}= get inventory sensor ${OPENBMC_MODEL} ${name} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 223 | [Return] ${x} |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 224 | |
| 225 | Post Test Case Execution |
| 226 | [Documentation] Do the post test teardown. |
| 227 | ... 1. Capture FFDC on test failure. |
| 228 | ... 2. Close all open SSH connections. |
| 229 | |
| 230 | FFDC On Test Case Fail |
| 231 | Close All Connections |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 232 | |
| 233 | Restore System Configuration |
| 234 | [Documentation] Restore System Configuration. |
| 235 | |
| 236 | Open Connection And Log In |
| 237 | Set Turbo Setting Via REST ${TURBO_SETTING} |
| 238 | Close All Connections |