Fix: detaches the attached XDP/BPF program before af_xdp test run
[csit.git] / resources / libraries / robot / shared / interfaces.robot
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:
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 *** Settings ***
14 | Library | resources.libraries.python.InterfaceUtil
15 | Library | resources.libraries.python.NodePath
16 | Library | resources.libraries.python.VhostUser
17
18 *** Variables ***
19 | ${dpdk_no_tx_checksum_offload}= | ${True}
20
21 *** Keywords ***
22 | Set single interfaces in path up
23 | | [Documentation]
24 | | ... | *Set UP state on single physical VPP interfaces in path on all DUT
25 | | ... | nodes and set maximal MTU.*
26 | |
27 | | ... | *Arguments:*
28 | | ... | - pf - NIC physical function (physical port).
29 | | ... | Type: integer
30 | |
31 | | ... | *Example:*
32 | |
33 | | ... | \| Set single interfaces in path \| 1 \|
34 | |
35 | | [Arguments] | ${pf}=${1}
36 | |
37 | | FOR | ${dut} | IN | @{duts}
38 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
39 | | END
40 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
41
42 | Set interfaces in path up
43 | | [Documentation]
44 | | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set
45 | | ... | maximal MTU.*
46 | |
47 | | ... | *Arguments:*
48 | | ... | - validate - Validate interfaces are up.
49 | | ... | Type: boolean
50 | |
51 | | [Arguments] | ${validate}=${True}
52 | |
53 | | FOR | ${dut} | IN | @{duts}
54 | | | Set interfaces in path up on node | ${dut}
55 | | END
56 | | Run Keyword If | ${validate}
57 | | ... | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
58
59 | Set interfaces in path up on node
60 | | [Documentation]
61 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
62 | | ... | set maximal MTU.*
63 | |
64 | | ... | *Arguments:*
65 | | ... | - dut - DUT node on which to set the interfaces up.
66 | | ... | Type: string
67 | |
68 | | ... | *Example:*
69 | |
70 | | ... | \| Set interfaces in path up on node \| DUT1 \|
71 | |
72 | | [Arguments] | ${dut}
73 | |
74 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
75 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
76 | | END
77
78 | Set interfaces in path up on node on PF
79 | | [Documentation]
80 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
81 | | ... | set maximal MTU.*
82 | |
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
88 | |
89 | | ... | *Example:*
90 | |
91 | | ... | \| Set interfaces in path up on node on PF \| DUT1 \| 1 \|
92 | |
93 | | [Arguments] | ${dut} | ${pf}
94 | |
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}
101 | | END
102
103 | Pre-initialize layer driver
104 | | [Documentation]
105 | | ... | Pre-initialize driver based interfaces on each DUT.
106 | |
107 | | ... | *Arguments:*
108 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
109 | | ... | Type: string
110 | |
111 | | ... | *Example:*
112 | |
113 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
114 | |
115 | | [Arguments] | ${driver}
116 | |
117 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
118
119 | Pre-initialize layer tap on all DUTs
120 | | [Documentation]
121 | | ... | Pre-initialize tap driver. Currently no operation.
122 | |
123 | | No operation
124
125 | Pre-initialize layer vhost on all DUTs
126 | | [Documentation]
127 | | ... | Pre-initialize vhost driver. Currently no operation.
128 | |
129 | | No operation
130
131 | Pre-initialize layer vfio-pci on all DUTs
132 | | [Documentation]
133 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
134 | | ... | config on all DUTs.
135 | |
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}
157 | | END
158
159 | Pre-initialize layer avf on all DUTs
160 | | [Documentation]
161 | | ... | Pre-initialize avf driver. Currently no operation.
162 | |
163 | | No operation
164
165 | Pre-initialize layer af_xdp on all DUTs
166 | | [Documentation]
167 | | ... | Pre-initialize af_xdp driver.
168 | |
169 | | FOR | ${dut} | IN | @{duts}
170 | | | Set Interface State PCI
171 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | state=up
172 | | | Set Interface XDP off
173 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci}
174 | | | Set Interface Channels
175 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | num_queues=${rxq_count_int}
176 | | | ... | channel=combined
177 | | END
178
179 | Pre-initialize layer rdma-core on all DUTs
180 | | [Documentation]
181 | | ... | Pre-initialize rdma-core driver.
182 | |
183 | | FOR | ${dut} | IN | @{duts}
184 | | | Run Keyword If | ${jumbo}
185 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
186 | | | ... | ELSE
187 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518
188 | | | Set Interface Flow Control
189 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
190 | | END
191
192 | Pre-initialize layer mlx5_core on all DUTs
193 | | [Documentation]
194 | | ... | Pre-initialize mlx5_core driver.
195 | |
196 | | FOR | ${dut} | IN | @{duts}
197 | | | Run Keyword If | ${jumbo}
198 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
199 | | | ... | ELSE
200 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1518
201 | | | Set Interface Flow Control
202 | | | ... | ${nodes['${dut}']} | ${${dut}_pf_pci} | rxf="off" | txf="off"
203 | | END
204 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
205 | | Run Keyword If | ${index} >= 0 | Return From Keyword
206 | | FOR | ${dut} | IN | @{duts}
207 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
208 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
209 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
210 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
211 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
212 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
213 | | | Run Keyword If | not ${jumbo}
214 | | | ... | ${dut}.Add DPDK No Multi Seg
215 | | | Run Keyword If | ${nic_rxq_size} > 0
216 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
217 | | | Run Keyword If | ${nic_txq_size} > 0
218 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
219 | | | Run Keyword If | '${crypto_type}' != '${None}'
220 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
221 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
222 | | END
223
224 | Initialize layer driver
225 | | [Documentation]
226 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
227 | | ... | brought up.
228 | |
229 | | ... | *Arguments:*
230 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
231 | | ... | Type: string
232 | | ... | - validate - Validate interfaces are up.
233 | | ... | Type: boolean
234 | |
235 | | ... | *Example:*
236 | |
237 | | ... | \| Initialize layer driver \| vfio-pci \|
238 | |
239 | | [Arguments] | ${driver} | ${validate}=${True}
240 | |
241 | | FOR | ${dut} | IN | @{duts}
242 | | | Initialize layer driver on node | ${dut} | ${driver}
243 | | END
244 | | Set Test Variable | ${int} | vf
245 | | Set interfaces in path up | validate=${validate}
246
247 | Initialize layer driver on node
248 | | [Documentation]
249 | | ... | Initialize driver based interfaces on DUT.
250 | |
251 | | ... | *Arguments:*
252 | | ... | - dut - DUT node.
253 | | ... | Type: string
254 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
255 | | ... | Type: string
256 | |
257 | | ... | *Example:*
258 | |
259 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
260 | |
261 | | [Arguments] | ${dut} | ${driver}
262 | |
263 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
264 | | | ${_vf}=
265 | | | ... | Copy List | ${${dut}_${int}${pf}}
266 | | | ${_ip4_addr}=
267 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
268 | | | ${_ip4_prefix}=
269 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
270 | | | ${_mac}=
271 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
272 | | | ${_pci}=
273 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
274 | | | ${_vlan}=
275 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
276 | | | Set Test Variable
277 | | | ... | ${${dut}_vf${pf}} | ${_vf}
278 | | | Set Test Variable
279 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
280 | | | Set Suite Variable
281 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
282 | | | Set Test Variable
283 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
284 | | | Set Test Variable
285 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
286 | | | Set Test Variable
287 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
288 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
289 | | END
290
291 | Initialize layer tap on node
292 | | [Documentation]
293 | | ... | Initialize tap interfaces on DUT.
294 | |
295 | | ... | *Arguments:*
296 | | ... | - dut - DUT node.
297 | | ... | Type: string
298 | | ... | - pf - TAP ID (logical port).
299 | | ... | Type: integer
300 | |
301 | | ... | *Example:*
302 | |
303 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
304 | |
305 | | [Arguments] | ${dut} | ${pf}
306 | |
307 | | Create Namespace
308 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
309 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
310 | | ${_tap}=
311 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
312 | | ... | host_namespace=tap${${pf}-1}_namespace
313 | | ... | num_rx_queues=${rxq_count_int}
314 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
315 | | ... | tap_feature_mask=${tap_feature_mask}
316 | | ${_mac}=
317 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
318 | | ${_tap}= | Create List | ${_tap}
319 | | ${_mac}= | Create List | ${_mac}
320 | | Vhost User Affinity
321 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
322 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
323 | | Set Test Variable
324 | | ... | ${${dut}_vf${pf}} | ${_tap}
325 | | Set Test Variable
326 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
327
328 | Initialize layer vhost on node
329 | | [Documentation]
330 | | ... | Initialize vhost interfaces on DUT.
331 | |
332 | | ... | *Arguments:*
333 | | ... | - dut - DUT node.
334 | | ... | Type: string
335 | | ... | - pf - VHOST ID (logical port).
336 | | ... | Type: integer
337 | |
338 | | ... | *Example:*
339 | |
340 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
341 | |
342 | | [Arguments] | ${dut} | ${pf}
343 | |
344 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
345 | | ${vhost}= | Vpp Create Vhost User Interface
346 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
347 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
348 | | ${_mac}=
349 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
350 | | ${_vhost}= | Create List | ${_vhost}
351 | | ${_mac}= | Create List | ${_mac}
352 | | Set Test Variable
353 | | ... | ${${dut}_vf${pf}} | ${_vhost}
354 | | Set Test Variable
355 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
356
357 | Initialize layer vfio-pci on node
358 | | [Documentation]
359 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
360 | | ... | Currently no operation.
361 | |
362 | | ... | *Arguments:*
363 | | ... | - dut - DUT node. Type: string
364 | | ... | - pf - NIC physical function (physical port). Type: integer
365 | |
366 | | ... | *Example:*
367 | |
368 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
369 | |
370 | | [Arguments] | ${dut} | ${pf}
371 | |
372 | | No operation
373
374 | Initialize layer avf on node
375 | | [Documentation]
376 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
377 | |
378 | | ... | *Arguments:*
379 | | ... | - dut - DUT node. Type: string
380 | | ... | - pf - NIC physical function (physical port). Type: integer
381 | |
382 | | ... | *Example:*
383 | |
384 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
385 | |
386 | | [Arguments] | ${dut} | ${pf}
387 | |
388 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
389 | | | ${_avf}= | VPP Create AVF Interface
390 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
391 | | | ... | num_rx_queues=${rxq_count_int}
392 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
393 | | | ${_ip4}=
394 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
395 | | | ${_ip4_prefix}=
396 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
397 | | | ${_mac}=
398 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
399 | | | ${_pci}=
400 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
401 | | | ${_vlan}=
402 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
403 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
404 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
405 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
406 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
407 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
408 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
409 | | END
410
411 | Initialize layer af_xdp on node
412 | | [Documentation]
413 | | ... | Initialize AF_XDP (eBPF) interfaces on DUT on NIC PF.
414 | |
415 | | ... | *Arguments:*
416 | | ... | - dut - DUT node. Type: string
417 | | ... | - pf - NIC physical function (physical port). Type: integer
418 | |
419 | | ... | *Example:*
420 | |
421 | | ... | \| Initialize layer af_xdp on node \| DUT1 \| 1 \|
422 | |
423 | | [Arguments] | ${dut} | ${pf}
424 | |
425 | | ${_af_xdp}= | VPP Create AF XDP Interface
426 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
427 | | ... | num_rx_queues=${65535}
428 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
429 | | ${cpu_skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM}+${CPU_CNT_MAIN}
430 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+${cpu_count_int}
431 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+(${pf}-${1})*${rxq_count_int}
432 | | Set Interface IRQs Affinity
433 | | ... | ${nodes['${dut}']} | ${_af_xdp}
434 | | ... | cpu_skip_cnt=${cpu_skip_cnt} | cpu_cnt=${rxq_count_int}
435 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_af_xdp}
436
437 | Initialize layer rdma-core on node
438 | | [Documentation]
439 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
440 | |
441 | | ... | *Arguments:*
442 | | ... | - dut - DUT node. Type: string
443 | | ... | - pf - NIC physical function (physical port). Type: integer
444 | |
445 | | ... | *Example:*
446 | |
447 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
448 | |
449 | | [Arguments] | ${dut} | ${pf}
450 | |
451 | | ${_rdma}= | VPP Create Rdma Interface
452 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
453 | | ... | num_rx_queues=${rxq_count_int}
454 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
455 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
456
457 | Initialize layer mlx5_core on node
458 | | [Documentation]
459 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
460 | | ... | Currently no operation.
461 | |
462 | | ... | *Arguments:*
463 | | ... | - dut - DUT node. Type: string
464 | | ... | - pf - NIC physical function (physical port). Type: integer
465 | |
466 | | ... | *Example:*
467 | |
468 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
469 | |
470 | | [Arguments] | ${dut} | ${pf}
471 | |
472 | | No operation
473
474 | Initialize layer interface
475 | | [Documentation]
476 | | ... | Physical interfaces variables to be created on all DUTs.
477 | |
478 | | ... | *Arguments:*
479 | | ... | - count - Number of untagged interfaces variables. Type: integer
480 | |
481 | | ... | *Example:*
482 | |
483 | | ... | \| Initialize layer interface \| 1 \|
484 | |
485 | | [Arguments] | ${count}=${1}
486 | |
487 | | FOR | ${dut} | IN | @{duts}
488 | | | Initialize layer interface on node | ${dut} | count=${count}
489 | | END
490
491 | Initialize layer interface on node
492 | | [Documentation]
493 | | ... | Physical interfaces variables to be created on all DUTs.
494 | |
495 | | ... | *Arguments:*
496 | | ... | - dut - DUT node. Type: string
497 | | ... | - count - Number of baseline interface variables. Type: integer
498 | |
499 | | ... | *Example:*
500 | |
501 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
502 | |
503 | | [Arguments] | ${dut} | ${count}=${1}
504 | |
505 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
506 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
507 | | END
508
509 | Initialize layer interface on node on PF
510 | | [Documentation]
511 | | ... | Baseline interfaces variables to be created.
512 | |
513 | | ... | *Arguments:*
514 | | ... | - dut - DUT node. Type: string
515 | | ... | - pf - NIC physical function (physical port). Type: integer
516 | | ... | - count - Number of baseline interface variables. Type: integer
517 | |
518 | | ... | *Example:*
519 | |
520 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
521 | |
522 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
523 | |
524 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
525 | | | Set Test Variable
526 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
527 | | END
528
529 | Initialize layer bonding
530 | | [Documentation]
531 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
532 | |
533 | | ... | *Arguments:*
534 | | ... | - bond_mode - Link bonding mode. Type: string
535 | | ... | - lb_mode - Load balance mode. Type: string
536 | | ... | - count - Number of bond interface variables. Type: integer
537 | |
538 | | ... | *Example:*
539 | |
540 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
541 | |
542 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
543 | |
544 | | FOR | ${dut} | IN | @{duts}
545 | | | Initialize layer bonding on node
546 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
547 | | | ... | count=${count}
548 | | END
549 | | Set Test Variable | ${int} | bond
550
551 | Initialize layer bonding on node
552 | | [Documentation]
553 | | ... | Bonded interface and variables to be created on across east and
554 | | ... | west DUT's node interfaces.
555 | |
556 | | ... | *Arguments:*
557 | | ... | - dut - DUT node. Type: string
558 | | ... | - bond_mode - Link bonding mode. Type: string
559 | | ... | - lb_mode - Load balance mode. Type: string
560 | | ... | - count - Number of bond interface variables. Type: integer
561 | |
562 | | ... | *Example:*
563 | |
564 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
565 | |
566 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
567 | |
568 | | ${if_index}= | VPP Create Bond Interface
569 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
570 | | ... | mac=00:00:00:01:01:01
571 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
572 | | VPP Add Bond Member
573 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
574 | | VPP Add Bond Member
575 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
576 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
577 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
578 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
579 | | END
580
581 | Initialize layer dot1q
582 | | [Documentation]
583 | | ... | Dot1q interfaces and variables to be created on all DUTs.
584 | |
585 | | ... | *Arguments:*
586 | | ... | - count - Number of chains.
587 | | ... | Type: integer
588 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
589 | | ... | Type: boolean
590 | | ... | - start - Id of first chain, allows adding chains during test.
591 | | ... | Type: integer
592 | |
593 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
594 | |
595 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
596 | |
597 | | FOR | ${dut} | IN | @{duts}
598 | | | Initialize layer dot1q on node
599 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
600 | | | ... | start=${start}
601 | | END
602 | | Set Test Variable | ${int} | dot1q
603
604 | Initialize layer dot1q on node
605 | | [Documentation]
606 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
607 | |
608 | | ... | *Arguments:*
609 | | ... | - dut - DUT node.
610 | | ... | Type: string
611 | | ... | - count - Number of chains.
612 | | ... | Type: integer
613 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
614 | | ... | Type: boolean
615 | | ... | - start - Id of first chain, allows adding chains during test.
616 | | ... | Type: integer
617 | |
618 | | ... | *Example:*
619 | |
620 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
621 | |
622 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
623 | | ... | ${start}=${1}
624 | |
625 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
626 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
627 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
628 | | END
629
630 | Initialize layer dot1q on node on PF
631 | | [Documentation]
632 | | ... | Dot1q interfaces and variables to be created on all DUT's node
633 | | ... | interfaces.
634 | |
635 | | ... | *Arguments:*
636 | | ... | - dut - DUT node.
637 | | ... | Type: string
638 | | ... | - pf - NIC physical function (physical port).
639 | | ... | Type: integer
640 | | ... | - count - Number of chains.
641 | | ... | Type: integer
642 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
643 | | ... | Type: boolean
644 | | ... | - start - Id of first chain, allows adding chains during test.
645 | | ... | Type: integer
646 | |
647 | | ... | *Example:*
648 | |
649 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
650 | |
651 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
652 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
653 | |
654 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
655 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
656 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
657 | | | # First id results in non-None indices, after that _1_ are defined.
658 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
659 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
660 | | | ${_dot1q}= | Create List | ${_dot1q}
661 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
662 | | END
663
664 | Initialize layer dot1q on node on PF for chain
665 | | [Documentation]
666 | | ... | Optionally create tag popping subinterface per chain.
667 | | ... | Return interface indices for dot1q layer interfaces,
668 | | ... | or Nones if subinterfaces are not created.
669 | |
670 | | ... | *Arguments:*
671 | | ... | - dut - DUT node.
672 | | ... | Type: string
673 | | ... | - pf - NIC physical function (physical port).
674 | | ... | Type: integer
675 | | ... | - id - Positive index of the chain.
676 | | ... | Type: integer
677 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
678 | | ... | Type: boolean
679 | |
680 | | ... | *Example:*
681 | |
682 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
683 | | ... | \| 1 \| 1 \| True \|
684 | |
685 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
686 | |
687 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
688 | | ... | ${NONE}
689 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
690 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
691 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
692 | | ... | ${_vlan}[0] | ${_default}
693 | | ${_name} | ${_index}= | Create Vlan Subinterface
694 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
695 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
696 | | Configure L2 tag rewrite method on interfaces
697 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
698 | | Return From Keyword | ${_index}
699
700 | Initialize layer ip4vxlan
701 | | [Documentation]
702 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
703 | |
704 | | ... | *Arguments:*
705 | | ... | - count - Number of vxlan interfaces.
706 | | ... | Type: integer
707 | | ... | - start - Id of first chain, allows adding chains during test.
708 | | ... | Type: integer
709 | |
710 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
711 | |
712 | | [Arguments] | ${count}=${1} | ${start}=${1}
713 | |
714 | | FOR | ${dut} | IN | @{duts}
715 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
716 | | | ... | start=${start}
717 | | END
718 | | Set Test Variable | ${int} | ip4vxlan
719
720 | Initialize layer ip4vxlan on node
721 | | [Documentation]
722 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
723 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
724 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
725 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
726 | |
727 | | ... | *Arguments:*
728 | | ... | - dut - DUT node.
729 | | ... | Type: string
730 | | ... | - count - Number of vxlan interfaces.
731 | | ... | Type: integer
732 | | ... | - start - Id of first chain, allows adding chains during test.
733 | | ... | Type: integer
734 | |
735 | | ... | *Example:*
736 | |
737 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
738 | |
739 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
740 | |
741 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
742 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
743 | | | ... | count=${count} | start=${start}
744 | | END
745
746 | Initialize layer ip4vxlan on node on PF
747 | | [Documentation]
748 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
749 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
750 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
751 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
752 | |
753 | | ... | *Arguments:*
754 | | ... | - dut - DUT node.
755 | | ... | Type: string
756 | | ... | - pf - NIC physical function (physical port).
757 | | ... | Type: integer
758 | | ... | - count - Number of vxlan interfaces.
759 | | ... | Type: integer
760 | | ... | - start - Id of first chain, allows adding chains during test.
761 | | ... | Type: integer
762 | |
763 | | ... | *Example:*
764 | |
765 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
766 | |
767 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
768 | |
769 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
770 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
771 | | ... | 172.${pf}6.0.1 | 24
772 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
773 | | | ${_subnet}= | Evaluate | ${id} - 1
774 | | | ${_vni}= | Evaluate | ${id} - 1
775 | | | ${_ip4vxlan}= | Create VXLAN interface
776 | | | ... | ${nodes['${dut}']} | ${_vni}
777 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
778 | | | ${_prev_mac}=
779 | | | ... | Set Variable If | '${dut}' == 'DUT1'
780 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
781 | | | ${_next_mac}=
782 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
783 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
784 | | | ${_even}= | Evaluate | ${pf} % 2
785 | | | ${_mac}= | Set Variable If | ${_even}
786 | | | ... | ${_prev_mac} | ${_next_mac}
787 | | | VPP Add IP Neighbor
788 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
789 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
790 | | | VPP Route Add
791 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
792 | | | ... | gateway=172.${pf}6.${_subnet}.2
793 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
794 | | | Set VXLAN Bypass
795 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
796 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
797 | | | Set Test Variable
798 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
799 | | END
800
801 | Configure vhost interfaces
802 | | [Documentation]
803 | | ... | Create two Vhost-User interfaces on defined VPP node.
804 | |
805 | | ... | *Arguments:*
806 | | ... | - ${dut_node} - DUT node.
807 | | ... | Type: dictionary
808 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
809 | | ... | Type: string
810 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
811 | | ... | Type: string
812 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
813 | | ... | Type: string
814 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
815 | | ... | Type: string
816 | | ... | - ${is_server} - Server side of connection (Optional).
817 | | ... | Type: boolean
818 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
819 | | ... | Type: integer
820 | |
821 | | ... | _NOTE:_ This KW sets following test case variable:
822 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
823 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
824 | |
825 | | ... | *Example:*
826 | |
827 | | ... | \| Configure vhost interfaces \
828 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
829 | |
830 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
831 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
832 | | ... | ${virtio_feature_mask}=${None}
833 | |
834 | | ${vhost_1}= | Vpp Create Vhost User Interface
835 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
836 | | ... | virtio_feature_mask=${virtio_feature_mask}
837 | | ${vhost_2}= | Vpp Create Vhost User Interface
838 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
839 | | ... | virtio_feature_mask=${virtio_feature_mask}
840 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
841 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
842 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
843 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
844 | | Set Interface State | ${dut_node} | ${vhost_1} | up
845 | | Set Interface State | ${dut_node} | ${vhost_2} | up
846 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
847 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
848 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
849 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
850
851 | Get Vhost dump
852 | | [Documentation] | Get vhost-user dump.
853 | |
854 | | ... | *Arguments:*
855 | | ... | - dut - DUT node data.
856 | | ... | Type: dictionary
857 | |
858 | | [Arguments] | ${dut}
859 | |
860 | | ${vhost_dump}= | Vhost User Dump | ${dut}
861 | | Return From Keyword | ${vhost_dump}