1 # Copyright (c) 2024 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 | '${nic_name}' == 'Amazon-Nitro-100G'
145 | | | ... | ${dut}.Add DPDK Dev Default Devargs |
146 | | | ... | "normal_llq_hdr=1,enable_llq=1,control_path_poll_interval=0"
147 | | | Run Keyword If | '${nic_name}' == 'Amazon-Nitro-200G'
148 | | | ... | ${dut}.Add DPDK Dev Default Devargs |
149 | | | ... | "normal_llq_hdr=1,enable_llq=1,control_path_poll_interval=0"
150 | | | Run Keyword If | not ${jumbo}
151 | | | ... | ${dut}.Add DPDK No Multi Seg
152 | | | Run Keyword If | ${nic_rxq_size} > 0
153 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
154 | | | Run Keyword If | ${nic_txq_size} > 0
155 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
156 | | | Run Keyword If | '${crypto_type}' != '${None}'
157 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
158 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
161 | Pre-initialize layer avf on all DUTs
163 | | ... | Pre-initialize avf driver. Currently no operation.
167 | Pre-initialize layer af_xdp on all DUTs
169 | | ... | Pre-initialize af_xdp driver.
171 | | FOR | ${dut} | IN | @{duts}
172 | | | Set Interface State PCI
173 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | state=up
174 | | | Set Interface XDP off
175 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci}
176 | | | Set Interface Channels
177 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | num_queues=${rxq_count_int}
178 | | | ... | channel=combined
181 | Pre-initialize layer rdma-core on all DUTs
183 | | ... | Pre-initialize rdma-core driver.
185 | | FOR | ${dut} | IN | @{duts}
186 | | | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci}
187 | | | ... | mtu=${recommended_mtu}
188 | | | Set Interface Flow Control
189 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
192 | Pre-initialize layer mlx5_core on all DUTs
194 | | ... | Pre-initialize mlx5_core driver.
196 | | FOR | ${dut} | IN | @{duts}
197 | | | Set Interface Flow Control
198 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
200 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
201 | | Run Keyword If | ${index} >= 0 | Return From Keyword
202 | | FOR | ${dut} | IN | @{duts}
203 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
204 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
205 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
206 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
207 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
208 | | | Run Keyword If | not ${jumbo}
209 | | | ... | ${dut}.Add DPDK No Multi Seg
210 | | | Run Keyword If | ${nic_rxq_size} > 0
211 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
212 | | | Run Keyword If | ${nic_txq_size} > 0
213 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
214 | | | Run Keyword If | '${crypto_type}' != '${None}'
215 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
216 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
219 | Initialize layer driver
221 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
222 | | ... | brought up.
224 | | ... | *Arguments:*
225 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
226 | | ... | Type: string
227 | | ... | - validate - Validate interfaces are up.
228 | | ... | Type: boolean
232 | | ... | \| Initialize layer driver \| vfio-pci \|
234 | | [Arguments] | ${driver} | ${validate}=${True}
236 | | FOR | ${dut} | IN | @{duts}
237 | | | Initialize layer driver on node | ${dut} | ${driver}
239 | | Set Test Variable | ${int} | vf
240 | | Set interfaces in path up | validate=${validate}
242 | Initialize layer driver on node
244 | | ... | Initialize driver based interfaces on DUT.
246 | | ... | *Arguments:*
247 | | ... | - dut - DUT node.
248 | | ... | Type: string
249 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
250 | | ... | Type: string
254 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
256 | | [Arguments] | ${dut} | ${driver}
258 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
260 | | | ... | Copy List | ${${dut}_${int}${pf}}
262 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
263 | | | ${_ip4_prefix}=
264 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
266 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
268 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
270 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
271 | | | Set Test Variable
272 | | | ... | ${${dut}_vf${pf}} | ${_vf}
273 | | | Set Test Variable
274 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
275 | | | Set Suite Variable
276 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
277 | | | Set Test Variable
278 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
279 | | | Set Test Variable
280 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
281 | | | Set Test Variable
282 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
283 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
286 | Initialize layer tap on node
288 | | ... | Initialize tap interfaces on DUT.
290 | | ... | *Arguments:*
291 | | ... | - dut - DUT node.
292 | | ... | Type: string
293 | | ... | - pf - TAP ID (logical port).
294 | | ... | Type: integer
298 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
300 | | [Arguments] | ${dut} | ${pf}
303 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
304 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
306 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
307 | | ... | host_namespace=tap${${pf}-1}_namespace
308 | | ... | num_rx_queues=${rxq_count_int}
309 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
310 | | ... | tap_feature_mask=${tap_feature_mask}
312 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
313 | | ${_tap}= | Create List | ${_tap}
314 | | ${_mac}= | Create List | ${_mac}
315 | | Vhost User Affinity
316 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
317 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
318 | | Set Test Variable
319 | | ... | ${${dut}_vf${pf}} | ${_tap}
320 | | Set Test Variable
321 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
323 | Initialize layer vhost on node
325 | | ... | Initialize vhost interfaces on DUT.
327 | | ... | *Arguments:*
328 | | ... | - dut - DUT node.
329 | | ... | Type: string
330 | | ... | - pf - VHOST ID (logical port).
331 | | ... | Type: integer
335 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
337 | | [Arguments] | ${dut} | ${pf}
339 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
340 | | ${vhost}= | Vpp Create Vhost User Interface
341 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
342 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
344 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
345 | | ${_vhost}= | Create List | ${_vhost}
346 | | ${_mac}= | Create List | ${_mac}
347 | | Set Test Variable
348 | | ... | ${${dut}_vf${pf}} | ${_vhost}
349 | | Set Test Variable
350 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
352 | Initialize layer vfio-pci on node
354 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
355 | | ... | Currently just set MTU to the recommended value.
357 | | ... | *Arguments:*
358 | | ... | - dut - DUT node. Type: string
359 | | ... | - pf - NIC physical function (physical port). Type: integer
363 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
365 | | [Arguments] | ${dut} | ${pf}
367 | | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
368 | | VPP Set Interface MTU
369 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
371 | Initialize layer avf on node
373 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
375 | | ... | *Arguments:*
376 | | ... | - dut - DUT node. Type: string
377 | | ... | - pf - NIC physical function (physical port). Type: integer
381 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
383 | | [Arguments] | ${dut} | ${pf}
385 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
386 | | | ${_avf}= | VPP Create AVF Interface
387 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
388 | | | ... | num_rx_queues=${rxq_count_int}
389 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
391 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
392 | | | ${_ip4_prefix}=
393 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
395 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
397 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
399 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
400 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
401 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
402 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
403 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
404 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
405 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
408 | Initialize layer af_xdp on node
410 | | ... | Initialize AF_XDP (eBPF) interfaces on DUT on NIC PF.
412 | | ... | *Arguments:*
413 | | ... | - dut - DUT node. Type: string
414 | | ... | - pf - NIC physical function (physical port). Type: integer
418 | | ... | \| Initialize layer af_xdp on node \| DUT1 \| 1 \|
420 | | [Arguments] | ${dut} | ${pf}
422 | | ${_af_xdp}= | VPP Create AF XDP Interface
423 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
424 | | ... | num_rx_queues=${65535}
425 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
426 | | ${cpu_skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM}+${CPU_CNT_MAIN}
427 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+${cpu_count_int}
428 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+(${pf}-${1})*${rxq_count_int}
429 | | Set Interface IRQs Affinity
430 | | ... | ${nodes['${dut}']} | ${_af_xdp}
431 | | ... | cpu_skip_cnt=${cpu_skip_cnt} | cpu_cnt=${rxq_count_int}
432 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_af_xdp}
434 | Initialize layer rdma-core on node
436 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
438 | | ... | *Arguments:*
439 | | ... | - dut - DUT node. Type: string
440 | | ... | - pf - NIC physical function (physical port). Type: integer
444 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
446 | | [Arguments] | ${dut} | ${pf}
448 | | ${_rdma}= | VPP Create Rdma Interface
449 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
450 | | ... | num_rx_queues=${rxq_count_int}
451 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
452 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
454 | Initialize layer mlx5_core on node
456 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
457 | | ... | Currently just set MTU to the recommended value.
459 | | ... | *Arguments:*
460 | | ... | - dut - DUT node. Type: string
461 | | ... | - pf - NIC physical function (physical port). Type: integer
465 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
467 | | [Arguments] | ${dut} | ${pf}
469 | | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
470 | | VPP Set Interface MTU
471 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
473 | Initialize layer interface
475 | | ... | Physical interfaces variables to be created on all DUTs.
477 | | ... | *Arguments:*
478 | | ... | - count - Number of untagged interfaces variables. Type: integer
482 | | ... | \| Initialize layer interface \| 1 \|
484 | | [Arguments] | ${count}=${1}
486 | | FOR | ${dut} | IN | @{duts}
487 | | | Initialize layer interface on node | ${dut} | count=${count}
490 | Initialize layer interface on node
492 | | ... | Physical interfaces variables to be created on all DUTs.
494 | | ... | *Arguments:*
495 | | ... | - dut - DUT node. Type: string
496 | | ... | - count - Number of baseline interface variables. Type: integer
500 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
502 | | [Arguments] | ${dut} | ${count}=${1}
504 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
505 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
508 | Initialize layer interface on node on PF
510 | | ... | Baseline interfaces variables to be created.
512 | | ... | *Arguments:*
513 | | ... | - dut - DUT node. Type: string
514 | | ... | - pf - NIC physical function (physical port). Type: integer
515 | | ... | - count - Number of baseline interface variables. Type: integer
519 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
521 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
523 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
524 | | | Set Test Variable
525 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
528 | Initialize layer bonding
530 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
532 | | ... | *Arguments:*
533 | | ... | - bond_mode - Link bonding mode. Type: string
534 | | ... | - lb_mode - Load balance mode. Type: string
535 | | ... | - count - Number of bond interface variables. Type: integer
539 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
541 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
543 | | FOR | ${dut} | IN | @{duts}
544 | | | Initialize layer bonding on node
545 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
546 | | | ... | count=${count}
548 | | Set Test Variable | ${int} | bond
550 | Initialize layer bonding on node
552 | | ... | Bonded interface and variables to be created on across east and
553 | | ... | west DUT's node interfaces.
555 | | ... | *Arguments:*
556 | | ... | - dut - DUT node. Type: string
557 | | ... | - bond_mode - Link bonding mode. Type: string
558 | | ... | - lb_mode - Load balance mode. Type: string
559 | | ... | - count - Number of bond interface variables. Type: integer
563 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
565 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
567 | | ${if_index}= | VPP Create Bond Interface
568 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
569 | | ... | mac=00:00:00:01:01:01
570 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
571 | | VPP Add Bond Member
572 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
573 | | VPP Add Bond Member
574 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
575 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
576 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
577 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
580 | Initialize layer dot1q
582 | | ... | Dot1q interfaces and variables to be created on all DUTs.
584 | | ... | *Arguments:*
585 | | ... | - count - Number of chains.
586 | | ... | Type: integer
587 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
588 | | ... | Type: boolean
589 | | ... | - start - Id of first chain, allows adding chains during test.
590 | | ... | Type: integer
592 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
594 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
596 | | FOR | ${dut} | IN | @{duts}
597 | | | Initialize layer dot1q on node
598 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
599 | | | ... | start=${start}
601 | | Set Test Variable | ${int} | dot1q
603 | Initialize layer dot1q on node
605 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
607 | | ... | *Arguments:*
608 | | ... | - dut - DUT node.
609 | | ... | Type: string
610 | | ... | - count - Number of chains.
611 | | ... | Type: integer
612 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
613 | | ... | Type: boolean
614 | | ... | - start - Id of first chain, allows adding chains during test.
615 | | ... | Type: integer
619 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
621 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
622 | | ... | ${start}=${1}
624 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
625 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
626 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
629 | Initialize layer dot1q on node on PF
631 | | ... | Dot1q interfaces and variables to be created on all DUT's node
632 | | ... | interfaces.
634 | | ... | *Arguments:*
635 | | ... | - dut - DUT node.
636 | | ... | Type: string
637 | | ... | - pf - NIC physical function (physical port).
638 | | ... | Type: integer
639 | | ... | - count - Number of chains.
640 | | ... | Type: integer
641 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
642 | | ... | Type: boolean
643 | | ... | - start - Id of first chain, allows adding chains during test.
644 | | ... | Type: integer
648 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
650 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
651 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
653 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
654 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
655 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
656 | | | # First id results in non-None indices, after that _1_ are defined.
657 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
658 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
659 | | | ${_dot1q}= | Create List | ${_dot1q}
660 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
663 | Initialize layer dot1q on node on PF for chain
665 | | ... | Optionally create tag popping subinterface per chain.
666 | | ... | Return interface indices for dot1q layer interfaces,
667 | | ... | or Nones if subinterfaces are not created.
669 | | ... | *Arguments:*
670 | | ... | - dut - DUT node.
671 | | ... | Type: string
672 | | ... | - pf - NIC physical function (physical port).
673 | | ... | Type: integer
674 | | ... | - id - Positive index of the chain.
675 | | ... | Type: integer
676 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
677 | | ... | Type: boolean
681 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
682 | | ... | \| 1 \| 1 \| True \|
684 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
686 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
688 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
689 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
690 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
691 | | ... | ${_vlan}[0] | ${_default}
692 | | ${_name} | ${_index}= | Create Vlan Subinterface
693 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
694 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
695 | | Configure L2 tag rewrite method on interfaces
696 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
697 | | Return From Keyword | ${_index}
699 | Initialize layer ip4vxlan
701 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
703 | | ... | *Arguments:*
704 | | ... | - count - Number of vxlan interfaces.
705 | | ... | Type: integer
706 | | ... | - start - Id of first chain, allows adding chains during test.
707 | | ... | Type: integer
709 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
711 | | [Arguments] | ${count}=${1} | ${start}=${1}
713 | | FOR | ${dut} | IN | @{duts}
714 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
715 | | | ... | start=${start}
717 | | Set Test Variable | ${int} | ip4vxlan
719 | Initialize layer ip4vxlan on node
721 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
722 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
723 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
724 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
726 | | ... | *Arguments:*
727 | | ... | - dut - DUT node.
728 | | ... | Type: string
729 | | ... | - count - Number of vxlan interfaces.
730 | | ... | Type: integer
731 | | ... | - start - Id of first chain, allows adding chains during test.
732 | | ... | Type: integer
736 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
738 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
740 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
741 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
742 | | | ... | count=${count} | start=${start}
745 | Initialize layer ip4vxlan on node on PF
747 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
748 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
749 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
750 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
752 | | ... | *Arguments:*
753 | | ... | - dut - DUT node.
754 | | ... | Type: string
755 | | ... | - pf - NIC physical function (physical port).
756 | | ... | Type: integer
757 | | ... | - count - Number of vxlan interfaces.
758 | | ... | Type: integer
759 | | ... | - start - Id of first chain, allows adding chains during test.
760 | | ... | Type: integer
764 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
766 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
768 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
769 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
770 | | ... | 172.${pf}6.0.1 | 24
771 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
772 | | | ${_subnet}= | Evaluate | ${id} - 1
773 | | | ${_vni}= | Evaluate | ${id} - 1
774 | | | ${_ip4vxlan}= | Create VXLAN interface
775 | | | ... | ${nodes['${dut}']} | ${_vni}
776 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
778 | | | ... | Set Variable If | '${dut}' == 'DUT1'
779 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
781 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
782 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
783 | | | ${_even}= | Evaluate | ${pf} % 2
784 | | | ${_mac}= | Set Variable If | ${_even}
785 | | | ... | ${_prev_mac} | ${_next_mac}
786 | | | VPP Add IP Neighbor
787 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
788 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
790 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
791 | | | ... | gateway=172.${pf}6.${_subnet}.2
792 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
793 | | | Set VXLAN Bypass
794 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
795 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
796 | | | Set Test Variable
797 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
800 | Configure vhost interfaces
802 | | ... | Create two Vhost-User interfaces on defined VPP node.
804 | | ... | *Arguments:*
805 | | ... | - ${dut_node} - DUT node.
806 | | ... | Type: dictionary
807 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
808 | | ... | Type: string
809 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
810 | | ... | Type: string
811 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
812 | | ... | Type: string
813 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
814 | | ... | Type: string
815 | | ... | - ${is_server} - Server side of connection (Optional).
816 | | ... | Type: boolean
817 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
818 | | ... | Type: integer
820 | | ... | _NOTE:_ This KW sets following test case variable:
821 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
822 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
826 | | ... | \| Configure vhost interfaces \
827 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
829 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
830 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
831 | | ... | ${virtio_feature_mask}=${None}
833 | | ${vhost_1}= | Vpp Create Vhost User Interface
834 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
835 | | ... | virtio_feature_mask=${virtio_feature_mask}
836 | | ${vhost_2}= | Vpp Create Vhost User Interface
837 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
838 | | ... | virtio_feature_mask=${virtio_feature_mask}
839 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
840 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
841 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
842 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
843 | | Set Interface State | ${dut_node} | ${vhost_1} | up
844 | | Set Interface State | ${dut_node} | ${vhost_2} | up
845 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
846 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
847 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
848 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
851 | | [Documentation] | Get vhost-user dump.
853 | | ... | *Arguments:*
854 | | ... | - dut - DUT node data.
855 | | ... | Type: dictionary
857 | | [Arguments] | ${dut}
859 | | ${vhost_dump}= | Vhost User Dump | ${dut}
860 | | Return From Keyword | ${vhost_dump}
862 | Lower DUT1-DUT2 MTU For Fragmentation
863 | | [Documentation] | Set lower MTU on both ends of DUT1-DUT2 link.
865 | | ... | This should force VPP to fragment (and reassembly) packets.
866 | | ... | Should be called after Initialize Layer Interface.
867 | | ... | Suite variables such as \${dut2_if1} should be defined by then.
869 | | ... | As VPP (at least dpdk plugin) require interface to be down
870 | | ... | before MTU can be changed, interfaces are temporarily downed.
872 | | # TODO: ip_reassembly_set to increase max_reassembly_length so jumbo passes.
873 | | Set Interface State | ${nodes['DUT1']} | ${dut1_if2} | down
874 | | Set Interface State | ${nodes['DUT2']} | ${dut2_if1} | down
875 | | VPP Set Interface MTU
876 | | ... | ${nodes['DUT1']} | ${dut1_if2} | ${MTU_FOR_FRAGMENTATION}
877 | | VPP Set Interface MTU
878 | | ... | ${nodes['DUT2']} | ${dut2_if1} | ${MTU_FOR_FRAGMENTATION}
879 | | Set Interface State | ${nodes['DUT1']} | ${dut1_if2} | up
880 | | Set Interface State | ${nodes['DUT2']} | ${dut2_if1} | up