FIX: Mellanox jumbo frames
[csit.git] / resources / libraries / robot / shared / interfaces.robot
1 # Copyright (c) 2020 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 | | FOR | ${dut} | IN | @{duts}
48 | | | Set interfaces in path up on node | ${dut}
49 | | END
50 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${60}
51
52 | Set interfaces in path up on node
53 | | [Documentation]
54 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
55 | | ... | set maximal MTU.*
56 | |
57 | | ... | *Arguments:*
58 | | ... | - dut - DUT node on which to set the interfaces up.
59 | | ... | Type: string
60 | |
61 | | ... | *Example:*
62 | |
63 | | ... | \| Set interfaces in path up on node \| DUT1 \|
64 | |
65 | | [Arguments] | ${dut}
66 | |
67 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
68 | | | Set interfaces in path up on node on PF | ${dut} | ${pf}
69 | | END
70
71 | Set interfaces in path up on node on PF
72 | | [Documentation]
73 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
74 | | ... | set maximal MTU.*
75 | |
76 | | ... | *Arguments:*
77 | | ... | - dut - DUT node on which to set the interfaces up.
78 | | ... | Type: string
79 | | ... | - pf - NIC physical function (physical port).
80 | | ... | Type: integer
81 | |
82 | | ... | *Example:*
83 | |
84 | | ... | \| Set interfaces in path up on node on PF \| DUT1 \| 1 \|
85 | |
86 | | [Arguments] | ${dut} | ${pf}
87 | |
88 | | ${_chains} | ${value}= | Run Keyword And Ignore Error
89 | | ... | Variable Should Exist | @{${dut}_${int}${pf}_1}
90 | | ${_id}= | Set Variable If | '${_chains}' == 'PASS' | _1 | ${EMPTY}
91 | | FOR | ${if} | IN | @{${dut}_${int}${pf}${_id}}
92 | | | Set Interface State | ${nodes['${dut}']} | ${if} | up
93 | | | VPP Set Interface MTU | ${nodes['${dut}']} | ${if}
94 | | END
95
96 | Pre-initialize layer driver
97 | | [Documentation]
98 | | ... | Pre-initialize driver based interfaces on each DUT.
99 | |
100 | | ... | *Arguments:*
101 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
102 | | ... | Type: string
103 | |
104 | | ... | *Example:*
105 | |
106 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
107 | |
108 | | [Arguments] | ${driver}
109 | |
110 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
111
112 | Pre-initialize layer vfio-pci on all DUTs
113 | | [Documentation]
114 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
115 | | ... | config on all DUTs.
116 | |
117 | | ${index}= | Get Index From List | ${TEST TAGS} | DPDK
118 | | Run Keyword If | ${index} >= 0 | Return From Keyword
119 | | FOR | ${dut} | IN | @{duts}
120 | | | Run keyword | ${dut}.Add DPDK Dev | @{${dut}_pf_pci}
121 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
122 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
123 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
124 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
125 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
126 | | | Run Keyword If | not ${jumbo}
127 | | | ... | ${dut}.Add DPDK No Multi Seg
128 | | | Run Keyword If | ${nic_rxq_size} > 0
129 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
130 | | | Run Keyword If | ${nic_txq_size} > 0
131 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
132 | | | Run Keyword If | '${crypto_type}' != '${None}'
133 | | | ... | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
134 | | END
135 | | ${_vlan_strip} | ${value}= | Run Keyword And Ignore Error
136 | | ... | Variable Should Exist | ${vlan_strip_off}
137 | | Run keyword If | '${_vlan_strip}' == 'PASS' and ${duts_count} == 2
138 | | ... | Add DPDK VLAN strip offload switch off between DUTs
139
140 | Pre-initialize layer avf on all DUTs
141 | | [Documentation]
142 | | ... | Pre-initialize avf driver. Currently no operation.
143 | |
144 | | No operation
145
146 | Pre-initialize layer rdma-core on all DUTs
147 | | [Documentation]
148 | | ... | Pre-initialize rdma-core driver. Currently no operation.
149 | |
150 | | No operation
151
152 | Pre-initialize layer mlx5_core on all DUTs
153 | | [Documentation]
154 | | ... | Pre-initialize mlx5_core driver.
155 | |
156 | | FOR | ${dut} | IN | @{duts}
157 | | | Run Keyword If | ${jumbo}
158 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=9200
159 | | | ... | ELSE
160 | | | ... | Set Interface MTU | ${nodes['${dut}']} | ${${dut}_pf_pci} | mtu=1500
161 | | END
162
163 | Initialize layer driver
164 | | [Documentation]
165 | | ... | Initialize driver based interfaces on all DUT. Interfaces are
166 | | ... | brought up.
167 | |
168 | | ... | *Arguments:*
169 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
170 | | ... | Type: string
171 | |
172 | | ... | *Example:*
173 | |
174 | | ... | \| Initialize layer driver \| vfio-pci \|
175 | |
176 | | [Arguments] | ${driver}
177 | |
178 | | FOR | ${dut} | IN | @{duts}
179 | | | Initialize layer driver on node | ${dut} | ${driver}
180 | | END
181 | | Set Test Variable | ${int} | vf
182 | | Set interfaces in path up
183
184 | Initialize layer driver on node
185 | | [Documentation]
186 | | ... | Initialize driver based interfaces on DUT.
187 | |
188 | | ... | *Arguments:*
189 | | ... | - dut - DUT node.
190 | | ... | Type: string
191 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
192 | | ... | Type: string
193 | |
194 | | ... | *Example:*
195 | |
196 | | ... | \| Initialize layer driver \| DUT1 \| vfio-pci \|
197 | |
198 | | [Arguments] | ${dut} | ${driver}
199 | |
200 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
201 | | | ${_vf}=
202 | | | ... | Copy List | ${${dut}_${int}${pf}}
203 | | | ${_ip4_addr}=
204 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_addr}
205 | | | ${_ip4_prefix}=
206 | | | ... | Copy List | ${${dut}_${int}${pf}_ip4_prefix}
207 | | | ${_mac}=
208 | | | ... | Copy List | ${${dut}_${int}${pf}_mac}
209 | | | ${_pci}=
210 | | | ... | Copy List | ${${dut}_${int}${pf}_pci}
211 | | | ${_vlan}=
212 | | | ... | Copy List | ${${dut}_${int}${pf}_vlan}
213 | | | Set Test Variable
214 | | | ... | ${${dut}_vf${pf}} | ${_vf}
215 | | | Set Test Variable
216 | | | ... | ${${dut}_vf${pf}_ip4_addr} | ${_ip4_addr}
217 | | | Set Suite Variable
218 | | | ... | ${${dut}_vf${pf}_ip4_prefix} | ${_ip4_prefix}
219 | | | Set Test Variable
220 | | | ... | ${${dut}_vf${pf}_mac} | ${_mac}
221 | | | Set Test Variable
222 | | | ... | ${${dut}_vf${pf}_pci} | ${_pci}
223 | | | Set Test Variable
224 | | | ... | ${${dut}_vf${pf}_vlan} | ${_vlan}
225 | | | Run Keyword | Initialize layer ${driver} on node | ${dut} | ${pf}
226 | | END
227
228 | Initialize layer vfio-pci on node
229 | | [Documentation]
230 | | ... | Initialize vfio-pci interfaces on DUT on NIC PF.
231 | | ... | Currently no operation.
232 | |
233 | | ... | *Arguments:*
234 | | ... | - dut - DUT node. Type: string
235 | | ... | - pf - NIC physical function (physical port). Type: integer
236 | |
237 | | ... | *Example:*
238 | |
239 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \| 1 \|
240 | |
241 | | [Arguments] | ${dut} | ${pf}
242 | |
243 | | No operation
244
245 | Initialize layer avf on node
246 | | [Documentation]
247 | | ... | Initialize AVF (Intel) interfaces on DUT on NIC PF.
248 | |
249 | | ... | *Arguments:*
250 | | ... | - dut - DUT node. Type: string
251 | | ... | - pf - NIC physical function (physical port). Type: integer
252 | |
253 | | ... | *Example:*
254 | |
255 | | ... | \| Initialize layer avf on node \| DUT1 \| 1 \|
256 | |
257 | | [Arguments] | ${dut} | ${pf}
258 | |
259 | | FOR | ${vf} | IN RANGE | 0 | ${nic_vfs}
260 | | | ${_avf}= | VPP Create AVF Interface
261 | | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[${vf}]
262 | | | ... | num_rx_queues=${rxq_count_int}
263 | | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
264 | | | ${_ip4}=
265 | | | ... | Get Interface IP4 | ${nodes['${dut}']} | ${_avf}
266 | | | ${_ip4_prefix}=
267 | | | ... | Get Interface IP4 Prefix Length | ${nodes['${dut}']} | ${_avf}
268 | | | ${_mac}=
269 | | | ... | Get Interface MAC | ${nodes['${dut}']} | ${_avf}
270 | | | ${_pci}=
271 | | | ... | Get Interface PCI Addr | ${nodes['${dut}']} | ${_avf}
272 | | | ${_vlan}=
273 | | | ... | Get Interface VLAN | ${nodes['${dut}']} | ${_avf}
274 | | | Set List Value | ${${dut}_vf${pf}} | ${vf} | ${_avf}
275 | | | Set List Value | ${${dut}_vf${pf}_ip4_addr} | ${vf} | ${_ip4}
276 | | | Set List Value | ${${dut}_vf${pf}_ip4_prefix} | ${vf} | ${_ip4_prefix}
277 | | | Set List Value | ${${dut}_vf${pf}_mac} | ${vf} | ${_mac}
278 | | | Set List Value | ${${dut}_vf${pf}_pci} | ${vf} | ${_pci}
279 | | | Set List Value | ${${dut}_vf${pf}_vlan} | ${vf} | ${_vlan}
280 | | END
281
282 | Initialize layer rdma-core on node
283 | | [Documentation]
284 | | ... | Initialize rdma-core (Mellanox VPP) interfaces on DUT on NIC PF.
285 | |
286 | | ... | *Arguments:*
287 | | ... | - dut - DUT node. Type: string
288 | | ... | - pf - NIC physical function (physical port). Type: integer
289 | |
290 | | ... | *Example:*
291 | |
292 | | ... | \| Initialize layer rdma-core on node \| DUT1 \| 1 \|
293 | |
294 | | [Arguments] | ${dut} | ${pf}
295 | |
296 | | ${_rdma}= | VPP Create Rdma Interface
297 | | ... | ${nodes['${dut}']} | ${${dut}_vf${pf}}[0]
298 | | ... | num_rx_queues=${rxq_count_int}
299 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
300 | | Set List Value | ${${dut}_vf${pf}} | 0 | ${_rdma}
301
302 | Initialize layer mlx5_core on node
303 | | [Documentation]
304 | | ... | Initialize mlx5_core interfaces on DUT on NIC PF.
305 | | ... | Currently no operation.
306 | |
307 | | No operation
308
309 | Initialize layer interface
310 | | [Documentation]
311 | | ... | Physical interfaces variables to be created on all DUTs.
312 | |
313 | | ... | *Arguments:*
314 | | ... | - count - Number of untagged interfaces variables. Type: integer
315 | |
316 | | ... | *Example:*
317 | |
318 | | ... | \| Initialize layer interface \| 1 \|
319 | |
320 | | [Arguments] | ${count}=${1}
321 | |
322 | | FOR | ${dut} | IN | @{duts}
323 | | | Initialize layer interface on node | ${dut} | count=${count}
324 | | END
325
326 | Initialize layer interface on node
327 | | [Documentation]
328 | | ... | Physical interfaces variables to be created on all DUTs.
329 | |
330 | | ... | *Arguments:*
331 | | ... | - dut - DUT node. Type: string
332 | | ... | - count - Number of baseline interface variables. Type: integer
333 | |
334 | | ... | *Example:*
335 | |
336 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
337 | |
338 | | [Arguments] | ${dut} | ${count}=${1}
339 | |
340 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
341 | | | Initialize layer interface on node on PF | ${dut} | ${pf} | count=${count}
342 | | END
343
344 | Initialize layer interface on node on PF
345 | | [Documentation]
346 | | ... | Baseline interfaces variables to be created.
347 | |
348 | | ... | *Arguments:*
349 | | ... | - dut - DUT node. Type: string
350 | | ... | - pf - NIC physical function (physical port). Type: integer
351 | | ... | - count - Number of baseline interface variables. Type: integer
352 | |
353 | | ... | *Example:*
354 | |
355 | | ... | \| Initialize layer interface on node on PF \| DUT1 \| 1 \| 1 \|
356 | |
357 | | [Arguments] | ${dut} | ${pf} | ${count}=${1}
358 | |
359 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
360 | | | Set Test Variable
361 | | | ... | ${${dut}_${int}${pf}_${id}} | ${${dut}_${int}${pf}}
362 | | END
363
364 | Initialize layer bonding
365 | | [Documentation]
366 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
367 | |
368 | | ... | *Arguments:*
369 | | ... | - bond_mode - Link bonding mode. Type: string
370 | | ... | - lb_mode - Load balance mode. Type: string
371 | | ... | - count - Number of bond interface variables. Type: integer
372 | |
373 | | ... | *Example:*
374 | |
375 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
376 | |
377 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
378 | |
379 | | FOR | ${dut} | IN | @{duts}
380 | | | Initialize layer bonding on node
381 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
382 | | | ... | count=${count}
383 | | END
384 | | Set Test Variable | ${int} | bond
385
386 | Initialize layer bonding on node
387 | | [Documentation]
388 | | ... | Bonded interface and variables to be created on across east and
389 | | ... | west DUT's node interfaces.
390 | |
391 | | ... | *Arguments:*
392 | | ... | - dut - DUT node. Type: string
393 | | ... | - bond_mode - Link bonding mode. Type: string
394 | | ... | - lb_mode - Load balance mode. Type: string
395 | | ... | - count - Number of bond interface variables. Type: integer
396 | |
397 | | ... | *Example:*
398 | |
399 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
400 | |
401 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
402 | |
403 | | ${if_index}= | VPP Create Bond Interface
404 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
405 | | ... | mac=00:00:00:01:01:01
406 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
407 | | VPP Enslave Physical Interface
408 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1_1} | ${if_index}
409 | | VPP Enslave Physical Interface
410 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2_1} | ${if_index}
411 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
412 | | | Set Test Variable | ${${dut}_bond1_${id}} | ${if_index}
413 | | | Set Test Variable | ${${dut}_bond2_${id}} | ${if_index}
414 | | END
415
416 | Initialize layer dot1q
417 | | [Documentation]
418 | | ... | Dot1q interfaces and variables to be created on all DUTs.
419 | |
420 | | ... | *Arguments:*
421 | | ... | - count - Number of chains.
422 | | ... | Type: integer
423 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
424 | | ... | Type: boolean
425 | | ... | - start - Id of first chain, allows adding chains during test.
426 | | ... | Type: integer
427 | |
428 | | ... | \| Initialize layer dot1q \| 1 \| True \| 1 \|
429 | |
430 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
431 | |
432 | | FOR | ${dut} | IN | @{duts}
433 | | | Initialize layer dot1q on node
434 | | | ... | ${dut} | count=${count} | vlan_per_chain=${vlan_per_chain}
435 | | | ... | start=${start}
436 | | END
437 | | Set Test Variable | ${int} | dot1q
438
439 | Initialize layer dot1q on node
440 | | [Documentation]
441 | | ... | Dot1q interfaces and variables to be created on all DUT's node.
442 | |
443 | | ... | *Arguments:*
444 | | ... | - dut - DUT node.
445 | | ... | Type: string
446 | | ... | - count - Number of chains.
447 | | ... | Type: integer
448 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
449 | | ... | Type: boolean
450 | | ... | - start - Id of first chain, allows adding chains during test.
451 | | ... | Type: integer
452 | |
453 | | ... | *Example:*
454 | |
455 | | ... | \| Initialize layer dot1q on node \| DUT1 \| 1 \| True \| 1 \|
456 | |
457 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
458 | | ... | ${start}=${1}
459 | |
460 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
461 | | | Initialize layer dot1q on node on PF | ${dut} | pf=${pf} | count=${count}
462 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
463 | | END
464
465 | Initialize layer dot1q on node on PF
466 | | [Documentation]
467 | | ... | Dot1q interfaces and variables to be created on all DUT's node
468 | | ... | interfaces.
469 | |
470 | | ... | *Arguments:*
471 | | ... | - dut - DUT node.
472 | | ... | Type: string
473 | | ... | - pf - NIC physical function (physical port).
474 | | ... | Type: integer
475 | | ... | - count - Number of chains.
476 | | ... | Type: integer
477 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
478 | | ... | Type: boolean
479 | | ... | - start - Id of first chain, allows adding chains during test.
480 | | ... | Type: integer
481 | |
482 | | ... | *Example:*
483 | |
484 | | ... | \| Initialize layer dot1q on node on PF \| DUT1 \| 3 \| True \| 2 \|
485 | |
486 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1}
487 | | ... | ${vlan_per_chain}=${True} | ${start}=${1}
488 | |
489 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
490 | | | ${_dot1q}= | Initialize layer dot1q on node on PF for chain
491 | | | ... | dut=${dut} | pf=${pf} | id=${id} | vlan_per_chain=${vlan_per_chain}
492 | | | # First id results in non-None indices, after that _1_ are defined.
493 | | | ${_dot1q}= | Set Variable If | '${_dot1q}' == '${NONE}'
494 | | | ... | ${${dut}_dot1q${pf}_1} | ${_dot1q}
495 | | | ${_dot1q}= | Create List | ${_dot1q}
496 | | | Set Test Variable | ${${dut}_dot1q${pf}_${id}} | ${_dot1q}
497 | | END
498
499 | Initialize layer dot1q on node on PF for chain
500 | | [Documentation]
501 | | ... | Optionally create tag popping subinterface per chain.
502 | | ... | Return interface indices for dot1q layer interfaces,
503 | | ... | or Nones if subinterfaces are not created.
504 | |
505 | | ... | *Arguments:*
506 | | ... | - dut - DUT node.
507 | | ... | Type: string
508 | | ... | - pf - NIC physical function (physical port).
509 | | ... | Type: integer
510 | | ... | - id - Positive index of the chain.
511 | | ... | Type: integer
512 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
513 | | ... | Type: boolean
514 | |
515 | | ... | *Example:*
516 | |
517 | | ... | \| Initialize layer dot1q on node on PF for chain \| DUT1 \
518 | | ... | \| 1 \| 1 \| True \|
519 | |
520 | | [Arguments] | ${dut} | ${pf} | ${id} | ${vlan_per_chain}=${True}
521 | |
522 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
523 | | ... | ${NONE} | ${NONE}
524 | | ${_default}= | Evaluate | ${pf} * ${100} + ${id} - ${1}
525 | | ${_vlan}= | Get Variable Value | \${${dut}_pf${pf}_vlan}
526 | | ${_vlan}= | Set Variable If | '${_vlan}[0]' != '${NONE}'
527 | | ... | ${_vlan}[0] | ${_default}
528 | | ${_name} | ${_index}= | Create Vlan Subinterface
529 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0] | ${_vlan}
530 | | Set Interface State | ${nodes['${dut}']} | ${_index} | up
531 | | Configure L2 tag rewrite method on interfaces
532 | | ... | ${nodes['${dut}']} | ${_index} | TAG_REWRITE_METHOD=pop-1
533 | | Return From Keyword | ${_index}
534
535 | Initialize layer ip4vxlan
536 | | [Documentation]
537 | | ... | VXLAN interfaces and variables to be created on all DUT's interfaces.
538 | |
539 | | ... | *Arguments:*
540 | | ... | - count - Number of vxlan interfaces.
541 | | ... | Type: integer
542 | | ... | - start - Id of first chain, allows adding chains during test.
543 | | ... | Type: integer
544 | |
545 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
546 | |
547 | | [Arguments] | ${count}=${1} | ${start}=${1}
548 | |
549 | | FOR | ${dut} | IN | @{duts}
550 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
551 | | | ... | start=${start}
552 | | END
553 | | Set Test Variable | ${int} | ip4vxlan
554
555 | Initialize layer ip4vxlan on node
556 | | [Documentation]
557 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
558 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
559 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
560 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
561 | |
562 | | ... | *Arguments:*
563 | | ... | - dut - DUT node.
564 | | ... | Type: string
565 | | ... | - count - Number of vxlan interfaces.
566 | | ... | Type: integer
567 | | ... | - start - Id of first chain, allows adding chains during test.
568 | | ... | Type: integer
569 | |
570 | | ... | *Example:*
571 | |
572 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
573 | |
574 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
575 | |
576 | | FOR | ${pf} | IN RANGE | 1 | ${nic_pfs} + 1
577 | | | Initialize layer ip4vxlan on node on PF | ${dut} | pf=${pf}
578 | | | ... | count=${count} | start=${start}
579 | | END
580
581 | Initialize layer ip4vxlan on node on PF
582 | | [Documentation]
583 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
584 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
585 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
586 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
587 | |
588 | | ... | *Arguments:*
589 | | ... | - dut - DUT node.
590 | | ... | Type: string
591 | | ... | - pf - NIC physical function (physical port).
592 | | ... | Type: integer
593 | | ... | - count - Number of vxlan interfaces.
594 | | ... | Type: integer
595 | | ... | - start - Id of first chain, allows adding chains during test.
596 | | ... | Type: integer
597 | |
598 | | ... | *Example:*
599 | |
600 | | ... | \| Initialize layer ip4vxlan on node on PF \| DUT1 \| 3 \| 2 \|
601 | |
602 | | [Arguments] | ${dut} | ${pf}=${1} | ${count}=${1} | ${start}=${1}
603 | |
604 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
605 | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_1}[0]
606 | | ... | 172.${pf}6.0.1 | 24
607 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
608 | | | ${_subnet}= | Evaluate | ${id} - 1
609 | | | ${_vni}= | Evaluate | ${id} - 1
610 | | | ${_ip4vxlan}= | Create VXLAN interface
611 | | | ... | ${nodes['${dut}']} | ${_vni}
612 | | | ... | 172.${pf}6.0.1 | 172.${pf}7.${_subnet}.2
613 | | | ${_prev_mac}=
614 | | | ... | Set Variable If | '${dut}' == 'DUT1'
615 | | | ... | ${TG_pf1_mac}[0] | ${DUT1_pf2_mac}[0]
616 | | | ${_next_mac}=
617 | | | ... | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
618 | | | ... | ${DUT2_pf1_mac}[0] | ${TG_pf2_mac}[0]
619 | | | ${_even}= | Evaluate | ${pf} % 2
620 | | | ${_mac}= | Set Variable If | ${_even}
621 | | | ... | ${_prev_mac} | ${_next_mac}
622 | | | VPP Add IP Neighbor
623 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
624 | | | ... | 172.${pf}6.${_subnet}.2 | ${_mac}
625 | | | VPP Route Add
626 | | | ... | ${nodes['${dut}']} | 172.${pf}7.${_subnet}.0 | 24
627 | | | ... | gateway=172.${pf}6.${_subnet}.2
628 | | | ... | interface=${${dut}_${int}${pf}_${id}}[0]
629 | | | Set VXLAN Bypass
630 | | | ... | ${nodes['${dut}']} | ${${dut}_${int}${pf}_${id}}[0]
631 | | | ${_ip4vxlan}= | Create List | ${_ip4vxlan}
632 | | | Set Test Variable
633 | | | ... | ${${dut}_ip4vxlan${pf}_${id}} | ${_ip4vxlan}
634 | | END
635
636 | Configure vhost interfaces
637 | | [Documentation]
638 | | ... | Create two Vhost-User interfaces on defined VPP node.
639 | |
640 | | ... | *Arguments:*
641 | | ... | - ${dut_node} - DUT node.
642 | | ... | Type: dictionary
643 | | ... | - ${sock1} - Socket path for first Vhost-User interface.
644 | | ... | Type: string
645 | | ... | - ${sock2} - Socket path for second Vhost-User interface.
646 | | ... | Type: string
647 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
648 | | ... | Type: string
649 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
650 | | ... | Type: string
651 | | ... | - ${is_server} - Server side of connection (Optional).
652 | | ... | Type: boolean
653 | | ... | - ${enable_gso} - Generic segmentation offloading (Optional).
654 | | ... | Type: boolean
655 | |
656 | | ... | _NOTE:_ This KW sets following test case variable:
657 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
658 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
659 | |
660 | | ... | *Example:*
661 | |
662 | | ... | \| Configure vhost interfaces \
663 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
664 | |
665 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
666 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
667 | | ... | ${enable_gso}=${False}
668 | |
669 | | ${vhost_1}= | Vpp Create Vhost User Interface
670 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
671 | | ... | enable_gso=${enable_gso}
672 | | ${vhost_2}= | Vpp Create Vhost User Interface
673 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
674 | | ... | enable_gso=${enable_gso}
675 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
676 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
677 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
678 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
679 | | Set Interface State | ${dut_node} | ${vhost_1} | up
680 | | Set Interface State | ${dut_node} | ${vhost_2} | up
681 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
682 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
683 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
684 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}
685
686 | Get Vhost dump
687 | | [Documentation] | Get vhost-user dump.
688 | |
689 | | ... | *Arguments:*
690 | | ... | - dut - DUT node data.
691 | | ... | Type: dictionary
692 | |
693 | | [Arguments] | ${dut}
694 | |
695 | | ${vhost_dump}= | Vhost User Dump | ${dut}
696 | | Return From Keyword | ${vhost_dump}