blob: 705780ac7d87f31f48dcf9a867adcbf28c285d48 [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
23 Verify LED Group cpu Fault
24
25Verify Fan Fault LEDs Group
26 [Documentation] Verify fan's fault LEDs.
27 [Tags] Verify_Fan_Fault_LEDs_Group
28
29 Verify LED Group Fan Fault
30
31Verify DIMM Fault LEDs Group
32 [Documentation] Verify DIMM's fault LEDs.
33 [Tags] Verify_DIMM_Fault_LEDs_Group
34
35 Verify LED Group dimm Fault
36
37Verify GPU Fault LEDs Group
38 [Documentation] Verify GPU's fault LEDs.
39 [Tags] Verify_GPU_Fault_LEDs_Group
40
41 Verify LED Group gpu Fault
42
43Verify Power Supply Fault LEDs Group
44 [Documentation] Verify power supply's fault LEDs.
45 [Tags] Verify_Power_Supply_Fault_LEDs_Group
46
47 Verify LED Group powersupply Fault
48
49Verify Enclosure Fault LED Group
50 [Documentation] Validate enclosure's fault LED.
51 [Tags] Verify_Enclosure_Fault_LED_Group
52
53 Verify LED Group Enclosure Fault
54
55Verify Power State LEDs Group
56 [Documentation] Verify power state LEDs.
57 [Tags] Verify_Power_State_LEDs_Group
58
59 Verify LED Group Power
60
61Verify Enclosure Identify LED Group
62 [Documentation] Validate enclosure's identify LED.
63 [Tags] Verify_Enclosure_Identify_LED_Group
64
65 Verify LED Group Enclosure Identify
66
67Verify Fan Identify LEDs Group
68 [Documentation] Verify fan's identify LEDs.
69 [Tags] Verify_Fan_Identify_LEDs_Group
70
71 Verify LED Group Fan Identify
72
73Verify Other Fault LEDs Group
74 [Documentation] Verify other fault LEDs.
75 [Tags] Verify_Other_Fault_LEDs_Group
76
77 Verify LED Group systemFault
78 Verify LED Group boxelderFault
79 Verify LED Group bmcFault
80 Verify LED Group motherboardFault
81
82*** Keywords ***
83
84Get LED State XYZ
85 [Documentation] Returns state of given LED.
86 [Arguments] ${led_name}
87 # Description of arguments:
88 # led_name Name of LED
89
90 ${state}= Read Attribute ${LED_GROUPS_URI}${led_name} Asserted
91 [Return] ${state}
92
93Set LED State
94 [Documentation] Set state of given LED to on or off.
95 [Arguments] ${state} ${led_name}
96 # Description of arguments:
97 # state LED's state to set, i.e. On or Off
98 # led_name Name of LED
99
100 ${data}= Run Keyword If
101 ... '${state}' == 'On' Create Dictionary data=${True}
102 ... ELSE IF '${state}' == 'Off' Create Dictionary data=${False}
103 ... ELSE Fail msg=Invalid LED state
104
105 ${resp}= OpenBMC Put Request
106 ... ${LED_GROUPS_URI}${led_name}/attr/Asserted data=${data}
107 ${jsondata}= to JSON ${resp.content}
108 Should Be Equal As Strings ${jsondata['status']} ok
109
110Verify LED Group
111 [Documentation] Set and validate state of all LEDs with given name.
112 [Arguments] ${led_prefix} ${led_suffix}=${EMPTY}
113 # Description of arguments:
114 # led_prefix LED name's prefix
115 # led_suffix LED name's suffix
116
117 ${led_list}= Get LED List ${led_prefix} ${led_suffix}
118
119 ${list_length}= Get Length ${led_list}
120 Should Be True ${list_length} > 0
121 ... msg=No ${led_prefix} ${led_suffix} LED found
122
123 :FOR ${led} IN @{led_list}
124 \ Set LED State On ${led}
125 \ ${resp}= Get LED State XYZ ${led}
126 \ Should Be Equal ${resp} ${1}
127 \ Set LED State Off ${led}
128 \ ${resp}= Get LED State XYZ ${led}
129 \ Should Be Equal ${resp} ${0}
130
131Setup The Suite
132 [Documentation] Test setup before running this suite.
133
134 ${resp}= Read Properties ${LED_GROUPS_URI}
135 Set Suite Variable ${LED_GROUPS} ${resp}
136
137Get LED List
138 [Documentation] Returns all LEDs with given name.
139 [Arguments] ${led_prefix} ${led_suffix}=${EMPTY}
140 # Description of arguments:
141 # led_prefix LED name's prefix
142 # led_suffix LED name's suffix
143
144 ${list}= Get Matches
145 ... ${LED_GROUPS} regexp=^.*[0-9a-z_].${led_prefix}.*${led_suffix}
146 ${led_list}= Create List
147
148 : FOR ${element} IN @{list}
149 \ ${element}= Remove String ${element} ${LED_GROUPS_URI}
150 \ Append To List ${led_list} ${element}
151 Sort List ${led_list}
152
153 [Return] ${led_list}