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