1 # Copyright (c) 2022 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
25 | | ... | nodes and set maximal MTU.*
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 and set
45 | | ... | maximal MTU.*
47 | | ... | *Arguments:*
48 | | ... | - validate - Validate interfaces are up.
49 | | ... | Type: boolean
51 | | [Arguments] | ${validate}=${True}
53 | | FOR | ${dut} | IN | @{duts}
54 | | | Set interfaces in path up on node | ${dut}
56 | | Run Keyword If | ${validate}
57 | | ... | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
59 | Set interfaces in path up on node
61 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
62 | | ... | set maximal MTU.*
64 | | ... | *Arguments:*
65 | | ... | - dut - DUT node on which to set the interfaces up.
66 | | ... | Type: string
70 | | ... | \| Set interfaces in path up on node \| DUT1 \|
72 | | [Arguments] | ${dut}
74 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
75 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
78 | Set interfaces in path up on node on PF
80 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
81 | | ... | set maximal MTU.*
83 | | ... | *Arguments:*
84 | | ... | - dut - DUT node on which to set the interfaces up.
85 | | ... | Type: string
86 | | ... | - pf - NIC physical function (physical port).
87 | | ... | Type: integer
91 | | ... | \| Set interfaces in path up on node on PF \| DUT1 \| 1 \|
93 | | [Arguments] | ${dut} | ${pf}
95 | | ${_chains} | ${value}= | Run Keyword And Ignore Error
96 | | ... | Variable Should Exist | @{${dut}_${int}${pf}_1}
97 | | ${_id}= | Set Variable If | '${_chains}' == 'PASS' | _1 | ${EMPTY}
98 | | FOR | ${if} | IN | @{${dut}_${int}${pf}${_id}}
99 | | | Set Interface State | ${nodes['${dut}']} | ${if} | up
100 | | | VPP Set Interface MTU | ${nodes['${dut}']} | ${if}
103 | Pre-initialize layer driver
105 | | ... | Pre-initialize driver based interfaces on each DUT.
107 | | ... | *Arguments:*
108 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
109 | | ... | Type: string
113 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
115 | | [Arguments] | ${driver}
117 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
119 | Pre-initialize layer tap on all DUTs
121 | | ... | Pre-initialize tap driver. Currently no operation.
125 | Pre-initialize layer vhost on all DUTs
127 | | ... | Pre-initialize vhost driver. Currently no operation.
131 | Pre-initialize layer vfio-pci on all DUTs
133 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
134 | | ... | config on all DUTs.
136 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
137 | | Run Keyword If | ${index} >= 0 | Return From Keyword
138 | | FOR | ${dut} | IN | @{duts}
139 | | | Stop VPP Service | ${nodes['${dut}']}
140 | | | Unbind PCI Devices From Other Driver | ${nodes['${dut}']} | vfio-pci |
141 | | | ... | @{${dut}_pf_pci}
142 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
143 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
144 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
145 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
146 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
147 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
148 | | | Run Keyword If | not ${jumbo}
149 | | | ... | ${dut}.Add DPDK No Multi Seg
150 | | | Run Keyword If | ${nic_rxq_size} > 0
151 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
152 | | | Run Keyword If | ${nic_txq_size} > 0
153 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
154 | | | Run Keyword If | '${crypto_type}' != '${None}'
155 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
156 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
159 | Pre-initialize layer avf on all DUTs
161 | | ... | Pre-initialize avf driver. Currently no operation.
165 | Pre-initialize layer af_xdp on all DUTs
167 | | ... | Pre-initialize af_xdp driver.
169 | | FOR | ${dut} | IN | @{duts}
170 | | | Set Interface State PCI
171 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | state=up
172 | | | Set Interface Channels
173 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | num_queues=${rxq_count_int}
174 | | | ... | channel=combined
177 | Pre-initialize layer rdma-core on all DUTs
179 | | ... | Pre-initialize rdma-core driver.
181 | | FOR | ${dut} | IN | @{duts}
182 | | | Run Keyword If | ${jumbo}
183 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
185 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518
186 | | | Set Interface Flow Control
187 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
190 | Pre-initialize layer mlx5_core on all DUTs
192 | | ... | Pre-initialize mlx5_core driver.
194 | | FOR | ${dut} | IN | @{duts}
195 | | | Run Keyword If | ${jumbo}
196 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
198 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518
199 | | | Set Interface Flow Control
200 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
203 | Initialize layer driver
205 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
206 | | ... | brought up.
208 | | ... | *Arguments:*
209 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
210 | | ... | Type: string
211 | | ... | - validate - Validate interfaces are up.
212 | | ... | Type: boolean
216 | | ... | \| Initialize layer driver \| vfio-pci \|
218 | | [Arguments] | ${driver} | ${validate}=${True}
220 | | FOR | ${dut} | IN | @{duts}
221 | | | Initialize layer driver on node | ${dut} | ${driver}
223 | | Set Test Variable | ${int} | vf
224 | | Set interfaces in path up | validate=${validate}
226 | Initialize layer driver on node
228 | | ... | Initialize driver based interfaces on DUT.
230 | | ... | *Arguments:*
231 | | ... | - dut - DUT node.
232 | | ... | Type: string
233 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
234 | | ... | Type: string
238 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
240 | | [Arguments] | ${dut} | ${driver}
242 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
244 | | | ... | Copy List | ${${dut}_${int}${pf}}
246 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
247 | | | ${_ip4_prefix}=
248 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
250 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
252 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
254 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
255 | | | Set Test Variable
256 | | | ... | ${${dut}_vf${pf}} | ${_vf}
257 | | | Set Test Variable
258 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
259 | | | Set Suite Variable
260 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
261 | | | Set Test Variable
262 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
263 | | | Set Test Variable
264 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
265 | | | Set Test Variable
266 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
267 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
270 | Initialize layer tap on node
272 | | ... | Initialize tap interfaces on DUT.
274 | | ... | *Arguments:*
275 | | ... | - dut - DUT node.
276 | | ... | Type: string
277 | | ... | - pf - TAP ID (logical port).
278 | | ... | Type: integer
282 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
284 | | [Arguments] | ${dut} | ${pf}
287 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
288 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
290 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
291 | | ... | host_namespace=tap${${pf}-1}_namespace
292 | | ... | num_rx_queues=${rxq_count_int}
293 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
294 | | ... | tap_feature_mask=${tap_feature_mask}
296 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
297 | | ${_tap}= | Create List | ${_tap}
298 | | ${_mac}= | Create List | ${_mac}
299 | | Vhost User Affinity
300 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
301 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
302 | | Set Test Variable
303 | | ... | ${${dut}_vf${pf}} | ${_tap}
304 | | Set Test Variable
305 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
307 | Initialize layer vhost on node
309 | | ... | Initialize vhost interfaces on DUT.
311 | | ... | *Arguments:*
312 | | ... | - dut - DUT node.
313 | | ... | Type: string
314 | | ... | - pf - VHOST ID (logical port).
315 | | ... | Type: integer
319 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
321 | | [Arguments] | ${dut} | ${pf}
323 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
324 | | ${vhost}= | Vpp Create Vhost User Interface
325 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
326 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
328 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
329 | | ${_vhost}= | Create List | ${_vhost}
330 | | ${_mac}= | Create List | ${_mac}
331 | | Set Test Variable
332 | | ... | ${${dut}_vf${pf}} | ${_vhost}
333 | | Set Test Variable
334 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
336 | Initialize layer vfio-pci on node
338 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
339 | | ... | Currently no operation.
341 | | ... | *Arguments:*
342 | | ... | - dut - DUT node. Type: string
343 | | ... | - pf - NIC physical function (physical port). Type: integer
347 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
349 | | [Arguments] | ${dut} | ${pf}
353 | Initialize layer avf on node
355 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
357 | | ... | *Arguments:*
358 | | ... | - dut - DUT node. Type: string
359 | | ... | - pf - NIC physical function (physical port). Type: integer
363 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
365 | | [Arguments] | ${dut} | ${pf}
367 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
368 | | | ${_avf}= | VPP Create AVF Interface
369 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
370 | | | ... | num_rx_queues=${rxq_count_int}
371 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
373 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
374 | | | ${_ip4_prefix}=
375 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
377 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
379 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
381 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
382 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
383 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
384 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
385 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
386 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
387 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
390 | Initialize layer af_xdp on node
392 | | ... | Initialize AF_XDP (eBPF) interfaces on DUT on NIC PF.
394 | | ... | *Arguments:*
395 | | ... | - dut - DUT node. Type: string
396 | | ... | - pf - NIC physical function (physical port). Type: integer
400 | | ... | \| Initialize layer af_xdp on node \| DUT1 \| 1 \|
402 | | [Arguments] | ${dut} | ${pf}
404 | | ${_af_xdp}= | VPP Create AF XDP Interface
405 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
406 | | ... | num_rx_queues=${65535}
407 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
408 | | ${cpu_skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM}+${CPU_CNT_MAIN}
409 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+${cpu_count_int}
410 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+(${pf}-${1})*${rxq_count_int}
411 | | Set Interface IRQs Affinity
412 | | ... | ${nodes['${dut}']} | ${_af_xdp}
413 | | ... | cpu_skip_cnt=${cpu_skip_cnt} | cpu_cnt=${rxq_count_int}
414 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_af_xdp}
416 | Initialize layer rdma-core on node
418 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
420 | | ... | *Arguments:*
421 | | ... | - dut - DUT node. Type: string
422 | | ... | - pf - NIC physical function (physical port). Type: integer
426 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
428 | | [Arguments] | ${dut} | ${pf}
430 | | ${_rdma}= | VPP Create Rdma Interface
431 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
432 | | ... | num_rx_queues=${rxq_count_int}
433 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
434 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
436 | Initialize layer mlx5_core on node
438 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
439 | | ... | Currently no operation.
443 | Initialize layer interface
445 | | ... | Physical interfaces variables to be created on all DUTs.
447 | | ... | *Arguments:*
448 | | ... | - count - Number of untagged interfaces variables. Type: integer
452 | | ... | \| Initialize layer interface \| 1 \|
454 | | [Arguments] | ${count}=${1}
456 | | FOR | ${dut} | IN | @{duts}
457 | | | Initialize layer interface on node | ${dut} | count=${count}
460 | Initialize layer interface on node
462 | | ... | Physical interfaces variables to be created on all DUTs.
464 | | ... | *Arguments:*
465 | | ... | - dut - DUT node. Type: string
466 | | ... | - count - Number of baseline interface variables. Type: integer
470 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
472 | | [Arguments] | ${dut} | ${count}=${1}
474 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
475 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
478 | Initialize layer interface on node on PF
480 | | ... | Baseline interfaces variables to be created.
482 | | ... | *Arguments:*
483 | | ... | - dut - DUT node. Type: string
484 | | ... | - pf - NIC physical function (physical port). Type: integer
485 | | ... | - count - Number of baseline interface variables. Type: integer
489 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
491 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
493 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
494 | | | Set Test Variable
495 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
498 | Initialize layer bonding
500 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
502 | | ... | *Arguments:*
503 | | ... | - bond_mode - Link bonding mode. Type: string
504 | | ... | - lb_mode - Load balance mode. Type: string
505 | | ... | - count - Number of bond interface variables. Type: integer
509 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
511 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
513 | | FOR | ${dut} | IN | @{duts}
514 | | | Initialize layer bonding on node
515 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
516 | | | ... | count=${count}
518 | | Set Test Variable | ${int} | bond
520 | Initialize layer bonding on node
522 | | ... | Bonded interface and variables to be created on across east and
523 | | ... | west DUT's node interfaces.
525 | | ... | *Arguments:*
526 | | ... | - dut - DUT node. Type: string
527 | | ... | - bond_mode - Link bonding mode. Type: string
528 | | ... | - lb_mode - Load balance mode. Type: string
529 | | ... | - count - Number of bond interface variables. Type: integer
533 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
535 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
537 | | ${if_index}= | VPP Create Bond Interface
538 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
539 | | ... | mac=00:00:00:01:01:01
540 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
541 | | VPP Add Bond Member
542 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
543 | | VPP Add Bond Member
544 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
545 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
546 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
547 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
550 | Initialize layer dot1q
552 | | ... | Dot1q interfaces and variables to be created on all DUTs.
554 | | ... | *Arguments:*
555 | | ... | - count - Number of chains.
556 | | ... | Type: integer
557 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
558 | | ... | Type: boolean
559 | | ... | - start - Id of first chain, allows adding chains during test.
560 | | ... | Type: integer
562 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
564 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
566 | | FOR | ${dut} | IN | @{duts}
567 | | | Initialize layer dot1q on node
568 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
569 | | | ... | start=${start}
571 | | Set Test Variable | ${int} | dot1q
573 | Initialize layer dot1q on node
575 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
577 | | ... | *Arguments:*
578 | | ... | - dut - DUT node.
579 | | ... | Type: string
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
589 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
591 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
592 | | ... | ${start}=${1}
594 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
595 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
596 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
599 | Initialize layer dot1q on node on PF
601 | | ... | Dot1q interfaces and variables to be created on all DUT's node
602 | | ... | interfaces.
604 | | ... | *Arguments:*
605 | | ... | - dut - DUT node.
606 | | ... | Type: string
607 | | ... | - pf - NIC physical function (physical port).
608 | | ... | Type: integer
609 | | ... | - count - Number of chains.
610 | | ... | Type: integer
611 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
612 | | ... | Type: boolean
613 | | ... | - start - Id of first chain, allows adding chains during test.
614 | | ... | Type: integer
618 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
620 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
621 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
623 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
624 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
625 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
626 | | | # First id results in non-None indices, after that _1_ are defined.
627 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
628 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
629 | | | ${_dot1q}= | Create List | ${_dot1q}
630 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
633 | Initialize layer dot1q on node on PF for chain
635 | | ... | Optionally create tag popping subinterface per chain.
636 | | ... | Return interface indices for dot1q layer interfaces,
637 | | ... | or Nones if subinterfaces are not created.
639 | | ... | *Arguments:*
640 | | ... | - dut - DUT node.
641 | | ... | Type: string
642 | | ... | - pf - NIC physical function (physical port).
643 | | ... | Type: integer
644 | | ... | - id - Positive index of the chain.
645 | | ... | Type: integer
646 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
647 | | ... | Type: boolean
651 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
652 | | ... | \| 1 \| 1 \| True \|
654 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
656 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
658 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
659 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
660 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
661 | | ... | ${_vlan}[0] | ${_default}
662 | | ${_name} | ${_index}= | Create Vlan Subinterface
663 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
664 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
665 | | Configure L2 tag rewrite method on interfaces
666 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
667 | | Return From Keyword | ${_index}
669 | Initialize layer ip4vxlan
671 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
673 | | ... | *Arguments:*
674 | | ... | - count - Number of vxlan interfaces.
675 | | ... | Type: integer
676 | | ... | - start - Id of first chain, allows adding chains during test.
677 | | ... | Type: integer
679 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
681 | | [Arguments] | ${count}=${1} | ${start}=${1}
683 | | FOR | ${dut} | IN | @{duts}
684 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
685 | | | ... | start=${start}
687 | | Set Test Variable | ${int} | ip4vxlan
689 | Initialize layer ip4vxlan on node
691 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
692 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
693 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
694 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
696 | | ... | *Arguments:*
697 | | ... | - dut - DUT node.
698 | | ... | Type: string
699 | | ... | - count - Number of vxlan interfaces.
700 | | ... | Type: integer
701 | | ... | - start - Id of first chain, allows adding chains during test.
702 | | ... | Type: integer
706 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
708 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
710 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
711 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
712 | | | ... | count=${count} | start=${start}
715 | Initialize layer ip4vxlan on node on PF
717 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
718 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
719 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
720 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
722 | | ... | *Arguments:*
723 | | ... | - dut - DUT node.
724 | | ... | Type: string
725 | | ... | - pf - NIC physical function (physical port).
726 | | ... | Type: integer
727 | | ... | - count - Number of vxlan interfaces.
728 | | ... | Type: integer
729 | | ... | - start - Id of first chain, allows adding chains during test.
730 | | ... | Type: integer
734 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
736 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
738 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
739 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
740 | | ... | 172.${pf}6.0.1 | 24
741 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
742 | | | ${_subnet}= | Evaluate | ${id} - 1
743 | | | ${_vni}= | Evaluate | ${id} - 1
744 | | | ${_ip4vxlan}= | Create VXLAN interface
745 | | | ... | ${nodes['${dut}']} | ${_vni}
746 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
748 | | | ... | Set Variable If | '${dut}' == 'DUT1'
749 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
751 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
752 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
753 | | | ${_even}= | Evaluate | ${pf} % 2
754 | | | ${_mac}= | Set Variable If | ${_even}
755 | | | ... | ${_prev_mac} | ${_next_mac}
756 | | | VPP Add IP Neighbor
757 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
758 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
760 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
761 | | | ... | gateway=172.${pf}6.${_subnet}.2
762 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
763 | | | Set VXLAN Bypass
764 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
765 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
766 | | | Set Test Variable
767 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
770 | Configure vhost interfaces
772 | | ... | Create two Vhost-User interfaces on defined VPP node.
774 | | ... | *Arguments:*
775 | | ... | - ${dut_node} - DUT node.
776 | | ... | Type: dictionary
777 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
778 | | ... | Type: string
779 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
780 | | ... | Type: string
781 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
782 | | ... | Type: string
783 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
784 | | ... | Type: string
785 | | ... | - ${is_server} - Server side of connection (Optional).
786 | | ... | Type: boolean
787 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
788 | | ... | Type: integer
790 | | ... | _NOTE:_ This KW sets following test case variable:
791 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
792 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
796 | | ... | \| Configure vhost interfaces \
797 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
799 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
800 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
801 | | ... | ${virtio_feature_mask}=${None}
803 | | ${vhost_1}= | Vpp Create Vhost User Interface
804 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
805 | | ... | virtio_feature_mask=${virtio_feature_mask}
806 | | ${vhost_2}= | Vpp Create Vhost User Interface
807 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
808 | | ... | virtio_feature_mask=${virtio_feature_mask}
809 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
810 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
811 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
812 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
813 | | Set Interface State | ${dut_node} | ${vhost_1} | up
814 | | Set Interface State | ${dut_node} | ${vhost_2} | up
815 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
816 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
817 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
818 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
821 | | [Documentation] | Get vhost-user dump.
823 | | ... | *Arguments:*
824 | | ... | - dut - DUT node data.
825 | | ... | Type: dictionary
827 | | [Arguments] | ${dut}
829 | | ${vhost_dump}= | Vhost User Dump | ${dut}
830 | | Return From Keyword | ${vhost_dump}