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