| Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation       This suite is for testing general IPMI functions. | 
|  | 3 |  | 
|  | 4 | Resource            ../../lib/ipmi_client.robot | 
|  | 5 | Resource            ../../lib/openbmc_ffdc.robot | 
| George Keishing | 0825a11 | 2018-03-30 10:48:07 -0500 | [diff] [blame] | 6 | Resource            ../../lib/boot_utils.robot | 
| George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 7 | Resource            ../../lib/utils.robot | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 8 | Resource            ../../lib/bmc_network_utils.robot | 
| George Keishing | d627380 | 2018-09-07 07:06:53 -0500 | [diff] [blame] | 9 | Resource            ../../lib/logging_utils.robot | 
| George Keishing | 78ce8dc | 2018-03-30 11:49:06 -0500 | [diff] [blame] | 10 | Library             ../../lib/ipmi_utils.py | 
| George Keishing | 0825a11 | 2018-03-30 10:48:07 -0500 | [diff] [blame] | 11 | Variables           ../../data/ipmi_raw_cmd_table.py | 
| Rahul Maheshwari | df6f05d | 2018-09-04 03:48:37 -0500 | [diff] [blame] | 12 | Library             ../../lib/gen_misc.py | 
| Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 13 |  | 
| Michael Walsh | c9eb34e | 2019-01-23 11:08:43 -0600 | [diff] [blame] | 14 | Test Setup          Log to Console  ${EMPTY} | 
| Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 15 | Test Teardown       FFDC On Test Case Fail | 
|  | 16 |  | 
|  | 17 | *** Variables *** | 
|  | 18 |  | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 19 | ${new_mc_id}=  HOST | 
| Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 20 | ${allowed_temp_diff}=  ${1} | 
| Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 21 | ${allowed_power_diff}=  ${10} | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 22 |  | 
| Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 23 | *** Test Cases *** | 
|  | 24 |  | 
|  | 25 | Set Asset Tag With Valid String Length | 
|  | 26 | [Documentation]  Set asset tag with valid string length and verify. | 
|  | 27 | [Tags]  Set_Asset_Tag_With_Valid_String_Length | 
|  | 28 |  | 
|  | 29 | # Allowed MAX characters length for asset tag name is 63. | 
|  | 30 | ${random_string}=  Generate Random String  63 | 
|  | 31 | Run Keyword  Run IPMI Standard Command  dcmi set_asset_tag ${random_string} | 
|  | 32 |  | 
|  | 33 | ${asset_tag}=  Run Keyword  Run IPMI Standard Command  dcmi asset_tag | 
|  | 34 | Should Contain  ${asset_tag}  ${random_string} | 
|  | 35 |  | 
|  | 36 |  | 
|  | 37 | Set Asset Tag With Invalid String Length | 
|  | 38 | [Documentation]  Verify error while setting invalid asset tag via IPMI. | 
|  | 39 | [Tags]  Set_Asset_Tag_With_Invalid_String_Length | 
|  | 40 |  | 
|  | 41 | # Any string more than 63 character is invalid for asset tag. | 
|  | 42 | ${random_string}=  Generate Random String  64 | 
|  | 43 |  | 
|  | 44 | ${resp}=  Run Keyword And Expect Error  *  Run IPMI Standard Command | 
|  | 45 | ...  dcmi set_asset_tag ${random_string} | 
|  | 46 | Should Contain  ${resp}  Parameter out of range  ignore_case=True | 
|  | 47 |  | 
|  | 48 |  | 
|  | 49 | Set Asset Tag With Valid String Length Via REST | 
|  | 50 | [Documentation]  Set valid asset tag via REST and verify. | 
|  | 51 | [Tags]  Set_Asset_Tag_With_Valid_String_Length_Via_REST | 
|  | 52 |  | 
|  | 53 | ${random_string}=  Generate Random String  63 | 
|  | 54 | ${args}=  Create Dictionary  data=${random_string} | 
|  | 55 | Write Attribute  /xyz/openbmc_project/inventory/system  AssetTag | 
|  | 56 | ...  data=${args} | 
|  | 57 |  | 
|  | 58 | ${asset_tag}=  Read Attribute  /xyz/openbmc_project/inventory/system | 
|  | 59 | ...  AssetTag | 
|  | 60 | Should Be Equal As Strings  ${asset_tag}  ${random_string} | 
|  | 61 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 62 |  | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 63 | Verify Get And Set Management Controller ID String | 
|  | 64 | [Documentation]  Verify get and set management controller ID string. | 
|  | 65 | [Tags]  Verify_Get_And_Set_Management_Controller_ID_String | 
|  | 66 |  | 
|  | 67 | # Get the value of the managemment controller ID string. | 
|  | 68 | # Example: | 
|  | 69 | # Get Management Controller Identifier String: witherspoon | 
|  | 70 |  | 
|  | 71 | ${cmd_output}=  Run IPMI Standard Command  dcmi get_mc_id_string | 
|  | 72 |  | 
|  | 73 | # Extract management controller ID from cmd_output. | 
|  | 74 | ${initial_mc_id}=  Fetch From Right  ${cmd_output}  :${SPACE} | 
|  | 75 |  | 
|  | 76 | # Set the management controller ID string to other value. | 
|  | 77 | # Example: | 
|  | 78 | # Set Management Controller Identifier String Command: HOST | 
|  | 79 |  | 
|  | 80 | Set Management Controller ID String  ${new_mc_id} | 
|  | 81 |  | 
|  | 82 | # Get the management controller ID and verify. | 
|  | 83 | Get Management Controller ID String And Verify  ${new_mc_id} | 
|  | 84 |  | 
|  | 85 | # Set the value back to the initial value and verify. | 
|  | 86 | Set Management Controller ID String  ${initial_mc_id} | 
|  | 87 |  | 
|  | 88 | # Get the management controller ID and verify. | 
|  | 89 | Get Management Controller ID String And Verify  ${initial_mc_id} | 
| Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 90 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 91 |  | 
| Rahul Maheshwari | 0eb33f0 | 2018-04-10 02:31:54 -0500 | [diff] [blame] | 92 | Test Management Controller ID String Status via IPMI | 
|  | 93 | [Documentation]  Test management controller ID string status via IPMI. | 
|  | 94 | [Tags]  Test_Management_Controller_ID_String_Status_via_IPMI | 
|  | 95 |  | 
|  | 96 | # Disable management controller ID string status via IPMI and verify. | 
|  | 97 | Run IPMI Standard Command  dcmi set_conf_param dhcp_config 0x00 | 
|  | 98 | Verify Management Controller ID String Status  disable | 
|  | 99 |  | 
|  | 100 | # Enable management controller ID string status via IPMI and verify. | 
|  | 101 | Run IPMI Standard Command  dcmi set_conf_param dhcp_config 0x01 | 
|  | 102 | Verify Management Controller ID String Status  enable | 
|  | 103 |  | 
|  | 104 |  | 
|  | 105 | Test Management Controller ID String Status via Raw IPMI | 
|  | 106 | [Documentation]  Test management controller ID string status via IPMI. | 
|  | 107 | [Tags]  Test_Management_Controller_ID_String_Status_via_Raw_IPMI | 
|  | 108 |  | 
|  | 109 | # Disable management controller ID string status via raw IPMI and verify. | 
|  | 110 | Run IPMI Standard Command  raw ${IPMI_RAW_CMD['conf_param']['Disabled'][0]} | 
|  | 111 | Verify Management Controller ID String Status  disable | 
|  | 112 |  | 
|  | 113 | # Enable management controller ID string status via raw IPMI and verify. | 
|  | 114 | Run IPMI Standard Command  raw ${IPMI_RAW_CMD['conf_param']['Enabled'][0]} | 
|  | 115 | Verify Management Controller ID String Status  enable | 
|  | 116 |  | 
|  | 117 |  | 
| Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 118 | Verify Chassis Identify via IPMI | 
|  | 119 | [Documentation]  Verify "chassis identify" using IPMI command. | 
|  | 120 | [Tags]  Verify_Chassis_Identify_via_IPMI | 
|  | 121 |  | 
|  | 122 | # Set to default "chassis identify" and verify that LED blinks for 15s. | 
|  | 123 | Run IPMI Standard Command  chassis identify | 
|  | 124 | Verify Identify LED State  Blink | 
|  | 125 |  | 
|  | 126 | Sleep  15s | 
|  | 127 | Verify Identify LED State  Off | 
|  | 128 |  | 
|  | 129 | # Set "chassis identify" to 10s and verify that the LED blinks for 10s. | 
|  | 130 | Run IPMI Standard Command  chassis identify 10 | 
|  | 131 | Verify Identify LED State  Blink | 
|  | 132 |  | 
|  | 133 | Sleep  10s | 
|  | 134 | Verify Identify LED State  Off | 
|  | 135 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 136 |  | 
| Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 137 | Verify Chassis Identify Off And Force Identify On via IPMI | 
|  | 138 | [Documentation]  Verify "chassis identify" off | 
|  | 139 | ...  and "force identify on" via IPMI. | 
|  | 140 | [Tags]  Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI | 
|  | 141 |  | 
|  | 142 | # Set the LED to "Force Identify On". | 
|  | 143 | Run IPMI Standard Command  chassis identify force | 
|  | 144 | Verify Identify LED State  Blink | 
|  | 145 |  | 
|  | 146 | # Set "chassis identify" to 0 and verify that the LED turns off. | 
|  | 147 | Run IPMI Standard Command  chassis identify 0 | 
|  | 148 | Verify Identify LED State  Off | 
|  | 149 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 150 |  | 
| Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 151 | Test Watchdog Reset Via IPMI And Verify Using REST | 
|  | 152 | [Documentation]  Test watchdog reset via IPMI and verify using REST. | 
|  | 153 | [Tags]  Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST | 
|  | 154 |  | 
|  | 155 | Initiate Host Boot | 
|  | 156 |  | 
|  | 157 | Set Watchdog Enabled Using REST  ${1} | 
|  | 158 |  | 
|  | 159 | Watchdog Object Should Exist | 
|  | 160 |  | 
|  | 161 | # Resetting the watchdog via IPMI. | 
|  | 162 | Run IPMI Standard Command  mc watchdog reset | 
|  | 163 |  | 
|  | 164 | # Verify the watchdog is reset using REST after an interval of 1000ms. | 
|  | 165 | Sleep  1000ms | 
|  | 166 | ${watchdog_time_left}= | 
|  | 167 | ...  Read Attribute  ${HOST_WATCHDOG_URI}  TimeRemaining | 
|  | 168 | Should Be True | 
|  | 169 | ...  ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000} | 
|  | 170 | ...  msg=Watchdog timer didn't reset. | 
|  | 171 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 172 |  | 
| Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 173 | Test Watchdog Off Via IPMI And Verify Using REST | 
|  | 174 | [Documentation]  Test watchdog off via IPMI and verify using REST. | 
|  | 175 | [Tags]  Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST | 
|  | 176 |  | 
|  | 177 | Initiate Host Boot | 
|  | 178 |  | 
|  | 179 | Set Watchdog Enabled Using REST  ${1} | 
|  | 180 |  | 
|  | 181 | Watchdog Object Should Exist | 
|  | 182 |  | 
|  | 183 | # Turn off the watchdog via IPMI. | 
|  | 184 | Run IPMI Standard Command  mc watchdog off | 
|  | 185 |  | 
|  | 186 | # Verify the watchdog is off using REST | 
|  | 187 | ${watchdog_state}=  Read Attribute  ${HOST_WATCHDOG_URI}  Enabled | 
|  | 188 | Should Be Equal  ${watchdog_state}  ${0} | 
|  | 189 | ...  msg=msg=Verification failed for watchdog off check. | 
| Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 190 |  | 
|  | 191 |  | 
|  | 192 | Test Ambient Temperature Via IPMI | 
|  | 193 | [Documentation]  Test ambient temperature via IPMI and verify using REST. | 
|  | 194 | [Tags]  Test_Ambient_Temperature_Via_IPMI | 
|  | 195 |  | 
|  | 196 | #        Entity ID                       Entity Instance    Temp. Readings | 
|  | 197 | # Inlet air temperature(40h)                      1               +19 C | 
|  | 198 | # CPU temperature sensors(41h)                    5               +51 C | 
|  | 199 | # CPU temperature sensors(41h)                    6               +50 C | 
|  | 200 | # CPU temperature sensors(41h)                    7               +50 C | 
|  | 201 | # CPU temperature sensors(41h)                    8               +50 C | 
|  | 202 | # CPU temperature sensors(41h)                    9               +50 C | 
|  | 203 | # CPU temperature sensors(41h)                    10              +48 C | 
|  | 204 | # CPU temperature sensors(41h)                    11              +49 C | 
|  | 205 | # CPU temperature sensors(41h)                    12              +47 C | 
|  | 206 | # CPU temperature sensors(41h)                    8               +50 C | 
|  | 207 | # CPU temperature sensors(41h)                    16              +51 C | 
|  | 208 | # CPU temperature sensors(41h)                    24              +50 C | 
|  | 209 | # CPU temperature sensors(41h)                    32              +43 C | 
|  | 210 | # CPU temperature sensors(41h)                    40              +43 C | 
|  | 211 | # Baseboard temperature sensors(42h)              1               +35 C | 
|  | 212 |  | 
|  | 213 | ${temp_reading}=  Run IPMI Standard Command  dcmi get_temp_reading -N 10 | 
| George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 214 | Should Contain  ${temp_reading}  Inlet air temperature | 
|  | 215 | ...  msg="Unable to get inlet temperature via DCMI". | 
| Rahul Maheshwari | 901dcde | 2018-02-06 03:14:31 -0600 | [diff] [blame] | 216 | ${ambient_temp_line}= | 
|  | 217 | ...  Get Lines Containing String  ${temp_reading} | 
|  | 218 | ...  Inlet air temperature  case-insensitive | 
|  | 219 |  | 
|  | 220 | ${ambient_temp_ipmi}=  Fetch From Right  ${ambient_temp_line}  + | 
|  | 221 | ${ambient_temp_ipmi}=  Remove String  ${ambient_temp_ipmi}  ${SPACE}C | 
|  | 222 |  | 
|  | 223 | ${ambient_temp_rest}=  Read Attribute | 
|  | 224 | ...  ${SENSORS_URI}temperature/ambient  Value | 
|  | 225 |  | 
|  | 226 | # Example of ambient temperature via REST | 
|  | 227 | #  "CriticalAlarmHigh": 0, | 
|  | 228 | #  "CriticalAlarmLow": 0, | 
|  | 229 | #  "CriticalHigh": 35000, | 
|  | 230 | #  "CriticalLow": 0, | 
|  | 231 | #  "Scale": -3, | 
|  | 232 | #  "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC", | 
|  | 233 | #  "Value": 21775, | 
|  | 234 | #  "WarningAlarmHigh": 0, | 
|  | 235 | #  "WarningAlarmLow": 0, | 
|  | 236 | #  "WarningHigh": 25000, | 
|  | 237 | #  "WarningLow": 0 | 
|  | 238 |  | 
|  | 239 | # Get temperature value based on scale i.e. Value * (10 power Scale Value) | 
|  | 240 | # e.g. from above case 21775 * (10 power -3) = 21775/1000 | 
|  | 241 |  | 
|  | 242 | ${ambient_temp_rest}=  Evaluate  ${ambient_temp_rest}/1000 | 
|  | 243 | ${ipmi_rest_temp_diff}= | 
|  | 244 | ...  Evaluate  abs(${ambient_temp_rest} - ${ambient_temp_ipmi}) | 
|  | 245 |  | 
|  | 246 | Should Be True  ${ipmi_rest_temp_diff} <= ${allowed_temp_diff} | 
|  | 247 | ...  msg=Ambient temperature above allowed threshold ${allowed_temp_diff}. | 
|  | 248 |  | 
|  | 249 |  | 
| Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 250 | Verify Get DCMI Capabilities | 
|  | 251 | [Documentation]  Verify get DCMI capabilities command output. | 
|  | 252 | [Tags]  Verify_Get_DCMI_Capabilities | 
|  | 253 |  | 
|  | 254 | ${cmd_output}=  Run IPMI Standard Command  dcmi discover | 
|  | 255 |  | 
|  | 256 | @{supported_capabilities}=  Create List | 
|  | 257 | # Supported DCMI capabilities: | 
| George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 258 | ...  Mandatory platform capabilities | 
|  | 259 | ...  Optional platform capabilities | 
| Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 260 | ...  Power management available | 
| George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 261 | ...  Managebility access capabilities | 
| Rahul Maheshwari | 4355663 | 2018-02-05 23:42:52 -0600 | [diff] [blame] | 262 | ...  In-band KCS channel available | 
|  | 263 | # Mandatory platform attributes: | 
|  | 264 | ...  200 SEL entries | 
|  | 265 | ...  SEL automatic rollover is enabled | 
|  | 266 | # Optional Platform Attributes: | 
|  | 267 | ...  Slave address of device: 0h (8bits)(Satellite/External controller) | 
|  | 268 | ...  Channel number is 0h (Primary BMC) | 
|  | 269 | ...  Device revision is 0 | 
|  | 270 | # Manageability Access Attributes: | 
|  | 271 | ...  Primary LAN channel number: 1 is available | 
|  | 272 | ...  Secondary LAN channel is not available for OOB | 
|  | 273 | ...  No serial channel is available | 
|  | 274 |  | 
|  | 275 | :FOR  ${capability}  IN  @{supported_capabilities} | 
|  | 276 | \  Should Contain  ${cmd_output}  ${capability}  ignore_case=True | 
|  | 277 | ...  msg=Supported DCMI capabilities not present. | 
|  | 278 |  | 
|  | 279 |  | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 280 | Test Power Reading Via IPMI With Host Off | 
|  | 281 | [Documentation]  Test power reading via IPMI with host off state and | 
|  | 282 | ...  verify using REST. | 
|  | 283 | [Tags]  Test_Power_Reading_Via_IPMI_With_Host_Off | 
| Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 284 |  | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 285 | REST Power Off  stack_mode=skip  quiet=1 | 
| Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 286 |  | 
| George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 287 | Wait Until Keyword Succeeds  1 min  30 sec  Verify Power Reading | 
| George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 288 |  | 
|  | 289 |  | 
|  | 290 | Test Power Reading Via IPMI With Host Booted | 
|  | 291 | [Documentation]  Test power reading via IPMI with host booted state and | 
|  | 292 | ...  verify using REST. | 
|  | 293 | [Tags]  Test_Power_Reading_Via_IPMI_With_Host_Booted | 
|  | 294 |  | 
|  | 295 | REST Power On  stack_mode=skip  quiet=1 | 
|  | 296 |  | 
|  | 297 | # For a good power reading take a 3 samples for 15 seconds interval and | 
|  | 298 | # average it out. | 
|  | 299 |  | 
| George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 300 | Wait Until Keyword Succeeds  2 min  30 sec  Verify Power Reading | 
| Rahul Maheshwari | 615da15 | 2018-02-13 23:53:36 -0600 | [diff] [blame] | 301 |  | 
|  | 302 |  | 
| Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 303 | Test Power Reading Via IPMI Raw Command | 
|  | 304 | [Documentation]  Test power reading via IPMI raw command and verify | 
|  | 305 | ...  using REST. | 
|  | 306 | [Tags]  Test_Power_Reading_Via_IPMI_Raw_Command | 
|  | 307 |  | 
|  | 308 | # Response data structure of power reading command output via IPMI. | 
|  | 309 | # 1        Completion Code. Refer to section 8, DCMI Completion Codes. | 
|  | 310 | # 2        Group Extension Identification = DCh | 
|  | 311 | # 3:4      Current Power in watts | 
|  | 312 |  | 
| George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 313 | REST Power On  stack_mode=skip  quiet=1 | 
| Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 314 |  | 
| George Keishing | 04bf06c | 2018-10-05 08:28:50 -0500 | [diff] [blame] | 315 | Wait Until Keyword Succeeds  2 min  30 sec  Verify Power Reading Via Raw Command | 
| Rahul Maheshwari | abe13af | 2018-02-15 22:42:08 -0600 | [diff] [blame] | 316 |  | 
|  | 317 |  | 
| Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 318 | Test Baseboard Temperature Via IPMI | 
|  | 319 | [Documentation]  Test baseboard temperature via IPMI and verify using REST. | 
|  | 320 | [Tags]  Test_Baseboard_Temperature_Via_IPMI | 
|  | 321 |  | 
|  | 322 | # Example of IPMI dcmi get_temp_reading output: | 
|  | 323 | #        Entity ID                       Entity Instance    Temp. Readings | 
|  | 324 | # Inlet air temperature(40h)                      1               +19 C | 
|  | 325 | # CPU temperature sensors(41h)                    5               +51 C | 
|  | 326 | # CPU temperature sensors(41h)                    6               +50 C | 
|  | 327 | # CPU temperature sensors(41h)                    7               +50 C | 
|  | 328 | # CPU temperature sensors(41h)                    8               +50 C | 
|  | 329 | # CPU temperature sensors(41h)                    9               +50 C | 
|  | 330 | # CPU temperature sensors(41h)                    10              +48 C | 
|  | 331 | # CPU temperature sensors(41h)                    11              +49 C | 
|  | 332 | # CPU temperature sensors(41h)                    12              +47 C | 
|  | 333 | # CPU temperature sensors(41h)                    8               +50 C | 
|  | 334 | # CPU temperature sensors(41h)                    16              +51 C | 
|  | 335 | # CPU temperature sensors(41h)                    24              +50 C | 
|  | 336 | # CPU temperature sensors(41h)                    32              +43 C | 
|  | 337 | # CPU temperature sensors(41h)                    40              +43 C | 
|  | 338 | # Baseboard temperature sensors(42h)              1               +35 C | 
|  | 339 |  | 
|  | 340 | ${temp_reading}=  Run IPMI Standard Command  dcmi get_temp_reading -N 10 | 
| George Keishing | 77f1ad2 | 2018-07-23 12:39:28 -0500 | [diff] [blame] | 341 | Should Contain  ${temp_reading}  Baseboard temperature sensors | 
|  | 342 | ...  msg="Unable to get baseboard temperature via DCMI". | 
| Rahul Maheshwari | 91a18ef | 2018-02-15 04:54:59 -0600 | [diff] [blame] | 343 | ${baseboard_temp_line}= | 
|  | 344 | ...  Get Lines Containing String  ${temp_reading} | 
|  | 345 | ...  Baseboard temperature  case-insensitive=True | 
|  | 346 |  | 
|  | 347 | ${baseboard_temp_ipmi}=  Fetch From Right  ${baseboard_temp_line}  + | 
|  | 348 | ${baseboard_temp_ipmi}=  Remove String  ${baseboard_temp_ipmi}  ${SPACE}C | 
|  | 349 |  | 
|  | 350 | ${baseboard_temp_rest}=  Read Attribute | 
|  | 351 | ...  /xyz/openbmc_project/sensors/temperature/pcie  Value | 
|  | 352 | ${baseboard_temp_rest}=  Evaluate  ${baseboard_temp_rest}/1000 | 
|  | 353 |  | 
|  | 354 | Should Be True | 
|  | 355 | ...  ${baseboard_temp_rest} - ${baseboard_temp_ipmi} <= ${allowed_temp_diff} | 
|  | 356 | ...  msg=Baseboard temperature above allowed threshold ${allowed_temp_diff}. | 
|  | 357 |  | 
|  | 358 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 359 | Retrieve Default Gateway Via IPMI And Verify Using REST | 
|  | 360 | [Documentation]  Retrieve default gateway from LAN print using IPMI. | 
|  | 361 | [Tags]  Retrieve_Default_Gateway_Via_IPMI_And_Verify_Using_REST | 
|  | 362 |  | 
|  | 363 | # Fetch "Default Gateway" from IPMI LAN print. | 
|  | 364 | ${default_gateway_ipmi}=  Fetch Details From LAN Print  Default Gateway IP | 
|  | 365 |  | 
|  | 366 | # Verify "Default Gateway" using REST. | 
| Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 367 | Read Attribute  ${NETWORK_MANAGER}config  DefaultGateway | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 368 | ...  expected_value=${default_gateway_ipmi} | 
|  | 369 |  | 
|  | 370 |  | 
|  | 371 | Retrieve MAC Address Via IPMI And Verify Using REST | 
|  | 372 | [Documentation]  Retrieve MAC Address from LAN print using IPMI. | 
|  | 373 | [Tags]  Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_REST | 
|  | 374 |  | 
|  | 375 | # Fetch "MAC Address" from IPMI LAN print. | 
|  | 376 | ${mac_address_ipmi}=  Fetch Details From LAN Print  MAC Address | 
|  | 377 |  | 
|  | 378 | # Verify "MAC Address" using REST. | 
|  | 379 | ${mac_address_rest}=  Get BMC MAC Address | 
|  | 380 | Should Be Equal  ${mac_address_ipmi}  ${mac_address_rest} | 
|  | 381 | ...  msg=Verification of MAC address from lan print using IPMI failed. | 
|  | 382 |  | 
|  | 383 |  | 
|  | 384 | Retrieve Network Mode Via IPMI And Verify Using REST | 
|  | 385 | [Documentation]  Retrieve network mode from LAN print using IPMI. | 
|  | 386 | [Tags]  Retrieve_Network_Mode_Via_IPMI_And_Verify_Using_REST | 
|  | 387 |  | 
|  | 388 | # Fetch "Mode" from IPMI LAN print. | 
|  | 389 | ${network_mode_ipmi}=  Fetch Details From LAN Print  Source | 
|  | 390 |  | 
|  | 391 | # Verify "Mode" using REST. | 
|  | 392 | ${network_mode_rest}=  Read Attribute | 
| Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 393 | ...  ${NETWORK_MANAGER}eth0  DHCPEnabled | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 394 | Run Keyword If  '${network_mode_ipmi}' == 'Static Address' | 
|  | 395 | ...  Should Be Equal  ${network_mode_rest}  ${0} | 
|  | 396 | ...  msg=Verification of network setting failed. | 
|  | 397 | ...  ELSE  IF  '${network_mode_ipmi}' == 'DHCP' | 
|  | 398 | ...  Should Be Equal  ${network_mode_rest}  ${1} | 
|  | 399 | ...  msg=Verification of network setting failed. | 
|  | 400 |  | 
|  | 401 |  | 
|  | 402 | Retrieve IP Address Via IPMI And Verify With BMC Details | 
|  | 403 | [Documentation]  Retrieve IP address from LAN print using IPMI. | 
|  | 404 | [Tags]  Retrieve_IP_Address_Via_IPMI_And_Verify_With_BMC_Details | 
|  | 405 |  | 
|  | 406 | # Fetch "IP Address" from IPMI LAN print. | 
|  | 407 | ${ip_addr_ipmi}=  Fetch Details From LAN Print  IP Address | 
|  | 408 |  | 
|  | 409 | # Verify the IP address retrieved via IPMI with BMC IPs. | 
|  | 410 | ${ip_address_rest}=  Get BMC IP Info | 
|  | 411 | Validate IP On BMC  ${ip_addr_ipmi}  ${ip_address_rest} | 
|  | 412 |  | 
|  | 413 |  | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 414 | Verify Get Device ID | 
|  | 415 | [Documentation]  Verify get device ID command output. | 
|  | 416 | [Tags]  Verify_Get_Device_ID | 
|  | 417 |  | 
|  | 418 | # Example of get device ID command output: | 
|  | 419 | # Device ID                 : 0 | 
|  | 420 | # Device Revision           : 0 | 
|  | 421 | # Firmware Revision         : 2.01 | 
|  | 422 | # IPMI Version              : 2.0 | 
|  | 423 | # Manufacturer ID           : 42817 | 
|  | 424 | # Manufacturer Name         : Unknown (0xA741) | 
|  | 425 | # Product ID                : 16975 (0x424f) | 
|  | 426 | # Product Name              : Unknown (0x424F) | 
|  | 427 | # Device Available          : yes | 
|  | 428 | # Provides Device SDRs      : yes | 
|  | 429 | # Additional Device Support : | 
|  | 430 | #     Sensor Device | 
|  | 431 | #     SEL Device | 
|  | 432 | #     FRU Inventory Device | 
|  | 433 | #     Chassis Device | 
|  | 434 | # Aux Firmware Rev Info     : | 
| George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 435 | #     0x04 | 
|  | 436 | #     0x38 | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 437 | #     0x00 | 
| George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 438 | #     0x03 | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 439 |  | 
|  | 440 | ${mc_info}=  Get MC Info | 
|  | 441 |  | 
|  | 442 | Should Be Equal  ${mc_info['device_id']}  0 | 
|  | 443 | Should Be Equal  ${mc_info['device_revision']}  0 | 
|  | 444 |  | 
| Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 445 | # Get firmware revision from mc info command output i.e. 2.01 | 
|  | 446 | ${ipmi_fw_major_version}  ${ipmi_fw_minor_version}= | 
|  | 447 | ...  Split String  ${mc_info['firmware_revision']}  . | 
|  | 448 | # Convert minor firmware version from BCD format to integer. i.e. 01 to 1 | 
|  | 449 | ${ipmi_fw_minor_version}=  Convert To Integer  ${ipmi_fw_minor_version} | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 450 |  | 
| George Keishing | e0a8128 | 2018-06-08 10:02:30 -0500 | [diff] [blame] | 451 | # Get BMC version from BMC CLI i.e. 2.2 from "v2.2-253-g00050f1" | 
| George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 452 | ${bmc_version_full}=  Get BMC Version | 
| Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 453 | ${bmc_version}= | 
| George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 454 | ...  Remove String Using Regexp  ${bmc_version_full}  ^[^0-9]+  [^0-9\.].* | 
| Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 455 |  | 
|  | 456 | # Get major and minor version from BMC version i.e. 2 and 1 from 2.1 | 
| George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 457 | @{major_minor_version}=  Split String  ${bmc_version}  . | 
| Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 458 |  | 
| George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 459 | Should Be Equal As Strings  ${ipmi_fw_major_version}  ${major_minor_version[0]} | 
| George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 460 | ...  msg=Major version mismatch. | 
| George Keishing | c95e998 | 2019-01-14 09:27:45 -0600 | [diff] [blame] | 461 | Should Be Equal As Strings  ${ipmi_fw_minor_version}  ${major_minor_version[1]} | 
| George Keishing | 2ee2f00 | 2019-02-16 09:36:02 -0600 | [diff] [blame] | 462 | ...  msg=Minor version mismatch. | 
| Rahul Maheshwari | bb9e257 | 2018-04-02 05:24:37 -0500 | [diff] [blame] | 463 |  | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 464 | Should Be Equal  ${mc_info['ipmi_version']}  2.0 | 
|  | 465 |  | 
| Gunnar Mills | 917ba1a | 2018-04-08 16:42:12 -0500 | [diff] [blame] | 466 | # TODO: Verify Manufacturer and Product IDs directly from json file. | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 467 | # Reference : openbmc/openbmc-test-automation#1244 | 
|  | 468 | Should Be Equal  ${mc_info['manufacturer_id']}  42817 | 
|  | 469 | Should Be Equal  ${mc_info['product_id']}  16975 (0x424f) | 
|  | 470 |  | 
|  | 471 | Should Be Equal  ${mc_info['device_available']}  yes | 
|  | 472 | Should Be Equal  ${mc_info['provides_device_sdrs']}  yes | 
|  | 473 | Should Contain  ${mc_info['additional_device_support']}  Sensor Device | 
|  | 474 | Should Contain  ${mc_info['additional_device_support']}  SEL Device | 
|  | 475 | Should Contain | 
|  | 476 | ...  ${mc_info['additional_device_support']}  FRU Inventory Device | 
|  | 477 | Should Contain  ${mc_info['additional_device_support']}  Chassis Device | 
| George Keishing | b746d3f | 2018-04-19 10:53:10 -0500 | [diff] [blame] | 478 |  | 
| George Keishing | 3511a3f | 2018-04-19 10:38:30 -0500 | [diff] [blame] | 479 | # Auxiliary revision data verification. | 
|  | 480 | ${aux_version}=  Get Aux Version  ${bmc_version_full} | 
|  | 481 |  | 
|  | 482 | # From aux_firmware_rev_info field ['0x04', '0x38', '0x00', '0x03'] | 
|  | 483 | ${bmc_aux_version}=  Catenate | 
|  | 484 | ...  SEPARATOR= | 
|  | 485 | ...  ${mc_info['aux_firmware_rev_info'][0][2:]} | 
|  | 486 | ...  ${mc_info['aux_firmware_rev_info'][1][2:]} | 
|  | 487 | ...  ${mc_info['aux_firmware_rev_info'][2][2:]} | 
|  | 488 | ...  ${mc_info['aux_firmware_rev_info'][3][2:]} | 
|  | 489 |  | 
|  | 490 | Should Be Equal As Integers | 
|  | 491 | ...  ${bmc_aux_version}  ${aux_version} | 
|  | 492 | ...  msg=BMC aux version ${bmc_aux_version} does not match expected value of ${aux_version}. | 
| Rahul Maheshwari | fe8639b | 2018-02-05 22:42:24 -0600 | [diff] [blame] | 493 |  | 
|  | 494 |  | 
| Rahul Maheshwari | dc6a32c | 2018-03-15 05:21:55 -0500 | [diff] [blame] | 495 | Verify SDR Info | 
|  | 496 | [Documentation]  Verify sdr info command output. | 
|  | 497 | [Tags]  Verify_SDR_Info | 
|  | 498 |  | 
|  | 499 | # Example of SDR info command output: | 
|  | 500 | # SDR Version                         : 0x51 | 
|  | 501 | # Record Count                        : 216 | 
|  | 502 | # Free Space                          : unspecified | 
|  | 503 | # Most recent Addition                : | 
|  | 504 | # Most recent Erase                   : | 
|  | 505 | # SDR overflow                        : no | 
|  | 506 | # SDR Repository Update Support       : unspecified | 
|  | 507 | # Delete SDR supported                : no | 
|  | 508 | # Partial Add SDR supported           : no | 
|  | 509 | # Reserve SDR repository supported    : no | 
|  | 510 | # SDR Repository Alloc info supported : no | 
|  | 511 |  | 
|  | 512 | ${sdr_info}=  Get SDR Info | 
|  | 513 | Should Be Equal  ${sdr_info['sdr_version']}  0x51 | 
|  | 514 |  | 
|  | 515 | # Get sensor count from "sdr elist all" command output. | 
|  | 516 | ${sensor_count}=  Get Sensor Count | 
|  | 517 | Should Be Equal As Strings | 
|  | 518 | ...  ${sdr_info['record_count']}  ${sensor_count} | 
|  | 519 |  | 
|  | 520 | Should Be Equal  ${sdr_info['free_space']}  unspecified | 
|  | 521 | Should Be Equal  ${sdr_info['most_recent_addition']}  ${EMPTY} | 
|  | 522 | Should Be Equal  ${sdr_info['most_recent_erase']}  ${EMPTY} | 
|  | 523 | Should Be Equal  ${sdr_info['sdr_overflow']}  no | 
|  | 524 | Should Be Equal  ${sdr_info['sdr_repository_update_support']}  unspecified | 
|  | 525 | Should Be Equal  ${sdr_info['delete_sdr_supported']}  no | 
|  | 526 | Should Be Equal  ${sdr_info['partial_add_sdr_supported']}  no | 
|  | 527 | Should Be Equal  ${sdr_info['reserve_sdr_repository_supported']}  no | 
|  | 528 | Should Be Equal  ${sdr_info['sdr_repository_alloc_info_supported']}  no | 
|  | 529 |  | 
|  | 530 |  | 
| George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 531 | Test Valid IPMI Channels Supported | 
|  | 532 | [Documentation]  Verify IPMI channels supported on a given system. | 
|  | 533 | [Tags]  Test_Valid_IPMI_Channels_Supported | 
|  | 534 |  | 
|  | 535 | ${channel_count}=  Get Physical Network Interface Count | 
|  | 536 |  | 
|  | 537 | # Note: IPMI network channel logically starts from 1. | 
|  | 538 | :FOR  ${channel_number}  IN RANGE  1  ${channel_count} | 
| Rahul Maheshwari | 20f3bf7 | 2018-12-18 04:24:20 -0600 | [diff] [blame] | 539 | \  Run IPMI Standard Command  lan print ${channel_number} | 
| George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 540 |  | 
|  | 541 |  | 
|  | 542 | Test Invalid IPMI Channel Response | 
|  | 543 | [Documentation]  Verify invalid IPMI channels supported response. | 
|  | 544 | [Tags]  Test_Invalid_IPMI_Channel_Response | 
|  | 545 |  | 
|  | 546 | ${channel_count}=  Get Physical Network Interface Count | 
|  | 547 |  | 
|  | 548 | # To target invalid channel, increment count. | 
|  | 549 | ${channel_number}=  Evaluate  ${channel_count} + 1 | 
|  | 550 |  | 
|  | 551 | # Example of invalid channel: | 
| George Keishing | 72d0ac8 | 2018-09-20 09:33:01 -0500 | [diff] [blame] | 552 | # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3 | 
| George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 553 | # Get Channel Info command failed: Parameter out of range | 
|  | 554 | # Invalid channel: 3 | 
|  | 555 |  | 
|  | 556 | ${stdout}=  Run External IPMI Standard Command | 
|  | 557 | ...  lan print ${channel_number}  fail_on_err=${0} | 
|  | 558 | Should Contain  ${stdout}  Invalid channel | 
|  | 559 | ...  msg=IPMI channel ${channel_number} is invalid but seen working. | 
|  | 560 |  | 
|  | 561 |  | 
| George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 562 | Test IPMI Restriction Mode | 
|  | 563 | [Documentation]  Set restricition mode via REST and verify IPMI operation. | 
|  | 564 | [Tags]  Test_IPMI_Restriction_Mode | 
|  | 565 | # Forego normal test setup: | 
|  | 566 | [Setup]  No Operation | 
|  | 567 | [Teardown]  Run Keywords  FFDC On Test Case Fail  AND | 
|  | 568 | ...  Set IPMI Restriction Mode  xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None | 
|  | 569 |  | 
|  | 570 | # By default no IPMI operations are restricted. | 
|  | 571 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode | 
|  | 572 | # { | 
|  | 573 | #    "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.None", | 
|  | 574 | #    "message": "200 OK", | 
|  | 575 | #    "status": "ok" | 
|  | 576 | # } | 
|  | 577 |  | 
|  | 578 | # Refer to: #openbmc/phosphor-host-ipmid/blob/master/host-ipmid-whitelist.conf | 
|  | 579 | # Set the restriction mode to Whitelist IPMI commands only: | 
|  | 580 | # /xyz/openbmc_project/control/host0/restriction_mode/attr/RestrictionMode | 
|  | 581 | # { | 
|  | 582 | #    "data": "xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist", | 
|  | 583 | #    "message": "200 OK", | 
|  | 584 | #    "status": "ok" | 
|  | 585 | # } | 
|  | 586 |  | 
|  | 587 | Set IPMI Restriction Mode  xyz.openbmc_project.Control.Security.RestrictionMode.Modes.Whitelist | 
|  | 588 |  | 
|  | 589 | # Attempt white-listed operation expecting success. | 
|  | 590 | IPMI Power On | 
|  | 591 |  | 
|  | 592 | # Attempt non white-listed operation expecting failure. | 
|  | 593 | Run Keyword And Expect Error  *Insufficient privilege level* | 
|  | 594 | ...  Run Inband IPMI Standard Command  mc reset cold | 
|  | 595 |  | 
|  | 596 |  | 
| Rahul Maheshwari | fdd5ff6 | 2017-08-01 04:15:03 -0500 | [diff] [blame] | 597 | *** Keywords *** | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 598 |  | 
| Rahul Maheshwari | dc6a32c | 2018-03-15 05:21:55 -0500 | [diff] [blame] | 599 | Get Sensor Count | 
|  | 600 | [Documentation]  Get sensors count using "sdr elist all" command. | 
|  | 601 |  | 
|  | 602 | # Example of "sdr elist all" command output: | 
|  | 603 | # BootProgress     | 03h | ok  | 34.2 | | 
|  | 604 | # OperatingSystemS | 05h | ok  | 35.1 | | 
|  | 605 | # AttemptsLeft     | 07h | ok  | 34.1 | | 
|  | 606 | # occ0             | 08h | ok  | 210.1 | Device Disabled | 
|  | 607 | # occ1             | 09h | ok  | 210.2 | Device Disabled | 
|  | 608 | # p0_core0_temp    | 11h | ns  |  3.1 | Disabled | 
|  | 609 | # cpu0_core0       | 12h | ok  | 208.1 | Presence detected | 
|  | 610 | # p0_core1_temp    | 14h | ns  |  3.2 | Disabled | 
|  | 611 | # cpu0_core1       | 15h | ok  | 208.2 | Presence detected | 
|  | 612 | # p0_core2_temp    | 17h | ns  |  3.3 | Disabled | 
|  | 613 | # .. | 
|  | 614 | # .. | 
|  | 615 | # .. | 
|  | 616 | # .. | 
|  | 617 | # .. | 
|  | 618 | # .. | 
|  | 619 | # fan3             | 00h | ns  | 29.4 | Logical FRU @35h | 
|  | 620 | # bmc              | 00h | ns  |  6.1 | Logical FRU @3Ch | 
|  | 621 | # ethernet         | 00h | ns  |  1.1 | Logical FRU @46h | 
|  | 622 |  | 
|  | 623 | ${output}=  Run IPMI Standard Command  sdr elist all | 
|  | 624 | ${sensor_list}=  Split String  ${output}  \n | 
|  | 625 | ${sensor_count}=  Get Length  ${sensor_list} | 
|  | 626 | [Return]  ${sensor_count} | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 627 |  | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 628 | Set Management Controller ID String | 
|  | 629 | [Documentation]  Set the management controller ID string. | 
|  | 630 | [Arguments]  ${string} | 
|  | 631 |  | 
|  | 632 | # Description of argument(s): | 
|  | 633 | # string  Management Controller ID String to be set | 
|  | 634 |  | 
|  | 635 | ${set_mc_id_string}=  Run IPMI Standard Command | 
|  | 636 | ...  dcmi set_mc_id_string ${string} | 
|  | 637 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 638 |  | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 639 | Get Management Controller ID String And Verify | 
| George Keishing | cb3b9b6 | 2018-09-14 12:11:19 -0500 | [diff] [blame] | 640 | [Documentation]  Get the management controller ID string. | 
| Sweta Potthuri | 5c6c72e | 2018-01-23 05:48:35 -0600 | [diff] [blame] | 641 | [Arguments]  ${string} | 
|  | 642 |  | 
|  | 643 | # Description of argument(s): | 
|  | 644 | # string  Management Controller ID string | 
|  | 645 |  | 
|  | 646 | ${get_mc_id}=  Run IPMI Standard Command  dcmi get_mc_id_string | 
|  | 647 | Should Contain  ${get_mc_id}  ${string} | 
|  | 648 | ...  msg=Command failed: get_mc_id. | 
| Sweta Potthuri | 0cc6050 | 2018-01-24 00:36:17 -0600 | [diff] [blame] | 649 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 650 |  | 
| Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 651 | Set Watchdog Enabled Using REST | 
|  | 652 | [Documentation]  Set watchdog Enabled field using REST. | 
|  | 653 | [Arguments]  ${value} | 
|  | 654 |  | 
|  | 655 | # Description of argument(s): | 
|  | 656 | # value  Integer value (eg. "0-Disabled", "1-Enabled"). | 
|  | 657 |  | 
|  | 658 | ${value_dict}=  Create Dictionary  data=${value} | 
| Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 659 | ${resp}=  OpenBMC Put Request  ${HOST_WATCHDOG_URI}attr/Enabled | 
| Sweta Potthuri | 7d3af3c | 2018-01-29 03:07:07 -0600 | [diff] [blame] | 660 | ...  data=${value_dict} | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 661 |  | 
|  | 662 |  | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 663 | Fetch Details From LAN Print | 
|  | 664 | [Documentation]  Fetch details from LAN print. | 
|  | 665 | [Arguments]  ${field_name} | 
|  | 666 |  | 
|  | 667 | # Description of argument(s): | 
|  | 668 | # ${field_name}   Field name to be fetched from LAN print | 
|  | 669 | #                 (e.g. "MAC Address", "Source"). | 
|  | 670 |  | 
| Rahul Maheshwari | d8037d3 | 2018-12-17 00:59:57 -0600 | [diff] [blame] | 671 | ${stdout}=  Run IPMI Standard Command  lan print | 
| Sweta Potthuri | f39022d | 2018-02-06 03:40:07 -0600 | [diff] [blame] | 672 | ${fetch_value}=  Get Lines Containing String  ${stdout}  ${field_name} | 
|  | 673 | ${value_fetch}=  Fetch From Right  ${fetch_value}  :${SPACE} | 
|  | 674 | [Return]  ${value_fetch} | 
|  | 675 |  | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 676 |  | 
|  | 677 | Verify Power Reading | 
|  | 678 | [Documentation]  Get dcmi power reading via IPMI. | 
|  | 679 |  | 
|  | 680 | # Example of power reading command output via IPMI. | 
|  | 681 | # Instantaneous power reading:                   235 Watts | 
|  | 682 | # Minimum during sampling period:                235 Watts | 
|  | 683 | # Maximum during sampling period:                235 Watts | 
|  | 684 | # Average power reading over sample period:      235 Watts | 
|  | 685 | # IPMI timestamp:                                Thu Jan  1 00:00:00 1970 | 
|  | 686 | # Sampling period:                               00000000 Seconds. | 
|  | 687 | # Power reading state is:                        deactivated | 
|  | 688 |  | 
|  | 689 | ${power_reading}=  Get IPMI Power Reading | 
|  | 690 |  | 
|  | 691 | ${host_state}=  Get Host State | 
|  | 692 | Run Keyword If  '${host_state}' == 'Off' | 
| George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 693 | ...  Should Be Equal  ${power_reading['instantaneous_power_reading']}  0 | 
|  | 694 | ...  msg=Power reading not zero when power is off. | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 695 |  | 
| George Keishing | 5131487 | 2018-03-31 13:24:35 -0500 | [diff] [blame] | 696 | Run Keyword If  '${power_reading['instantaneous_power_reading']}' != '0' | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 697 | ...  Verify Power Reading Using REST  ${power_reading['instantaneous_power_reading']} | 
|  | 698 |  | 
|  | 699 |  | 
| George Keishing | e78f1fd | 2018-09-04 13:34:59 -0500 | [diff] [blame] | 700 | Verify Power Reading Via Raw Command | 
|  | 701 | [Documentation]  Get dcmi power reading via IPMI raw command. | 
|  | 702 |  | 
|  | 703 | ${ipmi_raw_output}=  Run IPMI Standard Command | 
|  | 704 | ...  raw ${IPMI_RAW_CMD['power_reading']['Get'][0]} | 
|  | 705 |  | 
|  | 706 | @{raw_output_list}=  Split String  ${ipmi_raw_output}  ${SPACE} | 
|  | 707 |  | 
|  | 708 | # On successful execution of raw IPMI power reading command, completion | 
|  | 709 | # code does not come in output. So current power value will start from 2 | 
|  | 710 | # byte instead of 3. | 
|  | 711 |  | 
|  | 712 | ${power_reading_ipmi_raw_3_item}=  Get From List  ${raw_output_list}  2 | 
|  | 713 | ${power_reading_ipmi_raw_3_item}= | 
|  | 714 | ...  Convert To Integer  0x${power_reading_ipmi_raw_3_item} | 
|  | 715 |  | 
|  | 716 | ${power_reading_rest}=  Read Attribute | 
|  | 717 | ...  ${SENSORS_URI}power/total_power  Value | 
|  | 718 |  | 
|  | 719 | # Example of power reading via REST | 
|  | 720 | #  "CriticalAlarmHigh": 0, | 
|  | 721 | #  "CriticalAlarmLow": 0, | 
|  | 722 | #  "CriticalHigh": 3100000000, | 
|  | 723 | #  "CriticalLow": 0, | 
|  | 724 | #  "Scale": -6, | 
|  | 725 | #  "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", | 
|  | 726 | #  "Value": 228000000, | 
|  | 727 | #  "WarningAlarmHigh": 0, | 
|  | 728 | #  "WarningAlarmLow": 0, | 
|  | 729 | #  "WarningHigh": 3050000000, | 
|  | 730 | #  "WarningLow": 0 | 
|  | 731 |  | 
|  | 732 | # Get power value based on scale i.e. Value * (10 power Scale Value) | 
|  | 733 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 | 
|  | 734 |  | 
|  | 735 | ${power_reading_rest}=  Evaluate  ${power_reading_rest}/1000000 | 
|  | 736 | ${ipmi_rest_power_diff}= | 
|  | 737 | ...  Evaluate  abs(${power_reading_rest} - ${power_reading_ipmi_raw_3_item}) | 
|  | 738 |  | 
|  | 739 | Should Be True  ${ipmi_rest_power_diff} <= ${allowed_power_diff} | 
|  | 740 | ...  msg=Power Reading above allowed threshold ${allowed_power_diff}. | 
|  | 741 |  | 
|  | 742 |  | 
| Rahul Maheshwari | 0eb33f0 | 2018-04-10 02:31:54 -0500 | [diff] [blame] | 743 | Verify Management Controller ID String Status | 
|  | 744 | [Documentation]  Verify management controller ID string status via IPMI. | 
|  | 745 | [Arguments]  ${status} | 
|  | 746 |  | 
|  | 747 | # Example of dcmi get_conf_param command output: | 
|  | 748 | # DHCP Discovery method   : | 
|  | 749 | #           Management Controller ID String is disabled | 
|  | 750 | #           Vendor class identifier DCMI IANA and Vendor class-specific Informationa are disabled | 
|  | 751 | #   Initial timeout interval        : 4 seconds | 
|  | 752 | #   Server contact timeout interval : 120 seconds | 
|  | 753 | #   Server contact retry interval   : 64 seconds | 
|  | 754 |  | 
|  | 755 | ${resp}=  Run IPMI Standard Command  dcmi get_conf_param | 
|  | 756 | ${resp}=  Get Lines Containing String  ${resp} | 
|  | 757 | ...  Management Controller ID String  case_insensitive=True | 
|  | 758 | Should Contain  ${resp}  ${status} | 
|  | 759 | ...  msg=Management controller ID string is not ${status} | 
|  | 760 |  | 
|  | 761 |  | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 762 | Verify Power Reading Using REST | 
|  | 763 | [Documentation]  Verify power reading using REST. | 
|  | 764 | [Arguments]  ${power_reading} | 
|  | 765 |  | 
| Gunnar Mills | 948e2e2 | 2018-03-23 12:54:27 -0500 | [diff] [blame] | 766 | # Description of argument(s): | 
| Sweta Potthuri | 78dd1e1 | 2018-02-21 00:03:33 -0600 | [diff] [blame] | 767 | # power_reading  IPMI Power reading | 
|  | 768 |  | 
|  | 769 | ${power_reading_rest}=  Read Attribute | 
|  | 770 | ...  ${SENSORS_URI}power/total_power  Value | 
|  | 771 |  | 
|  | 772 | # Example of power reading via REST | 
|  | 773 | #  "CriticalAlarmHigh": 0, | 
|  | 774 | #  "CriticalAlarmLow": 0, | 
|  | 775 | #  "CriticalHigh": 3100000000, | 
|  | 776 | #  "CriticalLow": 0, | 
|  | 777 | #  "Scale": -6, | 
|  | 778 | #  "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts", | 
|  | 779 | #  "Value": 228000000, | 
|  | 780 | #  "WarningAlarmHigh": 0, | 
|  | 781 | #  "WarningAlarmLow": 0, | 
|  | 782 | #  "WarningHigh": 3050000000, | 
|  | 783 | #  "WarningLow": 0 | 
|  | 784 |  | 
|  | 785 | # Get power value based on scale i.e. Value * (10 power Scale Value) | 
|  | 786 | # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000 | 
|  | 787 | ${power_reading_rest}=  Evaluate  ${power_reading_rest}/1000000 | 
|  | 788 | ${ipmi_rest_power_diff}= | 
|  | 789 | ...  Evaluate  abs(${power_reading_rest} - ${power_reading}) | 
|  | 790 |  | 
|  | 791 | Should Be True  ${ipmi_rest_power_diff} <= ${allowed_power_diff} | 
|  | 792 | ...  msg=Power reading above allowed threshold ${allowed_power_diff}. | 
| George Keishing | 02651f0 | 2018-04-11 02:07:16 -0500 | [diff] [blame] | 793 |  | 
|  | 794 |  | 
|  | 795 | Get Physical Network Interface Count | 
|  | 796 | [Documentation]  Return valid physical network interfaces count. | 
|  | 797 |  | 
|  | 798 | # Example: | 
|  | 799 | # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff | 
|  | 800 | # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff | 
|  | 801 |  | 
|  | 802 | ${mac_entry_list}=  Get BMC MAC Address List | 
|  | 803 | ${mac_unique_list}=  Remove Duplicates  ${mac_entry_list} | 
|  | 804 | ${physical_interface_count}=  Get Length  ${mac_unique_list} | 
|  | 805 |  | 
|  | 806 | [Return]  ${physical_interface_count} | 
| George Keishing | 39967eb | 2018-04-30 11:36:23 -0500 | [diff] [blame] | 807 |  | 
| George Keishing | e85113a | 2019-06-07 08:21:51 -0500 | [diff] [blame] | 808 |  | 
|  | 809 | Set IPMI Restriction Mode | 
|  | 810 | [Documentation]  Set the IPMI restriction mode. | 
|  | 811 | [Arguments]  ${restriction_mode} | 
|  | 812 |  | 
|  | 813 | # Description of argument(s): | 
|  | 814 | # restriction_mode   IPMI valid restriction modes. | 
|  | 815 |  | 
|  | 816 | ${valueDict}=  Create Dictionary  data=${restriction_mode} | 
|  | 817 |  | 
|  | 818 | Write Attribute  ${CONTROL_HOST_URI}restriction_mode/ | 
|  | 819 | ...  RestrictionMode  data=${valueDict} |