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