Convert functional tests to statefull QemuUtils
[csit.git] / resources / libraries / robot / shared / default.robot
1 # Copyright (c) 2019 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 | Variables | resources/libraries/python/topology.py
16 | Variables | resources/libraries/python/PapiHistory.py
17 | ...
18 | Library | Collections
19 | Library | OperatingSystem
20 | Library | String
21 | ...
22 | Library | resources.libraries.python.CoreDumpUtil
23 | Library | resources.libraries.python.CpuUtils
24 | Library | resources.libraries.python.DUTSetup
25 | Library | resources.libraries.python.L2Util
26 | Library | resources.libraries.python.SchedUtils
27 | Library | resources.libraries.python.Tap
28 | Library | resources.libraries.python.TGSetup
29 | Library | resources.libraries.python.PapiHistory
30 | Library | resources.libraries.python.VppCounters
31 | Library | resources.libraries.python.VPPUtil
32 | Library | resources.libraries.python.Trace
33 | Library | resources.libraries.python.topology.Topology
34 | ...
35 | Resource | resources/libraries/robot/shared/container.robot
36 | Resource | resources/libraries/robot/vm/qemu.robot
37
38 *** Keywords ***
39 | Configure all DUTs before test
40 | | [Documentation] | Setup all DUTs in topology before test execution.
41 | | ...
42 | | Setup All DUTs | ${nodes}
43
44 | Configure all TGs for traffic script
45 | | [Documentation] | Prepare all TGs before traffic scripts execution.
46 | | ...
47 | | All TGs Set Interface Default Driver | ${nodes}
48
49 | Show Vpp Errors On All DUTs
50 | | [Documentation] | Show VPP errors verbose on all DUTs.
51 | | ...
52 | | ${duts}= | Get Matches | ${nodes} | DUT*
53 | | :FOR | ${dut} | IN | @{duts}
54 | | | Vpp Show Errors | ${nodes['${dut}']}
55
56 | Show VPP trace dump on all DUTs
57 | | [Documentation] | Save API trace and dump output on all DUTs.
58 | | ...
59 | | ${duts}= | Get Matches | ${nodes} | DUT*
60 | | :FOR | ${dut} | IN | @{duts}
61 | | | Vpp api trace save | ${nodes['${dut}']}
62 | | | Vpp api trace dump | ${nodes['${dut}']}
63
64 | Show Bridge Domain Data On All DUTs
65 | | [Documentation] | Show Bridge Domain data on all DUTs.
66 | | ...
67 | | ${duts}= | Get Matches | ${nodes} | DUT*
68 | | :FOR | ${dut} | IN | @{duts}
69 | | | Vpp Get Bridge Domain Data | ${nodes['${dut}']}
70
71 | Setup Scheduler Policy for Vpp On All DUTs
72 | | [Documentation] | Set realtime scheduling policy (SCHED_RR) with priority 1
73 | | ... | on all VPP worker threads on all DUTs.
74 | | ...
75 | | ${duts}= | Get Matches | ${nodes} | DUT*
76 | | :FOR | ${dut} | IN | @{duts}
77 | | | Set VPP Scheduling rr | ${nodes['${dut}']}
78
79 | Configure crypto device on all DUTs
80 | | [Documentation] | Verify if Crypto QAT device virtual functions are
81 | | ... | initialized on all DUTs. If parameter force_init is set to True, then
82 | | ... | try to initialize/disable.
83 | | ...
84 | | ... | *Arguments:*
85 | | ... | - force_init - Force to initialize. Type: boolean
86 | | ... | - numvfs - Number of VFs to initialize, 0 - disable the VFs
87 | | ... | (Optional). Type: integer, default value: ${32}
88 | | ...
89 | | ... | *Example:*
90 | | ...
91 | | ... | \| Configure crypto device on all DUTs \| ${True} \|
92 | | ...
93 | | [Arguments] | ${force_init}=${False} | ${numvfs}=${32}
94 | | ...
95 | | ${duts}= | Get Matches | ${nodes} | DUT*
96 | | :FOR | ${dut} | IN | @{duts}
97 | | | Crypto Device Verify | ${nodes['${dut}']} | force_init=${force_init}
98 | | | ... | numvfs=${numvfs}
99
100 | Configure AVF interfaces on all DUTs
101 | | [Documentation] | Configure virtual functions for AVF interfaces on PCI
102 | | ... | interface on all DUTs.
103 | | ...
104 | | ... | *Arguments:*
105 | | ... | - numvfs - Number of VFs to initialize, 0 - disable the VFs
106 | | ... | (Optional). Type: integer, default value: ${1}
107 | | ... | - topology_type - Topology type.
108 | | ... | (Optional). Type: string, default value: L2
109 | | ...
110 | | ... | *Example:*
111 | | ...
112 | | ... | \| Configure AVF device on all DUTs \| ${1} \| L2 \|
113 | | ...
114 | | [Arguments] | ${numvfs}=${1} | ${topology_type}=L2
115 | | ...
116 | | ${duts}= | Get Matches | ${nodes} | DUT*
117 | | :FOR | ${dut} | IN | @{duts}
118 | | | ${if1_avf_arr}= | Init AVF interface | ${nodes['${dut}']} | ${${dut}_if1}
119 | | | ... | numvfs=${numvfs} | topology_type=${topology_type}
120 | | | ${if2_avf_arr}= | Init AVF interface | ${nodes['${dut}']} | ${${dut}_if2}
121 | | | ... | numvfs=${numvfs} | topology_type=${topology_type}
122 # Currently only one AVF is supported.
123 | | | Set Suite Variable | ${${dut}_if1_vf0} | ${if1_avf_arr[0]}
124 | | | Set Suite Variable | ${${dut}_if2_vf0} | ${if2_avf_arr[0]}
125
126 | Configure kernel module on all DUTs
127 | | [Documentation] | Verify if specific kernel module is loaded on all DUTs.
128 | | ... | If parameter force_load is set to True, then try to load.
129 | | ...
130 | | ... | *Arguments:*
131 | | ... | - module - Module to verify. Type: string
132 | | ... | - force_load - Try to load module. Type: boolean
133 | | ...
134 | | ... | *Example:*
135 | | ...
136 | | ... | \| Configure kernel module on all DUTs \| ${True} \|
137 | | ...
138 | | [Arguments] | ${module} | ${force_load}=${False}
139 | | ...
140 | | Verify Kernel Module on All DUTs | ${nodes} | ${module}
141 | | ... | force_load=${force_load}
142
143 | Create base startup configuration of VPP on all DUTs
144 | | [Documentation] | Create base startup configuration of VPP to all DUTs.
145 | | ...
146 | | ${duts}= | Get Matches | ${nodes} | DUT*
147 | | :FOR | ${dut} | IN | @{duts}
148 | | | Import Library | resources.libraries.python.VppConfigGenerator
149 | | | ... | WITH NAME | ${dut}
150 | | | Run keyword | ${dut}.Set Node |  ${nodes['${dut}']}
151 | | | Run keyword | ${dut}.Add Unix Log
152 | | | Run keyword | ${dut}.Add Unix CLI Listen
153 | | | Run keyword | ${dut}.Add Unix Nodaemon
154 | | | Run keyword | ${dut}.Add Unix Coredump
155 | | | Run keyword | ${dut}.Add DPDK No Tx Checksum Offload
156 | | | Run keyword | ${dut}.Add DPDK Log Level | debug
157 | | | Run keyword | ${dut}.Add DPDK Uio Driver
158 | | | Run keyword | ${dut}.Add Heapsize | 4G
159 | | | Run keyword | ${dut}.Add Statseg size | 4G
160 | | | Run keyword | ${dut}.Add Plugin | disable | default
161 | | | Run keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable}
162 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | 2000000
163 | | | Run keyword | ${dut}.Add IP6 Heap Size | 4G
164 | | | Run keyword | ${dut}.Add IP Heap Size | 4G
165
166 | Add worker threads and rxqueues to all DUTs
167 | | [Documentation] | Setup worker threads and rxqueues in vpp startup
168 | | ... | configuration on all DUTs. Based on the SMT configuration of DUT if
169 | | ... | enabled keyword will automatically map also the sibling logical cores.
170 | | ... | Keyword will automatically set the appropriate test TAGs in format
171 | | ... | mTnC, where m=logical_core_count and n=physical_core_count.
172 | | ...
173 | | ... | *Arguments:*
174 | | ... | - phy_cores - Number of physical cores to use. Type: integer
175 | | ... | - rx_queues - Number of RX queues. Type: integer
176 | | ...
177 | | ... | *Example:*
178 | | ...
179 | | ... | \| Add worker threads and rxqueues to all DUTs \| ${1} \| ${1} \|
180 | | ...
181 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None}
182 | | ...
183 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
184 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
185 | | ${num_mbufs_int} | Convert to Integer | 16384
186 | | ${duts}= | Get Matches | ${nodes} | DUT*
187 | | :FOR | ${dut} | IN | @{duts}
188 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
189 | | | ... | Variable Should Exist | ${${dut}_if1}
190 | | | @{if_list}= | Run Keyword If | '${if1_status}' == 'PASS'
191 | | | ... | Create List | ${${dut}_if1}
192 | | | ... | ELSE | Create List | ${${dut}_if1_1} | ${${dut}_if1_2}
193 | | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
194 | | | ... | Variable Should Exist | ${${dut}_if2}
195 | | | Run Keyword If | '${if2_status}' == 'PASS'
196 | | | ... | Append To List | ${if_list} | ${${dut}_if2}
197 | | | ... | ELSE
198 | | | ... | Append To List | ${if_list} | ${${dut}_if2_1} | ${${dut}_if2_2}
199 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']} | @{if_list}
200 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
201 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
202 | | | ... | skip_cnt=${1} | cpu_cnt=${1}
203 | | | ${cpu_wt}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
204 | | | ... | skip_cnt=${2} | cpu_cnt=${cpu_count_int} | smt_used=${smt_used}
205 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
206 | | | ... | Evaluate | int(${cpu_count_int}*2)
207 | | | ... | ELSE | Set variable | ${thr_count_int}
208 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
209 | | | ... | Set variable | ${rx_queues}
210 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
211 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
212 | | | ... | Set variable | ${1}
213 | | | ... | ELSE | Set variable | ${rxq_count_int}
214 | | | ${num_mbufs_int}= | Evaluate | int(${num_mbufs_int}*${rxq_count_int})
215 | | | Run keyword | ${dut}.Add CPU Main Core | ${cpu_main}
216 | | | Run keyword | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
217 | | | Run keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
218 # Temporarily desabling due to API changes:
219 # https://gerrit.fd.io/r/#/c/16638/
220 #| | | Run keyword | ${dut}.Add DPDK Num Mbufs | ${num_mbufs_int}
221 | | | Run keyword if | ${thr_count_int} > 1
222 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
223 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
224 | | Set Test Variable | ${smt_used}
225 | | Set Test Variable | ${thr_count_int}
226 | | Set Test Variable | ${cpu_count_int}
227 | | Set Test Variable | ${rxq_count_int}
228
229 | Create Kubernetes VSWITCH startup config on all DUTs
230 | | [Documentation] | Create base startup configuration of VSWITCH in Kubernetes
231 | | ... | deploy to all DUTs.
232 | | ...
233 | | ... | *Arguments:*
234 | | ... | - ${jumbo} - Jumbo packet. Type: boolean
235 | | ... | - ${phy_cores} - Physical cores. Type: integer
236 | | ... | - ${rxq} - RX queues. Type: integer
237 | | ...
238 | | ... | *Example:*
239 | | ...
240 | | ... | \| Create Kubernetes VSWITCH startup config on all DUTs \| ${True} \
241 | | ... | \| ${1} \| ${1}
242 | | ...
243 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${jumbo}=${False}
244 | | ...
245 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
246 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
247 | | ${num_mbufs_int} | Convert to Integer | 16384
248 | | ${duts}= | Get Matches | ${nodes} | DUT*
249 | | :FOR | ${dut} | IN | @{duts}
250 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']}
251 | | | ... | ${${dut}_if1} | ${${dut}_if2}
252 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
253 | | | ${if1_pci}= | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1}
254 | | | ${if2_pci}= | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2}
255 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
256 | | | ... | Evaluate | int(${cpu_count_int}*2)
257 | | | ... | ELSE | Set variable | ${thr_count_int}
258 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
259 | | | ... | Set variable | ${rx_queues}
260 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
261 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
262 | | | ... | Set variable | ${1}
263 | | | ... | ELSE | Set variable | ${rxq_count_int}
264 | | | ${num_mbufs_int}= | Evaluate | int(${num_mbufs_int}*${rxq_count_int})
265 | | | ${config}= | Run keyword | Create Kubernetes VSWITCH startup config
266 | | | ... | node=${nodes['${dut}']} | phy_cores=${phy_cores}
267 | | | ... | cpu_node=${numa} | jumbo=${jumbo} | rxq_count_int=${rxq_count_int}
268 | | | ... | num_mbufs_int=${num_mbufs_int}
269 | | | ... | filename=/tmp/vswitch.conf | if1=${if1_pci} | if2=${if2_pci}
270 | | | Run keyword if | ${thr_count_int} > 1
271 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
272 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
273 | | Set Test Variable | ${smt_used}
274 | | Set Test Variable | ${thr_count_int}
275 | | Set Test Variable | ${cpu_count_int}
276 | | Set Test Variable | ${rxq_count_int}
277
278 | Create Kubernetes VNF'${i}' startup config on all DUTs
279 | | [Documentation] | Create base startup configuration of VNF in Kubernetes
280 | | ... | deploy to all DUTs.
281 | | ...
282 | | ${i_int}= | Convert To Integer | ${i}
283 | | ${cpu_skip}= | Evaluate | ${vswitch_cpus}+${system_cpus}
284 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
285 | | ... | ${dut1_if1} | ${dut1_if2}
286 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
287 | | ... | ${dut2_if1} | ${dut2_if2}
288 | | ${config}= | Run keyword | Create Kubernetes VNF startup config
289 | | ... | node=${dut1} | phy_cores=${vnf_cpus} | cpu_node=${dut1_numa}
290 | | ... | cpu_skip=${cpu_skip} | filename=/tmp/vnf${i}.conf
291 | | ... | i=${i_int}
292 | | ${config}= | Run keyword | Create Kubernetes VNF startup config
293 | | ... | node=${dut2} | phy_cores=${vnf_cpus} | cpu_node=${dut2_numa}
294 | | ... | cpu_skip=${cpu_skip} | filename=/tmp/vnf${i}.conf
295 | | ... | i=${i_int}
296
297 | Add no multi seg to all DUTs
298 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
299 | | ...
300 | | ${duts}= | Get Matches | ${nodes} | DUT*
301 | | :FOR | ${dut} | IN | @{duts}
302 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
303
304 | Add DPDK no PCI to all DUTs
305 | | [Documentation] | Add DPDK no-pci to VPP startup configuration to all DUTs.
306 | | ...
307 | | ${duts}= | Get Matches | ${nodes} | DUT*
308 | | :FOR | ${dut} | IN | @{duts}
309 | | | Run keyword | ${dut}.Add DPDK no PCI
310
311 | Add DPDK dev default RXD to all DUTs
312 | | [Documentation] | Add DPDK num-rx-desc to VPP startup configuration to all
313 | | ... | DUTs.
314 | | ...
315 | | ... | *Arguments:*
316 | | ... | - rxd - Number of RX descriptors. Type: string
317 | | ...
318 | | ... | *Example:*
319 | | ...
320 | | ... | \| Add DPDK dev default RXD to all DUTs \| ${rxd} \|
321 | | ...
322 | | [Arguments] | ${rxd}
323 | | ...
324 | | ${duts}= | Get Matches | ${nodes} | DUT*
325 | | :FOR | ${dut} | IN | @{duts}
326 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
327
328 | Add DPDK dev default TXD to all DUTs
329 | | [Documentation] | Add DPDK num-tx-desc to VPP startup configuration to all
330 | | ... | DUTs.
331 | | ...
332 | | ... | *Arguments:*
333 | | ... | - txd - Number of TX descriptors. Type: string
334 | | ...
335 | | ... | *Example:*
336 | | ...
337 | | ... | \| Add DPDK dev default TXD to all DUTs \| ${txd} \|
338 | | ...
339 | | [Arguments] | ${txd}
340 | | ...
341 | | ${duts}= | Get Matches | ${nodes} | DUT*
342 | | :FOR | ${dut} | IN | @{duts}
343 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
344
345 | Add DPDK Uio Driver on all DUTs
346 | | [Documentation] | Add DPDK uio driver to VPP startup configuration on all
347 | | ... | DUTs.
348 | | ...
349 | | ... | *Arguments:*
350 | | ... | - uio_driver - Required uio driver. Type: string
351 | | ...
352 | | ... | *Example:*
353 | | ...
354 | | ... | \| Add DPDK Uio Driver on all DUTs \| igb_uio \|
355 | | ...
356 | | [Arguments] | ${uio_driver}
357 | | ...
358 | | ${duts}= | Get Matches | ${nodes} | DUT*
359 | | :FOR | ${dut} | IN | @{duts}
360 | | | Run keyword | ${dut}.Add DPDK Uio Driver | ${uio_driver}
361
362 | Add NAT to all DUTs
363 | | [Documentation] | Add NAT configuration to all DUTs.
364 | | ...
365 | | ${duts}= | Get Matches | ${nodes} | DUT*
366 | | :FOR | ${dut} | IN | @{duts}
367 | | | Run keyword | ${dut}.Add NAT
368
369 | Add cryptodev to all DUTs
370 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
371 | | ...
372 | | ... | *Arguments:*
373 | | ... | - count - Number of QAT devices. Type: integer
374 | | ...
375 | | ... | *Example:*
376 | | ...
377 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
378 | | ...
379 | | [Arguments] | ${count}
380 | | ${duts}= | Get Matches | ${nodes} | DUT*
381 | | :FOR | ${dut} | IN | @{duts}
382 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
383 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
384 | | | ... | Evaluate | int(${count}*2)
385 | | | ... | ELSE | Set variable | ${count}
386 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
387
388 | Add DPDK SW cryptodev on DUTs in 3-node single-link circular topology
389 | | [Documentation] | Add required number of SW crypto devices of given type
390 | | ... | to VPP startup configuration on all DUTs in 3-node single-link
391 | | ... | circular topology.
392 | | ...
393 | | ... | *Arguments:*
394 | | ... | - sw_pmd_type - PMD type of SW crypto device. Type: string
395 | | ... | - count - Number of SW crypto devices. Type: string
396 | | ...
397 | | ... | *Example:*
398 | | ...
399 | | ... | \| Add DPDK SW cryptodev on DUTs in 3-node single-link circular\
400 | | ... | topology \| aesni-mb \| ${2} \|
401 | | ...
402 | | [Arguments] | ${sw_pmd_type} | ${count}
403 | | ${smt_used}= | Is SMT enabled | ${nodes['DUT1']['cpuinfo']}
404 | | ${thr_count_int}= | Run keyword if | ${smt_used}
405 | | ... | Evaluate | int(${count}*2)
406 | | ... | ELSE | Set variable | ${count}
407 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT1']} | ${dut1_if2}
408 | | Run keyword | DUT1.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
409 | | ... | ${thr_count_int}
410 | | ${smt_used}= | Is SMT enabled | ${nodes['DUT2']['cpuinfo']}
411 | | ${thr_count_int}= | Run keyword if | ${smt_used}
412 | | ... | Evaluate | int(${count}*2)
413 | | ... | ELSE | Set variable | ${count}
414 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT2']} | ${dut2_if1}
415 | | Run keyword | DUT2.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
416 | | ... | ${thr_count_int}
417
418 | Apply startup configuration on all VPP DUTs
419 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
420 | | ...
421 | | ... | *Arguments:*
422 | | ... | - restart_vpp - Whether to restart VPP (Optional). Type: boolean
423 | | ...
424 | | ... | *Example:*
425 | | ...
426 | | ... | \| Apply startup configuration on all VPP DUTs \| ${False} \|
427 | | ...
428 | | [Arguments] | ${restart_vpp}=${True}
429 | | ...
430 | | ${duts}= | Get Matches | ${nodes} | DUT*
431 | | :FOR | ${dut} | IN | @{duts}
432 | | | Run keyword | ${dut}.Apply Config | restart_vpp=${restart_vpp}
433 | | Enable Coredump Limit VPP on All DUTs | ${nodes}
434 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg=${True}
435
436 | Save VPP PIDs
437 | | [Documentation] | Get PIDs of VPP processes from all DUTs in topology and\
438 | | ... | set it as a test variable. The PIDs are stored as dictionary items\
439 | | ... | where the key is the host and the value is the PID.
440 | | ...
441 | | ${setup_vpp_pids}= | Get VPP PIDs | ${nodes}
442 | | ${keys}= | Get Dictionary Keys | ${setup_vpp_pids}
443 | | :FOR | ${key} | IN | @{keys}
444 | | | ${pid}= | Get From Dictionary | ${setup_vpp_pids} | ${key}
445 | | | Run Keyword If | $pid is None | FAIL | No VPP PID found on node ${key}
446 | | | Run Keyword If | ',' in '${pid}'
447 | | | ... | FAIL | More then one VPP PID found on node ${key}: ${pid}
448 | | Set Test Variable | ${setup_vpp_pids}
449
450 | Verify VPP PID in Teardown
451 | | [Documentation] | Check if the VPP PIDs on all DUTs are the same at the end\
452 | | ... | of test as they were at the begining. If they are not, only a message\
453 | | ... | is printed on console and to log. The test will not fail.
454 | | ...
455 | | ${teardown_vpp_pids}= | Get VPP PIDs | ${nodes}
456 | | ${err_msg}= | Catenate | ${SUITE NAME} - ${TEST NAME}
457 | | ... | \nThe VPP PIDs are not equal!\nTest Setup VPP PIDs:
458 | | ... | ${setup_vpp_pids}\nTest Teardown VPP PIDs: ${teardown_vpp_pids}
459 | | ${rc} | ${msg}= | Run keyword and ignore error
460 | | ... | Dictionaries Should Be Equal
461 | | ... | ${setup_vpp_pids} | ${teardown_vpp_pids}
462 | | Run Keyword And Return If | '${rc}'=='FAIL' | Log | ${err_msg}
463 | | ... | console=yes | level=WARN
464
465 | Set up functional test
466 | | [Documentation] | Common test setup for functional tests.
467 | | ...
468 | | Configure all DUTs before test
469 | | Save VPP PIDs
470 | | Configure all TGs for traffic script
471 | | Update All Interface Data On All Nodes | ${nodes}
472 | | Reset PAPI History On All DUTs | ${nodes}
473
474 | Tear down functional test
475 | | [Documentation] | Common test teardown for functional tests.
476 | | ...
477 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
478 | | Show Packet Trace on All DUTs | ${nodes}
479 | | Show PAPI History On All DUTs | ${nodes}
480 | | Vpp Show Errors On All DUTs | ${nodes}
481 | | Verify VPP PID in Teardown
482
483 | Set up VPP device test
484 # TODO: Generalize this KW if it will not diverge from Functional derivate too
485 # much
486 | | [Documentation] | Common test setup for vpp-device tests.
487 | | ...
488 | | Configure all DUTs before test
489 | | Save VPP PIDs
490 | | Configure all TGs for traffic script
491 | | Update All Interface Data On All Nodes | ${nodes} | skip_tg_udev=${True}
492 | | Reset PAPI History On All DUTs | ${nodes}
493
494 | Tear down VPP device test
495 # TODO: Generalize this KW if it will not diverge from Functional derivate too
496 # much
497 | | [Documentation] | Common test teardown for vpp-device tests.
498 | | ...
499 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
500 | | Show Packet Trace on All DUTs | ${nodes}
501 | | Show PAPI History On All DUTs | ${nodes}
502 | | Vpp Show Errors On All DUTs | ${nodes}
503 | | Verify VPP PID in Teardown
504
505 | Tear down LISP functional test
506 | | [Documentation] | Common test teardown for functional tests with LISP.
507 | | ...
508 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
509 | | Show Packet Trace on All DUTs | ${nodes}
510 | | Show PAPI History On All DUTs | ${nodes}
511 | | Show Vpp Settings | ${nodes['DUT1']}
512 | | Show Vpp Settings | ${nodes['DUT2']}
513 | | Vpp Show Errors On All DUTs | ${nodes}
514 | | Verify VPP PID in Teardown
515
516 | Tear down LISP functional test with QEMU
517 | | [Documentation] | Common test teardown for functional tests with LISP and\
518 | | ... | QEMU.
519 | | ...
520 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
521 | | Show Packet Trace on All DUTs | ${nodes}
522 | | Show PAPI History On All DUTs | ${nodes}
523 | | Show Vpp Settings | ${nodes['DUT1']}
524 | | Show Vpp Settings | ${nodes['DUT2']}
525 | | Vpp Show Errors On All DUTs | ${nodes}
526 | | Tear down QEMU
527 | | Verify VPP PID in Teardown
528
529 | Set up TAP functional test
530 | | [Documentation] | Common test setup for functional tests with TAP.
531 | | ...
532 | | Set up functional test
533 | | Clean Up Namespaces | ${nodes['DUT1']}
534
535 | Set up functional test with containers
536 | | [Documentation]
537 | | ... | Common test setup for functional tests with containers.
538 | | ...
539 | | ... | *Arguments:*
540 | | ... | - chains: Total number of chains (Optional). Type: integer, default
541 | | ... | value: ${1}
542 | | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer,
543 | | ... | default value: ${1}
544 | | ...
545 | | ... | _NOTE:_ This KW sets following test case variables:
546 | | ... | - dcr_uuid - Parent container UUID.
547 | | ... | - dcr_root - Parent container overlay.
548 | | ...
549 | | ... | *Example:*
550 | | ...
551 | | ... | \| Set up functional test with containers \| 1 \| 1 \|
552 | | ...
553 | | [Arguments] | ${chains}=${1} | ${nodeness}=${1}
554 | | ...
555 | | Set Test Variable | @{container_groups} | @{EMPTY}
556 | | Set Test Variable | ${container_group} | CNF
557 | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
558 | | ... | engine=${container_engine} | WITH NAME | ${container_group}
559 | | ...
560 | | ${dcr_uuid}= | Get Environment Variable | CSIT_DUT1_UUID
561 | | ${dcr_root}= | Run Keyword | Get Docker Mergeddir | ${nodes['DUT1']}
562 | | ... | ${dcr_uuid}
563 | | Set Test Variable | ${dcr_uuid}
564 | | Set Test Variable | ${dcr_root}
565 | | ...
566 | | Construct chains of containers on all DUTs | ${chains} | ${nodeness}
567 | | ... | nested=${True}
568 | | Acquire all '${container_group}' containers
569 | | Create all '${container_group}' containers
570 | | Configure VPP in all '${container_group}' containers
571 | | Start VPP in all '${container_group}' containers
572 | | Append To List | ${container_groups} | ${container_group}
573
574 | Tear down TAP functional test
575 | | [Documentation] | Common test teardown for functional tests with TAP.
576 | | ...
577 | | Tear down functional test
578 | | Clean Up Namespaces | ${nodes['DUT1']}
579
580 | Tear down TAP functional test with Linux bridge
581 | | [Documentation] | Common test teardown for functional tests with TAP and
582 | | ... | a Linux bridge.
583 | | ...
584 | | ... | *Arguments:*
585 | | ... | - bid_TAP - Bridge name. Type: string
586 | | ...
587 | | ... | *Example:*
588 | | ...
589 | | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
590 | | ...
591 | | [Arguments] | ${bid_TAP}
592 | | ...
593 | | Tear down functional test
594 | | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
595 | | Clean Up Namespaces | ${nodes['DUT1']}
596
597 | Tear down FDS functional test
598 | | [Documentation] | Common test teardown for FDS functional tests.
599 | | ...
600 | | ... | *Arguments:*
601 | | ... | - dut1_node - Node Nr.1 where to clean qemu. Type: dictionary
602 | | ... | - dut2_node - Node Nr.2 where to clean qemu. Type: dictionary
603 | | ...
604 | | ... | *Example:*
605 | | ...
606 | | ... | \| Tear down FDS functional test \| ${dut1_node} \| ${dut2_node} \|
607 | | ...
608 | | [Arguments] | ${dut1_node} | ${dut2_node}
609 | | ...
610 | | Tear down functional test
611 | | Tear down QEMU | qemu_node1
612 | | Tear down QEMU | qemu_node2
613
614 | Tear down functional test with container
615 | | [Documentation]
616 | | ... | Common test teardown for functional tests which uses containers.
617 | | ...
618 | | :FOR | ${container_group} | IN | @{container_groups}
619 | | | Destroy all '${container_group}' containers
620
621 | Stop VPP Service on DUT
622 | | [Documentation] | Stop the VPP service on the specified node.
623 | | ...
624 | | ... | *Arguments:*
625 | | ... | - node - information about a DUT node. Type: dictionary
626 | | ...
627 | | ... | *Example:*
628 | | ...
629 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
630 | | ...
631 | | [Arguments] | ${node}
632 | | Stop VPP Service | ${node}
633
634 | Start VPP Service on DUT
635 | | [Documentation] | Start the VPP service on the specified node.
636 | | ...
637 | | ... | *Arguments:*
638 | | ... | - node - information about a DUT node. Type: dictionary
639 | | ...
640 | | ... | *Example:*
641 | | ...
642 | | ... | \| Start VPP Service on DUT \| ${nodes['DUT1']} \|
643 | | ...
644 | | [Arguments] | ${node}
645 | | Start VPP Service | ${node}