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