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