WORKAROUND: Remove static mbufs
[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/VatHistory.py
17 | ...
18 | Library | Collections
19 | Library | OperatingSystem
20 | Library | String
21 | ...
22 | Library | resources.libraries.python.CpuUtils
23 | Library | resources.libraries.python.DUTSetup
24 | Library | resources.libraries.python.L2Util
25 | Library | resources.libraries.python.SchedUtils
26 | Library | resources.libraries.python.Tap
27 | Library | resources.libraries.python.TGSetup
28 | Library | resources.libraries.python.VatHistory
29 | Library | resources.libraries.python.VppCounters
30 | Library | resources.libraries.python.VPPUtil
31 | Library | resources.libraries.python.Trace
32 | Library | resources.libraries.python.topology.Topology
33 | ...
34 | Resource | resources/libraries/robot/shared/container.robot
35 | Resource | resources/libraries/robot/vm/double_qemu_setup.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 Socketmem | 1024,1024
156 | | | Run keyword | ${dut}.Add DPDK No Tx Checksum Offload
157 | | | Run keyword | ${dut}.Add DPDK Log Level | debug
158 | | | Run keyword | ${dut}.Add DPDK Uio Driver
159 | | | Run keyword | ${dut}.Add Heapsize | 4G
160 | | | Run keyword | ${dut}.Add Statseg size | 4G
161 | | | Run keyword | ${dut}.Add Plugin | disable | default
162 | | | Run keyword | ${dut}.Add Plugin | enable | @{plugins_to_enable}
163 | | | Run keyword | ${dut}.Add IP6 Hash Buckets | 2000000
164 | | | Run keyword | ${dut}.Add IP6 Heap Size | 4G
165 | | | Run keyword | ${dut}.Add IP Heap Size | 4G
166
167 | Add worker threads and rxqueues to all DUTs
168 | | [Documentation] | Setup worker threads and rxqueues in vpp startup
169 | | ... | configuration on all DUTs. Based on the SMT configuration of DUT if
170 | | ... | enabled keyword will automatically map also the sibling logical cores.
171 | | ... | Keyword will automatically set the appropriate test TAGs in format
172 | | ... | mTnC, where m=logical_core_count and n=physical_core_count.
173 | | ...
174 | | ... | *Arguments:*
175 | | ... | - phy_cores - Number of physical cores to use. Type: integer
176 | | ... | - rx_queues - Number of RX queues. Type: integer
177 | | ...
178 | | ... | *Example:*
179 | | ...
180 | | ... | \| Add worker threads and rxqueues to all DUTs \| ${1} \| ${1} \|
181 | | ...
182 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None}
183 | | ...
184 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
185 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
186 | | ${num_mbufs_int} | Convert to Integer | 16384
187 | | ${duts}= | Get Matches | ${nodes} | DUT*
188 | | :FOR | ${dut} | IN | @{duts}
189 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
190 | | | ... | Variable Should Exist | ${${dut}_if1}
191 | | | @{if_list}= | Run Keyword If | '${if1_status}' == 'PASS'
192 | | | ... | Create List | ${${dut}_if1}
193 | | | ... | ELSE | Create List | ${${dut}_if1_1} | ${${dut}_if1_2}
194 | | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
195 | | | ... | Variable Should Exist | ${${dut}_if2}
196 | | | Run Keyword If | '${if2_status}' == 'PASS'
197 | | | ... | Append To List | ${if_list} | ${${dut}_if2}
198 | | | ... | ELSE
199 | | | ... | Append To List | ${if_list} | ${${dut}_if2_1} | ${${dut}_if2_2}
200 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']} | @{if_list}
201 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
202 | | | ${cpu_main}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
203 | | | ... | skip_cnt=${1} | cpu_cnt=${1}
204 | | | ${cpu_wt}= | Cpu list per node str | ${nodes['${dut}']} | ${numa}
205 | | | ... | skip_cnt=${2} | cpu_cnt=${cpu_count_int} | smt_used=${smt_used}
206 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
207 | | | ... | Evaluate | int(${cpu_count_int}*2)
208 | | | ... | ELSE | Set variable | ${thr_count_int}
209 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
210 | | | ... | Set variable | ${rx_queues}
211 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
212 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
213 | | | ... | Set variable | ${1}
214 | | | ... | ELSE | Set variable | ${rxq_count_int}
215 | | | ${num_mbufs_int}= | Evaluate | int(${num_mbufs_int}*${rxq_count_int})
216 | | | Run keyword | ${dut}.Add CPU Main Core | ${cpu_main}
217 | | | Run keyword | ${dut}.Add CPU Corelist Workers | ${cpu_wt}
218 | | | Run keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
219 # Temporarily desabling due to API changes:
220 # https://gerrit.fd.io/r/#/c/16638/
221 #| | | Run keyword | ${dut}.Add DPDK Num Mbufs | ${num_mbufs_int}
222 | | | Run keyword if | ${thr_count_int} > 1
223 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
224 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
225 | | Set Test Variable | ${smt_used}
226 | | Set Test Variable | ${thr_count_int}
227 | | Set Test Variable | ${cpu_count_int}
228 | | Set Test Variable | ${rxq_count_int}
229
230 | Create Kubernetes VSWITCH startup config on all DUTs
231 | | [Documentation] | Create base startup configuration of VSWITCH in Kubernetes
232 | | ... | deploy to all DUTs.
233 | | ...
234 | | ... | *Arguments:*
235 | | ... | - ${jumbo} - Jumbo packet. Type: boolean
236 | | ... | - ${phy_cores} - Physical cores. Type: integer
237 | | ... | - ${rxq} - RX queues. Type: integer
238 | | ...
239 | | ... | *Example:*
240 | | ...
241 | | ... | \| Create Kubernetes VSWITCH startup config on all DUTs \| ${True} \
242 | | ... | \| ${1} \| ${1}
243 | | ...
244 | | [Arguments] | ${phy_cores} | ${rx_queues}=${None} | ${jumbo}=${False}
245 | | ...
246 | | ${cpu_count_int} | Convert to Integer | ${phy_cores}
247 | | ${thr_count_int} | Convert to Integer | ${phy_cores}
248 | | ${num_mbufs_int} | Convert to Integer | 16384
249 | | ${duts}= | Get Matches | ${nodes} | DUT*
250 | | :FOR | ${dut} | IN | @{duts}
251 | | | ${numa}= | Get interfaces numa node | ${nodes['${dut}']}
252 | | | ... | ${${dut}_if1} | ${${dut}_if2}
253 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
254 | | | ${if1_pci}= | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if1}
255 | | | ${if2_pci}= | Get Interface PCI Addr | ${nodes['${dut}']} | ${${dut}_if2}
256 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
257 | | | ... | Evaluate | int(${cpu_count_int}*2)
258 | | | ... | ELSE | Set variable | ${thr_count_int}
259 | | | ${rxq_count_int}= | Run keyword if | ${rx_queues}
260 | | | ... | Set variable | ${rx_queues}
261 | | | ... | ELSE | Evaluate | int(${thr_count_int}/2)
262 | | | ${rxq_count_int}= | Run keyword if | ${rxq_count_int} == 0
263 | | | ... | Set variable | ${1}
264 | | | ... | ELSE | Set variable | ${rxq_count_int}
265 | | | ${num_mbufs_int}= | Evaluate | int(${num_mbufs_int}*${rxq_count_int})
266 | | | ${config}= | Run keyword | Create Kubernetes VSWITCH startup config
267 | | | ... | node=${nodes['${dut}']} | phy_cores=${phy_cores}
268 | | | ... | cpu_node=${numa} | jumbo=${jumbo} | rxq_count_int=${rxq_count_int}
269 | | | ... | num_mbufs_int=${num_mbufs_int}
270 | | | ... | filename=/tmp/vswitch.conf | if1=${if1_pci} | if2=${if2_pci}
271 | | | Run keyword if | ${thr_count_int} > 1
272 | | | ... | Set Tags | MTHREAD | ELSE | Set Tags | STHREAD
273 | | | Set Tags | ${thr_count_int}T${cpu_count_int}C
274 | | Set Test Variable | ${smt_used}
275 | | Set Test Variable | ${thr_count_int}
276 | | Set Test Variable | ${cpu_count_int}
277 | | Set Test Variable | ${rxq_count_int}
278
279 | Create Kubernetes VNF'${i}' startup config on all DUTs
280 | | [Documentation] | Create base startup configuration of VNF in Kubernetes
281 | | ... | deploy to all DUTs.
282 | | ...
283 | | ${i_int}= | Convert To Integer | ${i}
284 | | ${cpu_skip}= | Evaluate | ${vswitch_cpus}+${system_cpus}
285 | | ${dut1_numa}= | Get interfaces numa node | ${dut1}
286 | | ... | ${dut1_if1} | ${dut1_if2}
287 | | ${dut2_numa}= | Get interfaces numa node | ${dut2}
288 | | ... | ${dut2_if1} | ${dut2_if2}
289 | | ${config}= | Run keyword | Create Kubernetes VNF startup config
290 | | ... | node=${dut1} | phy_cores=${vnf_cpus} | cpu_node=${dut1_numa}
291 | | ... | cpu_skip=${cpu_skip} | filename=/tmp/vnf${i}.conf
292 | | ... | i=${i_int}
293 | | ${config}= | Run keyword | Create Kubernetes VNF startup config
294 | | ... | node=${dut2} | phy_cores=${vnf_cpus} | cpu_node=${dut2_numa}
295 | | ... | cpu_skip=${cpu_skip} | filename=/tmp/vnf${i}.conf
296 | | ... | i=${i_int}
297
298 | Add no multi seg to all DUTs
299 | | [Documentation] | Add No Multi Seg to VPP startup configuration to all DUTs.
300 | | ...
301 | | ${duts}= | Get Matches | ${nodes} | DUT*
302 | | :FOR | ${dut} | IN | @{duts}
303 | | | Run keyword | ${dut}.Add DPDK No Multi Seg
304
305 | Add DPDK no PCI to all DUTs
306 | | [Documentation] | Add DPDK no-pci to VPP startup configuration to all DUTs.
307 | | ...
308 | | ${duts}= | Get Matches | ${nodes} | DUT*
309 | | :FOR | ${dut} | IN | @{duts}
310 | | | Run keyword | ${dut}.Add DPDK no PCI
311
312 | Add DPDK dev default RXD to all DUTs
313 | | [Documentation] | Add DPDK num-rx-desc to VPP startup configuration to all
314 | | ... | DUTs.
315 | | ...
316 | | ... | *Arguments:*
317 | | ... | - rxd - Number of RX descriptors. Type: string
318 | | ...
319 | | ... | *Example:*
320 | | ...
321 | | ... | \| Add DPDK dev default RXD to all DUTs \| ${rxd} \|
322 | | ...
323 | | [Arguments] | ${rxd}
324 | | ...
325 | | ${duts}= | Get Matches | ${nodes} | DUT*
326 | | :FOR | ${dut} | IN | @{duts}
327 | | | Run keyword | ${dut}.Add DPDK Dev Default RXD | ${rxd}
328
329 | Add DPDK dev default TXD to all DUTs
330 | | [Documentation] | Add DPDK num-tx-desc to VPP startup configuration to all
331 | | ... | DUTs.
332 | | ...
333 | | ... | *Arguments:*
334 | | ... | - txd - Number of TX descriptors. Type: string
335 | | ...
336 | | ... | *Example:*
337 | | ...
338 | | ... | \| Add DPDK dev default TXD to all DUTs \| ${txd} \|
339 | | ...
340 | | [Arguments] | ${txd}
341 | | ...
342 | | ${duts}= | Get Matches | ${nodes} | DUT*
343 | | :FOR | ${dut} | IN | @{duts}
344 | | | Run keyword | ${dut}.Add DPDK Dev Default TXD | ${txd}
345
346 | Add DPDK Uio Driver on all DUTs
347 | | [Documentation] | Add DPDK uio driver to VPP startup configuration on all
348 | | ... | DUTs.
349 | | ...
350 | | ... | *Arguments:*
351 | | ... | - uio_driver - Required uio driver. Type: string
352 | | ...
353 | | ... | *Example:*
354 | | ...
355 | | ... | \| Add DPDK Uio Driver on all DUTs \| igb_uio \|
356 | | ...
357 | | [Arguments] | ${uio_driver}
358 | | ...
359 | | ${duts}= | Get Matches | ${nodes} | DUT*
360 | | :FOR | ${dut} | IN | @{duts}
361 | | | Run keyword | ${dut}.Add DPDK Uio Driver | ${uio_driver}
362
363 | Add NAT to all DUTs
364 | | [Documentation] | Add NAT configuration to all DUTs.
365 | | ...
366 | | ${duts}= | Get Matches | ${nodes} | DUT*
367 | | :FOR | ${dut} | IN | @{duts}
368 | | | Run keyword | ${dut}.Add NAT
369
370 | Add cryptodev to all DUTs
371 | | [Documentation] | Add Cryptodev to VPP startup configuration to all DUTs.
372 | | ...
373 | | ... | *Arguments:*
374 | | ... | - count - Number of QAT devices. Type: integer
375 | | ...
376 | | ... | *Example:*
377 | | ...
378 | | ... | \| Add cryptodev to all DUTs \| ${4} \|
379 | | ...
380 | | [Arguments] | ${count}
381 | | ${duts}= | Get Matches | ${nodes} | DUT*
382 | | :FOR | ${dut} | IN | @{duts}
383 | | | ${smt_used}= | Is SMT enabled | ${nodes['${dut}']['cpuinfo']}
384 | | | ${thr_count_int}= | Run keyword if | ${smt_used}
385 | | | ... | Evaluate | int(${count}*2)
386 | | | ... | ELSE | Set variable | ${count}
387 | | | Run keyword | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
388
389 | Add DPDK SW cryptodev on DUTs in 3-node single-link circular topology
390 | | [Documentation] | Add required number of SW crypto devices of given type
391 | | ... | to VPP startup configuration on all DUTs in 3-node single-link
392 | | ... | circular topology.
393 | | ...
394 | | ... | *Arguments:*
395 | | ... | - sw_pmd_type - PMD type of SW crypto device. Type: string
396 | | ... | - count - Number of SW crypto devices. Type: string
397 | | ...
398 | | ... | *Example:*
399 | | ...
400 | | ... | \| Add DPDK SW cryptodev on DUTs in 3-node single-link circular\
401 | | ... | topology \| aesni-mb \| ${2} \|
402 | | ...
403 | | [Arguments] | ${sw_pmd_type} | ${count}
404 | | ${smt_used}= | Is SMT enabled | ${nodes['DUT1']['cpuinfo']}
405 | | ${thr_count_int}= | Run keyword if | ${smt_used}
406 | | ... | Evaluate | int(${count}*2)
407 | | ... | ELSE | Set variable | ${count}
408 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT1']} | ${dut1_if2}
409 | | Run keyword | DUT1.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
410 | | ... | ${thr_count_int}
411 | | ${smt_used}= | Is SMT enabled | ${nodes['DUT2']['cpuinfo']}
412 | | ${thr_count_int}= | Run keyword if | ${smt_used}
413 | | ... | Evaluate | int(${count}*2)
414 | | ... | ELSE | Set variable | ${count}
415 | | ${socket_id}= | Get Interface Numa Node | ${nodes['DUT2']} | ${dut2_if1}
416 | | Run keyword | DUT2.Add DPDK SW Cryptodev | ${sw_pmd_type} | ${socket_id}
417 | | ... | ${thr_count_int}
418
419 | Apply startup configuration on all VPP DUTs
420 | | [Documentation] | Write startup configuration and restart VPP on all DUTs.
421 | | ...
422 | | ... | *Arguments:*
423 | | ... | - restart_vpp - Whether to restart VPP (Optional). Type: boolean
424 | | ...
425 | | ... | *Example:*
426 | | ...
427 | | ... | \| Apply startup configuration on all VPP DUTs \| ${False} \|
428 | | ...
429 | | [Arguments] | ${restart_vpp}=${True}
430 | | ...
431 | | ${duts}= | Get Matches | ${nodes} | DUT*
432 | | :FOR | ${dut} | IN | @{duts}
433 | | | Run keyword | ${dut}.Apply Config | restart_vpp=${restart_vpp}
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 VAT 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 VAT 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 VAT 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 VAT 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 VAT 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 | | ... | *Arguments:*
521 | | ... | - vm_node - VM to stop. Type: string
522 | | ...
523 | | ... | *Example:*
524 | | ...
525 | | ... | \| Tear down LISP functional test with QEMU \| ${vm_node} \|
526 | | ...
527 | | [Arguments] | ${vm_node}
528 | | ...
529 | | Remove All Added Ports On All DUTs From Topology | ${nodes}
530 | | Show Packet Trace on All DUTs | ${nodes}
531 | | Show VAT History On All DUTs | ${nodes}
532 | | Show Vpp Settings | ${nodes['DUT1']}
533 | | Show Vpp Settings | ${nodes['DUT2']}
534 | | Vpp Show Errors On All DUTs | ${nodes}
535 | | Stop and clear QEMU | ${nodes['DUT1']} | ${vm_node}
536 | | Verify VPP PID in Teardown
537
538 | Set up TAP functional test
539 | | [Documentation] | Common test setup for functional tests with TAP.
540 | | ...
541 | | Set up functional test
542 | | Clean Up Namespaces | ${nodes['DUT1']}
543
544 | Set up functional test with containers
545 | | [Documentation]
546 | | ... | Common test setup for functional tests with containers.
547 | | ...
548 | | ... | *Arguments:*
549 | | ... | - chains: Total number of chains (Optional). Type: integer, default
550 | | ... | value: ${1}
551 | | ... | - nodeness: Total number of nodes per chain (Optional). Type: integer,
552 | | ... | default value: ${1}
553 | | ...
554 | | ... | _NOTE:_ This KW sets following test case variables:
555 | | ... | - tmp_volume - Docker volume mounted as /tmp directory on DUT1.
556 | | ... | - dcr_uuid - UUID string (including prefix - underscore character) of
557 | | ... | DUT1 /tmp volume.
558 | | ...
559 | | ... | *Example:*
560 | | ...
561 | | ... | \| Set up functional test with containers \| 1 \| 1 \|
562 | | ...
563 | | [Arguments] | ${chains}=${1} | ${nodeness}=${1}
564 | | ...
565 | | Set Test Variable | @{container_groups} | @{EMPTY}
566 | | Set Test Variable | ${container_group} | CNF
567 | | Import Library | resources.libraries.python.ContainerUtils.ContainerManager
568 | | ... | engine=${container_engine} | WITH NAME | ${container_group}
569 | | ...
570 | | ${tmp_volume}= | Get Environment Variable | CSIT_DUT1_VOL
571 | | ${dcr_uuid}= | Remove String | ${tmp_volume} | DUT1_VOL
572 | | Set Test Variable | ${tmp_volume}
573 | | Set Test Variable | ${dcr_uuid}
574 | | ...
575 | | Construct chains of containers on all DUTs | ${chains} | ${nodeness}
576 | | ... | set_nf_cpus=${False}
577 | | Acquire all '${container_group}' containers
578 | | Create all '${container_group}' containers
579 | | Configure VPP in all '${container_group}' containers
580 | | Stop VPP service on all DUTs | ${nodes}
581 | | Install VPP in all '${container_group}' containers
582 | | Start VPP service on all DUTs | ${nodes}
583 | | Append To List | ${container_groups} | ${container_group}
584
585 | Tear down TAP functional test
586 | | [Documentation] | Common test teardown for functional tests with TAP.
587 | | ...
588 | | Tear down functional test
589 | | Clean Up Namespaces | ${nodes['DUT1']}
590
591 | Tear down TAP functional test with Linux bridge
592 | | [Documentation] | Common test teardown for functional tests with TAP and
593 | | ... | a Linux bridge.
594 | | ...
595 | | ... | *Arguments:*
596 | | ... | - bid_TAP - Bridge name. Type: string
597 | | ...
598 | | ... | *Example:*
599 | | ...
600 | | ... | \| Tear down TAP functional test with Linux bridge \| ${bid_TAP} \|
601 | | ...
602 | | [Arguments] | ${bid_TAP}
603 | | ...
604 | | Tear down functional test
605 | | Linux Del Bridge | ${nodes['DUT1']} | ${bid_TAP}
606 | | Clean Up Namespaces | ${nodes['DUT1']}
607
608 | Tear down FDS functional test
609 | | [Documentation] | Common test teardown for FDS functional tests.
610 | | ...
611 | | ... | *Arguments:*
612 | | ... | - dut1_node - Node Nr.1 where to clean qemu. Type: dictionary
613 | | ... | - qemu_node1 - VM Nr.1 node info dictionary. Type: string
614 | | ... | - dut2_node - Node Nr.2 where to clean qemu. Type: dictionary
615 | | ... | - qemu_node2 - VM Nr.2 node info dictionary. Type: string
616 | | ...
617 | | ... | *Example:*
618 | | ...
619 | | ... | \| Tear down FDS functional test \| ${dut1_node} \| ${qemu_node1}\
620 | | ... | \| ${dut2_node} \| ${qemu_node2} \|
621 | | ...
622 | | [Arguments] | ${dut1_node} | ${qemu_node1} | ${dut2_node}
623 | | ... | ${qemu_node2}
624 | | ...
625 | | Tear down functional test
626 | | Tear down QEMU | ${dut1_node} | ${qemu_node1} | qemu_node1
627 | | Tear down QEMU | ${dut2_node} | ${qemu_node2} | qemu_node2
628
629 | Tear down functional test with container
630 | | [Documentation]
631 | | ... | Common test teardown for functional tests which uses containers.
632 | | ...
633 | | :FOR | ${container_group} | IN | @{container_groups}
634 | | | Destroy all '${container_group}' containers
635
636 | Stop VPP Service on DUT
637 | | [Documentation] | Stop the VPP service on the specified node.
638 | | ...
639 | | ... | *Arguments:*
640 | | ... | - node - information about a DUT node. Type: dictionary
641 | | ...
642 | | ... | *Example:*
643 | | ...
644 | | ... | \| Stop VPP Service on DUT \| ${nodes['DUT1']} \|
645 | | ...
646 | | [Arguments] | ${node}
647 | | Stop VPP Service | ${node}
648
649 | Start VPP Service on DUT
650 | | [Documentation] | Start the VPP service on the specified node.
651 | | ...
652 | | ... | *Arguments:*
653 | | ... | - node - information about a DUT node. Type: dictionary
654 | | ...
655 | | ... | *Example:*
656 | | ...
657 | | ... | \| Start VPP Service on DUT \| ${nodes['DUT1']} \|
658 | | ...
659 | | [Arguments] | ${node}
660 | | Start VPP Service | ${node}