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