blob: ecf0b1d1d9410b60d1d6d40663fa8a64f5dc8545 [file] [log] [blame]
Steven Sombar43d6ba32018-02-16 11:25:09 -06001*** Settings ***
2
3Documentation Operational checks for fans.
4
5# Test Parameters:
6# OPENBMC_HOST The BMC host name or IP address.
7# OPENBMC_USERNAME The userID to login to the BMC as.
8# OPENBMC_PASSWORD The password for OPENBMC_USERNAME.
9# OS_HOST The OS host name or IP Address.
10# OS_USERNAME The OS login userid (usually root).
11# OS_PASSWORD The password for the OS login.
12#
13# Approximate run time: 8 minutes.
14
15Resource ../syslib/utils_os.robot
16Resource ../lib/logging_utils.robot
17Resource ../lib/utils.robot
18Resource ../lib/fan_utils.robot
19
20Suite Setup Suite Setup Execution
21Test Teardown Test Teardown Execution
22
23
24*** Variables ***
25
26# The fan speed-monitoring daemon takes less than one second to
27# notice a fan failure. Allow system_response_time before checking
28# if there was a measurable response to the daemon, such as an increase
29# in RPMs of the other fans.
30${system_response_time} 30s
31
32# The @{fan_names} list holds the names of the fans in the system.
33@{fan_names}
34
35# Fan state values.
36${fan_functional} ${1}
37${fan_nonfunctional} ${0}
38
39
40*** Test Cases ***
41
42
43Check Number Of Fans With Power On
44 [Documentation] Verify system has the minimum number of fans.
45 [Tags] Check_Number_Of_Fans_With_Power_On
46
47 @{fan_names} Create List
48 # Populate the list with the names of the fans in the system.
49 ${fan_names}= Get Fan Names ${fan_names}
50 Set Suite Variable ${fan_names} children=true
51
52 ${number_of_fans}= Get Length ${fan_names}
53
54 # Determine if system is water cooled.
55 ${water_coooled}= Is Water Cooled
56
57 Verify Minimum Number Of Fans With Cooling Type ${number_of_fans}
58 ... ${water_coooled}
59
60
61Check Number Of Fan Monitors With Power On
62 [Documentation] Verify monitors are present when power on.
63 [Tags] Check_Number_Of_Fan_Monitors_With_Power_On
64
65 Verify Fan Monitors With State On
66
67
68Verify Fan RPM Increase
69 [Documentation] Verify that RPMs of working fans increase when one fan
70 ... is disabled.
71 [Tags] Verify_Fan_RPM_Increase
72 # A non-functional fan should cause an error log and
73 # an enclosure LED will light. The other fans should speed up.
74
75 # Any fan at this speed or greater will be considered to be at maximum RPM.
76 ${max_fan_rpm}= Set Variable 10400
77
78 # Choose a fan to test with, e.g., fan1.
79 ${test_fan_name}= Get From List ${fan_names} 1
80 Rpvars test_fan_name
81
82 ${initial_speed}= Get Target Speed Of Fans
83 Rpvars initial_speed
84
85 # If initial speed is not already at maximum, set expect_increase.
86 # This flag is used later to determine if speed checking is
87 # to be done or not.
88 ${expect_increase}= Run Keyword If
89 ... ${initial_speed} < ${max_fan_rpm}
90 ... Set Variable 1 ELSE Set Variable 0
91
92 Set Fan State ${test_fan_name} ${fan_nonfunctional}
93 Sleep ${system_response_time}
94
95 Verify System Error Indication Due To Fans
96
97 # Verify the error log is for test_fan_name.
98 ${elog_entries}= Get Logging Entry List
99 :FOR ${elog_entry} IN @{elog_entries}
100 \ ${elog_entry_callout}= Set Variable ${elog_entry}/callout
101 \ ${endpoint}= Read Attribute ${elog_entry_callout} endpoints
102 \ ${endpoint_name}= Get From List ${endpoint} 0
103 \ Should Contain ${endpoint_name} ${test_fan_name}
104 ... msg=Error log present but not for ${test_fan_name}.
105
106 ${new_fan_speed}= Get Target Speed Of Fans
107 Rpvars expect_increase initial_speed new_fan_speed
108
109 # Fail if current fan speed did not increase past the initial
110 # speed, but do this check only if not at maximum speed to begin with.
111 Run Keyword If
112 ... ${expect_increase} == 1 and ${new_fan_speed} < ${initial_speed}
113 ... Fail msg=Remaining fans did not increase speed with loss of one fan.
114
115 # Recover the fan.
116 Set Fan State ${test_fan_name} ${fan_functional}
117 Sleep ${system_response_time}
118
119 Delete Error Logs
120 Sleep 2s
121
122 # Enclosure LEDs should go off immediately after deleting the error logs.
123 Verify Front And Rear LED State Off
124
125 ${restored_fan_speed}= Get Target Speed Of Fans
126 Rpvars new_fan_speed restored_fan_speed
127
128 # Fan speed should lower because the fan is now functional again.
129 Run Keyword If
130 ... ${expect_increase} == 1 and ${new_fan_speed} < ${restored_fan_speed}
131 ... Fail msg=Fans did not recover speed with all fans functional again.
132
133
134Verify System Shutdown Due To Fans
135 [Documentation] Shut down when not enough fans.
136 [Tags] Verify_System_Shutdown_Due_To_Fans
137
138 # Set fans to be non-functional.
139 :FOR ${fan_name} IN @{fan_names}
140 \ Set Fan State ${fan_name} ${fan_nonfunctional}
141
142 # System should notice the non-functional fans and power-off the
143 # system. The Wait For PowerOff keyword will time-out and report
144 # an error if power off does not happen within a reasonable time.
145 Wait For PowerOff
146
147 Verify System Error Indication Due To Fans
148
149 # Verify there is an error log because of the shutdown.
150 ${expect}= Catenate
151 ... xyz.openbmc_project.State.Shutdown.Inventory.Error.Fan
152 ${elog_entries}= Get Logging Entry List
153 :FOR ${elog_entry} IN @{elog_entries}
154 \ ${elog_message}= Read Attribute ${elog_entry} Message
155 \ ${found}= Set Variable 1
156 \ Run Keyword If '${elog_message}' == '${expect}' Exit For Loop
157 \ ${found}= Set Variable 0
158 Run Keyword If not ${found} Fail
159 ... msg=No error log for event Shutdown.Inventory.Error.Fan.
160
161
162*** Keywords ***
163
164
165Reset Fans
166 [Documentation] Set the fans to functional state.
167 # Set state of fans to functional by writing 1 to the Functional
168 # attribute of each fan in the @{fan_names} list. If @{fan_names}
169 # is empty nothing is done.
170
171 # Description of Argument(s):
172 # fans Suite Variable which is a list containing the
173 # names of the fans (e.g., fan0 fan2 fan3).
174
175 :FOR ${fan_name} IN @{fan_names}
176 \ Set Fan State ${fan_name} ${fan_functional}
177
178
179Suite Setup Execution
180 [Documentation] Do the pre-test setup.
181
182 REST Power On stack_mode=skip
183 Delete All Error Logs
184 Set System LED State front_fault Off
185 Set System LED State rear_fault Off
186
187
188Test Teardown Execution
189 [Documentation] Do the post-test teardown.
190
191 FFDC On Test Case Fail
192 Reset Fans
193 Delete Error Logs
194 Set System LED State front_fault Off
195 Set System LED State rear_fault Off