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