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