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