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 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 14 | |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 15 | Suite Setup Setup The Suite |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 16 | Test Setup Open Connection And Log In |
| 17 | Test Teardown Post Test Case Execution |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 18 | |
| 19 | *** Variables *** |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 20 | |
| 21 | ${stack_mode} skip |
| 22 | ${model}= ${OPENBMC_MODEL} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 23 | |
| 24 | *** Test Cases *** |
| 25 | Verify connection |
| 26 | Execute new Command echo "hello" |
| 27 | Response Should Be Equal "hello" |
| 28 | |
| 29 | Execute ipmi BT capabilities command |
George Keishing | cac24c7 | 2016-09-23 04:44:19 -0500 | [diff] [blame] | 30 | [Tags] Execute_ipmi_BT_capabilities_command |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 31 | Run IPMI command 0x06 0x36 |
| 32 | response Should Be Equal " 01 40 40 0a 01" |
| 33 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 34 | Execute Set Sensor Boot Count |
| 35 | [Tags] Execute_Set_Sensor_Boot_Count |
| 36 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 37 | ${uri}= Get System component BootCount |
| 38 | ${x}= Get Sensor Number ${uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 39 | |
| 40 | Run IPMI command 0x04 0x30 ${x} 0x01 0x00 0x35 0x00 0x00 0x00 0x00 0x00 0x00 |
| 41 | Read the Attribute ${uri} value |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 42 | ${val}= convert to integer 53 |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 43 | Response Should Be Equal ${val} |
| 44 | |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 45 | OCC Active Sensor On Enabled |
| 46 | [Tags] OCC_Active_Sensor_On_Enabled |
| 47 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 48 | ${uri}= Get System component OccStatus |
| 49 | ${x}= Get Sensor Number ${uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 50 | |
| 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 Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 55 | OCC Active Sensor On Disabled |
| 56 | [Tags] OCC_Active_Sensor_On_Disabled |
| 57 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 58 | ${uri}= Get System component OccStatus |
| 59 | ${x}= Get Sensor Number ${uri} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 60 | |
| 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 Maheshwari | eb1f6db | 2017-04-27 06:32:53 -0500 | [diff] [blame] | 65 | Verify 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 | |
| 73 | Verify 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 Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 83 | |
| 84 | Verify 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 Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 89 | [Setup] Turbo Setting Test Case Setup |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 90 | [Tags] Verify_Enabling_OCC_Turbo_Setting_Via_IPMI |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 91 | [Teardown] Restore System Configuration |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 92 | |
| 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 | |
| 104 | Verify 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 Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 109 | [Setup] Turbo Setting Test Case Setup |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 110 | [Tags] Verify_Disabling_OCC_Turbo_Setting_Via_IPMI |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 111 | [Teardown] Restore System Configuration |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 112 | |
| 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 Maheshwari | a3fdba4 | 2017-05-30 06:44:04 -0500 | [diff] [blame] | 124 | Verify 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 Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 131 | [Setup] Turbo Setting Test Case Setup |
Rahul Maheshwari | a3fdba4 | 2017-05-30 06:44:04 -0500 | [diff] [blame] | 132 | [Tags] Verify_Setting_OCC_Turbo_Via_REST |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 133 | [Teardown] Restore System Configuration |
Rahul Maheshwari | a3fdba4 | 2017-05-30 06:44:04 -0500 | [diff] [blame] | 134 | |
| 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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 143 | Chassis Present |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 144 | [Tags] Chassis_Present |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 145 | |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 146 | ${uri}= Get System component chassis |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 147 | Read The Attribute |
| 148 | ... ${INVENTORY_URI}system/chassis present |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 149 | Response Should Be Equal True |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 150 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 151 | Chassis Fault |
Sridevi Ramesh | 83f5c59 | 2017-01-20 04:35:13 -0600 | [diff] [blame] | 152 | [Tags] Chassis_Fault |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 153 | ${uri}= Get System component chassis |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 154 | Read The Attribute |
| 155 | ... ${INVENTORY_URI}system/chassis fault |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 156 | Response Should Be Equal False |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 157 | |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 158 | io_board Present |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 159 | [Tags] io_board_Present |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 160 | ${uri}= Get System component io_board |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 161 | Read The Attribute ${uri} present |
| 162 | Response Should Be Equal True |
| 163 | |
| 164 | io_board Fault |
Rahul Maheshwari | f811910 | 2016-10-05 01:15:56 -0500 | [diff] [blame] | 165 | [Tags] io_board_Fault |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 166 | ${uri}= Get System component io_board |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 167 | Read The Attribute ${uri} fault |
| 168 | Response Should Be Equal False |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 169 | |
| 170 | *** Keywords *** |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 171 | |
| 172 | Setup The Suite |
George Keishing | a743322 | 2017-03-23 23:47:11 -0500 | [diff] [blame] | 173 | [Documentation] Do the initial suite setup. |
George Keishing | f142668 | 2017-07-12 23:17:17 -0500 | [diff] [blame] | 174 | |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 175 | # Boot Host. |
| 176 | REST Power On |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 177 | |
| 178 | Open Connection And Log In |
George Keishing | ab1bd92 | 2016-12-05 05:29:59 -0600 | [diff] [blame] | 179 | ${resp}= Read Properties ${OPENBMC_BASE_URI}enumerate timeout=30 |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 180 | Set Suite Variable ${SYSTEM_INFO} ${resp} |
| 181 | log Dictionary ${resp} |
| 182 | |
Sweta Potthuri | 7e5dc59 | 2017-07-03 06:10:02 -0500 | [diff] [blame] | 183 | Turbo Setting Test Case Setup |
| 184 | [Documentation] Open Connection and turbo settings |
| 185 | |
| 186 | Open Connection And Log In |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 187 | ${setting}= Read Turbo Setting Via REST |
| 188 | Set Global Variable ${TURBO_SETTING} ${setting} |
| 189 | |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 190 | Get System component |
| 191 | [Arguments] ${type} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 192 | ${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 Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 195 | [Return] ${url} |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 196 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 197 | Execute new Command |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 198 | [Arguments] ${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 199 | ${output}= Execute Command ${args} |
| 200 | set test variable ${OUTPUT} "${output}" |
| 201 | |
| 202 | response Should Be Equal |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 203 | [Arguments] ${args} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 204 | Should Be Equal ${OUTPUT} ${args} |
| 205 | |
| 206 | Response Should Be Empty |
| 207 | Should Be Empty ${OUTPUT} |
| 208 | |
Gunnar Mills | 56b3289 | 2016-11-14 13:56:17 -0600 | [diff] [blame] | 209 | Read the Attribute |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 210 | [Arguments] ${uri} ${parm} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 211 | ${output}= Read Attribute ${uri} ${parm} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 212 | set test variable ${OUTPUT} ${output} |
| 213 | |
| 214 | Get Sensor Number |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 215 | [Arguments] ${name} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 216 | ${x}= get sensor ${OPENBMC_MODEL} ${name} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 217 | [Return] ${x} |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 218 | |
| 219 | Get Inventory Sensor Number |
Gunnar Mills | 3803280 | 2016-12-12 13:43:40 -0600 | [diff] [blame] | 220 | [Arguments] ${name} |
Gunnar Mills | 1cd544d | 2016-12-06 11:19:22 -0600 | [diff] [blame] | 221 | ${x}= get inventory sensor ${OPENBMC_MODEL} ${name} |
Gunnar Mills | c9ea936 | 2016-12-13 16:21:13 -0600 | [diff] [blame] | 222 | [Return] ${x} |
Rahul Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 223 | |
Rahul Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 224 | Read 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 | |
| 232 | Set 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 Maheshwari | 06174f2 | 2017-03-06 03:17:09 -0600 | [diff] [blame] | 241 | Post 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 Maheshwari | ca368e5 | 2017-05-04 05:01:49 -0500 | [diff] [blame] | 248 | |
| 249 | Restore 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 |