1*** Settings ***
2Documentation       Check the indicator LEDs on the system can set the assert
3...                 property to the correct state.
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
19
20*** Test Cases ***
21
22Verify LED Lamp Test Asserted At Standby
23    [Documentation]  Verify the LED asserted at standby is set to off or blinking.
24    [Tags]  Verify_LED_Lamp_Test_Asserted_At_Standby
25    [Template]  Set and Verify Lamp LED Indicator
26
27    # pre_req_state     asserted     expected_indicator_led
28    Off                 1            Blinking
29    Off                 0            Off
30
31
32Verify LED Lamp Test Asserted At Runtime
33    [Documentation]  Verify the LED asserted at runtime is set to off or blinking.
34    [Tags]  Verify_LED_Lamp_Test_Asserted_At_Runtime
35    [Template]  Set and Verify Lamp LED Indicator
36
37    # pre_req_state     asserted     expected_indicator_led
38    On                  1            Blinking
39    On                  0            Off
40
41
42Verify LED Power Supply Units Asserted At Standby
43    [Documentation]  Verify the power supply units are asserted at standby to lit or off.
44    [Tags]  Verify_LED_Power_Supply_Units_Asserted_At_Standby
45    [Template]  Set and Verify LED Indicator
46
47    # pre_req_state     asserted                                        expected_indicator_led
48    Off                 "xyz.openbmc_project.Led.Physical.Action.On"    Lit
49    Off                 "xyz.openbmc_project.Led.Physical.Action.Off"   Off
50
51
52Verify LED Power Supply Units Asserted At Runtime
53    [Documentation]  Verify the power supply units are asserted at runtime to lit or off.
54    [Tags]  Verify_LED_Power_Supply_Units_Asserted_At_Runtime
55    [Template]  Set and Verify LED Indicator
56
57    # pre_req_state     asserted                                        expected_indicator_led
58    On                  "xyz.openbmc_project.Led.Physical.Action.On"    Lit
59    On                  "xyz.openbmc_project.Led.Physical.Action.Off"   Off
60
61
62Verify LED Fans Asserted At Standby
63    [Documentation]  Verify the fans are asserted at standby to lit or off.
64    [Tags]  Verify_LED_Fans_Asserted_At_Standby
65    [Template]  Set and Verify Fan LED Indicators
66
67    # pre_req_state     asserted                                        expected_indicator_led
68    Off                 "xyz.openbmc_project.Led.Physical.Action.On"    Lit
69    Off                 "xyz.openbmc_project.Led.Physical.Action.Off"   Off
70
71
72Verify LED Fans Asserted At Runtime
73    [Documentation]  Verify the fans are asserted at runtime to lit or off.
74    [Tags]  Verify_LED_Fans_Asserted_At_Runtime
75    [Template]  Set and Verify Fan LED Indicators
76
77    # pre_req_state     asserted                                        expected_indicator_led
78    On                  "xyz.openbmc_project.Led.Physical.Action.On"    Lit
79    On                  "xyz.openbmc_project.Led.Physical.Action.Off"   Off
80
81
82*** Keywords ***
83
84Set and Verify Lamp LED Indicator
85    [Documentation]  Verify the indicator LED for the group lamp test is asserted.
86    [Arguments]  ${pre_req_state}  ${asserted}  ${expected_indicator_led}
87
88    # Description of Arguments(s):
89    # pre_req_state           The pre-requisite state of the host to perform the test (e.g. "On")
90    # asserted                The assert property that sets the value to 0 - Off or 1 - Blinking (e.g. "1")
91    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
92    #                         LEDs after the lamp test is initiated (e.g. "Blinking")
93
94    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
95    Redfish.Login
96
97    Redfish.Put  ${LED_LAMP_TEST_ASSERTED_URI}attr/Asserted  body={"data":${asserted}}
98
99    # Example result:
100    # power_supplies:
101    #   [0]:
102    #     [MemberId]:                                   powersupply0
103    #     [PartNumber]:                                 02CL396
104    #     [IndicatorLED]:                               Blinking
105    #     [EfficiencyPercent]:                          90
106    #     [Status]:
107    #       [Health]:                                   OK
108    #       [State]:                                    Enabled
109
110    Verify Indicator LEDs  ${expected_indicator_led}
111
112
113Set and Verify LED Indicator
114    [Documentation]  Verify the indicator LED for the power supply units are asserted.
115    [Arguments]  ${pre_req_state}  ${asserted}  ${expected_indicator_led}
116
117    # Description of Arguments(s):
118    # pre_req_state           The pre-requisite state of the host to perform the test (e.g. "On")
119    # asserted                The assert property that sets the value
120    #                         (e.g. "xyz.openbmc_project.Led.Physical.Action.On")
121    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
122    #                         power supplies units are initiated (e.g. "Lit")
123
124    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
125    Redfish.Login
126
127    # Put both power supply LEDs On/Off to check all units are asserted
128    Redfish.Put  ${LED_PHYSICAL_PS0_URI}attr/State  body={"data":${asserted}}
129    Redfish.Put  ${LED_PHYSICAL_PS1_URI}attr/State  body={"data":${asserted}}
130
131    # Example output:
132    # power_supplies:
133    #   [0]:
134    #     [MemberId]:                                   powersupply0
135    #     [IndicatorLED]:                               Lit
136    #     [Status]:
137    #       [Health]:                                   OK
138    #       [State]:                                    Enabled
139    #   [1]:
140    #     [MemberId]:                                   powersupply1
141    #     [IndicatorLED]:                               Lit
142    #     [Status]:
143    #       [Health]:                                   OK
144    #       [State]:                                    Enabled
145
146    Verify Indicator LEDs  ${expected_indicator_led}
147
148
149Verify Indicator LEDs
150    [Documentation]  Verify the LEDs on the power supply units are set according to caller's expectation.
151    [Arguments]  ${expected_indicator_led}
152
153    # Description of Arguments(s):
154    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
155    #                         LEDs after the lamp test is initiated (e.g. "Blinking")
156
157    ${power_supplies}=  Redfish.Get Attribute  ${REDFISH_CHASSIS_POWER_URI}  PowerSupplies
158    Rprint Vars  power_supplies
159    FOR  ${power_supply_leds}  IN  @{power_supplies}
160        Valid Value  power_supply_leds['IndicatorLED']  ['${expected_indicator_led}']
161    END
162
163
164Set and Verify Fan LED Indicators
165    [Documentation]  Verify the indicator LED for the fans are asserted.
166    [Arguments]  ${pre_req_state}  ${asserted}  ${expected_indicator_led}
167
168    # Description of Arguments(s):
169    # pre_req_state           The pre-requisite state of the host to perform the test (e.g. "On")
170    # asserted                The assert property that sets the value
171    #                         (e.g. "xyz.openbmc_project.Led.Physical.Action.On")
172    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the fans
173    #                         are initiated (e.g. "Lit")
174
175    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
176    Redfish.Login
177
178    # Put all the fan LEDs On/Off to check all are asserted
179    Redfish.Put  ${LED_PHYSICAL_FAN0_URI}attr/State  body={"data":${asserted}}
180    Redfish.Put  ${LED_PHYSICAL_FAN2_URI}attr/State  body={"data":${asserted}}
181    Redfish.Put  ${LED_PHYSICAL_FAN3_URI}attr/State  body={"data":${asserted}}
182
183    # Example output:
184    # fans:
185    #   [0]:
186    #     [@odata.id]:                                  /redfish/v1/Chassis/chassis/Thermal#/Fans/0
187    #     [@odata.type]:                                #Thermal.v1_3_0.Fan
188    #     [IndicatorLED]:                               Lit
189    #     [MemberId]:                                   fan0_0
190    #     [Name]:                                       fan0 0
191    #     [Status]:
192    #       [Health]:                                   OK
193    #       [State]:                                    Enabled
194
195    ${fans}=  Redfish.Get Attribute  ${REDFISH_CHASSIS_THERMAL_URI}  Fans
196    Rprint Vars  fans
197    FOR  ${fan_leds}  IN  @{fans}
198        Valid Value  fan_leds['IndicatorLED']  ['${expected_indicator_led}']
199    END
200
201
202Suite Teardown Execution
203    [Documentation]  Do the post suite teardown.
204
205    Redfish.Logout
206
207
208Suite Setup Execution
209    [Documentation]  Do test case setup tasks.
210
211    Printn
212    Redfish.Login
213
214
215Test Teardown Execution
216    [Documentation]  Do the post test teardown.
217
218    FFDC On Test Case Fail
219