chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite tests IPMI Cold Reset in OpenBMC. |
| 3 | ... |
| 4 | ... The Cold reset command directs the Responder to perform |
| 5 | ... a 'Cold Reset' action, which causes default setting of |
| 6 | ... interrupt enables, event message generation,sensor scanning, |
| 7 | ... threshold values, and other 'power up' default state to be restored. |
| 8 | ... |
| 9 | ... The script consist of 3 testcases: |
| 10 | ... - Cold_Reset_Via_IPMI |
| 11 | ... - Cold_Reset_With_Invalid_Data_Request_Via_IPMI |
| 12 | ... - Verify_Cold_Reset_Impact_On_Sensor_Threshold_Via_IPMI |
| 13 | ... |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 14 | ... The script verifies command execution for cold reset, |
| 15 | ... invalid data request verification of cold reset and |
| 16 | ... impact on sensor threshold value change with cold reset. |
| 17 | ... |
| 18 | ... The script changes sensor threshold value for Fan sensor, |
| 19 | ... executes cold reset IPMI command, |
| 20 | ... compares sensor threshold values of initial and reading after cold reset. |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 21 | ... |
| 22 | ... Request data for cold reset present under data/ipmi_raw_cmd_table.py |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 23 | |
| 24 | Library Collections |
| 25 | Library ../lib/ipmi_utils.py |
| 26 | Resource ../lib/ipmi_client.robot |
| 27 | Resource ../lib/openbmc_ffdc.robot |
| 28 | Variables ../data/ipmi_raw_cmd_table.py |
| 29 | |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 30 | Test Teardown FFDC On Test Case Fail |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 31 | |
| 32 | |
| 33 | *** Variables *** |
| 34 | |
| 35 | ${NETWORK_RESTART_TIME} 30s |
| 36 | @{thresholds_list} lcr lnc unc ucr |
| 37 | |
| 38 | |
| 39 | *** Test Cases *** |
| 40 | |
| 41 | Cold Reset Via IPMI |
| 42 | [Documentation] Verify Cold Reset via IPMI. |
| 43 | [Tags] Cold_Reset_Via_IPMI |
| 44 | |
| 45 | # Cold Reset Via IPMI raw command. |
| 46 | Run External IPMI Raw Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]} |
| 47 | |
| 48 | # Get the BMC Status. |
| 49 | Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable |
| 50 | Wait Until Keyword Succeeds 3 min 10 sec Is BMC Operational |
| 51 | |
| 52 | # Verify if BMC restarted with Get Device ID command. |
| 53 | |
| 54 | ${resp}= Run External IPMI Raw Command ${IPMI_RAW_CMD['Device ID']['Get'][0]} |
| 55 | Should Not Contain ${resp} ${IPMI_RAW_CMD['Device ID']['Get'][1]} |
| 56 | |
| 57 | |
| 58 | Cold Reset With Invalid Data Request Via IPMI |
| 59 | [Documentation] Verify Cold Reset with invalid data request via IPMI. |
| 60 | [Tags] Cold_Reset_With_Invalid_Data_Request_Via_IPMI |
| 61 | |
| 62 | # Verify cold reset with invalid length of the request data and expect error. |
| 63 | ${resp}= Run Keyword and Expect Error *Request data length invalid* |
| 64 | ... Run External IPMI Raw Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]} 0x00 |
| 65 | |
| 66 | |
| 67 | Verify Cold Reset Impact On Sensor Threshold Via IPMI |
| 68 | [Documentation] Modify sensor threshold, perform cold reset, |
| 69 | ... and verify if sensor threshold reverts back to initial value. |
| 70 | [Tags] Verify_Cold_Reset_Impact_On_Sensor_Threshold_Via_IPMI |
| 71 | |
| 72 | # Get sensor list. |
| 73 | ${Sensor_list}= Get Sensor List |
| 74 | |
| 75 | # Get initial sensor threshold readings. |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 76 | ${initial_sensor_threshold} ${sensor_name}= Get The Sensor Name And Threshold ${sensor_list} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 77 | |
| 78 | # Identify sensor threshold values to modify. |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 79 | ${threshold_list} ${threshold_dict}= Identify Sensor Threshold Values ${initial_sensor_threshold} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 80 | |
| 81 | # Set sensor threshold for given sensor and compare with initial reading. |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 82 | ${set_sensor_threshold}= Set Sensor Threshold For given Sensor |
| 83 | ... ${threshold_dict} ${sensor_name} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 84 | Should Not Be Equal ${set_sensor_threshold} ${initial_sensor_threshold} |
| 85 | |
| 86 | # Execute cold reset command via IPMI and check status. |
| 87 | Run External IPMI Raw Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]} |
| 88 | Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable |
| 89 | Wait Until Keyword Succeeds 3 min 10 sec Is BMC Operational |
| 90 | |
| 91 | # Get sensor data for the sensor identified. |
| 92 | ${data_after_coldreset}= Wait Until Keyword Succeeds 2 min 30 sec |
| 93 | ... Run IPMI Standard Command sensor | grep -i RPM | grep "${sensor_name}" |
| 94 | |
| 95 | # Get sensor threshold readings after BMC restarts. |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 96 | ${sensor_threshold_after_reset} ${sensor_name_after_reset}= |
| 97 | ... Get The Sensor Name And Threshold ${data_after_coldreset} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 98 | |
| 99 | # Compare with initial sensor threshold values. |
| 100 | Should Be Equal ${sensor_threshold_after_reset} ${initial_sensor_threshold} |
| 101 | |
| 102 | |
| 103 | *** Keywords *** |
| 104 | |
| 105 | Get Sensor List |
| 106 | [Documentation] To get the list of sensors via IPMI sensor list. |
| 107 | |
| 108 | # BMC may take time to populate all the sensors once BMC Cold reset completes. |
| 109 | ${data}= Wait Until Keyword Succeeds 2 min 30 sec |
| 110 | ... Run IPMI Standard Command sensor | grep -i RPM |
| 111 | |
| 112 | [Return] ${data} |
| 113 | |
| 114 | Identify Sensor |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 115 | [Documentation] To fetch first sensor listed from sensor list IPMI command and return the sensor. |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 116 | [Arguments] ${data} |
| 117 | |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 118 | # Description of Argument(s): |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 119 | # ${data} All the sensors listed with ipmi sensor list command. |
| 120 | |
| 121 | # Find Sensor detail of sensor list first entry. |
| 122 | |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 123 | ${data}= Split To Lines ${data} |
| 124 | ${data}= Set Variable ${data[0]} |
| 125 | |
| 126 | [Return] ${data} |
| 127 | |
| 128 | |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 129 | Get The Sensor Reading And Name |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 130 | [Documentation] To get the sensor reading of the given sensor using IPMI. |
| 131 | [Arguments] ${Sensors_all} |
| 132 | |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 133 | # Description of Argument(s): |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 134 | # ${Sensors_all} All the sensors listed with ipmi sensor list command. |
| 135 | |
| 136 | # Split Sensor details in a list. |
| 137 | |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 138 | ${sensor}= Identify Sensor ${Sensors_all} |
| 139 | ${data}= Split String ${sensor} | |
| 140 | |
| 141 | # Locate the sensor name. |
| 142 | ${sensor_name}= Set Variable ${data[0]} |
| 143 | # Function defined in lib/utils.py. |
| 144 | ${sensor_name}= Remove Whitespace ${sensor_name} |
| 145 | |
| 146 | [Return] ${data} ${sensor_name} |
| 147 | |
| 148 | |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 149 | Get The Sensor Name And Threshold |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 150 | [Documentation] To get the sensor threshold for given sensor using IPMI. |
| 151 | [Arguments] ${Sensor_list} |
| 152 | |
| 153 | # Description of Argument(s): |
| 154 | # ${Sensor_list} All the sensors listed with ipmi sensor list command. |
| 155 | |
| 156 | # Gets the sensor data and sensor name for the required sensor. |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 157 | ${data} ${sensor_name}= Get The Sensor Reading And Name ${Sensor_list} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 158 | # Gets the threshold values in a list. |
| 159 | ${threshold}= Set Variable ${data[5:9]} |
| 160 | |
| 161 | [Return] ${threshold} ${sensor_name} |
| 162 | |
| 163 | |
| 164 | Identify Sensor Threshold Values |
| 165 | [Documentation] Identify New Sensor Threshold Values with adding 100 to old threshold values. |
| 166 | [Arguments] ${old_threshold} |
| 167 | |
| 168 | # Description of Argument(s): |
| 169 | # ${old_threshold} original threshold values list of the given sensor. |
| 170 | |
| 171 | # Retrieves modified threshold values of the original threshold value. |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 172 | ${threshold_list} ${threshold_dict}= Modify And Fetch Threshold ${old_threshold} ${thresholds_list} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 173 | |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 174 | [Return] ${threshold_list} ${threshold_dict} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 175 | |
| 176 | |
| 177 | Set Sensor Threshold For given Sensor |
George Keishing | 6e64126 | 2022-05-05 10:46:22 -0500 | [diff] [blame] | 178 | [Documentation] Set Sensor Threshold for given sensor with given Upper and Lower critical |
| 179 | ... and non-critical values Via IPMI. |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 180 | [Arguments] ${threshold_dict} ${sensor} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 181 | |
| 182 | # Description of Argument(s): |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 183 | # ${threshold_dict} New thresholds dictionary to be set |
| 184 | # E.g. {'lcr': 2600, 'lnc': 'na', 'unc': 'na', 'ucr': 12200} |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 185 | # ${sensor} Sensor name, eg: SENSOR_1, FAN_1 |
| 186 | |
| 187 | # The return data will be newly set threshold value for the given sensor. |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 188 | |
| 189 | # Set critical and non-critical values for the given sensor. |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 190 | FOR ${criticals} IN @{threshold_dict} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 191 | # Set Lower/Upper critical and non-critical values if a threshold is available. |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 192 | Run keyword if '${threshold_dict['${criticals}']}' != 'na' |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 193 | ... Run IPMI Standard Command |
George Keishing | 30ef8b8 | 2022-05-06 09:15:04 -0500 | [diff] [blame] | 194 | ... sensor thresh "${sensor}" ${criticals} ${threshold_dict['${criticals}']} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 195 | # Allow Network restart sleep time for the readings to get reflected. |
| 196 | Sleep ${NETWORK_RESTART_TIME} |
| 197 | END |
| 198 | |
| 199 | # Get sensor list for the sensor name identified. |
| 200 | ${data}= Wait Until Keyword Succeeds 2 min 30 sec |
| 201 | ... Run IPMI Standard Command sensor | grep -i RPM | grep "${sensor}" |
| 202 | |
| 203 | # Get new threshold value set from sensor list. |
chithrag | 6b279b3 | 2022-05-05 08:28:05 +0000 | [diff] [blame] | 204 | ${threshold_new} ${sensor_name}= Get The Sensor Name And Threshold ${data} |
chithrag | ff43db9 | 2022-03-01 13:13:48 +0000 | [diff] [blame] | 205 | |
| 206 | [Return] ${threshold_new} |