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