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