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
62*** Keywords ***
63
64Set and Verify Lamp LED Indicator
65    [Documentation]  Verify the indicator LED for the group lamp test is asserted.
66    [Arguments]  ${pre_req_state}  ${asserted}  ${expected_indicator_led}
67
68    # Description of Arguments(s):
69    # pre_req_state           The pre-requisite state of the host to perform the test (e.g. "On")
70    # asserted                The assert property that sets the value to 0 - Off or 1 - Blinking (e.g. "1")
71    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
72    #                         LEDs after the lamp test is initiated (e.g. "Blinking")
73
74    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
75    Redfish.Login
76
77    Redfish.Put  ${LED_LAMP_TEST_ASSERTED_URI}attr/Asserted  body={"data":${asserted}}
78
79    # Example result:
80    # power_supplies:
81    #   [0]:
82    #     [MemberId]:                                   powersupply0
83    #     [PartNumber]:                                 02CL396
84    #     [IndicatorLED]:                               Blinking
85    #     [EfficiencyPercent]:                          90
86    #     [Status]:
87    #       [Health]:                                   OK
88    #       [State]:                                    Enabled
89
90    Verify Indicator LEDs  ${expected_indicator_led}
91
92
93Set and Verify LED Indicator
94    [Documentation]  Verify the indicator LED for the power supply units are asserted.
95    [Arguments]  ${pre_req_state}  ${asserted}  ${expected_indicator_led}
96
97    # Description of Arguments(s):
98    # pre_req_state           The pre-requisite state of the host to perform the test (e.g. "On")
99    # asserted                The assert property that sets the value (e.g. "xyz.openbmc_project.Led.Physical.Action.On")
100    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
101    #                         power supplies units are initiated (e.g. "Lit")
102
103    Run Key U  Redfish Power ${pre_req_state} \ stack_mode=skip \ quiet=1
104    Redfish.Login
105
106    # Put both power supply LEDs On/Off to check all units are asserted
107    Redfish.Put  ${LED_PHYSICAL_PS0_URI}attr/State  body={"data":${asserted}}
108    Redfish.Put  ${LED_PHYSICAL_PS1_URI}attr/State  body={"data":${asserted}}
109
110    # Example output:
111    # power_supplies:
112    #   [0]:
113    #     [MemberId]:                                   powersupply0
114    #     [IndicatorLED]:                               Lit
115    #     [Status]:
116    #       [Health]:                                   OK
117    #       [State]:                                    Enabled
118    #   [1]:
119    #     [MemberId]:                                   powersupply1
120    #     [IndicatorLED]:                               Lit
121    #     [Status]:
122    #       [Health]:                                   OK
123    #       [State]:                                    Enabled
124
125    Verify Indicator LEDs  ${expected_indicator_led}
126
127
128Verify Indicator LEDs
129    [Documentation]  Verify the LEDs on the power supply units are set according to caller's expectation.
130    [Arguments]  ${expected_indicator_led}
131
132    # Description of Arguments(s):
133    # expected_indicator_led  The expected value of the IndicatorLED attribute for all the
134    #                         LEDs after the lamp test is initiated (e.g. "Blinking")
135
136    ${power_supplies}=  Redfish.Get Attribute  ${REDFISH_CHASSIS_POWER_URI}  PowerSupplies
137    Rprint Vars  power_supplies
138    FOR  ${power_supply_leds}  IN  @{power_supplies}
139        Valid Value  power_supply_leds['IndicatorLED']  [${expected_indicator_led}]
140    END
141
142
143Suite Teardown Execution
144    [Documentation]  Do the post suite teardown.
145
146    Redfish.Logout
147
148
149Suite Setup Execution
150    [Documentation]  Do test case setup tasks.
151
152    Printn
153    Redfish.Login
154
155
156Test Teardown Execution
157    [Documentation]  Do the post test teardown.
158
159    FFDC On Test Case Fail
160