1 # Copyright (c) 2023 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:
6 # http://www.apache.org/licenses/LICENSE-2.0
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.
14 | Library | resources.libraries.python.InterfaceUtil
15 | Library | resources.libraries.python.NodePath
16 | Library | resources.libraries.python.VhostUser
19 | ${dpdk_no_tx_checksum_offload}= | ${True}
22 | Set single interfaces in path up
24 | | ... | *Set UP state on single physical VPP interfaces in path on all DUT
27 | | ... | *Arguments:*
28 | | ... | - pf - NIC physical function (physical port).
29 | | ... | Type: integer
33 | | ... | \| Set single interfaces in path \| 1 \|
35 | | [Arguments] | ${pf}=${1}
37 | | FOR | ${dut} | IN | @{duts}
38 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
40 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
42 | Set interfaces in path up
44 | | ... | *Set UP state on VPP interfaces in path on all DUT nodes.*
46 | | ... | *Arguments:*
47 | | ... | - validate - Validate interfaces are up.
48 | | ... | Type: boolean
50 | | [Arguments] | ${validate}=${True}
52 | | FOR | ${dut} | IN | @{duts}
53 | | | Set interfaces in path up on node | ${dut}
55 | | Run Keyword If | ${validate}
56 | | ... | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
58 | Set interfaces in path up on node
60 | | ... | *Set UP state on VPP interfaces in path on specified DUT node.*
62 | | ... | *Arguments:*
63 | | ... | - dut - DUT node on which to set the interfaces up.
64 | | ... | Type: string
68 | | ... | \| Set interfaces in path up on node \| DUT1 \|
70 | | [Arguments] | ${dut}
72 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
73 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
76 | Set interfaces in path up on node on PF
78 | | ... | *Set UP state on VPP interfaces in path on specified DUT node.*
80 | | ... | *Arguments:*
81 | | ... | - dut - DUT node on which to set the interfaces up.
82 | | ... | Type: string
83 | | ... | - pf - NIC physical function (physical port).
84 | | ... | Type: integer
88 | | ... | \| Set interfaces in path up on node on PF \| DUT1 \| 1 \|
90 | | [Arguments] | ${dut} | ${pf}
92 | | ${_chains} | ${value}= | Run Keyword And Ignore Error
93 | | ... | Variable Should Exist | @{${dut}_${int}${pf}_1}
94 | | ${_id}= | Set Variable If | '${_chains}' == 'PASS' | _1 | ${EMPTY}
95 | | FOR | ${if} | IN | @{${dut}_${int}${pf}${_id}}
96 | | | Set Interface State | ${nodes['${dut}']} | ${if} | up
99 | Pre-initialize layer driver
101 | | ... | Pre-initialize driver based interfaces on each DUT.
103 | | ... | *Arguments:*
104 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
105 | | ... | Type: string
109 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
111 | | [Arguments] | ${driver}
113 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
115 | Pre-initialize layer tap on all DUTs
117 | | ... | Pre-initialize tap driver. Currently no operation.
121 | Pre-initialize layer vhost on all DUTs
123 | | ... | Pre-initialize vhost driver. Currently no operation.
127 | Pre-initialize layer vfio-pci on all DUTs
129 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
130 | | ... | config on all DUTs.
132 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
133 | | Run Keyword If | ${index} >= 0 | Return From Keyword
134 | | FOR | ${dut} | IN | @{duts}
135 | | | Stop VPP Service | ${nodes['${dut}']}
136 | | | Unbind PCI Devices From Other Driver | ${nodes['${dut}']} | vfio-pci |
137 | | | ... | @{${dut}_pf_pci}
138 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
139 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
140 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
141 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
142 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
143 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
144 | | | Run Keyword If | not ${jumbo}
145 | | | ... | ${dut}.Add DPDK No Multi Seg
146 | | | Run Keyword If | ${nic_rxq_size} > 0
147 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
148 | | | Run Keyword If | ${nic_txq_size} > 0
149 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
150 | | | Run Keyword If | '${crypto_type}' != '${None}'
151 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
152 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
155 | Pre-initialize layer avf on all DUTs
157 | | ... | Pre-initialize avf driver. Currently no operation.
161 | Pre-initialize layer af_xdp on all DUTs
163 | | ... | Pre-initialize af_xdp driver.
165 | | FOR | ${dut} | IN | @{duts}
166 | | | Set Interface State PCI
167 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | state=up
168 | | | Set Interface XDP off
169 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci}
170 | | | Set Interface Channels
171 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | num_queues=${rxq_count_int}
172 | | | ... | channel=combined
175 | Pre-initialize layer rdma-core on all DUTs
177 | | ... | Pre-initialize rdma-core driver.
179 | | FOR | ${dut} | IN | @{duts}
180 | | | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci}
181 | | | ... | mtu=${recommended_mtu}
182 | | | Set Interface Flow Control
183 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
186 | Pre-initialize layer mlx5_core on all DUTs
188 | | ... | Pre-initialize mlx5_core driver.
190 | | FOR | ${dut} | IN | @{duts}
191 | | | Set Interface Flow Control
192 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
194 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
195 | | Run Keyword If | ${index} >= 0 | Return From Keyword
196 | | FOR | ${dut} | IN | @{duts}
197 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
198 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
199 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
200 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
201 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
202 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
203 | | | Run Keyword If | not ${jumbo}
204 | | | ... | ${dut}.Add DPDK No Multi Seg
205 | | | Run Keyword If | ${nic_rxq_size} > 0
206 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
207 | | | Run Keyword If | ${nic_txq_size} > 0
208 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
209 | | | Run Keyword If | '${crypto_type}' != '${None}'
210 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
211 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
214 | Initialize layer driver
216 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
217 | | ... | brought up.
219 | | ... | *Arguments:*
220 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
221 | | ... | Type: string
222 | | ... | - validate - Validate interfaces are up.
223 | | ... | Type: boolean
227 | | ... | \| Initialize layer driver \| vfio-pci \|
229 | | [Arguments] | ${driver} | ${validate}=${True}
231 | | FOR | ${dut} | IN | @{duts}
232 | | | Initialize layer driver on node | ${dut} | ${driver}
234 | | Set Test Variable | ${int} | vf
235 | | Set interfaces in path up | validate=${validate}
237 | Initialize layer driver on node
239 | | ... | Initialize driver based interfaces on DUT.
241 | | ... | *Arguments:*
242 | | ... | - dut - DUT node.
243 | | ... | Type: string
244 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
245 | | ... | Type: string
249 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
251 | | [Arguments] | ${dut} | ${driver}
253 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
255 | | | ... | Copy List | ${${dut}_${int}${pf}}
257 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
258 | | | ${_ip4_prefix}=
259 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
261 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
263 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
265 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
266 | | | Set Test Variable
267 | | | ... | ${${dut}_vf${pf}} | ${_vf}
268 | | | Set Test Variable
269 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
270 | | | Set Suite Variable
271 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
272 | | | Set Test Variable
273 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
274 | | | Set Test Variable
275 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
276 | | | Set Test Variable
277 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
278 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
281 | Initialize layer tap on node
283 | | ... | Initialize tap interfaces on DUT.
285 | | ... | *Arguments:*
286 | | ... | - dut - DUT node.
287 | | ... | Type: string
288 | | ... | - pf - TAP ID (logical port).
289 | | ... | Type: integer
293 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
295 | | [Arguments] | ${dut} | ${pf}
298 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
299 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
301 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
302 | | ... | host_namespace=tap${${pf}-1}_namespace
303 | | ... | num_rx_queues=${rxq_count_int}
304 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
305 | | ... | tap_feature_mask=${tap_feature_mask}
307 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
308 | | ${_tap}= | Create List | ${_tap}
309 | | ${_mac}= | Create List | ${_mac}
310 | | Vhost User Affinity
311 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
312 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
313 | | Set Test Variable
314 | | ... | ${${dut}_vf${pf}} | ${_tap}
315 | | Set Test Variable
316 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
318 | Initialize layer vhost on node
320 | | ... | Initialize vhost interfaces on DUT.
322 | | ... | *Arguments:*
323 | | ... | - dut - DUT node.
324 | | ... | Type: string
325 | | ... | - pf - VHOST ID (logical port).
326 | | ... | Type: integer
330 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
332 | | [Arguments] | ${dut} | ${pf}
334 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
335 | | ${vhost}= | Vpp Create Vhost User Interface
336 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
337 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
339 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
340 | | ${_vhost}= | Create List | ${_vhost}
341 | | ${_mac}= | Create List | ${_mac}
342 | | Set Test Variable
343 | | ... | ${${dut}_vf${pf}} | ${_vhost}
344 | | Set Test Variable
345 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
347 | Initialize layer vfio-pci on node
349 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
350 | | ... | Currently just set MTU to the recommended value.
352 | | ... | *Arguments:*
353 | | ... | - dut - DUT node. Type: string
354 | | ... | - pf - NIC physical function (physical port). Type: integer
358 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
360 | | [Arguments] | ${dut} | ${pf}
362 | | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
363 | | VPP Set Interface MTU
364 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
366 | Initialize layer avf on node
368 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
370 | | ... | *Arguments:*
371 | | ... | - dut - DUT node. Type: string
372 | | ... | - pf - NIC physical function (physical port). Type: integer
376 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
378 | | [Arguments] | ${dut} | ${pf}
380 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
381 | | | ${_avf}= | VPP Create AVF Interface
382 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
383 | | | ... | num_rx_queues=${rxq_count_int}
384 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
386 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
387 | | | ${_ip4_prefix}=
388 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
390 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
392 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
394 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
395 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
396 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
397 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
398 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
399 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
400 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
403 | Initialize layer af_xdp on node
405 | | ... | Initialize AF_XDP (eBPF) interfaces on DUT on NIC PF.
407 | | ... | *Arguments:*
408 | | ... | - dut - DUT node. Type: string
409 | | ... | - pf - NIC physical function (physical port). Type: integer
413 | | ... | \| Initialize layer af_xdp on node \| DUT1 \| 1 \|
415 | | [Arguments] | ${dut} | ${pf}
417 | | ${_af_xdp}= | VPP Create AF XDP Interface
418 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
419 | | ... | num_rx_queues=${65535}
420 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
421 | | ${cpu_skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM}+${CPU_CNT_MAIN}
422 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+${cpu_count_int}
423 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+(${pf}-${1})*${rxq_count_int}
424 | | Set Interface IRQs Affinity
425 | | ... | ${nodes['${dut}']} | ${_af_xdp}
426 | | ... | cpu_skip_cnt=${cpu_skip_cnt} | cpu_cnt=${rxq_count_int}
427 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_af_xdp}
429 | Initialize layer rdma-core on node
431 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
433 | | ... | *Arguments:*
434 | | ... | - dut - DUT node. Type: string
435 | | ... | - pf - NIC physical function (physical port). Type: integer
439 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
441 | | [Arguments] | ${dut} | ${pf}
443 | | ${_rdma}= | VPP Create Rdma Interface
444 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
445 | | ... | num_rx_queues=${rxq_count_int}
446 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
447 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
449 | Initialize layer mlx5_core on node
451 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
452 | | ... | Currently just set MTU to the recommended value.
454 | | ... | *Arguments:*
455 | | ... | - dut - DUT node. Type: string
456 | | ... | - pf - NIC physical function (physical port). Type: integer
460 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
462 | | [Arguments] | ${dut} | ${pf}
464 | | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
465 | | VPP Set Interface MTU
466 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
468 | Initialize layer interface
470 | | ... | Physical interfaces variables to be created on all DUTs.
472 | | ... | *Arguments:*
473 | | ... | - count - Number of untagged interfaces variables. Type: integer
477 | | ... | \| Initialize layer interface \| 1 \|
479 | | [Arguments] | ${count}=${1}
481 | | FOR | ${dut} | IN | @{duts}
482 | | | Initialize layer interface on node | ${dut} | count=${count}
485 | Initialize layer interface on node
487 | | ... | Physical interfaces variables to be created on all DUTs.
489 | | ... | *Arguments:*
490 | | ... | - dut - DUT node. Type: string
491 | | ... | - count - Number of baseline interface variables. Type: integer
495 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
497 | | [Arguments] | ${dut} | ${count}=${1}
499 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
500 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
503 | Initialize layer interface on node on PF
505 | | ... | Baseline interfaces variables to be created.
507 | | ... | *Arguments:*
508 | | ... | - dut - DUT node. Type: string
509 | | ... | - pf - NIC physical function (physical port). Type: integer
510 | | ... | - count - Number of baseline interface variables. Type: integer
514 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
516 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
518 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
519 | | | Set Test Variable
520 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
523 | Initialize layer bonding
525 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
527 | | ... | *Arguments:*
528 | | ... | - bond_mode - Link bonding mode. Type: string
529 | | ... | - lb_mode - Load balance mode. Type: string
530 | | ... | - count - Number of bond interface variables. Type: integer
534 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
536 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
538 | | FOR | ${dut} | IN | @{duts}
539 | | | Initialize layer bonding on node
540 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
541 | | | ... | count=${count}
543 | | Set Test Variable | ${int} | bond
545 | Initialize layer bonding on node
547 | | ... | Bonded interface and variables to be created on across east and
548 | | ... | west DUT's node interfaces.
550 | | ... | *Arguments:*
551 | | ... | - dut - DUT node. Type: string
552 | | ... | - bond_mode - Link bonding mode. Type: string
553 | | ... | - lb_mode - Load balance mode. Type: string
554 | | ... | - count - Number of bond interface variables. Type: integer
558 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
560 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
562 | | ${if_index}= | VPP Create Bond Interface
563 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
564 | | ... | mac=00:00:00:01:01:01
565 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
566 | | VPP Add Bond Member
567 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
568 | | VPP Add Bond Member
569 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
570 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
571 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
572 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
575 | Initialize layer dot1q
577 | | ... | Dot1q interfaces and variables to be created on all DUTs.
579 | | ... | *Arguments:*
580 | | ... | - count - Number of chains.
581 | | ... | Type: integer
582 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
583 | | ... | Type: boolean
584 | | ... | - start - Id of first chain, allows adding chains during test.
585 | | ... | Type: integer
587 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
589 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
591 | | FOR | ${dut} | IN | @{duts}
592 | | | Initialize layer dot1q on node
593 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
594 | | | ... | start=${start}
596 | | Set Test Variable | ${int} | dot1q
598 | Initialize layer dot1q on node
600 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
602 | | ... | *Arguments:*
603 | | ... | - dut - DUT node.
604 | | ... | Type: string
605 | | ... | - count - Number of chains.
606 | | ... | Type: integer
607 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
608 | | ... | Type: boolean
609 | | ... | - start - Id of first chain, allows adding chains during test.
610 | | ... | Type: integer
614 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
616 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
617 | | ... | ${start}=${1}
619 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
620 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
621 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
624 | Initialize layer dot1q on node on PF
626 | | ... | Dot1q interfaces and variables to be created on all DUT's node
627 | | ... | interfaces.
629 | | ... | *Arguments:*
630 | | ... | - dut - DUT node.
631 | | ... | Type: string
632 | | ... | - pf - NIC physical function (physical port).
633 | | ... | Type: integer
634 | | ... | - count - Number of chains.
635 | | ... | Type: integer
636 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
637 | | ... | Type: boolean
638 | | ... | - start - Id of first chain, allows adding chains during test.
639 | | ... | Type: integer
643 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
645 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
646 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
648 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
649 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
650 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
651 | | | # First id results in non-None indices, after that _1_ are defined.
652 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
653 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
654 | | | ${_dot1q}= | Create List | ${_dot1q}
655 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
658 | Initialize layer dot1q on node on PF for chain
660 | | ... | Optionally create tag popping subinterface per chain.
661 | | ... | Return interface indices for dot1q layer interfaces,
662 | | ... | or Nones if subinterfaces are not created.
664 | | ... | *Arguments:*
665 | | ... | - dut - DUT node.
666 | | ... | Type: string
667 | | ... | - pf - NIC physical function (physical port).
668 | | ... | Type: integer
669 | | ... | - id - Positive index of the chain.
670 | | ... | Type: integer
671 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
672 | | ... | Type: boolean
676 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
677 | | ... | \| 1 \| 1 \| True \|
679 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
681 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
683 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
684 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
685 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
686 | | ... | ${_vlan}[0] | ${_default}
687 | | ${_name} | ${_index}= | Create Vlan Subinterface
688 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
689 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
690 | | Configure L2 tag rewrite method on interfaces
691 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
692 | | Return From Keyword | ${_index}
694 | Initialize layer ip4vxlan
696 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
698 | | ... | *Arguments:*
699 | | ... | - count - Number of vxlan interfaces.
700 | | ... | Type: integer
701 | | ... | - start - Id of first chain, allows adding chains during test.
702 | | ... | Type: integer
704 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
706 | | [Arguments] | ${count}=${1} | ${start}=${1}
708 | | FOR | ${dut} | IN | @{duts}
709 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
710 | | | ... | start=${start}
712 | | Set Test Variable | ${int} | ip4vxlan
714 | Initialize layer ip4vxlan on node
716 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
717 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
718 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
719 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
721 | | ... | *Arguments:*
722 | | ... | - dut - DUT node.
723 | | ... | Type: string
724 | | ... | - count - Number of vxlan interfaces.
725 | | ... | Type: integer
726 | | ... | - start - Id of first chain, allows adding chains during test.
727 | | ... | Type: integer
731 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
733 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
735 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
736 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
737 | | | ... | count=${count} | start=${start}
740 | Initialize layer ip4vxlan on node on PF
742 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
743 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
744 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
745 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
747 | | ... | *Arguments:*
748 | | ... | - dut - DUT node.
749 | | ... | Type: string
750 | | ... | - pf - NIC physical function (physical port).
751 | | ... | Type: integer
752 | | ... | - count - Number of vxlan interfaces.
753 | | ... | Type: integer
754 | | ... | - start - Id of first chain, allows adding chains during test.
755 | | ... | Type: integer
759 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
761 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
763 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
764 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
765 | | ... | 172.${pf}6.0.1 | 24
766 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
767 | | | ${_subnet}= | Evaluate | ${id} - 1
768 | | | ${_vni}= | Evaluate | ${id} - 1
769 | | | ${_ip4vxlan}= | Create VXLAN interface
770 | | | ... | ${nodes['${dut}']} | ${_vni}
771 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
773 | | | ... | Set Variable If | '${dut}' == 'DUT1'
774 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
776 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
777 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
778 | | | ${_even}= | Evaluate | ${pf} % 2
779 | | | ${_mac}= | Set Variable If | ${_even}
780 | | | ... | ${_prev_mac} | ${_next_mac}
781 | | | VPP Add IP Neighbor
782 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
783 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
785 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
786 | | | ... | gateway=172.${pf}6.${_subnet}.2
787 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
788 | | | Set VXLAN Bypass
789 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
790 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
791 | | | Set Test Variable
792 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
795 | Configure vhost interfaces
797 | | ... | Create two Vhost-User interfaces on defined VPP node.
799 | | ... | *Arguments:*
800 | | ... | - ${dut_node} - DUT node.
801 | | ... | Type: dictionary
802 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
803 | | ... | Type: string
804 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
805 | | ... | Type: string
806 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
807 | | ... | Type: string
808 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
809 | | ... | Type: string
810 | | ... | - ${is_server} - Server side of connection (Optional).
811 | | ... | Type: boolean
812 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
813 | | ... | Type: integer
815 | | ... | _NOTE:_ This KW sets following test case variable:
816 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
817 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
821 | | ... | \| Configure vhost interfaces \
822 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
824 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
825 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
826 | | ... | ${virtio_feature_mask}=${None}
828 | | ${vhost_1}= | Vpp Create Vhost User Interface
829 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
830 | | ... | virtio_feature_mask=${virtio_feature_mask}
831 | | ${vhost_2}= | Vpp Create Vhost User Interface
832 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
833 | | ... | virtio_feature_mask=${virtio_feature_mask}
834 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
835 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
836 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
837 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
838 | | Set Interface State | ${dut_node} | ${vhost_1} | up
839 | | Set Interface State | ${dut_node} | ${vhost_2} | up
840 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
841 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
842 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
843 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
846 | | [Documentation] | Get vhost-user dump.
848 | | ... | *Arguments:*
849 | | ... | - dut - DUT node data.
850 | | ... | Type: dictionary
852 | | [Arguments] | ${dut}
854 | | ${vhost_dump}= | Vhost User Dump | ${dut}
855 | | Return From Keyword | ${vhost_dump}
857 | Lower DUT1-DUT2 MTU For Fragmentation
858 | | [Documentation] | Set lower MTU on both ends of DUT1-DUT2 link.
860 | | ... | This should force VPP to fragment (and reassembly) packets.
861 | | ... | Should be called after Initialize Layer Interface.
862 | | ... | Suite variables such as \${dut2_if1} should be defined by then.
864 | | ... | As VPP (at least dpdk plugin) require interface to be down
865 | | ... | before MTU can be changed, interfaces are temporarily downed.
867 | | # TODO: ip_reassembly_set to increase max_reassembly_length so jumbo passes.
868 | | Set Interface State | ${nodes['DUT1']} | ${dut1_if2} | down
869 | | Set Interface State | ${nodes['DUT2']} | ${dut2_if1} | down
870 | | VPP Set Interface MTU
871 | | ... | ${nodes['DUT1']} | ${dut1_if2} | ${MTU_FOR_FRAGMENTATION}
872 | | VPP Set Interface MTU
873 | | ... | ${nodes['DUT2']} | ${dut2_if1} | ${MTU_FOR_FRAGMENTATION}
874 | | Set Interface State | ${nodes['DUT1']} | ${dut1_if2} | up
875 | | Set Interface State | ${nodes['DUT2']} | ${dut2_if1} | up