HC Test: Fix intermittent failures of HC startup
[csit.git] / resources / libraries / robot / honeycomb / honeycomb.robot
1 # Copyright (c) 2017 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.honeycomb.HoneycombSetup
16 | Library | resources.libraries.python.honeycomb.HoneycombUtil
17 | Library | resources.libraries.python.honeycomb.HcPersistence
18 | Library | resources.libraries.python.DUTSetup
19 | Library | resources.libraries.python.InterfaceUtil
20
21 *** Keywords ***
22 | Configure Honeycomb service on DUTs
23 | | [Documentation] | *Setup environment for honeycomb testing.*
24 | | ...
25 | | ... | _Setup steps:_
26 | | ... | - 1. Login to each honeycomb node using ssh
27 | | ... | - 2. Startup honeycomb service
28 | | ... | - 3. Monitor service startup using HTTP GET request loop
29 | | ... | Expected sequence of HTTP replies:
30 | | ... | connection refused -> 404 -> 401 -> 503 or 500 -> 200 (pass)
31 | | ... | - 4. Configure honeycomb nodes using HTTP PUT request
32 | | ...
33 | | ... | _Arguments:_
34 | | ... | - duts - list of nodes to setup Honeycomb on
35 | | ...
36 | | ... | _Used global constants and variables:_
37 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
38 | | ... | - HTTPCodes - HTTP protocol status codes
39 | | ...
40 | | [Arguments] | @{duts}
41 | | Start honeycomb on DUTs | @{duts}
42 | | :FOR | ${dut} | IN | @{duts}
43 | | | Check honeycomb startup state | @{duts}
44 | | | Sleep | 5s | Make sure all modules are loaded and ready.
45
46 | Stop Honeycomb service on DUTs
47 | | [Documentation] | *Cleanup environment after honeycomb testing.*
48 | | ...
49 | | ... | _Teardown steps:_
50 | | ... | - 1. Login to each honeycomb node using ssh
51 | | ... | - 2. Stop honeycomb service
52 | | ... | - 3. Monitor service shutdown using HTTP GET request loop
53 | | ... | Expected sequence of HTTP replies:
54 | | ... | 200 -> 404 -> connection refused (pass)
55 | | ...
56 | | ... | _Arguments:_
57 | | ... | - duts - list of nodes to stop Honeycomb on
58 | | ...
59 | | ... | _Used global constants and variables:_
60 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
61 | | ... | - HTTPCodes - HTTP protocol status codes
62 | | ...
63 | | [Arguments] | @{duts}
64 | | Stop honeycomb on DUTs | @{duts}
65 | | :FOR | ${dut} | IN | @{duts}
66 | | | Wait until keyword succeeds | 60sec | 15sec
67 | | | ... | Check honeycomb shutdown state | @{duts}
68
69 | Clear persisted Honeycomb configuration
70 | | [Documentation] | *Delete saved configuration.*
71 | | ...
72 | | ... | *Arguments:*
73 | | ... | - duts - one or more nodes to clear persistence on. Type: dictionary
74 | | ...
75 | | ... | *Example:*
76 | | ...
77 | | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \|
78 | | ...
79 | | [Arguments] | @{duts}
80 | | Clear persisted Honeycomb config | @{duts}
81
82 | Restart Honeycomb and VPP and clear persisted configuration
83 | | [Documentation] | Restarts Honeycomb and VPP with default configuration.
84 | | ...
85 | | ... | *Arguments:*
86 | | ... | - node - information about a DUT node. Type: dictionary
87 | | ...
88 | | ... | *Example:*
89 | | ...
90 | | ... | \| Restart Honeycomb and VPP and clear persisted configuration \
91 | | ... | \| ${nodes['DUT1']} \|
92 | | ...
93 | | [Arguments] | ${node}
94 | | Stop Honeycomb service on DUTs | ${node}
95 | | Clear persisted Honeycomb configuration | ${node}
96 | | Setup DUT | ${node}
97 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
98 | | Configure Honeycomb service on DUTs | ${node}
99
100 | Restart Honeycomb and VPP
101 | | [Documentation] | Stops the Honeycomb service and verifies it is stopped.
102 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
103 | | ...
104 | | ... | *Arguments:*
105 | | ... | - node - information about a DUT node. Type: dictionary
106 | | ...
107 | | ... | *Example:*
108 | | ...
109 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
110 | | ...
111 | | [Arguments] | ${node}
112 | | Stop Honeycomb service on DUTs | ${node}
113 | | Setup DUT | ${node}
114 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
115 | | Configure Honeycomb service on DUTs | ${node}
116
117 | Restart Honeycomb and VPP in performance test
118 | | [Documentation] | Stops Honeycomb and VPP and verifies HC is stopped.
119 | | ... | Then restarts VPP, starts Honeycomb again and verifies it is running.
120 | | ...
121 | | ... | *Arguments:*
122 | | ... | - node - information about a DUT node. Type: dictionary
123 | | ...
124 | | ... | *Example:*
125 | | ...
126 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
127 | | ...
128 | | [Arguments] | ${node}
129 | | Stop Honeycomb service on DUTs | ${node}
130 | | Stop VPP service on DUT | ${node}
131 | | Setup DUT | ${node}
132 | | Sleep | 10s | Wait 10sec so VPP is up for sure.
133 | | Configure Honeycomb service on DUTs | ${node}
134 | | Check honeycomb startup state | ${node} | timeout=120
135
136 | Archive Honeycomb log file
137 | | [Documentation] | Copy honeycomb.log file from Honeycomb node\
138 | | ... | to test executor.
139 | | ...
140 | | ... | *Arguments:*
141 | | ... | - node - information about a DUT node. Type: dictionary
142 | | ... | - perf - Running on performance testbed? Yes/no Type: boolean
143 | | ...
144 | | ... | *Example:*
145 | | ...
146 | | ... | \| Archive Honeycomb log file \| ${nudes['DUT1']} \|
147 | | ...
148 | | [Arguments] | ${node} | ${perf}=${False}
149 | | Archive Honeycomb log | ${node} | ${perf}
150
151 | Configure ODL Client Service On DUT
152 | | [Documentation] | Configure and start ODL client, then repeatedly check if
153 | | ... | it is running.
154 | | ...
155 | | ... | *Arguments:*
156 | | ... | - node - information about a DUT node. Type: dictionary
157 | | ... | - odl_name - Name of ODL client version. Type: string
158 | | ...
159 | | ... | *Example:*
160 | | ...
161 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
162 | | ... | \| carbon-SR1 \|
163 | | ...
164 | | [Arguments] | ${node} | ${odl_name}
165 | | Copy ODL Client | ${node} | ${odl_name} | /mnt/common | /tmp
166 | | Setup ODL Client | ${node} | /tmp
167 | | Wait until keyword succeeds | 2min | 30sec
168 | | ... | Install ODL Features | ${node} | /tmp
169 | | Wait until keyword succeeds | 4min | 15sec
170 | | ... | Mount Honeycomb on ODL | ${node}
171 | | Wait until keyword succeeds | 2min | 15sec
172 | | ... | Check ODL startup state | ${node}
173 | | Check honeycomb startup state | ${node} | timeout=120
174
175 | Configure Honeycomb for functional testing
176 | | [Documentation] | Configure Honeycomb with parameters for functional
177 | | ... | testing, then start Honeycomb and repeatedly check startup status.
178 | | ...
179 | | ... | *Arguments:*
180 | | ... | - node - information about a DUT node. Type: dictionary
181 | | ...
182 | | ... | *Example:*
183 | | ...
184 | | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \|
185 | | ...
186 | | [Arguments] | ${node}
187 | | Configure Restconf binding address | ${node}
188 | | Configure Log Level | ${node} | TRACE
189 | | Configure Persistence | ${node} | disable
190 | | Configure jVPP timeout | ${node} | ${10}
191 | | Clear Persisted Honeycomb Configuration | ${node}
192 | | Configure Honeycomb service on DUTs | ${node}
193
194 | Configure ODL Client for functional testing
195 | | [Documentation] | Read external variable HC_ODL. Depending on its
196 | | ... | value either: do nothing, or setup ODL client for testing and
197 | | ... | create a global variable that modifies Restconf requests to use ODL.
198 | | ...
199 | | ... | *Arguments:*
200 | | ... | - node - information about a DUT node. Type: dictionary
201 | | ...
202 | | ... | *Example:*
203 | | ...
204 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
205 | | ...
206 | | [Arguments] | ${node}
207 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
208 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
209 | | ... | Run Keywords
210 | | ... | Set Global Variable | ${use_odl_client} | AND
211 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
212 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
213 | | ... | level=INFO
214
215 | Set Up Honeycomb Functional Test Suite
216 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
217 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
218 | | ... | on external variable.
219 | | ...
220 | | ... | *Arguments:*
221 | | ... | - node - information about a DUT node. Type: dictionary
222 | | ...
223 | | ... | *Example:*
224 | | ...
225 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
226 | | ...
227 | | [Arguments] | ${node}
228 | | Setup DUT | ${node}
229 | | Configure all TGs for traffic script
230 | | Configure Honeycomb for functional testing | ${node}
231 | | Configure ODL Client for functional testing | ${node}
232
233 | Tear Down Honeycomb Functional Test Suite
234 | | [Documentation] | Generic test suite teardown for Honeycomb functional
235 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
236 | | ... | that they are both stopped.
237 | | ...
238 | | ... | *Arguments:*
239 | | ... | - node - information about a DUT node. Type: dictionary
240 | | ...
241 | | ... | *Example:*
242 | | ...
243 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
244 | | ...
245 | | [Arguments] | ${node}
246 | | Append suite to Honeycomb log file | ${node}
247 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
248 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
249 | | ... | Run Keywords
250 | | ... | Stop ODL Client | ${node} | /tmp | AND
251 | | ... | Wait until keyword succeeds | 3min | 15sec
252 | | ... | Check ODL shutdown state | ${node} | AND
253 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
254 | | Stop Honeycomb service on DUTs | ${node}
255 | | Clear Honeycomb Log | ${node}
256 | | Stop VPP Service on DUT | ${node}
257
258 | Enable Honeycomb Feature
259 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
260 | | ... | Requires a restart of Honeycomb to take effect.
261 | | ...
262 | | ... | *Arguments:*
263 | | ... | - node - information about a DUT node. Type: dictionary
264 | | ...
265 | | ... | *Example:*
266 | | ...
267 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
268 | | ...
269 | | [arguments] | ${node} | ${feature}
270 | | Manage Honeycomb Features | ${node} | ${feature}
271
272 | Disable Honeycomb Feature
273 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
274 | | ... | Requires a restart of Honeycomb to take effect.
275 | | ...
276 | | ... | *Arguments:*
277 | | ... | - node - information about a DUT node. Type: dictionary
278 | | ...
279 | | ... | *Example:*
280 | | ...
281 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
282 | | ...
283 | | [arguments] | ${node} | ${feature}
284 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}
285
286 | Stop VPP Service on DUT
287 | | [Documentation] | Stop the VPP service on the specified node.
288 | | ...
289 | | ... | *Arguments:*
290 | | ... | - node - information about a DUT node. Type: dictionary
291 | | ...
292 | | ... | *Example:*
293 | | ...
294 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
295 | | ...
296 | | [Arguments] | ${node}
297 | | Stop VPP Service | ${node}
298
299 | Honeycomb Performance Suite Setup Generic
300 | | [Documentation] | Generic test suite setup for Honeycomb performance tests.
301 | | ... | Performs multiple attempts to start Honeycomb+VPP stack.
302 | | ...
303 | | ... | *Arguments:*
304 | | ... | - node - information about a DUT node. Type: dictionary
305 | | ...
306 | | ... | *Example:*
307 | | ...
308 | | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \|
309 | | ...
310 | | [Arguments] | ${node}
311 | | Wait until keyword succeeds | 8min | 2min
312 | | ... | Restart Honeycomb and VPP in Performance test | ${node}
313
314 | Honeycomb Performance Suite Teardown Generic
315 | | [Documentation] | Generic test suite teardown for Honeycomb performance
316 | | ... | tests. Logs CPU usage before stopping Honeycomb.
317 | | ...
318 | | ... | *Arguments:*
319 | | ... | - node - information about a DUT node. Type: dictionary
320 | | ...
321 | | ... | *Example:*
322 | | ...
323 | | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \|
324 | | ...
325 | | [Arguments] | ${node}
326 | | Log Honeycomb and VPP process distribution on cores | ${node}
327 | | Append suite to Honeycomb log file | ${node}
328 | | Stop Honeycomb service on DUTs | ${node}
329 | | Clear Honeycomb Log | ${node}
330 | | Stop VPP Service on DUT | ${node}
331
332 | Append suite to Honeycomb log file
333 | | [Documentation] | Add the contents of honeycomb.log for the current suite\
334 | | ... | to the full log which will be archived.
335 | | ...
336 | | ... | *Arguments:*
337 | | ... | - node - information about a DUT node. Type: dictionary
338 | | ...
339 | | ... | *Example:*
340 | | ...
341 | | ... | \| Append suite to Honeycomb log file \| ${nodes['DUT1']} \|
342 | | ...
343 | | [Arguments] | ${node}
344 | | Append Honeycomb log | ${node} | ${SUITE_NAME}
345
346 | Generate Honeycomb startup configuration for ODL test
347 | | [Documentation] | Create HC startup configuration and apply to config
348 | | ... | file on DUT. Requires Honeycomb restart to take effect.
349 | | ...
350 | | ... | *Arguments:*
351 | | ... | - node - Honeycomb node. Type: dictionary
352 | | ...
353 | | ... | *Example:*
354 | | ...
355 | | ... | \| Generate Honeycomb startup configuration for ODL test \
356 | | ... | \| ${nodes[DUT1]} \|
357 | | ...
358 | | [Arguments] | ${node}
359 | | Import Library | resources.libraries.python.honeycomb.HoneycombSetup.HoneycombStartupConfig
360 | | ... | WITH NAME | HC_config
361 | | Run Keyword | HC_config.Set SSH Security provider
362 | | Run Keyword | HC_config.Set Memory Size | ${32}
363 | | Run Keyword | HC_config.Set Metaspace Size | ${32}
364 | | Run Keyword | HC_config.Apply config | ${node}