xref: /openbmc/openbmc-test-automation/redfish/systems/test_alternate_fan_settings.robot (revision feb79d60e26d78a6e91521ee41b1af5b8ba71f4c)
1*** Settings ***
2
3Documentation  Test Suite for Supported Fan Modules.
4
5Resource         ../../lib/rest_client.robot
6Resource         ../../lib/bmc_redfish_resource.robot
7Resource         ../../lib/bmc_redfish_utils.robot
8Resource         ../../lib/openbmc_ffdc.robot
9Resource         ../../lib/resource.robot
10Resource         ../../lib/boot_utils.robot
11Library          ../../lib/gen_robot_valid.py
12Library          ../../lib/gen_robot_keyword.py
13
14Suite Setup      Suite Setup Execution
15Suite Teardown   Suite Teardown Execution
16Test Setup       Printn
17Test Teardown    Test Teardown Execution
18
19Test Tags        Alternate_Fan_Settings
20
21*** Variables ***
22
23@{VALID_MODE_VALUES}   DEFAULT  CUSTOM  HEAVY_IO  MAX_BASE_FAN_FLOOR
24
25
26*** Test Cases ***
27
28Verify Current Fan Thermal Mode
29    [Documentation]  Check current thermal fan mode is a valid mode value.
30    [Tags]  Verify_Current_Fan_Thermal_Mode
31
32    # Example:
33    #  /xyz/openbmc_project/control/thermal/0
34    #
35    # Response code:200, Content: {
36    # "data": {
37    #         "Current": "DEFAULT",
38    #         "Supported": [
39    #           "DEFAULT",
40    #           "CUSTOM",
41    #           "HEAVY_IO",
42    #           "MAX_BASE_FAN_FLOOR"
43    #         },
44    #         },
45    # "message": "200 OK",
46    # "status": "ok"
47    # }
48
49    ${current}=  Read Attribute  ${THERMAL_CONTROL_URI}  Current
50    Rprint Vars  current
51
52    Valid Value  current  valid_values=${VALID_MODE_VALUES}
53
54
55Verify Supported Fan Thermal Modes Available
56    [Documentation]  Check supported fan thermal modes are valid mode values.
57    [Tags]  Verify_Supported_Fan_Thermal_Modes_Available
58
59    ${supported}=  Read Attribute  ${THERMAL_CONTROL_URI}  Supported
60    Rprint Vars  supported
61
62    Valid List  supported  valid_values=${VALID_MODE_VALUES}
63
64
65Verify Supported Fan Thermal Modes Switch At Standby
66    [Documentation]  Check that supported modes are set successfully at standby.
67    [Tags]  Verify_Supported_Fan_Thermal_Modes_Switch_At_Standby
68    [Template]  Set and Verify Thermal Mode Switches
69
70    # pre_req_state      thermal_mode_type
71    Off                  DEFAULT
72    Off                  CUSTOM
73    Off                  HEAVY_IO
74    Off                  MAX_BASE_FAN_FLOOR
75
76
77Verify Supported Fan Thermal Modes Switch At Runtime
78    [Documentation]  Check that supported modes are set successfully at runtime.
79    [Tags]  Verify_Supported_Fan_Thermal_Modes_Switch_At_Runtime
80    [Template]  Set and Verify Thermal Mode Switches
81
82    # pre_req_state      thermal_mode
83    On                   DEFAULT
84    On                   CUSTOM
85    On                   HEAVY_IO
86    On                   MAX_BASE_FAN_FLOOR
87
88
89Verify Supported Fan Thermal Mode Remains Set After Boot
90    [Documentation]  Check that supported modes remain set at runtime.
91    [Tags]  Verify_Supported_Fan_Thermal_Mode_Remains_Set_After_Boot
92    [Template]  Set and Verify Thermal Mode After Boot
93
94    # pre_req_state      thermal_mode_type
95    Off                  DEFAULT
96    Off                  CUSTOM
97    Off                  HEAVY_IO
98    Off                  MAX_BASE_FAN_FLOOR
99
100
101*** Keywords ***
102
103Set and Verify Thermal Mode Switches
104    [Documentation]  Verify the thermal mode switches successfully at standby or runtime.
105    [Arguments]  ${pre_req_state}  ${thermal_mode}
106
107    # Description of Arguments(s):
108    # thermal_mode       Read the supported thermal mode (e.g. "CUSTOM")
109    # pre_req_state      Set the state of the host to Standby or Runtime (e.g. "Running")
110
111    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
112    Redfish.Login
113
114    ${mode}=  Redfish.Put  ${THERMAL_CONTROL_URI}/attr/Current  body={"data": "${thermal_mode}"}
115
116    ${current}=  Read Attribute  ${THERMAL_CONTROL_URI}  Current
117    Should Be Equal As Strings  ${thermal_mode}  ${current}
118    ...  msg=The thermal mode does not match the current fan mode.
119    Rprint Vars  current
120
121
122Set and Verify Thermal Mode After Boot
123    [Documentation]  Verify the thermal mode remains set at runtime.
124    [Arguments]  ${pre_req_state}  ${thermal_mode}
125
126    Set and Verify Thermal Mode Switches  ${pre_req_state}  ${thermal_mode}
127
128    Run Key U  Redfish Power On \ stack_mode=normal \ quiet=1
129    Redfish.Login
130
131    ${current}=  Read Attribute  ${THERMAL_CONTROL_URI}  Current
132    Should Be Equal As Strings  ${thermal_mode}  ${current}
133    ...  msg=The current thermal fan mode switched successfully.
134    Rprint Vars  current
135
136
137Suite Teardown Execution
138    [Documentation]  Do the post suite teardown.
139
140    Redfish.Logout
141
142
143Suite Setup Execution
144    [Documentation]  Do test case setup tasks.
145
146    Printn
147    Redfish.Login
148
149
150Test Teardown Execution
151    [Documentation]  Do the post test teardown.
152
153    FFDC On Test Case Fail
154