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