blob: 7eb9ad736ea8ca0fe8870de97ba9b8c887c5d2bd [file] [log] [blame]
Steven Sombar6b280142018-02-12 10:45:13 -06001*** Settings ***
2Documentation Utilities for fan tests.
3
4Library ../lib/bmc_ssh_utils.py
5Variables ../data/variables.py
6
7*** Keywords ***
8
9
10Is Water Cooled
11 [Documentation] Return 1 if system is water cooled, 0 othersise.
12
13 ${water_cooled}= Read Attribute
14 ... ${HOST_INVENTORY_URI}/system/chassis WaterCooled
15 [Return] ${water_cooled}
16
17
18Get Number Of Fans
19 [Documentation] Get the number of fans currently present in inventory.
20
21 ${num_fans} Set Variable ${0}
22 ${fan_uris}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system fan
23
24 : FOR ${fan_uri} IN @{fan_uris}
25 \ ${fan_record}= Read Properties ${fan_uri}
26 \ Continue For Loop If ${fan_record['Present']} != 1
27 \ ${num_fans}= Set Variable ${num_fans+1}
28 [Return] ${num_fans}
29
30
31Verify Minimum Number Of Fans With Cooling Type
32 [Documentation] Verify minimum number of fans.
33 [Arguments] ${water_cooled}
34
35 # Description of argument(s):
36 # water_cooled The value 1 if the system is water cooled,
37 # the value 0 if air cooled.
38
39 # For a water cooled system.
40 ${min_fans_water}= Set Variable 2
41
42 # For an air cooled system.
43 ${min_fans_air}= Set Variable 3
44
45 ${num_fans}= Get Number Of Fans
46
47 Rprintn
48 Rpvars water_cooled num_fans
49
50 # If water cooled must have at least min_fans_water fans, otherwise
51 # issue Fatal Error and terminate testing.
52 Run Keyword If ${water_cooled} == 1 and ${num_fans} < ${min_fans_water}
53 ... Fatal Error
54 ... msg=Water cooled but less than ${min_fans_water} fans present.
55
56 # If air cooled must have at least min_fans_air fans.
57 Run Keyword If ${water_cooled} == 0 and ${num_fans} < ${min_fans_air}
58 ... Fatal Error
59 ... msg=Air cooled but less than ${min_fans_air} fans present.
60
61
62Verify Fan Monitors With State
63 [Documentation] Verify fan monitor daemons in the system state.
64 # The number of monitoring daemons is dependent upon the system
65 # power state. If power is off there should be 0, if power
66 # is on there should be several.
67 [Arguments] ${power_state}
68
69 # Description of argument(s):
70 # power_state Power staet of the system, either "On" or "Off"
71
72 ${cmd}= Catenate systemctl list-units | grep phosphor-fan | wc -l
73 ${num_fan_daemons} ${stderr} ${rc}= BMC Execute Command ${cmd}
74
75 Rpvars power_state num_fan_daemons
76
77 # Fail if system is On and there are no fan monitors.
78 Run Keyword If '${power_state}' == 'On' and ${num_fan_daemons} == 0
79 ... Fail msg=No phosphor-fan monitors found at power on.
80
81 # Fail if system is Off and the fan monitors are present.
82 Run Keyword If '${power_state}' == 'Off' and ${num_fan_daemons} != 0
83 ... Fail msg=Phosphor-fan monitors found at power off.