style(ipsec): Unify mutiline strings
[csit.git] / resources / libraries / robot / shared / interfaces.robot
1 # Copyright (c) 2024 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
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 Dev Default RXQ | ${rxq_count_int}
202 | | | Run Keyword If | not ${jumbo}
203 | | | ... | ${dut}.Add DPDK No Multi Seg
204 | | | Run Keyword If | ${nic_rxq_size} > 0
205 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
206 | | | Run Keyword If | ${nic_txq_size} > 0
207 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
208 | | | Run Keyword If | '${crypto_type}' != '${None}'
209 | | | ... | ${dut}.Add DPDK Cryptodev | ${dp_count_int}
210 | | | Run Keyword | ${dut}.Add DPDK Max Simd Bitwidth | ${GRAPH_NODE_VARIANT}
211 | | END
212
213 | Initialize layer driver
214 | | [Documentation]
215 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
216 | | ... | brought up.
217 | |
218 | | ... | *Arguments:*
219 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
220 | | ... | Type: string
221 | | ... | - validate - Validate interfaces are up.
222 | | ... | Type: boolean
223 | |
224 | | ... | *Example:*
225 | |
226 | | ... | \| Initialize layer driver \| vfio-pci \|
227 | |
228 | | [Arguments] | ${driver} | ${validate}=${True}
229 | |
230 | | FOR | ${dut} | IN | @{duts}
231 | | | Initialize layer driver on node | ${dut} | ${driver}
232 | | END
233 | | Set Test Variable | ${int} | vf
234 | | Set interfaces in path up | validate=${validate}
235
236 | Initialize layer driver on node
237 | | [Documentation]
238 | | ... | Initialize driver based interfaces on DUT.
239 | |
240 | | ... | *Arguments:*
241 | | ... | - dut - DUT node.
242 | | ... | Type: string
243 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
244 | | ... | Type: string
245 | |
246 | | ... | *Example:*
247 | |
248 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
249 | |
250 | | [Arguments] | ${dut} | ${driver}
251 | |
252 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
253 | | | ${_vf}=
254 | | | ... | Copy List | ${${dut}_${int}${pf}}
255 | | | ${_ip4_addr}=
256 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
257 | | | ${_ip4_prefix}=
258 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
259 | | | ${_mac}=
260 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
261 | | | ${_pci}=
262 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
263 | | | ${_vlan}=
264 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
265 | | | Set Test Variable
266 | | | ... | ${${dut}_vf${pf}} | ${_vf}
267 | | | Set Test Variable
268 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
269 | | | Set Suite Variable
270 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
271 | | | Set Test Variable
272 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
273 | | | Set Test Variable
274 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
275 | | | Set Test Variable
276 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
277 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
278 | | END
279
280 | Initialize layer tap on node
281 | | [Documentation]
282 | | ... | Initialize tap interfaces on DUT.
283 | |
284 | | ... | *Arguments:*
285 | | ... | - dut - DUT node.
286 | | ... | Type: string
287 | | ... | - pf - TAP ID (logical port).
288 | | ... | Type: integer
289 | |
290 | | ... | *Example:*
291 | |
292 | | ... | \| Initialize layer tap on node \| DUT1 \| 0 \|
293 | |
294 | | [Arguments] | ${dut} | ${pf}
295 | |
296 | | Create Namespace
297 | | ... | ${nodes['${dut}']} | tap${${pf}-1}_namespace
298 | | ${tap_feature_mask}= | Create Tap feature mask | gso=${enable_gso}
299 | | ${_tap}=
300 | | ... | And Add Tap Interface | ${nodes['${dut}']} | tap${${pf}-1}
301 | | ... | host_namespace=tap${${pf}-1}_namespace
302 | | ... | num_rx_queues=${rxq_count_int}
303 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
304 | | ... | tap_feature_mask=${tap_feature_mask}
305 | | ${_mac}=
306 | | ... | Get Interface MAC | ${nodes['${dut}']} | tap${pf}
307 | | ${_tap}= | Create List | ${_tap}
308 | | ${_mac}= | Create List | ${_mac}
309 | | Vhost User Affinity
310 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0]
311 | | ... | skip_cnt=${${CPU_CNT_MAIN}+${CPU_CNT_SYSTEM}+${cpu_count_int}}
312 | | Set Test Variable
313 | | ... | ${${dut}_vf${pf}} | ${_tap}
314 | | Set Test Variable
315 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
316
317 | Initialize layer vhost on node
318 | | [Documentation]
319 | | ... | Initialize vhost interfaces on DUT.
320 | |
321 | | ... | *Arguments:*
322 | | ... | - dut - DUT node.
323 | | ... | Type: string
324 | | ... | - pf - VHOST ID (logical port).
325 | | ... | Type: integer
326 | |
327 | | ... | *Example:*
328 | |
329 | | ... | \| Initialize layer vhost on node \| DUT1 \| 0 \|
330 | |
331 | | [Arguments] | ${dut} | ${pf}
332 | |
333 | | ${virtio_feature_mask}= | Create Virtio feature mask | gso=${enable_gso}
334 | | ${vhost}= | Vpp Create Vhost User Interface
335 | | ... | ${nodes['${dut}']} | /var/run/vpp/sock-${pf}-1
336 | | ... | is_server=${True} | virtio_feature_mask=${virtio_feature_mask}
337 | | ${_mac}=
338 | | ... | Get Interface MAC | ${nodes['${dut}']} | vhost${pf}
339 | | ${_vhost}= | Create List | ${_vhost}
340 | | ${_mac}= | Create List | ${_mac}
341 | | Set Test Variable
342 | | ... | ${${dut}_vf${pf}} | ${_vhost}
343 | | Set Test Variable
344 | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
345
346 | Initialize layer vfio-pci on node
347 | | [Documentation]
348 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
349 | | ... | Currently just set MTU to the recommended value.
350 | |
351 | | ... | *Arguments:*
352 | | ... | - dut - DUT node. Type: string
353 | | ... | - pf - NIC physical function (physical port). Type: integer
354 | |
355 | | ... | *Example:*
356 | |
357 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
358 | |
359 | | [Arguments] | ${dut} | ${pf}
360 | |
361 | | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
362 | | VPP Set Interface MTU
363 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
364
365 | Initialize layer avf on node
366 | | [Documentation]
367 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
368 | |
369 | | ... | *Arguments:*
370 | | ... | - dut - DUT node. Type: string
371 | | ... | - pf - NIC physical function (physical port). Type: integer
372 | |
373 | | ... | *Example:*
374 | |
375 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
376 | |
377 | | [Arguments] | ${dut} | ${pf}
378 | |
379 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
380 | | | ${_avf}= | VPP Create AVF Interface
381 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
382 | | | ... | num_rx_queues=${rxq_count_int}
383 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
384 | | | ${_ip4}=
385 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
386 | | | ${_ip4_prefix}=
387 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
388 | | | ${_mac}=
389 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
390 | | | ${_pci}=
391 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
392 | | | ${_vlan}=
393 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
394 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
395 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
396 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
397 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
398 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
399 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
400 | | END
401
402 | Initialize layer af_xdp on node
403 | | [Documentation]
404 | | ... | Initialize AF_XDP (eBPF) interfaces on DUT on NIC PF.
405 | |
406 | | ... | *Arguments:*
407 | | ... | - dut - DUT node. Type: string
408 | | ... | - pf - NIC physical function (physical port). Type: integer
409 | |
410 | | ... | *Example:*
411 | |
412 | | ... | \| Initialize layer af_xdp on node \| DUT1 \| 1 \|
413 | |
414 | | [Arguments] | ${dut} | ${pf}
415 | |
416 | | ${_af_xdp}= | VPP Create AF XDP Interface
417 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
418 | | ... | num_rx_queues=${65535}
419 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
420 | | ${cpu_skip_cnt}= | Evaluate | ${CPU_CNT_SYSTEM}+${CPU_CNT_MAIN}
421 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+${cpu_count_int}
422 | | ${cpu_skip_cnt}= | Evaluate | ${cpu_skip_cnt}+(${pf}-${1})*${rxq_count_int}
423 | | Set Interface IRQs Affinity
424 | | ... | ${nodes['${dut}']} | ${_af_xdp}
425 | | ... | cpu_skip_cnt=${cpu_skip_cnt} | cpu_cnt=${rxq_count_int}
426 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_af_xdp}
427
428 | Initialize layer rdma-core on node
429 | | [Documentation]
430 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
431 | |
432 | | ... | *Arguments:*
433 | | ... | - dut - DUT node. Type: string
434 | | ... | - pf - NIC physical function (physical port). Type: integer
435 | |
436 | | ... | *Example:*
437 | |
438 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
439 | |
440 | | [Arguments] | ${dut} | ${pf}
441 | |
442 | | ${_rdma}= | VPP Create Rdma Interface
443 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
444 | | ... | num_rx_queues=${rxq_count_int}
445 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
446 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
447
448 | Initialize layer mlx5_core on node
449 | | [Documentation]
450 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
451 | | ... | Currently just set MTU to the recommended value.
452 | |
453 | | ... | *Arguments:*
454 | | ... | - dut - DUT node. Type: string
455 | | ... | - pf - NIC physical function (physical port). Type: integer
456 | |
457 | | ... | *Example:*
458 | |
459 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
460 | |
461 | | [Arguments] | ${dut} | ${pf}
462 | |
463 | | Set Interface State | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | down
464 | | VPP Set Interface MTU
465 | | ... | ${nodes['${dut}']} | ${${dut}_pf${pf}}[0] | mtu=${recommended_mtu}
466
467 | Initialize layer interface
468 | | [Documentation]
469 | | ... | Physical interfaces variables to be created on all DUTs.
470 | |
471 | | ... | *Arguments:*
472 | | ... | - count - Number of untagged interfaces variables. Type: integer
473 | |
474 | | ... | *Example:*
475 | |
476 | | ... | \| Initialize layer interface \| 1 \|
477 | |
478 | | [Arguments] | ${count}=${1}
479 | |
480 | | FOR | ${dut} | IN | @{duts}
481 | | | Initialize layer interface on node | ${dut} | count=${count}
482 | | END
483
484 | Initialize layer interface on node
485 | | [Documentation]
486 | | ... | Physical interfaces variables to be created on all DUTs.
487 | |
488 | | ... | *Arguments:*
489 | | ... | - dut - DUT node. Type: string
490 | | ... | - count - Number of baseline interface variables. Type: integer
491 | |
492 | | ... | *Example:*
493 | |
494 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
495 | |
496 | | [Arguments] | ${dut} | ${count}=${1}
497 | |
498 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
499 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
500 | | END
501
502 | Initialize layer interface on node on PF
503 | | [Documentation]
504 | | ... | Baseline interfaces variables to be created.
505 | |
506 | | ... | *Arguments:*
507 | | ... | - dut - DUT node. Type: string
508 | | ... | - pf - NIC physical function (physical port). Type: integer
509 | | ... | - count - Number of baseline interface variables. Type: integer
510 | |
511 | | ... | *Example:*
512 | |
513 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
514 | |
515 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
516 | |
517 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
518 | | | Set Test Variable
519 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
520 | | END
521
522 | Initialize layer bonding
523 | | [Documentation]
524 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
525 | |
526 | | ... | *Arguments:*
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
530 | |
531 | | ... | *Example:*
532 | |
533 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
534 | |
535 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
536 | |
537 | | FOR | ${dut} | IN | @{duts}
538 | | | Initialize layer bonding on node
539 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
540 | | | ... | count=${count}
541 | | END
542 | | Set Test Variable | ${int} | bond
543
544 | Initialize layer bonding on node
545 | | [Documentation]
546 | | ... | Bonded interface and variables to be created on across east and
547 | | ... | west DUT's node interfaces.
548 | |
549 | | ... | *Arguments:*
550 | | ... | - dut - DUT node. Type: string
551 | | ... | - bond_mode - Link bonding mode. Type: string
552 | | ... | - lb_mode - Load balance mode. Type: string
553 | | ... | - count - Number of bond interface variables. Type: integer
554 | |
555 | | ... | *Example:*
556 | |
557 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
558 | |
559 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
560 | |
561 | | ${if_index}= | VPP Create Bond Interface
562 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
563 | | ... | mac=00:00:00:01:01:01
564 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
565 | | VPP Add Bond Member
566 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
567 | | VPP Add Bond Member
568 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
569 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
570 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
571 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
572 | | END
573
574 | Initialize layer dot1q
575 | | [Documentation]
576 | | ... | Dot1q interfaces and variables to be created on all DUTs.
577 | |
578 | | ... | *Arguments:*
579 | | ... | - count - Number of chains.
580 | | ... | Type: integer
581 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
582 | | ... | Type: boolean
583 | | ... | - start - Id of first chain, allows adding chains during test.
584 | | ... | Type: integer
585 | |
586 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
587 | |
588 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
589 | |
590 | | FOR | ${dut} | IN | @{duts}
591 | | | Initialize layer dot1q on node
592 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
593 | | | ... | start=${start}
594 | | END
595 | | Set Test Variable | ${int} | dot1q
596
597 | Initialize layer dot1q on node
598 | | [Documentation]
599 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
600 | |
601 | | ... | *Arguments:*
602 | | ... | - dut - DUT node.
603 | | ... | Type: string
604 | | ... | - count - Number of chains.
605 | | ... | Type: integer
606 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
607 | | ... | Type: boolean
608 | | ... | - start - Id of first chain, allows adding chains during test.
609 | | ... | Type: integer
610 | |
611 | | ... | *Example:*
612 | |
613 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
614 | |
615 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
616 | | ... | ${start}=${1}
617 | |
618 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
619 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
620 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
621 | | END
622
623 | Initialize layer dot1q on node on PF
624 | | [Documentation]
625 | | ... | Dot1q interfaces and variables to be created on all DUT's node
626 | | ... | interfaces.
627 | |
628 | | ... | *Arguments:*
629 | | ... | - dut - DUT node.
630 | | ... | Type: string
631 | | ... | - pf - NIC physical function (physical port).
632 | | ... | Type: integer
633 | | ... | - count - Number of chains.
634 | | ... | Type: integer
635 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
636 | | ... | Type: boolean
637 | | ... | - start - Id of first chain, allows adding chains during test.
638 | | ... | Type: integer
639 | |
640 | | ... | *Example:*
641 | |
642 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
643 | |
644 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
645 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
646 | |
647 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
648 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
649 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
650 | | | # First id results in non-None indices, after that _1_ are defined.
651 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
652 | | | ... | ${${dut}_dot1q${pf}_1}[0] | ${_dot1q}
653 | | | ${_dot1q}= | Create List | ${_dot1q}
654 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
655 | | END
656
657 | Initialize layer dot1q on node on PF for chain
658 | | [Documentation]
659 | | ... | Optionally create tag popping subinterface per chain.
660 | | ... | Return interface indices for dot1q layer interfaces,
661 | | ... | or Nones if subinterfaces are not created.
662 | |
663 | | ... | *Arguments:*
664 | | ... | - dut - DUT node.
665 | | ... | Type: string
666 | | ... | - pf - NIC physical function (physical port).
667 | | ... | Type: integer
668 | | ... | - id - Positive index of the chain.
669 | | ... | Type: integer
670 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
671 | | ... | Type: boolean
672 | |
673 | | ... | *Example:*
674 | |
675 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
676 | | ... | \| 1 \| 1 \| True \|
677 | |
678 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
679 | |
680 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
681 | | ... | ${NONE}
682 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
683 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
684 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
685 | | ... | ${_vlan}[0] | ${_default}
686 | | ${_name} | ${_index}= | Create Vlan Subinterface
687 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
688 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
689 | | Configure L2 tag rewrite method on interfaces
690 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
691 | | Return From Keyword | ${_index}
692
693 | Initialize layer ip4vxlan
694 | | [Documentation]
695 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
696 | |
697 | | ... | *Arguments:*
698 | | ... | - count - Number of vxlan interfaces.
699 | | ... | Type: integer
700 | | ... | - start - Id of first chain, allows adding chains during test.
701 | | ... | Type: integer
702 | |
703 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
704 | |
705 | | [Arguments] | ${count}=${1} | ${start}=${1}
706 | |
707 | | FOR | ${dut} | IN | @{duts}
708 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
709 | | | ... | start=${start}
710 | | END
711 | | Set Test Variable | ${int} | ip4vxlan
712
713 | Initialize layer ip4vxlan on node
714 | | [Documentation]
715 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
716 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
717 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
718 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
719 | |
720 | | ... | *Arguments:*
721 | | ... | - dut - DUT node.
722 | | ... | Type: string
723 | | ... | - count - Number of vxlan interfaces.
724 | | ... | Type: integer
725 | | ... | - start - Id of first chain, allows adding chains during test.
726 | | ... | Type: integer
727 | |
728 | | ... | *Example:*
729 | |
730 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
731 | |
732 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
733 | |
734 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
735 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
736 | | | ... | count=${count} | start=${start}
737 | | END
738
739 | Initialize layer ip4vxlan on node on PF
740 | | [Documentation]
741 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
742 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
743 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
744 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
745 | |
746 | | ... | *Arguments:*
747 | | ... | - dut - DUT node.
748 | | ... | Type: string
749 | | ... | - pf - NIC physical function (physical port).
750 | | ... | Type: integer
751 | | ... | - count - Number of vxlan interfaces.
752 | | ... | Type: integer
753 | | ... | - start - Id of first chain, allows adding chains during test.
754 | | ... | Type: integer
755 | |
756 | | ... | *Example:*
757 | |
758 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
759 | |
760 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
761 | |
762 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
763 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
764 | | ... | 172.${pf}6.0.1 | 24
765 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
766 | | | ${_subnet}= | Evaluate | ${id} - 1
767 | | | ${_vni}= | Evaluate | ${id} - 1
768 | | | ${_ip4vxlan}= | Create VXLAN interface
769 | | | ... | ${nodes['${dut}']} | ${_vni}
770 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
771 | | | ${_prev_mac}=
772 | | | ... | Set Variable If | '${dut}' == 'DUT1'
773 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
774 | | | ${_next_mac}=
775 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
776 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
777 | | | ${_even}= | Evaluate | ${pf} % 2
778 | | | ${_mac}= | Set Variable If | ${_even}
779 | | | ... | ${_prev_mac} | ${_next_mac}
780 | | | VPP Add IP Neighbor
781 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
782 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
783 | | | VPP Route Add
784 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
785 | | | ... | gateway=172.${pf}6.${_subnet}.2
786 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
787 | | | Set VXLAN Bypass
788 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
789 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
790 | | | Set Test Variable
791 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
792 | | END
793
794 | Configure vhost interfaces
795 | | [Documentation]
796 | | ... | Create two Vhost-User interfaces on defined VPP node.
797 | |
798 | | ... | *Arguments:*
799 | | ... | - ${dut_node} - DUT node.
800 | | ... | Type: dictionary
801 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
802 | | ... | Type: string
803 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
804 | | ... | Type: string
805 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
806 | | ... | Type: string
807 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
808 | | ... | Type: string
809 | | ... | - ${is_server} - Server side of connection (Optional).
810 | | ... | Type: boolean
811 | | ... | - ${virtio_feature_mask} - Enabled Virtio feature flags (Optional).
812 | | ... | Type: integer
813 | |
814 | | ... | _NOTE:_ This KW sets following test case variable:
815 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
816 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
817 | |
818 | | ... | *Example:*
819 | |
820 | | ... | \| Configure vhost interfaces \
821 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
822 | |
823 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
824 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
825 | | ... | ${virtio_feature_mask}=${None}
826 | |
827 | | ${vhost_1}= | Vpp Create Vhost User Interface
828 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
829 | | ... | virtio_feature_mask=${virtio_feature_mask}
830 | | ${vhost_2}= | Vpp Create Vhost User Interface
831 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
832 | | ... | virtio_feature_mask=${virtio_feature_mask}
833 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
834 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
835 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
836 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
837 | | Set Interface State | ${dut_node} | ${vhost_1} | up
838 | | Set Interface State | ${dut_node} | ${vhost_2} | up
839 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
840 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
841 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
842 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
843
844 | Get Vhost dump
845 | | [Documentation] | Get vhost-user dump.
846 | |
847 | | ... | *Arguments:*
848 | | ... | - dut - DUT node data.
849 | | ... | Type: dictionary
850 | |
851 | | [Arguments] | ${dut}
852 | |
853 | | ${vhost_dump}= | Vhost User Dump | ${dut}
854 | | Return From Keyword | ${vhost_dump}
855
856 | Lower DUT1-DUT2 MTU For Fragmentation
857 | | [Documentation] | Set lower MTU on both ends of DUT1-DUT2 link.
858 | |
859 | | ... | This should force VPP to fragment (and reassembly) packets.
860 | | ... | Should be called after Initialize Layer Interface.
861 | | ... | Suite variables such as \${dut2_if1} should be defined by then.
862 | |
863 | | ... | As VPP (at least dpdk plugin) require interface to be down
864 | | ... | before MTU can be changed, interfaces are temporarily downed.
865 | |
866 | | # TODO: ip_reassembly_set to increase max_reassembly_length so jumbo passes.
867 | | Set Interface State | ${nodes['DUT1']} | ${dut1_if2} | down
868 | | Set Interface State | ${nodes['DUT2']} | ${dut2_if1} | down
869 | | VPP Set Interface MTU
870 | | ... | ${nodes['DUT1']} | ${dut1_if2} | ${MTU_FOR_FRAGMENTATION}
871 | | VPP Set Interface MTU
872 | | ... | ${nodes['DUT2']} | ${dut2_if1} | ${MTU_FOR_FRAGMENTATION}
873 | | Set Interface State | ${nodes['DUT1']} | ${dut1_if2} | up
874 | | Set Interface State | ${nodes['DUT2']} | ${dut2_if1} | up