blob: 5443d6a35a33ed64a9c3846637349d991bd019a6 [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
George Keishing88f1f012025-04-16 23:44:10 +053015${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 Katti477debc2017-05-19 03:01:04 -050031Power On Via XCAT And Validate
32 [Documentation] Power on via XCAT and validate.
33 [Tags] Power_On_Via_XCAT_And_Validate
34
35 # Power on each BMC node and validate the power status.
Sushil Singhab209cd2020-07-01 09:01:14 -050036 FOR ${bmc} IN @{BMC_LIST}
37 Power On Via XCAT ${bmc}
George Keishing88f1f012025-04-16 23:44:10 +053038 Validate Power Status Via XCAT ${bmc} ${POWERON_FLAG}
Sushil Singhab209cd2020-07-01 09:01:14 -050039 END
40
Prashanth Katti477debc2017-05-19 03:01:04 -050041Power Off Via XCAT And Validate
42 [Documentation] Power off via XCAT and validate.
43 [Tags] Power_Off_Via_XCAT_And_Validate
44
45 # Power off each BMC node and validate the power status.
Sushil Singhab209cd2020-07-01 09:01:14 -050046 FOR ${bmc} IN @{BMC_LIST}
47 Power Off Via XCAT ${bmc}
George Keishing88f1f012025-04-16 23:44:10 +053048 Validate Power Status Via XCAT ${bmc} ${POWEROFF_FLAG}
Sushil Singhab209cd2020-07-01 09:01:14 -050049 END
50
Prashanth Kattib974a742017-05-25 06:52:29 -050051Add Nodes To Group List
52 [Documentation] Add BMC nodes into group.
George Keishingb98036a2022-01-31 12:39:47 -060053 [Tags] Add_Nodes_To_Group_List
Prashanth Kattib974a742017-05-25 06:52:29 -050054
55 # Add BMC nodes to group and validate.
Sushil Singhab209cd2020-07-01 09:01:14 -050056 FOR ${bmc} IN @{BMC_LIST}
57 Add Nodes To Group ${bmc} ${GROUP}
58 Validate Node Added In Group ${bmc} ${GROUP}
59 END
60
Prashanth Katti06c687d2017-06-01 04:15:59 -050061Power On Group And Validate
62 [Documentation] Power on all BMCs in group and validate.
63 [Tags] Power_On_Group_And_Validate
64
65 # Sample output of this keyword:
66 # XXX.XXX.XXX.XXX
67 # YYY.YYY.YYY.YYY
68 # ZZZ.ZZZ.ZZZ.ZZZ
69
70 ${nodes}= Get List Of Nodes In Group ${GROUP}
71 Should Not Be Empty ${nodes} msg=Group is empty.
72 Power On Via XCAT ${GROUP}
73
74 # List the BMC nodes.
75
76 @{bmc_nodes}= Split String ${nodes}
77
78 # Validate power status on each BMC node one by one.
Sushil Singhab209cd2020-07-01 09:01:14 -050079 FOR ${bmc_node} IN @{bmc_nodes}
George Keishing88f1f012025-04-16 23:44:10 +053080 Validate Power Status Via XCAT ${bmc_node} ${POWERON_FLAG}
Sushil Singhab209cd2020-07-01 09:01:14 -050081 END
82
Prashanth Katti06c687d2017-06-01 04:15:59 -050083Power Off Group And Validate
84 [Documentation] Power off all BMCs in group and validate.
85 [Tags] Power_Off_Group_And_Validate
86
87 # Sample output of this keyword:
88 # XXX.XXX.XXX.XXX
89 # YYY.YYY.YYY.YYY
90 # ZZZ.ZZZ.ZZZ.ZZZ
91
92 ${nodes}= Get List Of Nodes In Group ${GROUP}
93 Should Not Be Empty ${nodes} msg=Group is empty.
94 Power Off Via XCAT ${GROUP}
95
96 # List the BMC nodes.
97 @{bmc_nodes}= Split String ${nodes}
98
99 # Validate power status on each BMC node one by one.
Sushil Singhab209cd2020-07-01 09:01:14 -0500100 FOR ${bmc_node} IN @{bmc_nodes}
George Keishing88f1f012025-04-16 23:44:10 +0530101 Validate Power Status Via XCAT ${bmc_node} ${POWEROFF_FLAG}
Sushil Singhab209cd2020-07-01 09:01:14 -0500102 END
103
Prashanth Katti56cbd172017-07-07 05:38:12 -0500104Continuous Node Power Status
105 [Documentation] Continuously get the power status.
106 # This keyword verifies the REST connectivity between XCAT and the BMC node.
George Keishingb98036a2022-01-31 12:39:47 -0600107 [Tags] Continuous_Node_Power_Status
Prashanth Katti56cbd172017-07-07 05:38:12 -0500108
109 # Performing this operation only on one BMC node.
110
111 Power On Via XCAT ${BMC_LIST[1]}
112
113 # Get the power status of the node repeatedly.
114 # By default it gets power status 1000 times.
George Keishing4d4ef992021-01-28 09:56:53 -0600115 # It basically stress the BMC node and test REST implementation
Prashanth Katti56cbd172017-07-07 05:38:12 -0500116 # of the BMC node
117
Sushil Singhab209cd2020-07-01 09:01:14 -0500118 FOR ${index} IN RANGE 1 ${NUM_POWER_STATUS_CHECKS}
George Keishing88f1f012025-04-16 23:44:10 +0530119 Validate Power Status Via XCAT ${BMC_LIST[1]} ${POWERON_FLAG}
Sushil Singhab209cd2020-07-01 09:01:14 -0500120 END
121
Prashanth Katti56cbd172017-07-07 05:38:12 -0500122Get Temperature Reading Via XCAT
123 [Documentation] Get temperature reading via XCAT.
124 [Tags] Get_Temperature_Reading_Via_XCAT
125
126 # Sample output of the keyword:
127 # node1: Ambient: 28.62 C
128 # node1: P0 Vcs Temp: 35 C
129 # node1: P0 Vdd Temp: 35 C
130 # node1: P0 Vddr Temp: 35 C
131 # node1: P0 Vdn Temp: 35 C
132 # node1: P1 Vcs Temp: 33 C
133 # node1: P1 Vdd Temp: 33 C
134 # node1: P1 Vddr Temp: 34 C
135 # node1: P1 Vdn Temp: 34 C
136
137 # Get temperature reading from each BMC node.
138
Sushil Singhab209cd2020-07-01 09:01:14 -0500139 FOR ${bmc} IN @{BMC_LIST}
140 ${temp_reading}= Get Hardware Vitals Via XCAT ${bmc} temp
141 Should Match ${temp_reading} ${bmc}* C
142 Log \n Temperature reading on $[bmc}\n ${temp_reading}
143 END
144
George Keishingb98036a2022-01-31 12:39:47 -0600145Get Fanspeed Reading Via XCAT
Prashanth Katti56cbd172017-07-07 05:38:12 -0500146 [Documentation] Get fanspeed via XCAT.
147 [Tags] Get_Fanspeed_Reading_Via_XCAT
148
149 # Sample output of the keyword:
150 # node1: Fan0 0: 10714 RPMS
151 # node1: Fan1 0: 10216 RPMS
152 # node1: Fan2 0: 14124 RPMS
153 # node1: Fan3 0: 11114 RPMS
154
155 # Get fanspeed from each BMC node.
156
Sushil Singhab209cd2020-07-01 09:01:14 -0500157 FOR ${bmc} IN @{BMC_LIST}
158 ${fanspeed}= Get Hardware Vitals Via XCAT ${bmc} fanspeed
159 Should Match ${fanspeed} ${bmc}* RPMS
160 Log \n fanspeed on $[bmc}\n ${fanspeed}
161 END
Prashanth Katti56cbd172017-07-07 05:38:12 -0500162
Prashanth Katti56cbd172017-07-07 05:38:12 -0500163Get Voltage Reading Via XCAT
164 [Documentation] Get voltage via XCAT.
George Keishingb98036a2022-01-31 12:39:47 -0600165 [Tags] Get_Voltage_Reading_Via_XCAT
Prashanth Katti56cbd172017-07-07 05:38:12 -0500166
167 # Sample output of the keyword:
168 # node1: No attributes returned from the BMC.
169 # BMC node is not returning anything, this will fail at present.
170
171 # Get voltage reading from each BMC node.
172
Sushil Singhab209cd2020-07-01 09:01:14 -0500173 FOR ${bmc} IN @{BMC_LIST}
174 ${voltage}= Get Hardware Vitals Via XCAT ${bmc} voltage
175 Log \n Voltage reading on $[bmc}\n ${voltage}
176 END
177
Prashanth Katti56cbd172017-07-07 05:38:12 -0500178Get Wattage Via XCAT
179 [Documentation] Get wattage via XCAT.
180 [Tags] Get_Wattage_Via_XCAT
181
182 # Sample output of the keyword:
183 # node1: No attributes returned from the BMC.
184 # BMC node is not returning anything, this will fail at present.
185
186 # Get wattage reading from each BMC node.
187
Sushil Singhab209cd2020-07-01 09:01:14 -0500188 FOR ${bmc} IN @{BMC_LIST}
189 ${wattage}= Get Hardware Vitals Via XCAT ${bmc} wattage
190 Log \n Wattage reading on $[bmc}\n ${wattage}
191 END
Prashanth Katti56cbd172017-07-07 05:38:12 -0500192
Prashanth Katti1dcd5392017-05-12 04:35:53 -0500193*** Keywords ***
194
195Validate XCAT Setup
196 [Documentation] Validate XCAT setup.
197
198 Open Connection And Login To XCAT
199
200 # Check if XCAT is installed.
201 ${cmd_output}= Execute Command ${XCAT_DIR_PATH}/lsxcatd -v
202 Should Not Be Empty ${cmd_output} msg=XCAT not installed.
203
204 Log \n XCAT Version is: \n${cmd_output}
Prashanth Katti477debc2017-05-19 03:01:04 -0500205
206 # Get all the BMC nodes from the config file.
207 ${nodes}= Get List Of BMC Nodes
208 # Make a list of BMC nodes.
209 @{BMC_LIST}= Split To Lines ${nodes}
210 Log To Console BMC nodes to be added:\n ${BMC_LIST}
211 Set Suite Variable @{BMC_LIST}
212
Prashanth Katti06c687d2017-06-01 04:15:59 -0500213 # GROUP should not be empty.
214 Should Not Be EMPTY ${GROUP} msg=Group does not exist.
215
Prashanth Katti477debc2017-05-19 03:01:04 -0500216Validate Power Status Via XCAT
217 [Documentation] Validate power status.
218 [Arguments] ${node} ${flag}=ON
219
220 ${status}= Get Power Status ${node}
George Keishing06616252025-04-28 19:20:41 +0530221 IF '${flag}' == 'ON'
222 Should Contain ${status} on msg=Host is off.
223 ELSE
224 Should Contain ${status} off msg=Host is on.
225 END