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