blob: 54697a8c0f86bbb8db1b536005bbd1f62b734d7b [file] [log] [blame]
Rahul Maheshwari7258aec2017-02-02 04:46:38 -06001*** Settings ***
2
3Documentation Test LED groups in OpenBMC.
4
5Resource ../lib/rest_client.robot
6Resource ../lib/resource.txt
7Resource ../lib/openbmc_ffdc.robot
8
9Suite Setup Setup The Suite
10Test Teardown FFDC On Test Case Fail
11
12Force Tags LED_Group
13
14*** Variables ***
15
16
17*** Test Cases ***
18
19Verify CPU Fault LEDs Group
20 [Documentation] Verify CPU's fault LEDs.
21 [Tags] Verify_CPU_Fault_LEDs_Group
22
George Keishing15b38912017-03-30 06:54:30 -050023 Verify LED Group cpu fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060024
25Verify Fan Fault LEDs Group
26 [Documentation] Verify fan's fault LEDs.
27 [Tags] Verify_Fan_Fault_LEDs_Group
28
George Keishing15b38912017-03-30 06:54:30 -050029 Verify LED Group fan fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060030
31Verify DIMM Fault LEDs Group
32 [Documentation] Verify DIMM's fault LEDs.
33 [Tags] Verify_DIMM_Fault_LEDs_Group
34
George Keishing15b38912017-03-30 06:54:30 -050035 Verify LED Group dimm fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060036
37Verify GPU Fault LEDs Group
38 [Documentation] Verify GPU's fault LEDs.
39 [Tags] Verify_GPU_Fault_LEDs_Group
40
George Keishing15b38912017-03-30 06:54:30 -050041 Verify LED Group gpu fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060042
43Verify Power Supply Fault LEDs Group
44 [Documentation] Verify power supply's fault LEDs.
45 [Tags] Verify_Power_Supply_Fault_LEDs_Group
46
George Keishing15b38912017-03-30 06:54:30 -050047 Verify LED Group powersupply fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060048
49Verify Enclosure Fault LED Group
50 [Documentation] Validate enclosure's fault LED.
51 [Tags] Verify_Enclosure_Fault_LED_Group
52
George Keishing15b38912017-03-30 06:54:30 -050053 Verify LED Group enclosure fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060054
55Verify Power State LEDs Group
56 [Documentation] Verify power state LEDs.
57 [Tags] Verify_Power_State_LEDs_Group
58
George Keishing15b38912017-03-30 06:54:30 -050059 Verify LED Group power
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060060
61Verify Enclosure Identify LED Group
62 [Documentation] Validate enclosure's identify LED.
63 [Tags] Verify_Enclosure_Identify_LED_Group
64
George Keishing15b38912017-03-30 06:54:30 -050065 Verify LED Group enclosure identify
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060066
67Verify Fan Identify LEDs Group
68 [Documentation] Verify fan's identify LEDs.
69 [Tags] Verify_Fan_Identify_LEDs_Group
70
George Keishing15b38912017-03-30 06:54:30 -050071 Verify LED Group fan identify
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060072
73Verify Other Fault LEDs Group
74 [Documentation] Verify other fault LEDs.
75 [Tags] Verify_Other_Fault_LEDs_Group
76
George Keishing15b38912017-03-30 06:54:30 -050077 Verify LED Group system_fault
78 Verify LED Group boxelder_fault
79 Verify LED Group bmc_fault
80 Verify LED Group motherboard_fault
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060081
Sweta Potthurie5a9fc72017-05-03 07:02:46 -050082Verify Enclosure Fault LED On Assertion
83 [Documentation] Verify enclosure fault LED on assertion.
84 [Tags] Verify_Enclosure_Fault_LED_On_Assertion
85
86 Set LED State On cpu0_fault
87 ${resp}= Get System LED State rear_fault
88 Should Be Equal ${resp} On
89
90***Keywords***
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060091
Rahul Maheshwari7258aec2017-02-02 04:46:38 -060092Set LED State
93 [Documentation] Set state of given LED to on or off.
94 [Arguments] ${state} ${led_name}
95 # Description of arguments:
96 # state LED's state to set, i.e. On or Off
97 # led_name Name of LED
98
99 ${data}= Run Keyword If
100 ... '${state}' == 'On' Create Dictionary data=${True}
101 ... ELSE IF '${state}' == 'Off' Create Dictionary data=${False}
102 ... ELSE Fail msg=Invalid LED state
103
104 ${resp}= OpenBMC Put Request
105 ... ${LED_GROUPS_URI}${led_name}/attr/Asserted data=${data}
106 ${jsondata}= to JSON ${resp.content}
107 Should Be Equal As Strings ${jsondata['status']} ok
108
109Verify LED Group
110 [Documentation] Set and validate state of all LEDs with given name.
111 [Arguments] ${led_prefix} ${led_suffix}=${EMPTY}
112 # Description of arguments:
113 # led_prefix LED name's prefix
114 # led_suffix LED name's suffix
115
116 ${led_list}= Get LED List ${led_prefix} ${led_suffix}
117
118 ${list_length}= Get Length ${led_list}
119 Should Be True ${list_length} > 0
120 ... msg=No ${led_prefix} ${led_suffix} LED found
121
122 :FOR ${led} IN @{led_list}
123 \ Set LED State On ${led}
124 \ ${resp}= Get LED State XYZ ${led}
125 \ Should Be Equal ${resp} ${1}
126 \ Set LED State Off ${led}
127 \ ${resp}= Get LED State XYZ ${led}
128 \ Should Be Equal ${resp} ${0}
129
130Setup The Suite
131 [Documentation] Test setup before running this suite.
132
133 ${resp}= Read Properties ${LED_GROUPS_URI}
134 Set Suite Variable ${LED_GROUPS} ${resp}
135
136Get LED List
137 [Documentation] Returns all LEDs with given name.
138 [Arguments] ${led_prefix} ${led_suffix}=${EMPTY}
139 # Description of arguments:
140 # led_prefix LED name's prefix
141 # led_suffix LED name's suffix
142
143 ${list}= Get Matches
144 ... ${LED_GROUPS} regexp=^.*[0-9a-z_].${led_prefix}.*${led_suffix}
145 ${led_list}= Create List
146
147 : FOR ${element} IN @{list}
148 \ ${element}= Remove String ${element} ${LED_GROUPS_URI}
149 \ Append To List ${led_list} ${element}
150 Sort List ${led_list}
151
152 [Return] ${led_list}