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