Make RXQs/TXQs configurable
[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 interfaces in path up
23 | | [Documentation]
24 | | ... | *Set UP state on VPP interfaces in path on all DUT nodes and set
25 | | ... | maximal MTU.*
26 | |
27 | | FOR | ${dut} | IN | @{duts}
28 | | | Set interfaces in path up on DUT | ${dut}
29 | | END
30 | | All VPP Interfaces Ready Wait | ${nodes} | retries=${300}
31
32 | Set interfaces in path up on DUT
33 | | [Documentation]
34 | | ... | *Set UP state on VPP interfaces in path on specified DUT node and
35 | | ... | set maximal MTU.*
36 | |
37 | | ... | *Arguments:*
38 | | ... | - dut - DUT node on which to set the interfaces up.
39 | | ... | Type: string
40 | |
41 | | ... | *Example:*
42 | |
43 | | ... | \| Set interfaces in path up on DUT \| DUT1 \|
44 | |
45 | | [Arguments] | ${dut}
46 # TODO: Rework KW to set all interfaces in path UP and set MTU (including
47 # software interfaces. Run KW at the start phase of VPP setup to split
48 # from other "functional" configuration. This will allow modularity of this
49 # library
50 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
51 | | ... | Variable Should Exist | ${${dut}_if1}
52 | | Run Keyword If | '${if1_status}' == 'PASS'
53 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1} | up
54 | | ... | ELSE
55 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_1} | up
56 | | Run Keyword Unless | '${if1_status}' == 'PASS'
57 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_2} | up
58 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
59 | | ... | Variable Should Exist | ${${dut}_if2}
60 | | Run Keyword If | '${if2_status}' == 'PASS'
61 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2} | up
62 | | ... | ELSE
63 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_1} | up
64 | | Run Keyword Unless | '${if2_status}' == 'PASS'
65 | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if2_2} | up
66 | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
67 | | ... | Variable Should Exist | ${${dut}_if1}
68 | | Run Keyword If | '${if1_status}' == 'PASS'
69 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1}
70 | | ... | ELSE
71 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_1}
72 | | Run Keyword Unless | '${if1_status}' == 'PASS'
73 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_2}
74 | | ${if2_status} | ${value}= | Run Keyword And Ignore Error
75 | | ... | Variable Should Exist | ${${dut}_if2}
76 | | Run Keyword If | '${if2_status}' == 'PASS'
77 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2}
78 | | ... | ELSE
79 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_1}
80 | | Run Keyword Unless | '${if2_status}' == 'PASS'
81 | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if2_2}
82
83 | Set single interfaces in path up
84 | | [Documentation]
85 | | ... | *Set UP state on single VPP interfaces in path on all DUT nodes and set
86 | | ... | maximal MTU.*
87 | |
88 # TODO: Rework KW to set all interfaces in path UP and set MTU (including
89 # software interfaces. Run KW at the start phase of VPP setup to split
90 # from other "functional" configuration. This will allow modularity of this
91 # library
92 | | FOR | ${dut} | IN | @{duts}
93 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
94 | | | ... | Variable Should Exist | ${${dut}_if1}
95 | | | Run Keyword If | '${if1_status}' == 'PASS'
96 | | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1} | up
97 | | | ... | ELSE
98 | | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_1} | up
99 | | | Run Keyword Unless | '${if1_status}' == 'PASS'
100 | | | ... | Set Interface State | ${nodes['${dut}']} | ${${dut}_if1_2} | up
101 | | END
102 | | FOR | ${dut} | IN | @{duts}
103 | | | ${if1_status} | ${value}= | Run Keyword And Ignore Error
104 | | | ... | Variable Should Exist | ${${dut}_if1}
105 | | | Run Keyword If | '${if1_status}' == 'PASS'
106 | | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1}
107 | | | ... | ELSE
108 | | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_1}
109 | | | Run Keyword Unless | '${if1_status}' == 'PASS'
110 | | | ... | VPP Set Interface MTU | ${nodes['${dut}']} | ${${dut}_if1_2}
111 | | END
112 | | All VPP Interfaces Ready Wait | ${nodes}
113
114 | Get Vhost dump
115 | | [Documentation] | Get vhost-user dump.
116 | |
117 | | ... | *Arguments:*
118 | | ... | - node - DUT node data. Type: dictionary
119 | |
120 | | [Arguments] | ${dut_node}
121 | |
122 | | [Return] | ${vhost_dump}
123 | |
124 | | ${vhost_dump}= | Vhost User Dump | ${dut_node}
125
126 | Initialize layer interface on node
127 | | [Documentation]
128 | | ... | Baseline interfaces variables to be created.
129 | |
130 | | ... | *Arguments:*
131 | | ... | - dut - DUT node. Type: string
132 | | ... | - count - Number of baseline interface variables. Type: integer
133 | |
134 | | ... | *Example:*
135 | |
136 | | ... | \| Initialize layer interface on node \| DUT1 \| 1 \|
137 | |
138 | | [Arguments] | ${dut} | ${count}=${1}
139 | |
140 | | ${dut_str}= | Convert To Lowercase | ${dut}
141 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
142 | | | Set Test Variable | ${${dut_str}_if_${id}_1} | ${${dut_str}_if1}
143 | | | Set Test Variable | ${${dut_str}_if_${id}_2} | ${${dut_str}_if2}
144 | | END
145
146 | Initialize layer interface
147 | | [Documentation]
148 | | ... | Physical interfaces variables to be created on all DUTs.
149 | |
150 | | ... | *Arguments:*
151 | | ... | - count - Number of untagged interfaces variables. Type: integer
152 | |
153 | | ... | *Example:*
154 | |
155 | | ... | \| Initialize layer interface \| 1 \|
156 | |
157 | | [Arguments] | ${count}=${1}
158 | |
159 | | FOR | ${dut} | IN | @{duts}
160 | | | Initialize layer interface on node | ${dut} | count=${count}
161 | | END
162 | | Set Test Variable | ${prev_layer} | if
163
164 | Pre-initialize layer driver
165 | | [Documentation]
166 | | ... | Pre-initialize driver based interfaces on each DUT.
167 | |
168 | | ... | *Arguments:*
169 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
170 | | ... | Type: string
171 | |
172 | | ... | *Example:*
173 | |
174 | | ... | \| Pre-initialize layer driver \| vfio-pci \|
175 | |
176 | | [Arguments] | ${driver}
177 | |
178 | | Run Keyword | Pre-initialize layer ${driver} on all DUTs
179
180 | Pre-initialize layer vfio-pci on all DUTs
181 | | [Documentation]
182 | | ... | Pre-initialize vfio-pci driver by adding related sections to startup
183 | | ... | config on all DUTs.
184 | |
185 | | Add DPDK pci devices to all DUTs
186 | | FOR | ${dut} | IN | @{duts}
187 | | | Run Keyword If | ${dpdk_no_tx_checksum_offload}
188 | | | ... | ${dut}.Add DPDK No Tx Checksum Offload
189 | | | Run Keyword | ${dut}.Add DPDK Log Level | debug
190 | | | Run Keyword | ${dut}.Add DPDK Uio Driver | vfio-pci
191 | | | Run Keyword | ${dut}.Add DPDK Dev Default RXQ | ${rxq_count_int}
192 | | | Run Keyword If | not ${jumbo}
193 | | | ... | ${dut}.Add DPDK No Multi Seg
194 | | | Run Keyword If | ${nic_rxq_size} > 0
195 | | | ... | ${dut}.Add DPDK Dev Default RXD | ${nic_rxq_size}
196 | | | Run Keyword If | ${nic_txq_size} > 0
197 | | | ... | ${dut}.Add DPDK Dev Default TXD | ${nic_txq_size}
198 | | | Run Keyword If | '${crypto_type}' != '${None}'
199 | | | ... | ${dut}.Add DPDK Cryptodev | ${thr_count_int}
200 | | END
201
202 | Pre-initialize layer avf on all DUTs
203 | | [Documentation]
204 | | ... | Pre-initialize avf driver. Currently no operation.
205 | |
206 | | No operation
207
208 | Pre-initialize layer rdma-core on all DUTs
209 | | [Documentation]
210 | | ... | Pre-initialize rdma-core driver. Currently no operation.
211 | |
212 | | No operation
213
214 | Initialize layer driver
215 | | [Documentation]
216 | | ... | Initialize driver based interfaces on each DUT. Interfaces are
217 | | ... | brought up.
218 | |
219 | | ... | *Arguments:*
220 | | ... | - driver - NIC driver used in test [vfio-pci|avf|rdma-core].
221 | | ... | Type: string
222 | |
223 | | ... | *Example:*
224 | |
225 | | ... | \| Initialize layer driver \| vfio-pci \|
226 | |
227 | | [Arguments] | ${driver}
228 | |
229 | | FOR | ${dut} | IN | @{duts}
230 | | | Run Keyword | Initialize layer ${driver} on node | ${dut}
231 | | END
232 | | Set Test Variable | ${prev_layer} | vf
233 | | Set interfaces in path up
234
235 | Initialize layer vfio-pci on node
236 | | [Documentation]
237 | | ... | Initialize vfio-pci interfaces on DUT. Currently no operation.
238 | |
239 | | ... | *Arguments:*
240 | | ... | - dut - DUT node. Type: string
241 | |
242 | | ... | *Example:*
243 | |
244 | | ... | \| Initialize layer vfio-pci on node \| DUT1 \|
245 | |
246 | | [Arguments] | ${dut}
247 | |
248 | | No operation
249
250 | Initialize layer avf on node
251 | | [Documentation]
252 | | ... | Initialize AVF interfaces on DUT.
253 | |
254 | | ... | *Arguments:*
255 | | ... | - dut - DUT node. Type: string
256 | |
257 | | ... | *Example:*
258 | |
259 | | ... | \| Initialize layer avf on node \| DUT1 \|
260 | |
261 | | [Arguments] | ${dut}
262 | |
263 | | ${dut_str}= | Convert To Lowercase | ${dut}
264 | | ${if1_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if1}
265 | | ${if2_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if2}
266 | | Set Test Variable | ${${dut_str}_vlan1} | ${if1_vlan}
267 | | Set Test Variable | ${${dut_str}_vlan2} | ${if2_vlan}
268 | | ${dut_new_if1}= | VPP Create AVF Interface | ${nodes['${dut}']}
269 | | ... | ${${dut}_if1_vf0} | num_rx_queues=${rxq_count_int}
270 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
271 | | ${dut_new_if1_mac}= | Get Interface MAC | ${nodes['${dut}']}
272 | | ... | ${dut_new_if1}
273 | | ${dut_new_if2}= | VPP Create AVF Interface | ${nodes['${dut}']}
274 | | ... | ${${dut}_if2_vf0} | num_rx_queues=${rxq_count_int}
275 | | ... | rxq_size=${nic_rxq_size} | txq_size=${nic_txq_size}
276 | | ${dut_new_if2_mac}= | Get Interface MAC | ${nodes['${dut}']}
277 | | ... | ${dut_new_if2}
278 | | Set Test Variable | ${${dut_str}_if1} | ${dut_new_if1}
279 | | Set Test Variable | ${${dut_str}_if2} | ${dut_new_if2}
280 | | Set Test Variable | ${${dut_str}_if1_mac} | ${dut_new_if1_mac}
281 | | Set Test Variable | ${${dut_str}_if2_mac} | ${dut_new_if2_mac}
282
283 | Initialize layer rdma-core on node
284 | | [Documentation]
285 | | ... | Initialize rdma-core (MLX) interfaces on DUT.
286 | |
287 | | ... | *Arguments:*
288 | | ... | - dut - DUT node. Type: string
289 | |
290 | | ... | *Example:*
291 | |
292 | | ... | \| Initialize layer rdma-core on node \| DUT1 \|
293 | |
294 | | [Arguments] | ${dut}
295 | |
296 | | ${dut_str}= | Convert To Lowercase | ${dut}
297 | | ${if1_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if1}
298 | | ${if2_vlan}= | Get Interface Vlan | ${nodes['${dut}']} | ${${dut}_if2}
299 | | Set Test Variable | ${${dut_str}_vlan1} | ${if1_vlan}
300 | | Set Test Variable | ${${dut_str}_vlan2} | ${if2_vlan}
301 | | ${dut_new_if1}= | VPP Create Rdma Interface | ${nodes['${dut}']}
302 | | ... | ${${dut}_if1} | num_rx_queues=${rxq_count_int}
303 | | ... | rxq_size=${nic_rxq_size} | txq_size=${rdma_txq_size}
304 | | ${dut_new_if1_mac}= | Get Interface MAC | ${nodes['${dut}']}
305 | | ... | ${dut_new_if1}
306 | | ${dut_new_if2}= | VPP Create Rdma Interface | ${nodes['${dut}']}
307 | | ... | ${${dut}_if2} | num_rx_queues=${rxq_count_int}
308 | | ... | rxq_size=${nic_rxq_size} | txq_size=${rdma_txq_size}
309 | | ${dut_new_if2_mac}= | Get Interface MAC | ${nodes['${dut}']}
310 | | ... | ${dut_new_if2}
311 | | Set Test Variable | ${${dut_str}_if1} | ${dut_new_if1}
312 | | Set Test Variable | ${${dut_str}_if2} | ${dut_new_if2}
313 | | Set Test Variable | ${${dut_str}_if1_mac} | ${dut_new_if1_mac}
314 | | Set Test Variable | ${${dut_str}_if2_mac} | ${dut_new_if2_mac}
315
316 | Initialize layer bonding on node
317 | | [Documentation]
318 | | ... | Bonded interface and variables to be created on across east and
319 | | ... | west DUT's node interfaces.
320 | |
321 | | ... | *Arguments:*
322 | | ... | - dut - DUT node. Type: string
323 | | ... | - bond_mode - Link bonding mode. Type: string
324 | | ... | - lb_mode - Load balance mode. Type: string
325 | | ... | - count - Number of bond interface variables. Type: integer
326 | |
327 | | ... | *Example:*
328 | |
329 | | ... | \| Initialize layer bonding on node \| DUT1 \| xor \| l34 \| 1 \|
330 | |
331 | | [Arguments] | ${dut} | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
332 | |
333 | | ${dut_str}= | Convert To Lowercase | ${dut}
334 | | ${if_index}= | VPP Create Bond Interface
335 | | ... | ${nodes['${dut}']} | ${bond_mode} | load_balance=${lb_mode}
336 | | ... | mac=00:00:00:01:01:01
337 | | Set Interface State | ${nodes['${dut}']} | ${if_index} | up
338 | | VPP Enslave Physical Interface
339 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_1} | ${if_index}
340 | | VPP Enslave Physical Interface
341 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_2} | ${if_index}
342 | | FOR | ${id} | IN RANGE | 1 | ${count} + 1
343 | | | Set Test Variable | ${${dut_str}_bond_${id}_1} | ${if_index}
344 | | | Set Test Variable | ${${dut_str}_bond_${id}_2} | ${if_index}
345 | | END
346
347 | Initialize layer bonding
348 | | [Documentation]
349 | | ... | Bonded interfaces and variables to be created on all DUT's interfaces.
350 | |
351 | | ... | *Arguments:*
352 | | ... | - bond_mode - Link bonding mode. Type: string
353 | | ... | - lb_mode - Load balance mode. Type: string
354 | | ... | - count - Number of bond interface variables. Type: integer
355 | |
356 | | ... | *Example:*
357 | |
358 | | ... | \| Initialize layer bonding \| xor \| l34 \| 1 \|
359 | |
360 | | [Arguments] | ${bond_mode}=xor | ${lb_mode}=l34 | ${count}=${1}
361 | |
362 | | FOR | ${dut} | IN | @{duts}
363 | | | Initialize layer bonding on node
364 | | | ... | ${dut} | bond_mode=${bond_mode} | lb_mode=${lb_mode}
365 | | | ... | count=${count}
366 | | END
367 | | Set Test Variable | ${prev_layer} | bond
368
369 | Initialize layer dot1q on node for chain
370 | | [Documentation]
371 | | ... | Optionally create tag popping subinterface per chain.
372 | | ... | Return interface indices for dot1q layer interfaces,
373 | | ... | or Nones if subinterfaces are not created.
374 | |
375 | | ... | *Arguments:*
376 | | ... | - dut - DUT node. Type: string
377 | | ... | - id - Positive index of the chain. Type: integer
378 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
379 | | ... | Type: boolean
380 | |
381 | | ... | *Example:*
382 | |
383 | | ... | \| Initialize layer dot1q on node for chain \| DUT1 \| 1 \| True \|
384 | |
385 | | [Arguments] | ${dut} | ${id} | ${vlan_per_chain}=${True}
386 | |
387 | | ${dut_str}= | Convert To Lowercase | ${dut}
388 | | Return From Keyword If | ${id} != ${1} and not ${vlan_per_chain}
389 | | ... | ${NONE} | ${NONE}
390 | | # TODO: Is it worth creating Get Variable Value If Not None keyword?
391 | | ${default}= | Evaluate | ${100} + ${id} - ${1}
392 | | ${if1_vlan}= | Get Variable Value | \${${dut_str}_vlan1}
393 | | ${if1_vlan}= | Set Variable If | '${if1_vlan}' != '${NONE}'
394 | | ... | ${if1_vlan} | ${default}
395 | | ${default}= | Evaluate | ${200} + ${id} - ${1}
396 | | ${if2_vlan}= | Get Variable Value | \${${dut_str}_vlan2}
397 | | ${if2_vlan}= | Set Variable If | '${if2_vlan}' != '${NONE}'
398 | | ... | ${if2_vlan} | ${default}
399 | | ${if1_name} | ${if1_index}= | Create Vlan Subinterface
400 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1}
401 | | ... | ${if1_vlan}
402 | | ${if2_name} | ${if2_index}= | Create Vlan Subinterface
403 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2}
404 | | ... | ${if2_vlan}
405 | | Set Interface State | ${nodes['${dut}']} | ${if1_index} | up
406 | | Set Interface State | ${nodes['${dut}']} | ${if2_index} | up
407 | | Configure L2 tag rewrite method on interfaces
408 | | ... | ${nodes['${dut}']} | ${if1_index} | TAG_REWRITE_METHOD=pop-1
409 | | Configure L2 tag rewrite method on interfaces
410 | | ... | ${nodes['${dut}']} | ${if2_index} | TAG_REWRITE_METHOD=pop-1
411 | | Return From Keyword | ${if1_index} | ${if2_index}
412
413 | Initialize layer dot1q on node
414 | | [Documentation]
415 | | ... | Dot1q interfaces and variables to be created on all DUT's node
416 | | ... | interfaces.
417 | |
418 | | ... | TODO: Unify names for number of chains/pipelines/instances/interfaces.
419 | | ... | Chose names and descriptions that makes sense for both
420 | | ... | nf_density and older tests.
421 | | ... | Note that with vlan_per_chain=False it is not a number of interfaces.
422 | | ... | At least not number of real interfaces, just number of aliases.
423 | | ... | This TODO applies also to all keywords with nf_chains argument.
424 | |
425 | | ... | *Arguments:*
426 | | ... | - dut - DUT node. Type: string
427 | | ... | - count - Number of chains. 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 \| 3 \| True \| 2 \|
436 | |
437 | | [Arguments] | ${dut} | ${count}=${1} | ${vlan_per_chain}=${True}
438 | | ... | ${start}=${1}
439 | |
440 | | ${dut_str}= | Convert To Lowercase | ${dut}
441 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
442 | | | ${if1_index} | ${if2_index}= | Initialize layer dot1q on node for chain
443 | | | ... | dut=${dut} | id=${id} | vlan_per_chain=${vlan_per_chain}
444 | | | # First id results in non-None indices, after that _1_ are defined.
445 | | | ${if1_index}= | Set Variable If | '${if1_index}' == '${NONE}'
446 | | | ... | ${${dut_str}_dot1q_1_1} | ${if1_index}
447 | | | ${if2_index}= | Set Variable If | '${if2_index}' == '${NONE}'
448 | | | ... | ${${dut_str}_dot1q_1_2} | ${if2_index}
449 | | | Set Test Variable | ${${dut_str}_dot1q_${id}_1} | ${if1_index}
450 | | | Set Test Variable | ${${dut_str}_dot1q_${id}_2} | ${if2_index}
451 | | END
452
453 | Initialize layer dot1q
454 | | [Documentation]
455 | | ... | Dot1q interfaces and variables to be created on all DUT's interfaces.
456 | |
457 | | ... | *Arguments:*
458 | | ... | - count - Number of chains. Type: integer
459 | | ... | - vlan_per_chain - Whether to create vlan subinterface for each chain.
460 | | ... | Type: boolean
461 | | ... | - start - Id of first chain, allows adding chains during test.
462 | | ... | Type: integer
463 | |
464 | | ... | \| Initialize layer dot1q \| 3 \| True \| 2 \|
465 | |
466 | | [Arguments] | ${count}=${1} | ${vlan_per_chain}=${True} | ${start}=${1}
467 | |
468 | | FOR | ${dut} | IN | @{duts}
469 | | | Initialize layer dot1q on node | ${dut} | count=${count}
470 | | | ... | vlan_per_chain=${vlan_per_chain} | start=${start}
471 | | END
472 | | Set Test Variable | ${prev_layer} | dot1q
473
474 | Initialize layer ip4vxlan on node
475 | | [Documentation]
476 | | ... | Setup VXLANoIPv4 between TG and DUTs and DUT to DUT by connecting
477 | | ... | physical and vxlan interfaces on each DUT. All interfaces are brought
478 | | ... | up. IPv4 addresses with prefix /24 are configured on interfaces
479 | | ... | towards TG. VXLAN sub-interfaces has same IPv4 address as interfaces.
480 | |
481 | | ... | *Arguments:*
482 | | ... | - dut - DUT node. Type: string
483 | | ... | - count - Number of vxlan interfaces. Type: integer
484 | | ... | - start - Id of first chain, allows adding chains during test.
485 | | ... | Type: integer
486 | |
487 | | ... | *Example:*
488 | |
489 | | ... | \| Initialize layer ip4vxlan on node \| DUT1 \| 3 \| 2 \|
490 | |
491 | | [Arguments] | ${dut} | ${count}=${1} | ${start}=${1}
492 | |
493 | | ${dut_str}= | Convert To Lowercase | ${dut}
494 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
495 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_1}
496 | | ... | 172.16.0.1 | 24
497 | | Run Keyword If | "${start}" == "1" | VPP Interface Set IP Address
498 | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_1_2}
499 | | ... | 172.26.0.1 | 24
500 | | FOR | ${id} | IN RANGE | ${start} | ${count} + 1
501 | | | ${subnet}= | Evaluate | ${id} - 1
502 | | | ${vni}= | Evaluate | ${id} - 1
503 | | | ${ip4vxlan_1}= | Create VXLAN interface
504 | | | ... | ${nodes['${dut}']} | ${vni} | 172.16.0.1 | 172.17.${subnet}.2
505 | | | ${ip4vxlan_2}= | Create VXLAN interface
506 | | | ... | ${nodes['${dut}']} | ${vni} | 172.26.0.1 | 172.27.${subnet}.2
507 | | | ${prev_mac}= | Set Variable If | '${dut}' == 'DUT1'
508 | | | ... | ${tg_if1_mac} | ${dut1_if2_mac}
509 | | | ${next_mac}= | Set Variable If | '${dut}' == 'DUT1' and ${duts_count} == 2
510 | | | ... | ${dut2_if1_mac} | ${tg_if2_mac}
511 | | | VPP Add IP Neighbor
512 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1}
513 | | | ... | 172.16.${subnet}.2 | ${prev_mac}
514 | | | VPP Add IP Neighbor
515 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2}
516 | | | ... | 172.26.${subnet}.2 | ${next_mac}
517 | | | VPP Route Add
518 | | | ... | ${nodes['${dut}']} | 172.17.${subnet}.0 | 24
519 | | | ... | gateway=172.16.${subnet}.2
520 | | | ... | interface=${${dut_str}_${prev_layer}_${id}_1}
521 | | | VPP Route Add
522 | | | ... | ${nodes['${dut}']} | 172.27.${subnet}.0 | 24
523 | | | ... | gateway=172.26.${subnet}.2
524 | | | ... | interface=${${dut_str}_${prev_layer}_${id}_2}
525 | | | Set VXLAN Bypass
526 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_1}
527 | | | Set VXLAN Bypass
528 | | | ... | ${nodes['${dut}']} | ${${dut_str}_${prev_layer}_${id}_2}
529 | | | Set Test Variable
530 | | | ... | ${${dut_str}_ip4vxlan_${id}_1} | ${ip4vxlan_1}
531 | | | Set Test Variable
532 | | | ... | ${${dut_str}_ip4vxlan_${id}_2} | ${ip4vxlan_2}
533 | | END
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. Type: integer
541 | | ... | - start - Id of first chain, allows adding chains during test.
542 | | ... | Type: integer
543 | |
544 | | ... | \| Initialize layer ip4vxlan \| 3 \| 2 \|
545 | |
546 | | [Arguments] | ${count}=${1} | ${start}=${1}
547 | |
548 | | FOR | ${dut} | IN | @{duts}
549 | | | Initialize layer ip4vxlan on node | ${dut} | count=${count}
550 | | ... | start=${start}
551 | | END
552 | | Set Test Variable | ${prev_layer} | ip4vxlan
553
554 | Configure vhost interfaces
555 | | [Documentation]
556 | | ... | Create two Vhost-User interfaces on defined VPP node.
557 | |
558 | | ... | *Arguments:*
559 | | ... | - ${dut_node} - DUT node. Type: dictionary
560 | | ... | - ${sock1} - Socket path for first Vhost-User interface. Type: string
561 | | ... | - ${sock2} - Socket path for second Vhost-User interface. Type: string
562 | | ... | - ${vhost_if1} - Name of the first Vhost-User interface (Optional).
563 | | ... | Type: string
564 | | ... | - ${vhost_if2} - Name of the second Vhost-User interface (Optional).
565 | | ... | Type: string
566 | | ... | - ${is_server} - Server side of connection (Optional).
567 | | ... | Type: boolean
568 | | ... | - ${enable_gso} - Generic segmentation offloading (Optional).
569 | | ... | Type: boolean
570 | |
571 | | ... | _NOTE:_ This KW sets following test case variable:
572 | | ... | - ${${vhost_if1}} - First Vhost-User interface.
573 | | ... | - ${${vhost_if2}} - Second Vhost-User interface.
574 | |
575 | | ... | *Example:*
576 | |
577 | | ... | \| Configure vhost interfaces \
578 | | ... | \| ${nodes['DUT1']} \| /tmp/sock1 \| /tmp/sock2 \|
579 | | ... | \| Configure vhost interfaces \
580 | | ... | \| ${nodes['DUT2']} \| /tmp/sock1 \| /tmp/sock2 \| dut2_vhost_if1 \
581 | | ... | \| dut2_vhost_if2 \|
582 | |
583 | | [Arguments] | ${dut_node} | ${sock1} | ${sock2} | ${vhost_if1}=vhost_if1
584 | | ... | ${vhost_if2}=vhost_if2 | ${is_server}=${False}
585 | | ... | ${enable_gso}=${False}
586 | |
587 | | ${vhost_1}= | Vpp Create Vhost User Interface
588 | | ... | ${dut_node} | ${sock1} | is_server=${is_server}
589 | | ... | enable_gso=${enable_gso}
590 | | ${vhost_2}= | Vpp Create Vhost User Interface
591 | | ... | ${dut_node} | ${sock2} | is_server=${is_server}
592 | | ... | enable_gso=${enable_gso}
593 | | ${vhost_1_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_1}
594 | | ${vhost_2_key}= | Get Interface By SW Index | ${dut_node} | ${vhost_2}
595 | | ${vhost_1_mac}= | Get Interface MAC | ${dut_node} | ${vhost_1_key}
596 | | ${vhost_2_mac}= | Get Interface MAC | ${dut_node} | ${vhost_2_key}
597 | | Set Interface State | ${dut_node} | ${vhost_1} | up
598 | | Set Interface State | ${dut_node} | ${vhost_2} | up
599 | | Set Test Variable | ${${vhost_if1}} | ${vhost_1}
600 | | Set Test Variable | ${${vhost_if2}} | ${vhost_2}
601 | | Set Test Variable | ${${vhost_if1}_mac} | ${vhost_1_mac}
602 | | Set Test Variable | ${${vhost_if2}_mac} | ${vhost_2_mac}