blob: ab7bcfb0f1b9ef7d1c3d116d82e39e2da26df137 [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.
73 ${Sensor_list}= Get Sensor List
74
75 # Get initial sensor threshold readings.
chithrag6b279b32022-05-05 08:28:05 +000076 ${initial_sensor_threshold} ${sensor_name}= Get The Sensor Name And Threshold ${sensor_list}
chithragff43db92022-03-01 13:13:48 +000077
78 # Identify sensor threshold values to modify.
79 ${threshold_dict}= Identify Sensor Threshold Values ${initial_sensor_threshold}
80
81 # Set sensor threshold for given sensor and compare with initial reading.
82 ${set_sensor_threshold}= Set Sensor Threshold For given Sensor ${threshold_dict} ${sensor_name}
83 Should Not Be Equal ${set_sensor_threshold} ${initial_sensor_threshold}
84
85 # Execute cold reset command via IPMI and check status.
86 Run External IPMI Raw Command ${IPMI_RAW_CMD['Cold Reset']['reset'][0]}
87 Wait Until Keyword Succeeds 3 min 10 sec Is BMC Unpingable
88 Wait Until Keyword Succeeds 3 min 10 sec Is BMC Operational
89
90 # Get sensor data for the sensor identified.
91 ${data_after_coldreset}= Wait Until Keyword Succeeds 2 min 30 sec
92 ... Run IPMI Standard Command sensor | grep -i RPM | grep "${sensor_name}"
93
94 # Get sensor threshold readings after BMC restarts.
George Keishing6e641262022-05-05 10:46:22 -050095 ${sensor_threshold_after_reset} ${sensor_name_after_reset}=
96 ... Get The Sensor Name And Threshold ${data_after_coldreset}
chithragff43db92022-03-01 13:13:48 +000097
98 # Compare with initial sensor threshold values.
99 Should Be Equal ${sensor_threshold_after_reset} ${initial_sensor_threshold}
100
101
102*** Keywords ***
103
104Get Sensor List
105 [Documentation] To get the list of sensors via IPMI sensor list.
106
107 # BMC may take time to populate all the sensors once BMC Cold reset completes.
108 ${data}= Wait Until Keyword Succeeds 2 min 30 sec
109 ... Run IPMI Standard Command sensor | grep -i RPM
110
111 [Return] ${data}
112
113Identify Sensor
chithrag6b279b32022-05-05 08:28:05 +0000114 [Documentation] To fetch first sensor listed from sensor list IPMI command and return the sensor.
chithragff43db92022-03-01 13:13:48 +0000115 [Arguments] ${data}
116
chithragff43db92022-03-01 13:13:48 +0000117 # Description of Argument(s):
chithrag6b279b32022-05-05 08:28:05 +0000118 # ${data} All the sensors listed with ipmi sensor list command.
119
120 # Find Sensor detail of sensor list first entry.
121
chithragff43db92022-03-01 13:13:48 +0000122 ${data}= Split To Lines ${data}
123 ${data}= Set Variable ${data[0]}
124
125 [Return] ${data}
126
127
chithrag6b279b32022-05-05 08:28:05 +0000128Get The Sensor Reading And Name
chithragff43db92022-03-01 13:13:48 +0000129 [Documentation] To get the sensor reading of the given sensor using IPMI.
130 [Arguments] ${Sensors_all}
131
chithragff43db92022-03-01 13:13:48 +0000132 # Description of Argument(s):
chithrag6b279b32022-05-05 08:28:05 +0000133 # ${Sensors_all} All the sensors listed with ipmi sensor list command.
134
135 # Split Sensor details in a list.
136
chithragff43db92022-03-01 13:13:48 +0000137 ${sensor}= Identify Sensor ${Sensors_all}
138 ${data}= Split String ${sensor} |
139
140 # Locate the sensor name.
141 ${sensor_name}= Set Variable ${data[0]}
142 # Function defined in lib/utils.py.
143 ${sensor_name}= Remove Whitespace ${sensor_name}
144
145 [Return] ${data} ${sensor_name}
146
147
chithrag6b279b32022-05-05 08:28:05 +0000148Get The Sensor Name And Threshold
chithragff43db92022-03-01 13:13:48 +0000149 [Documentation] To get the sensor threshold for given sensor using IPMI.
150 [Arguments] ${Sensor_list}
151
152 # Description of Argument(s):
153 # ${Sensor_list} All the sensors listed with ipmi sensor list command.
154
155 # Gets the sensor data and sensor name for the required sensor.
chithrag6b279b32022-05-05 08:28:05 +0000156 ${data} ${sensor_name}= Get The Sensor Reading And Name ${Sensor_list}
chithragff43db92022-03-01 13:13:48 +0000157 # Gets the threshold values in a list.
158 ${threshold}= Set Variable ${data[5:9]}
159
160 [Return] ${threshold} ${sensor_name}
161
162
163Identify Sensor Threshold Values
164 [Documentation] Identify New Sensor Threshold Values with adding 100 to old threshold values.
165 [Arguments] ${old_threshold}
166
167 # Description of Argument(s):
168 # ${old_threshold} original threshold values list of the given sensor.
169
170 # Retrieves modified threshold values of the original threshold value.
chithrag6b279b32022-05-05 08:28:05 +0000171 ${threshold_dict}= Modify And Fetch Threshold ${old_threshold} ${thresholds_list}
chithragff43db92022-03-01 13:13:48 +0000172
173 [Return] ${threshold_dict}
174
175
176Set Sensor Threshold For given Sensor
George Keishing6e641262022-05-05 10:46:22 -0500177 [Documentation] Set Sensor Threshold for given sensor with given Upper and Lower critical
178 ... and non-critical values Via IPMI.
chithragff43db92022-03-01 13:13:48 +0000179 [Arguments] ${threshold_list} ${sensor}
180
181 # Description of Argument(s):
chithrag6b279b32022-05-05 08:28:05 +0000182 # ${threshold_list} New thresholds to be set, eg: [ na, 101, 102, 103 ]
183 # ${sensor} Sensor name, eg: SENSOR_1, FAN_1
184
185 # The return data will be newly set threshold value for the given sensor.
chithragff43db92022-03-01 13:13:48 +0000186
187 # Set critical and non-critical values for the given sensor.
188 FOR ${criticals} IN @{threshold_list}
189 # Set Lower/Upper critical and non-critical values if a threshold is available.
190 Run keyword if '${threshold_list['${criticals}']}' != 'na'
191 ... Run IPMI Standard Command
192 ... sensor thresh "${sensor}" ${criticals} ${threshold_list['${criticals}']}
193 # Allow Network restart sleep time for the readings to get reflected.
194 Sleep ${NETWORK_RESTART_TIME}
195 END
196
197 # Get sensor list for the sensor name identified.
198 ${data}= Wait Until Keyword Succeeds 2 min 30 sec
199 ... Run IPMI Standard Command sensor | grep -i RPM | grep "${sensor}"
200
201 # Get new threshold value set from sensor list.
chithrag6b279b32022-05-05 08:28:05 +0000202 ${threshold_new} ${sensor_name}= Get The Sensor Name And Threshold ${data}
chithragff43db92022-03-01 13:13:48 +0000203
204 [Return] ${threshold_new}