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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
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
22 | Configure Honeycomb service on DUTs
23 | | [Documentation] | *Setup environment for honeycomb testing.*
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
33 | | ... | _Arguments:_
34 | | ... | - duts - list of nodes to setup Honeycomb on
36 | | ... | _Used global constants and variables:_
37 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
38 | | ... | - HTTPCodes - HTTP protocol status codes
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.
46 | Stop Honeycomb service on DUTs
47 | | [Documentation] | *Cleanup environment after honeycomb testing.*
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)
56 | | ... | _Arguments:_
57 | | ... | - duts - list of nodes to stop Honeycomb on
59 | | ... | _Used global constants and variables:_
60 | | ... | - RESOURCES_TPL_HC - path to honeycomb templates directory
61 | | ... | - HTTPCodes - HTTP protocol status codes
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}
69 | Clear persisted Honeycomb configuration
70 | | [Documentation] | *Delete saved configuration.*
72 | | ... | *Arguments:*
73 | | ... | - duts - one or more nodes to clear persistence on. Type: dictionary
77 | | ... | \| Clear persisted Honeycomb configuration \| ${nodes['DUT1']} \|
79 | | [Arguments] | @{duts}
80 | | Clear persisted Honeycomb config | @{duts}
82 | Restart Honeycomb and VPP and clear persisted configuration
83 | | [Documentation] | Restarts Honeycomb and VPP with default configuration.
85 | | ... | *Arguments:*
86 | | ... | - node - information about a DUT node. Type: dictionary
90 | | ... | \| Restart Honeycomb and VPP and clear persisted configuration \
91 | | ... | \| ${nodes['DUT1']} \|
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}
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.
104 | | ... | *Arguments:*
105 | | ... | - node - information about a DUT node. Type: dictionary
109 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
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}
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.
121 | | ... | *Arguments:*
122 | | ... | - node - information about a DUT node. Type: dictionary
126 | | ... | \| Restart Honeycomb and VPP \| ${nodes['DUT1']} \|
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
136 | Archive Honeycomb log file
137 | | [Documentation] | Copy honeycomb.log file from Honeycomb node\
138 | | ... | to test executor.
140 | | ... | *Arguments:*
141 | | ... | - node - information about a DUT node. Type: dictionary
142 | | ... | - perf - Running on performance testbed? Yes/no Type: boolean
146 | | ... | \| Archive Honeycomb log file \| ${nudes['DUT1']} \|
148 | | [Arguments] | ${node} | ${perf}=${False}
149 | | Archive Honeycomb log | ${node} | ${perf}
151 | Configure ODL Client Service On DUT
152 | | [Documentation] | Configure and start ODL client, then repeatedly check if
153 | | ... | it is running.
155 | | ... | *Arguments:*
156 | | ... | - node - information about a DUT node. Type: dictionary
157 | | ... | - odl_name - Name of ODL client version. Type: string
161 | | ... | \| Configure ODL Client Service on DUT \| ${nodes['DUT1']} \
162 | | ... | \| carbon-SR1 \|
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
175 | Configure Honeycomb for functional testing
176 | | [Documentation] | Configure Honeycomb with parameters for functional
177 | | ... | testing, then start Honeycomb and repeatedly check startup status.
179 | | ... | *Arguments:*
180 | | ... | - node - information about a DUT node. Type: dictionary
184 | | ... | \| Configure Honeycomb for functional testing \| ${nodes['DUT1']} \|
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 | | Generate Honeycomb startup configuration for ODL test | ${node}
192 | | Clear Persisted Honeycomb Configuration | ${node}
193 | | Configure Honeycomb service on DUTs | ${node}
195 | Configure ODL Client for functional testing
196 | | [Documentation] | Read external variable HC_ODL. Depending on its
197 | | ... | value either: do nothing, or setup ODL client for testing and
198 | | ... | create a global variable that modifies Restconf requests to use ODL.
200 | | ... | *Arguments:*
201 | | ... | - node - information about a DUT node. Type: dictionary
205 | | ... | \| Configure ODL Client for functional testing \| ${nodes['DUT1']} \|
207 | | [Arguments] | ${node}
208 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
209 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
210 | | ... | Run Keywords
211 | | ... | Set Global Variable | ${use_odl_client} | AND
212 | | ... | Configure ODL Client Service On DUT | ${node} | ${use_odl_client}
213 | | ... | ELSE | Log | Variable HC_ODL is not present. Not using ODL.
216 | Set Up Honeycomb Functional Test Suite
217 | | [Documentation] | Generic test suite setup for Honeycomb functional tests.
218 | | ... | Restarts VPP, then enables Honeycomb and optionally ODL, based
219 | | ... | on external variable.
221 | | ... | *Arguments:*
222 | | ... | - node - information about a DUT node. Type: dictionary
226 | | ... | \| Set Up Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
228 | | [Arguments] | ${node}
229 | | Setup DUT | ${node}
230 | | Configure all TGs for traffic script
231 | | Configure Honeycomb for functional testing | ${node}
232 | | Configure ODL Client for functional testing | ${node}
234 | Tear Down Honeycomb Functional Test Suite
235 | | [Documentation] | Generic test suite teardown for Honeycomb functional
236 | | ... | tests. Stops ODL client (if used), then stops Honeycomb and verifies
237 | | ... | that they are both stopped.
239 | | ... | *Arguments:*
240 | | ... | - node - information about a DUT node. Type: dictionary
244 | | ... | \| Tear Down Honeycomb Functional Test Suite \| ${nodes['DUT1']} \|
246 | | [Arguments] | ${node}
247 | | Append suite to Honeycomb log file | ${node}
248 | | ${use_odl_client}= | Get Variable Value | ${HC_ODL}
249 | | Run Keyword If | '${use_odl_client}' != '${NONE}'
250 | | ... | Run Keywords
251 | | ... | Stop ODL Client | ${node} | /tmp | AND
252 | | ... | Wait until keyword succeeds | 3min | 15sec
253 | | ... | Check ODL shutdown state | ${node} | AND
254 | | ... | Set Global Variable | ${use_odl_client} | ${NONE}
255 | | Stop Honeycomb service on DUTs | ${node}
256 | | Clear Honeycomb Log | ${node}
257 | | Stop VPP Service on DUT | ${node}
259 | Enable Honeycomb Feature
260 | | [Documentation] | Enable the specified feature in Honeycomb configuration.
261 | | ... | Requires a restart of Honeycomb to take effect.
263 | | ... | *Arguments:*
264 | | ... | - node - information about a DUT node. Type: dictionary
268 | | ... | \| Enable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
270 | | [arguments] | ${node} | ${feature}
271 | | Manage Honeycomb Features | ${node} | ${feature}
273 | Disable Honeycomb Feature
274 | | [Documentation] | Disable the specified feature in Honeycomb configuration.
275 | | ... | Requires a restart of Honeycomb to take effect.
277 | | ... | *Arguments:*
278 | | ... | - node - information about a DUT node. Type: dictionary
282 | | ... | \| Disable Honeycomb Feature \| ${nodes['DUT1']} \| NSH \|
284 | | [arguments] | ${node} | ${feature}
285 | | Manage Honeycomb Features | ${node} | ${feature} | disable=${True}
287 | Honeycomb Performance Suite Setup Generic
288 | | [Documentation] | Generic test suite setup for Honeycomb performance tests.
289 | | ... | Performs multiple attempts to start Honeycomb+VPP stack.
291 | | ... | *Arguments:*
292 | | ... | - node - information about a DUT node. Type: dictionary
296 | | ... | \| Honeycomb Performance Suite Setup Generic \| ${nodes['DUT1']} \|
298 | | [Arguments] | ${node}
299 | | Wait until keyword succeeds | 8min | 2min
300 | | ... | Restart Honeycomb and VPP in Performance test | ${node}
302 | Honeycomb Performance Suite Teardown Generic
303 | | [Documentation] | Generic test suite teardown for Honeycomb performance
304 | | ... | tests. Logs CPU usage before stopping Honeycomb.
306 | | ... | *Arguments:*
307 | | ... | - node - information about a DUT node. Type: dictionary
311 | | ... | \| Honeycomb Performance Suite Teardown Generic \| ${nodes['DUT1']} \|
313 | | [Arguments] | ${node}
314 | | Log Honeycomb and VPP process distribution on cores | ${node}
315 | | Append suite to Honeycomb log file | ${node}
316 | | Stop Honeycomb service on DUTs | ${node}
317 | | Clear Honeycomb Log | ${node}
318 | | Stop VPP Service on DUT | ${node}
320 | Append suite to Honeycomb log file
321 | | [Documentation] | Add the contents of honeycomb.log for the current suite\
322 | | ... | to the full log which will be archived.
324 | | ... | *Arguments:*
325 | | ... | - node - information about a DUT node. Type: dictionary
329 | | ... | \| Append suite to Honeycomb log file \| ${nodes['DUT1']} \|
331 | | [Arguments] | ${node}
332 | | Append Honeycomb log | ${node} | ${SUITE_NAME}
334 | Generate Honeycomb startup configuration for ODL test
335 | | [Documentation] | Create HC startup configuration and apply to config
336 | | ... | file on DUT. Requires Honeycomb restart to take effect.
338 | | ... | *Arguments:*
339 | | ... | - node - Honeycomb node. Type: dictionary
343 | | ... | \| Generate Honeycomb startup configuration for ODL test \
344 | | ... | \| ${nodes[DUT1]} \|
346 | | [Arguments] | ${node}
347 | | Import Library | resources.libraries.python.honeycomb.HoneycombSetup.HoneycombStartupConfig
348 | | ... | WITH NAME | HC_config
349 | | Run Keyword | HC_config.Set SSH Security provider
350 | | Run Keyword | HC_config.Set Memory Size | ${32}
351 | | Run Keyword | HC_config.Set Metaspace Size | ${32}
352 | | Run Keyword | HC_config.Apply config | ${node}