blob: 47784c0e58b8f4da024acd6f65d365a80748c960 [file] [log] [blame]
chithragff43db92022-03-01 13:13:48 +00001*** Settings ***
2Documentation 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...
chithragff43db92022-03-01 13:13:48 +000014... 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.
chithrag6b279b32022-05-05 08:28:05 +000021...
22... Request data for cold reset present under data/ipmi_raw_cmd_table.py
chithragff43db92022-03-01 13:13:48 +000023
24Library Collections
25Library ../lib/ipmi_utils.py
26Resource ../lib/ipmi_client.robot
27Resource ../lib/openbmc_ffdc.robot
28Variables ../data/ipmi_raw_cmd_table.py
29
chithrag6b279b32022-05-05 08:28:05 +000030Test Teardown FFDC On Test Case Fail
chithragff43db92022-03-01 13:13:48 +000031
32
33*** Variables ***
34
35${NETWORK_RESTART_TIME} 30s
36@{thresholds_list} lcr lnc unc ucr
37
38
39*** Test Cases ***
40
41Cold 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
58Cold 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
67Verify 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.
ganesanb29a24212022-05-11 19:49:40 +053073 ${sensor_list}= Get Sensor List
chithragff43db92022-03-01 13:13:48 +000074
75 # Get initial sensor threshold readings.
ganesanb29a24212022-05-11 19:49:40 +053076 ${sensor_name} ${sensor_threshold}= Get The Sensor Name And Threshold ${sensor_list}
chithragff43db92022-03-01 13:13:48 +000077
ganesanb29a24212022-05-11 19:49:40 +053078 ${threshold_key_list}= Get Dictionary Keys ${sensor_threshold}
79 ${random_threshold_key}= Evaluate random.choice(${threshold_key_list}) random
chithragff43db92022-03-01 13:13:48 +000080
ganesanb29a24212022-05-11 19:49:40 +053081 ${old_threshold_value}= Get From Dictionary ${sensor_threshold} ${random_threshold_key}
chithragff43db92022-03-01 13:13:48 +000082
ganesanb29a24212022-05-11 19:49:40 +053083 # Modify Default Threshold Value For An Sensor To Set An New Threshold Value
84 ${new_settable_threshold_value}= Modify Default Sensor Threshold Value ${old_threshold_value}
85
86 # Set/Get sensor threshold for given sensor and compare with initial reading.
87 ${new_threshold_value}= Set And Get Sensor Threshold For given Sensor ${sensor_name} ${random_threshold_key}
88 ... ${new_settable_threshold_value}
89
90 Should Not Be Equal ${new_threshold_value} ${old_threshold_value}
91
92 # Cold Reset Via IPMI raw command.
chithragff43db92022-03-01 13:13:48 +000093 Run External IPMI Raw Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]}
ganesanb29a24212022-05-11 19:49:40 +053094
95 # Get the BMC Status.
chithragff43db92022-03-01 13:13:48 +000096 Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable
ganesanb29a24212022-05-11 19:49:40 +053097 Wait Until Keyword Succeeds 10 min 10 sec Is BMC Operational
chithragff43db92022-03-01 13:13:48 +000098
99 # Get sensor data for the sensor identified.
100 ${data_after_coldreset}= Wait Until Keyword Succeeds 2 min 30 sec
ganesanb29a24212022-05-11 19:49:40 +0530101 ... Run IPMI Standard Command sensor | grep -i "${sensor_name}"
chithragff43db92022-03-01 13:13:48 +0000102
103 # Get sensor threshold readings after BMC restarts.
ganesanb29a24212022-05-11 19:49:40 +0530104 ${threshold_value_after_reset}= Getting Sensor Threshold Value Based On Threshold Key ${random_threshold_key} ${sensor_name}
chithragff43db92022-03-01 13:13:48 +0000105
106 # Compare with initial sensor threshold values.
ganesanb29a24212022-05-11 19:49:40 +0530107 Should Be Equal ${threshold_value_after_reset} ${old_threshold_value}
chithragff43db92022-03-01 13:13:48 +0000108
109*** Keywords ***
110
111Get Sensor List
112 [Documentation] To get the list of sensors via IPMI sensor list.
113
114 # BMC may take time to populate all the sensors once BMC Cold reset completes.
115 ${data}= Wait Until Keyword Succeeds 2 min 30 sec
ganesanb29a24212022-05-11 19:49:40 +0530116 ... Run IPMI Standard Command sensor
chithragff43db92022-03-01 13:13:48 +0000117
118 [Return] ${data}
119
chithrag6b279b32022-05-05 08:28:05 +0000120Get The Sensor Name And Threshold
chithragff43db92022-03-01 13:13:48 +0000121 [Documentation] To get the sensor threshold for given sensor using IPMI.
ganesanb29a24212022-05-11 19:49:40 +0530122 [Arguments] ${sensor_list}
chithragff43db92022-03-01 13:13:48 +0000123
124 # Description of Argument(s):
ganesanb29a24212022-05-11 19:49:40 +0530125 # ${sensor_list} All the sensors listed with ipmi sensor list command.
chithragff43db92022-03-01 13:13:48 +0000126
ganesanb29a24212022-05-11 19:49:40 +0530127 @{tmp_list}= Create List
chithragff43db92022-03-01 13:13:48 +0000128
ganesanb29a24212022-05-11 19:49:40 +0530129 @{sensor_list_lines}= Split To Lines ${sensor_list}
chithragff43db92022-03-01 13:13:48 +0000130
ganesanb29a24212022-05-11 19:49:40 +0530131 # Omit the discrete sensor and create an threshold sensor name list
132 FOR ${sensor} IN @{sensor_list_lines}
133 ${discrete_sensor_status}= Run Keyword And Return Status Should Contain ${sensor} discrete
134 Continue For Loop If '${discrete_sensor_status}' == 'True'
135 ${sensor_details}= Split String ${sensor} |
136 ${get_sensor_name}= Get From List ${sensor_details} 0
137 ${sensor_name}= Set Variable ${get_sensor_name.strip()}
138 Append To List ${tmp_list} ${sensor_name}
chithragff43db92022-03-01 13:13:48 +0000139 END
140
ganesanb29a24212022-05-11 19:49:40 +0530141 ${sensor_count}= Get Length ${tmp_list}
chithragff43db92022-03-01 13:13:48 +0000142
ganesanb29a24212022-05-11 19:49:40 +0530143 FOR ${RANGE} IN RANGE 0 ${sensor_count}
144 ${random_sensor} ${sensor_threshold}= Selecting Random Sensor Name And Threshold Value ${tmp_list} ${sensor_list}
145 ${threshold_dict_count}= Get Length ${sensor_threshold}
146 Exit For Loop If '${threshold_dict_count}' != '0'
147 Remove Values From List ${tmp_list} ${random_sensor}
148 END
chithragff43db92022-03-01 13:13:48 +0000149
ganesanb29a24212022-05-11 19:49:40 +0530150 [Return] ${random_sensor} ${sensor_threshold}
151
152Selecting Random Sensor Name And Threshold Value
153 [Documentation] Select Random Sensor Name And Threshold Values.
154 [Arguments] ${tmp_list} ${sensor_list}
155
156 # Selecting random sensors from sensor list
157 ${random_sensor_name}= Evaluate random.choice(${tmp_list}) random
158
159 # Create Dictionary For Threshold Key With Threshold Values
160 &{tmp_dict}= Create Dictionary
161 ${sensor_threshold}= Get Lines Containing String ${sensor_list} ${random_sensor_name}
162 @{ipmi_sensor}= Split String ${sensor_threshold} |
163 ${get_ipmi_lower_non_recoverable_threshold}= Get From List ${ipmi_sensor} 4
164 ${ipmi_lower_non_recoverable_threshold}= Set Variable ${get_ipmi_lower_non_recoverable_threshold.strip()}
165 ${lower_non_recoverable_threshold_status}= Run Keyword And Return Status Should Not Contain
166 ... ${ipmi_lower_non_recoverable_threshold} na
167 Run Keyword If '${lower_non_recoverable_threshold_status}' == 'True'
168 ... Set To Dictionary ${tmp_dict} lnr ${ipmi_lower_non_recoverable_threshold}
169
170 ${get_ipmi_lower_critical_threshold}= Get From List ${ipmi_sensor} 5
171 ${ipmi_lower_critical_threshold}= Set Variable ${get_ipmi_lower_critical_threshold.strip()}
172 ${lower_critical_threshold_status}= Run Keyword And Return Status Should Not Contain
173 ... ${ipmi_lower_critical_threshold} na
174 Run Keyword If '${lower_critical_threshold_status}' == 'True'
175 ... Set To Dictionary ${tmp_dict} lcr ${ipmi_lower_critical_threshold}
176
177 ${get_ipmi_lower_non_critical_threshold}= Get From List ${ipmi_sensor} 6
178 ${ipmi_lower_non_critical_threshold}= Set Variable ${get_ipmi_lower_non_critical_threshold.strip()}
179 ${lower_non_critical_threshold_status}= Run Keyword And Return Status Should Not Contain
180 ... ${ipmi_lower_non_critical_threshold} na
181 Run Keyword If '${lower_non_critical_threshold_status}' == 'True'
182 ... Set To Dictionary ${tmp_dict} lnc ${ipmi_lower_non_critical_threshold}
183
184 ${get_ipmi_upper_non_critical_threshold}= Get From List ${ipmi_sensor} 7
185 ${ipmi_upper_non_critical_threshold}= Set Variable ${get_ipmi_upper_non_critical_threshold.strip()}
186 ${upper_non_critical_threshold_status}= Run Keyword And Return Status Should Not Contain
187 ... ${ipmi_upper_non_critical_threshold} na
188 Run Keyword If '${upper_non_critical_threshold_status}' == 'True'
189 ... Set To Dictionary ${tmp_dict} unc ${ipmi_upper_non_critical_threshold}
190
191 ${get_ipmi_upper_critical_threshold}= Get From List ${ipmi_sensor} 8
192 ${ipmi_upper_critical_threshold}= Set Variable ${get_ipmi_upper_critical_threshold.strip()}
193 ${upper_critical_threshold_status}= Run Keyword And Return Status Should Not Contain
194 ... ${ipmi_upper_critical_threshold} na
195 Run Keyword If '${upper_critical_threshold_status}' == 'True'
196 ... Set To Dictionary ${tmp_dict} ucr ${ipmi_upper_critical_threshold}
197
198 ${get_ipmi_upper_non_recoverable_threshold}= Get From List ${ipmi_sensor} 9
199 ${ipmi_upper_non_recoverable_threshold}= Set Variable ${get_ipmi_upper_non_recoverable_threshold.strip()}
200 ${upper_non_recoverable_threshold_status}= Run Keyword And Return Status Should Not Contain
201 ... ${ipmi_upper_non_recoverable_threshold} na
202 Run Keyword If '${upper_non_recoverable_threshold_status}' == 'True'
203 ... Set To Dictionary ${tmp_dict} unr ${ipmi_upper_non_recoverable_threshold}
204
205 [Return] ${random_sensor_name} ${tmp_dict}
206
207Modify Default Sensor Threshold Value
208 [Documentation] Modify Default Sensor Threshold Value with adding 100 to old threshold values.
209 [Arguments] ${old_threshold}
210
211 ${new_threshold}= Evaluate ${old_threshold} + 100
212
213 [Return] ${new_threshold}
214
215Set And Get Sensor Threshold For given Sensor
216 [Documentation] Set/Get Sensor Threshold for given sensor Via IPMI.
217 [Arguments] ${sensor_name} ${random_threshold_key} ${new_settable_threshold_value}
218
219 # Set New Threshold Value To The Randomly Selected Sensor.
220 Run IPMI Standard Command sensor thresh "${sensor_name}" ${random_threshold_key} ${new_settable_threshold_value}
221
222 Sleep 10s
223
224 ${sensor_new_threshold_value}= Getting Sensor Threshold Value Based On Threshold Key ${random_threshold_key} ${sensor_name}
225
226 [Return] ${sensor_new_threshold_value}
227
228Getting Sensor Threshold Value Based On Threshold Key
229 [Documentation] Getting Particular Sensor Threshold Value Based On Sensor Name And Threshold Key.
230 [Arguments] ${threshold_key} ${sensor_name}
231
232 # After Setting Threshold Value, Get New Sensor Threshold Value.
233 ${new_data}= Run IPMI Standard Command sensor | grep -i "${sensor_name}"
234 ${new_sensor_details}= Split String ${new_data} |
235
236 ${index_value}= Set Variable If
237 ... '${threshold_key}' == 'lnr' ${4}
238 ... '${threshold_key}' == 'lcr' ${5}
239 ... '${threshold_key}' == 'lnc' ${6}
240 ... '${threshold_key}' == 'unc' ${7}
241 ... '${threshold_key}' == 'ucr' ${8}
242 ... '${threshold_key}' == 'unr' ${9}
243
244 ${get_sensor_new_threshold_value}= Get From List ${new_sensor_details} ${index_value}
245 ${sensor_new_threshold_value}= Set Variable ${get_sensor_new_threshold_value.strip()}
246
247 [Return] ${sensor_new_threshold_value}