blob: 6aad3ce8ffe531fc4217edefbb88ad8b2610676a [file] [log] [blame]
Prashanth Katti1dcd5392017-05-12 04:35:53 -05001*** Settings ***
2Documentation Module for testing BMC via XCAT.
3
Sandhya Somashekar839a0c22019-01-31 05:05:43 -06004Resource ../lib/xcat/resource.robot
Prashanth Katti1dcd5392017-05-12 04:35:53 -05005Resource ../lib/xcat/xcat_utils.robot
6
7Library OperatingSystem
Prashanth Katti477debc2017-05-19 03:01:04 -05008Library String
Prashanth Katti1dcd5392017-05-12 04:35:53 -05009
10Suite Setup Validate XCAT Setup
Prashanth Katti56cbd172017-07-07 05:38:12 -050011Suite Teardown Close All Connections
Prashanth Katti1dcd5392017-05-12 04:35:53 -050012
Prashanth Katti477debc2017-05-19 03:01:04 -050013*** Variables ***
14
15${poweron_flag} ON
16${poweroff_flag} OFF
Prashanth Katti56cbd172017-07-07 05:38:12 -050017${NUM_POWER_STATUS_CHECKS} 1000
Prashanth Katti477debc2017-05-19 03:01:04 -050018
Prashanth Katti1dcd5392017-05-12 04:35:53 -050019*** Test Cases ***
20
21Add BMC Nodes To XCAT
22 [Documentation] Connect and add BMC nodes.
23 [Tags] Add_BMC_Nodes_To_XCAT
24
Prashanth Katti477debc2017-05-19 03:01:04 -050025 # Add BMC nodes one by one and check whether it is successfully added.
Sushil Singhab209cd2020-07-01 09:01:14 -050026 FOR ${bmc} IN @{BMC_LIST}
27 Add Nodes To XCAT ${bmc}
28 Validate Added Node ${bmc}
29 END
30
Prashanth Katti1dcd5392017-05-12 04:35:53 -050031
Prashanth Katti477debc2017-05-19 03:01:04 -050032Power On Via XCAT And Validate
33 [Documentation] Power on via XCAT and validate.
34 [Tags] Power_On_Via_XCAT_And_Validate
35
36 # Power on each BMC node and validate the power status.
Sushil Singhab209cd2020-07-01 09:01:14 -050037 FOR ${bmc} IN @{BMC_LIST}
38 Power On Via XCAT ${bmc}
39 Validate Power Status Via XCAT ${bmc} ${poweron_flag}
40 END
41
Prashanth Katti477debc2017-05-19 03:01:04 -050042
43Power Off Via XCAT And Validate
44 [Documentation] Power off via XCAT and validate.
45 [Tags] Power_Off_Via_XCAT_And_Validate
46
47 # Power off each BMC node and validate the power status.
Sushil Singhab209cd2020-07-01 09:01:14 -050048 FOR ${bmc} IN @{BMC_LIST}
49 Power Off Via XCAT ${bmc}
50 Validate Power Status Via XCAT ${bmc} ${poweroff_flag}
51 END
52
Prashanth Katti1dcd5392017-05-12 04:35:53 -050053
Prashanth Kattib974a742017-05-25 06:52:29 -050054Add Nodes To Group List
55 [Documentation] Add BMC nodes into group.
56 [Tags] Move_Added_Nodes_To_Group
57
58 # Add BMC nodes to group and validate.
Sushil Singhab209cd2020-07-01 09:01:14 -050059 FOR ${bmc} IN @{BMC_LIST}
60 Add Nodes To Group ${bmc} ${GROUP}
61 Validate Node Added In Group ${bmc} ${GROUP}
62 END
63
Prashanth Katti06c687d2017-06-01 04:15:59 -050064
65Power On Group And Validate
66 [Documentation] Power on all BMCs in group and validate.
67 [Tags] Power_On_Group_And_Validate
68
69 # Sample output of this keyword:
70 # XXX.XXX.XXX.XXX
71 # YYY.YYY.YYY.YYY
72 # ZZZ.ZZZ.ZZZ.ZZZ
73
74 ${nodes}= Get List Of Nodes In Group ${GROUP}
75 Should Not Be Empty ${nodes} msg=Group is empty.
76 Power On Via XCAT ${GROUP}
77
78 # List the BMC nodes.
79
80 @{bmc_nodes}= Split String ${nodes}
81
82 # Validate power status on each BMC node one by one.
Sushil Singhab209cd2020-07-01 09:01:14 -050083 FOR ${bmc_node} IN @{bmc_nodes}
84 Validate Power Status Via XCAT ${bmc_node} ${poweron_flag}
85 END
86
Prashanth Katti06c687d2017-06-01 04:15:59 -050087
88Power Off Group And Validate
89 [Documentation] Power off all BMCs in group and validate.
90 [Tags] Power_Off_Group_And_Validate
91
92 # Sample output of this keyword:
93 # XXX.XXX.XXX.XXX
94 # YYY.YYY.YYY.YYY
95 # ZZZ.ZZZ.ZZZ.ZZZ
96
97 ${nodes}= Get List Of Nodes In Group ${GROUP}
98 Should Not Be Empty ${nodes} msg=Group is empty.
99 Power Off Via XCAT ${GROUP}
100
101 # List the BMC nodes.
102 @{bmc_nodes}= Split String ${nodes}
103
104 # Validate power status on each BMC node one by one.
Sushil Singhab209cd2020-07-01 09:01:14 -0500105 FOR ${bmc_node} IN @{bmc_nodes}
106 Validate Power Status Via XCAT ${bmc_node} ${poweroff_flag}
107 END
108
Prashanth Kattib974a742017-05-25 06:52:29 -0500109
Prashanth Katti56cbd172017-07-07 05:38:12 -0500110Continuous Node Power Status
111 [Documentation] Continuously get the power status.
112 # This keyword verifies the REST connectivity between XCAT and the BMC node.
113 [Tags] Continuos_Node_Power_Status
114
115 # Performing this operation only on one BMC node.
116
117 Power On Via XCAT ${BMC_LIST[1]}
118
119 # Get the power status of the node repeatedly.
120 # By default it gets power status 1000 times.
121 # It bascially stress the BMC node and test REST implementation
122 # of the BMC node
123
Sushil Singhab209cd2020-07-01 09:01:14 -0500124 FOR ${index} IN RANGE 1 ${NUM_POWER_STATUS_CHECKS}
125 Validate Power Status Via XCAT ${BMC_LIST[1]} ${poweron_flag}
126 END
127
Prashanth Katti56cbd172017-07-07 05:38:12 -0500128
129Get Temperature Reading Via XCAT
130 [Documentation] Get temperature reading via XCAT.
131 [Tags] Get_Temperature_Reading_Via_XCAT
132
133 # Sample output of the keyword:
134 # node1: Ambient: 28.62 C
135 # node1: P0 Vcs Temp: 35 C
136 # node1: P0 Vdd Temp: 35 C
137 # node1: P0 Vddr Temp: 35 C
138 # node1: P0 Vdn Temp: 35 C
139 # node1: P1 Vcs Temp: 33 C
140 # node1: P1 Vdd Temp: 33 C
141 # node1: P1 Vddr Temp: 34 C
142 # node1: P1 Vdn Temp: 34 C
143
144 # Get temperature reading from each BMC node.
145
Sushil Singhab209cd2020-07-01 09:01:14 -0500146 FOR ${bmc} IN @{BMC_LIST}
147 ${temp_reading}= Get Hardware Vitals Via XCAT ${bmc} temp
148 Should Match ${temp_reading} ${bmc}* C
149 Log \n Temperature reading on $[bmc}\n ${temp_reading}
150 END
151
Prashanth Katti56cbd172017-07-07 05:38:12 -0500152
153Get Fanspeed Via XCAT
154 [Documentation] Get fanspeed via XCAT.
155 [Tags] Get_Fanspeed_Reading_Via_XCAT
156
157 # Sample output of the keyword:
158 # node1: Fan0 0: 10714 RPMS
159 # node1: Fan1 0: 10216 RPMS
160 # node1: Fan2 0: 14124 RPMS
161 # node1: Fan3 0: 11114 RPMS
162
163 # Get fanspeed from each BMC node.
164
Sushil Singhab209cd2020-07-01 09:01:14 -0500165 FOR ${bmc} IN @{BMC_LIST}
166 ${fanspeed}= Get Hardware Vitals Via XCAT ${bmc} fanspeed
167 Should Match ${fanspeed} ${bmc}* RPMS
168 Log \n fanspeed on $[bmc}\n ${fanspeed}
169 END
Prashanth Katti56cbd172017-07-07 05:38:12 -0500170
Prashanth Katti56cbd172017-07-07 05:38:12 -0500171
172Get Voltage Reading Via XCAT
173 [Documentation] Get voltage via XCAT.
174 [Tags] Get_Voltage_Via_XCAT
175
176 # Sample output of the keyword:
177 # node1: No attributes returned from the BMC.
178 # BMC node is not returning anything, this will fail at present.
179
180 # Get voltage reading from each BMC node.
181
Sushil Singhab209cd2020-07-01 09:01:14 -0500182 FOR ${bmc} IN @{BMC_LIST}
183 ${voltage}= Get Hardware Vitals Via XCAT ${bmc} voltage
184 Log \n Voltage reading on $[bmc}\n ${voltage}
185 END
186
Prashanth Katti56cbd172017-07-07 05:38:12 -0500187
188Get Wattage Via XCAT
189 [Documentation] Get wattage via XCAT.
190 [Tags] Get_Wattage_Via_XCAT
191
192 # Sample output of the keyword:
193 # node1: No attributes returned from the BMC.
194 # BMC node is not returning anything, this will fail at present.
195
196 # Get wattage reading from each BMC node.
197
Sushil Singhab209cd2020-07-01 09:01:14 -0500198 FOR ${bmc} IN @{BMC_LIST}
199 ${wattage}= Get Hardware Vitals Via XCAT ${bmc} wattage
200 Log \n Wattage reading on $[bmc}\n ${wattage}
201 END
Prashanth Katti56cbd172017-07-07 05:38:12 -0500202
Prashanth Katti1dcd5392017-05-12 04:35:53 -0500203*** Keywords ***
204
205Validate XCAT Setup
206 [Documentation] Validate XCAT setup.
207
208 Open Connection And Login To XCAT
209
210 # Check if XCAT is installed.
211 ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v
212 Should Not Be Empty ${cmd_output} msg=XCAT not installed.
213
214 Log \n XCAT Version is: \n${cmd_output}
Prashanth Katti477debc2017-05-19 03:01:04 -0500215
216 # Get all the BMC nodes from the config file.
217 ${nodes}= Get List Of BMC Nodes
218 # Make a list of BMC nodes.
219 @{BMC_LIST}= Split To Lines ${nodes}
220 Log To Console BMC nodes to be added:\n ${BMC_LIST}
221 Set Suite Variable @{BMC_LIST}
222
Prashanth Katti06c687d2017-06-01 04:15:59 -0500223 # GROUP should not be empty.
224 Should Not Be EMPTY ${GROUP} msg=Group does not exist.
225
Prashanth Katti477debc2017-05-19 03:01:04 -0500226Validate Power Status Via XCAT
227 [Documentation] Validate power status.
228 [Arguments] ${node} ${flag}=ON
229
230 ${status}= Get Power Status ${node}
231 Run Keyword If '${flag}' == 'ON'
232 ... Should Contain ${status} on msg=Host is off.
233 ... ELSE Should Contain ${status} off msg=Host is on.