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