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 (e.g. "xyz.openbmc_project.Led.Physical.Action.On")
120    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
121    #                         power supplies units are initiated (e.g. "Lit")
122
123    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
124    Redfish.Login
125
126    # Put both power supply LEDs On/Off to check all units are asserted
127    Redfish.Put  ${LED_PHYSICAL_PS0_URI}attr/State  body={"data":${asserted}}
128    Redfish.Put  ${LED_PHYSICAL_PS1_URI}attr/State  body={"data":${asserted}}
129
130    # Example output:
131    # power_supplies:
132    #   [0]:
133    #     [MemberId]:                                   powersupply0
134    #     [IndicatorLED]:                               Lit
135    #     [Status]:
136    #       [Health]:                                   OK
137    #       [State]:                                    Enabled
138    #   [1]:
139    #     [MemberId]:                                   powersupply1
140    #     [IndicatorLED]:                               Lit
141    #     [Status]:
142    #       [Health]:                                   OK
143    #       [State]:                                    Enabled
144
145    Verify Indicator LEDs  ${expected_indicator_led}
146
147
148Verify Indicator LEDs
149    [Documentation]  Verify the LEDs on the power supply units are set according to caller's expectation.
150    [Arguments]  ${expected_indicator_led}
151
152    # Description of Arguments(s):
153    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
154    #                         LEDs after the lamp test is initiated (e.g. "Blinking")
155
156    ${power_supplies}=  Redfish.Get Attribute  ${REDFISH_CHASSIS_POWER_URI}  PowerSupplies
157    Rprint Vars  power_supplies
158    FOR  ${power_supply_leds}  IN  @{power_supplies}
159        Valid Value  power_supply_leds['IndicatorLED']  [${expected_indicator_led}]
160    END
161
162
163Set and Verify Fan LED Indicators
164    [Documentation]  Verify the indicator LED for the fans are asserted.
165    [Arguments]  ${pre_req_state}  ${asserted}  ${expected_indicator_led}
166
167    # Description of Arguments(s):
168    # pre_req_state           The pre-requisite state of the host to perform the test (e.g. "On")
169    # asserted                The assert property that sets the value (e.g. "xyz.openbmc_project.Led.Physical.Action.On")
170    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the fans are initiated (e.g. "Lit")
171
172    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
173    Redfish.Login
174
175    # Put all the fan LEDs On/Off to check all are asserted
176    Redfish.Put  ${LED_PHYSICAL_FAN0_URI}attr/State  body={"data":${asserted}}
177    Redfish.Put  ${LED_PHYSICAL_FAN2_URI}attr/State  body={"data":${asserted}}
178    Redfish.Put  ${LED_PHYSICAL_FAN3_URI}attr/State  body={"data":${asserted}}
179
180    # Example output:
181    # fans:
182    #   [0]:
183    #     [@odata.id]:                                  /redfish/v1/Chassis/chassis/Thermal#/Fans/0
184    #     [@odata.type]:                                #Thermal.v1_3_0.Fan
185    #     [IndicatorLED]:                               Lit
186    #     [MemberId]:                                   fan0_0
187    #     [Name]:                                       fan0 0
188    #     [Status]:
189    #       [Health]:                                   OK
190    #       [State]:                                    Enabled
191
192    ${fans}=  Redfish.Get Attribute  ${REDFISH_CHASSIS_THERMAL_URI}  Fans
193    Rprint Vars  fans
194    FOR  ${fan_leds}  IN  @{fans}
195        Valid Value  fan_leds['IndicatorLED']  [${expected_indicator_led}]
196    END
197
198
199Suite Teardown Execution
200    [Documentation]  Do the post suite teardown.
201
202    Redfish.Logout
203
204
205Suite Setup Execution
206    [Documentation]  Do test case setup tasks.
207
208    Printn
209    Redfish.Login
210
211
212Test Teardown Execution
213    [Documentation]  Do the post test teardown.
214
215    FFDC On Test Case Fail
216