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