FIX: Pylint reduce
[csit.git] / resources / libraries / robot / ip / ip4.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
14 *** Settings ***
15 | Library | resources.libraries.python.InterfaceUtil
16 | Library | resources.libraries.python.IPUtil
17 |
18 | Documentation | IPv4 keywords
19
20 *** Keywords ***
21 | Initialize IPv4 forwarding in circular topology
22 | | [Documentation]
23 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node / 3-node
24 | | ... | circular topology. Get the interface MAC addresses and setup ARP on
25 | | ... | all VPP interfaces. Setup IPv4 addresses with /24 prefix on DUT-TG
26 | | ... | links. In case of 3-node topology setup IPv4 adresses with /30 prefix
27 | | ... | on DUT1-DUT2 link and set routing on both DUT nodes with prefix /24
28 | | ... | and next hop of neighbour DUT interface IPv4 address.
29 | |
30 | | ... | *Arguments:*
31 | | ... | - remote_host1_ip - IP address of remote host1 (Optional).
32 | | ... | Type: string
33 | | ... | - remote_host2_ip - IP address of remote host2 (Optional).
34 | | ... | Type: string
35 | | ... | - remote_host_mask - Mask of remote host IP addresses (Optional).
36 | | ... | Type: string
37 | |
38 | | ... | *Example:*
39 | |
40 | | ... | \| Initialize IPv4 forwarding in circular topology \
41 | | ... | \| 192.168.0.1 \| 192.168.0.2 \| 24 \|
42 | |
43 | | [Arguments] | ${remote_host1_ip}=${NONE} | ${remote_host2_ip}=${NONE}
44 | | ... | ${remote_host_mask}=32
45 | |
46 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
47 | | ... | Variable Should Exist | ${dut2}
48 | |
49 | | Set interfaces in path up
50 | |
51 | | VPP Add IP Neighbor
52 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 10.10.10.2 | ${TG_pf1_mac}[0]
53 | | Run Keyword If | '${dut2_status}' == 'PASS'
54 | | ... | VPP Add IP Neighbor
55 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 1.1.1.2 | ${DUT2_${int}1_mac}[0]
56 | | Run Keyword If | '${dut2_status}' == 'PASS'
57 | | ... | VPP Add IP Neighbor
58 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 1.1.1.1 | ${DUT1_${int}2_mac}[0]
59 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
60 | | ... | Set Variable | ${dut2}
61 | | ... | ELSE | Set Variable | ${dut1}
62 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
63 | | ... | Set Variable | ${DUT2_${int}2}[0]
64 | | ... | ELSE | Set Variable | ${DUT1_${int}2}[0]
65 | | VPP Add IP Neighbor
66 | | ... | ${dut} | ${dut_if2} | 20.20.20.2 | ${TG_pf2_mac}[0]
67 | |
68 | | VPP Interface Set IP Address | ${dut1} | ${DUT1_${int}1}[0]
69 | | ... | 10.10.10.1 | 24
70 | | Run Keyword If | '${dut2_status}' == 'PASS'
71 | | ... | VPP Interface Set IP Address | ${dut1} | ${DUT1_${int}2}[0]
72 | | ... | 1.1.1.1 | 30
73 | | Run Keyword If | '${dut2_status}' == 'PASS'
74 | | ... | VPP Interface Set IP Address | ${dut2} | ${DUT2_${int}1}[0]
75 | | ... | 1.1.1.2 | 30
76 | | VPP Interface Set IP Address | ${dut} | ${dut_if2}
77 | | ... | 20.20.20.1 | 24
78 | |
79 | | Run Keyword If | '${dut2_status}' == 'PASS'
80 | | ... | Vpp Route Add | ${dut1} | 20.20.20.0 | 24 | gateway=1.1.1.2
81 | | ... | interface=${DUT1_${int}2}[0]
82 | | Run Keyword If | '${dut2_status}' == 'PASS'
83 | | ... | Vpp Route Add | ${dut2} | 10.10.10.0 | 24 | gateway=1.1.1.1
84 | | ... | interface=${DUT2_${int}1}[0]
85 | |
86 | | Run Keyword Unless | '${remote_host1_ip}' == '${NONE}'
87 | | ... | Vpp Route Add | ${dut1} | ${remote_host1_ip} | ${remote_host_mask}
88 | | ... | gateway=10.10.10.2 | interface=${DUT1_${int}1}[0]
89 | | Run Keyword Unless | '${remote_host2_ip}' == '${NONE}'
90 | | ... | Vpp Route Add | ${dut} | ${remote_host2_ip} | ${remote_host_mask}
91 | | ... | gateway=20.20.20.2 | interface=${dut_if2}
92 | | Run Keyword Unless | '${remote_host1_ip}' == '${NONE}'
93 | | ... | Run Keyword If | '${dut2_status}' == 'PASS'
94 | | ... | Vpp Route Add | ${dut1} | ${remote_host1_ip} | ${remote_host_mask}
95 | | ... | gateway=1.1.1.2 | interface=${DUT1_${int}2}[0]
96 | | Run Keyword Unless | '${remote_host2_ip}' == '${NONE}'
97 | | ... | Run Keyword If | '${dut2_status}' == 'PASS'
98 | | ... | Vpp Route Add | ${dut2} | ${remote_host2_ip} | ${remote_host_mask}
99 | | ... | gateway=1.1.1.1 | interface=${DUT2_${int}1}[0]
100
101 | Initialize IPv4 forwarding with scaling in circular topology
102 | | [Documentation]
103 | | ... | Custom setup of IPv4 topology with scalability of ip routes on all
104 | | ... | DUT nodes in 2-node / 3-node circular topology
105 | |
106 | | ... | *Arguments:*
107 | | ... | - count - IP route count. Type: integer
108 | |
109 | | ... | *Return:*
110 | | ... | - No value returned
111 | |
112 | | ... | *Example:*
113 | |
114 | | ... | \| Initialize IPv4 forwarding with scaling in 3-node circular \
115 | | ... | topology \| 100000 \|
116 | |
117 | | [Arguments] | ${count}
118 | |
119 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
120 | | ... | Variable Should Exist | ${dut2}
121 | |
122 | | Set interfaces in path up
123 | |
124 | | VPP Add IP Neighbor
125 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 1.1.1.1 | ${TG_pf1_mac}[0]
126 | | Run Keyword If | '${dut2_status}' == 'PASS'
127 | | ... | VPP Add IP Neighbor
128 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2.2.2.2 | ${DUT2_${int}1_mac}[0]
129 | | Run Keyword If | '${dut2_status}' == 'PASS'
130 | | ... | VPP Add IP Neighbor
131 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 2.2.2.1 | ${DUT1_${int}2_mac}[0]
132 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
133 | | ... | Set Variable | ${dut2}
134 | | ... | ELSE | Set Variable | ${dut1}
135 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
136 | | ... | Set Variable | ${DUT2_${int}2}[0]
137 | | ... | ELSE | Set Variable | ${DUT1_${int}2}[0]
138 | | VPP Add IP Neighbor
139 | | ... | ${dut} | ${dut_if2} | 3.3.3.1 | ${TG_pf2_mac}[0]
140 | | VPP Interface Set IP Address
141 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 1.1.1.2 | 30
142 | | Run Keyword If | '${dut2_status}' == 'PASS'
143 | | ... | VPP Interface Set IP Address | ${dut1} | ${DUT1_${int}2}[0] | 2.2.2.1
144 | | ... | 30
145 | | Run Keyword If | '${dut2_status}' == 'PASS'
146 | | ... | VPP Interface Set IP Address | ${dut2} | ${DUT2_${int}1}[0] | 2.2.2.2
147 | | ... | 30
148 | | VPP Interface Set IP Address | ${dut} | ${dut_if2} | 3.3.3.2 | 30
149 | | Vpp Route Add | ${dut1} | 10.0.0.0 | 32 | gateway=1.1.1.1
150 | | ... | interface=${DUT1_${int}1}[0] | count=${count}
151 | | Run Keyword If | '${dut2_status}' == 'PASS'
152 | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 32 | gateway=2.2.2.2
153 | | ... | interface=${DUT1_${int}2}[0] | count=${count}
154 | | Run Keyword If | '${dut2_status}' == 'PASS'
155 | | ... | Vpp Route Add | ${dut2} | 10.0.0.0 | 32 | gateway=2.2.2.1
156 | | ... | interface=${DUT2_${int}1}[0] | count=${count}
157 | | Vpp Route Add | ${dut} | 20.0.0.0 | 32 | gateway=3.3.3.1
158 | | ... | interface=${dut_if2} | count=${count}
159
160 | Initialize IPv4 routing with memif pairs
161 | | [Documentation]
162 | | ... | Create pairs of Memif interfaces on all defined VPP nodes. Put each
163 | | ... | Memif interface to separate IPv4 VRF with one physical or
164 | | ... | virtual interface to create a chain accross DUT node.
165 | |
166 | | ... | *Arguments:*
167 | | ... | - count - Number of memif pairs (containers). Type: integer
168 | |
169 | | ... | *Example:*
170 | |
171 | | ... | \| Initialize IPv4 routing with memif pairs \| ${1} \|
172 | |
173 | | [Arguments] | ${count}=${1}
174 | |
175 | | FOR | ${dut} | IN | @{duts}
176 | | | Initialize IPv4 routing with memif pairs on DUT node | ${dut} | ${count}
177 | | END
178 | | Set interfaces in path up
179 | | Show Memif on all DUTs | ${nodes}
180 | | VPP round robin RX placement on all DUTs | ${nodes} | prefix=memif
181
182 | Initialize IPv4 routing with memif pairs on DUT node
183 | | [Documentation]
184 | | ... | Create pairs of Memif interfaces on DUT node. Put each Memif interface
185 | | ... | to separate IPv4 VRF with one physical or virtual interface
186 | | ... | to create a chain accross DUT node.
187 | |
188 | | ... | *Arguments:*
189 | | ... | - dut - DUT node. Type: dictionary
190 | | ... | - count - Number of memif pairs (containers). Type: integer
191 | |
192 | | ... | *Note:*
193 | | ... | Socket paths for Memif are defined in following format:
194 | | ... | - /tmp/memif-\${dut}_CNF\${number}-\${sid}
195 | |
196 | | ... | *Example:*
197 | |
198 | | ... | \| Initialize IPv4 routing with memif pairs on DUT node \
199 | | ... | \| ${dut} \| ${1} \|
200 | |
201 | | [Arguments] | ${dut} | ${count}
202 | |
203 | | ${dut_index}= | Get Index From List | ${duts} | ${dut}
204 | | ${last_dut_index}= | Evaluate | ${duts_count} - ${1}
205 | |
206 | | ${tg_if1_net}= | Set Variable | 10.10.10.0
207 | | ${tg_if2_net}= | Set Variable | 20.20.20.0
208 | |
209 | | ${fib_table_1}= | Set Variable | ${10}
210 | | Run Keyword If | ${fib_table_1} > ${0}
211 | | ... | Add Fib Table | ${nodes['${dut}']} | ${fib_table_1}
212 | | ${ip_base_if1}= | Evaluate | ${dut_index} + ${1}
213 | | ${ip_net_if1}= | Set Variable
214 | | ... | ${ip_base_if1}.${ip_base_if1}.${ip_base_if1}
215 | | Vpp Route Add | ${nodes['${dut}']} | ${tg_if1_net} | 24
216 | | ... | vrf=${fib_table_1} | gateway=${ip_net_if1}.1
217 | | ... | interface=${${dut}_${int}1}[0] | multipath=${TRUE}
218 | | Assign Interface To Fib Table | ${nodes['${dut}']} | ${${dut}_${int}1}[0]
219 | | ... | ${fib_table_1}
220 | | VPP Interface Set IP Address | ${nodes['${dut}']} | ${${dut}_${int}1}[0]
221 | | ... | ${ip_net_if1}.2 | 30
222 | | ${prev_node}= | Run Keyword If | ${dut_index} == ${0}
223 | | ... | Set Variable | TG
224 | | ... | ELSE | Get From List | ${duts} | ${dut_index-${1}}
225 | | ${prev_if}= | Run Keyword If | ${dut_index} == ${0}
226 | | ... | Set Variable | pf1
227 | | ... | ELSE | Set Variable | ${int}2
228 | | ${prev_if_mac}= | Get Interface MAC | ${nodes['${prev_node}']}
229 | | ... | ${${prev_node}_${prev_if}}[0]
230 | | VPP Add IP Neighbor
231 | | ... | ${nodes['${dut}']} | ${${dut}_${int}1}[0] | ${ip_net_if1}.1
232 | | ... | ${prev_if_mac}
233 | |
234 | | ${fib_table_2}= | Evaluate | ${fib_table_1} + ${count}
235 | | Add Fib Table | ${nodes['${dut}']} | ${fib_table_2}
236 | | ${ip_base_if2}= | Evaluate | ${ip_base_if1} + ${1}
237 | | ${ip_net_if2}= | Set Variable
238 | | ... | ${ip_base_if2}.${ip_base_if2}.${ip_base_if2}
239 | | Vpp Route Add | ${nodes['${dut}']} | ${tg_if2_net} | 24
240 | | ... | vrf=${fib_table_2} | gateway=${ip_net_if2}.2
241 | | ... | interface=${${dut}_${int}2}[0] | multipath=${TRUE}
242 | | Assign Interface To Fib Table | ${nodes['${dut}']} | ${${dut}_${int}2}[0]
243 | | ... | ${fib_table_2}
244 | | VPP Interface Set IP Address | ${nodes['${dut}']} | ${${dut}_${int}2}[0]
245 | | ... | ${ip_net_if2}.1 | 30
246 | | ${next_node}= | Run Keyword If | ${dut_index} == ${last_dut_index}
247 | | ... | Set Variable | TG
248 | | ... | ELSE | Get From List | ${duts} | ${dut_index+${1}}
249 | | ${next_if}= | Run Keyword If | ${dut_index} == ${last_dut_index}
250 | | ... | Set Variable | pf2
251 | | ... | ELSE | Set Variable | ${int}1
252 | | ${next_if_mac}= | Get Interface MAC | ${nodes['${next_node}']}
253 | | ... | ${${next_node}_${next_if}}[0]
254 | | VPP Add IP Neighbor
255 | | ... | ${nodes['${dut}']} | ${${dut}_${int}2}[0] | ${ip_net_if2}.2
256 | | ... | ${next_if_mac}
257 | |
258 | | ${fib_table_1}= | Evaluate | ${fib_table_1} - ${1}
259 | | ${ip_base_start}= | Set Variable | ${31}
260 | | FOR | ${number} | IN RANGE | 1 | ${count+${1}}
261 | | | ${sock1}= | Set Variable | memif-${dut}_CNF
262 | | | ${sock2}= | Set Variable | memif-${dut}_CNF
263 | | | Set up memif interfaces on DUT node | ${nodes['${dut}']}
264 | | | ... | ${sock1} | ${sock2} | ${number} | ${dut}-memif-${number}-if1
265 | | | ... | ${dut}-memif-${number}-if2 | ${rxq_count_int} | ${rxq_count_int}
266 | | | ${memif1}= | Set Variable | ${${dut}-memif-${number}-if1}
267 | | | ${memif2}= | Set Variable | ${${dut}-memif-${number}-if2}
268 | | | ${fib_table_1}= | Evaluate | ${fib_table_1} + ${1}
269 | | | ${fib_table_2}= | Evaluate | ${fib_table_1} + ${1}
270 | | | Run Keyword Unless | ${number} == ${count}
271 | | | ... | Add Fib Table | ${nodes['${dut}']} | ${fib_table_2}
272 | | | Assign Interface To Fib Table | ${nodes['${dut}']}
273 | | | ... | ${memif1} | ${fib_table_1}
274 | | | Assign Interface To Fib Table | ${nodes['${dut}']}
275 | | | ... | ${memif2} | ${fib_table_2}
276 | | | ${ip_base_memif1}= | Evaluate
277 | | | ... | ${ip_base_start} + (${number} - ${1}) * ${2}
278 | | | ${ip_base_memif2}= | Evaluate | ${ip_base_memif1} + ${1}
279 | | | ${ip_net_memif1}= | Set Variable
280 | | | ... | ${ip_base_memif1}.${ip_base_memif1}.${ip_base_memif1}
281 | | | ${ip_net_memif2}= | Set Variable
282 | | | ... | ${ip_base_memif2}.${ip_base_memif2}.${ip_base_memif2}
283 | | | VPP Interface Set IP Address
284 | | | ... | ${nodes['${dut}']} | ${memif1} | ${ip_net_memif1}.1 | 30
285 | | | VPP Interface Set IP Address
286 | | | ... | ${nodes['${dut}']} | ${memif2} | ${ip_net_memif2}.1 | 30
287 | | | Vpp Route Add | ${nodes['${dut}']} | ${tg_if2_net} | 24
288 | | | ... | vrf=${fib_table_1} | gateway=${ip_net_memif2}.1
289 | | | ... | interface=${memif1}
290 | | | Vpp Route Add | ${nodes['${dut}']} | ${tg_if1_net} | 24
291 | | | ... | vrf=${fib_table_2} | gateway=${ip_net_memif1}.1
292 | | | ... | interface=${memif2}
293 | | | ${memif_if1_key}= | Get interface by sw index | ${nodes['${dut}']}
294 | | | ... | ${memif1}
295 | | | ${memif_if1_mac}= | Get interface mac | ${nodes['${dut}']}
296 | | | ... | ${memif_if1_key}
297 | | | ${memif_if2_key}= | Get interface by sw index | ${nodes['${dut}']}
298 | | | ... | ${memif2}
299 | | | ${memif_if2_mac}= | Get interface mac | ${nodes['${dut}']}
300 | | | ... | ${memif_if2_key}
301 | | | VPP Add IP Neighbor | ${nodes['${dut}']}
302 | | | ... | ${memif1} | ${ip_net_memif2}.1 | ${memif_if2_mac}
303 | | | VPP Add IP Neighbor | ${nodes['${dut}']}
304 | | | ... | ${memif2} | ${ip_net_memif1}.1 | ${memif_if1_mac}
305 | | END
306
307 | Initialize IPv4 forwarding with vhost in 2-node circular topology
308 | | [Documentation]
309 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on
310 | | ... | VPP node. Set UP state of all VPP interfaces in path. Create
311 | | ... | nf_nodes+1 FIB tables on DUT with multipath routing. Assign each
312 | | ... | Virtual interface to FIB table with Physical interface or Virtual
313 | | ... | interface on both nodes. Setup IPv4 addresses with /30 prefix on
314 | | ... | DUT-TG links. Set routing on DUT nodes in all FIB tables with prefix
315 | | ... | /8 and next hop of neighbour IPv4 address. Setup ARP on all VPP
316 | | ... | interfaces.
317 | |
318 | | ... | *Arguments:*
319 | | ... | - nf_nodes - Number of guest VMs. Type: integer
320 | | ... | - testpmd_mac - Switch for testpmd_mac test configuration.
321 | | ... | Type: boolean
322 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
323 | | ... | Type: integer
324 | |
325 | | ... | *Note:*
326 | | ... | Socket paths for VM are defined in following format:
327 | | ... | - /var/run/vpp/sock-${VM_ID}-1
328 | | ... | - /var/run/vpp/sock-${VM_ID}-2
329 | |
330 | | ... | *Example:*
331 | |
332 | | ... | \| IPv4 forwarding with Vhost-User initialized in a 2-node circular\
333 | | ... | topology \| 1 \|
334 | |
335 | | [Arguments] | ${nf_nodes}=${1} | ${testpmd_mac}=${FALSE}
336 | | ... | ${virtio_feature_mask}=${None}
337 | |
338 | | Set interfaces in path up
339 | | ${fib_table_1}= | Set Variable | ${101}
340 | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${nf_nodes}
341 | | Add Fib Table | ${dut1} | ${fib_table_1}
342 | | Add Fib Table | ${dut1} | ${fib_table_2}
343 | | Assign Interface To Fib Table
344 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${fib_table_1}
345 | | Assign Interface To Fib Table
346 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${fib_table_2}
347 | | VPP Interface Set IP Address
348 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 100.0.0.1 | 30
349 | | VPP Interface Set IP Address
350 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 200.0.0.1 | 30
351 | | VPP Add IP Neighbor
352 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 100.0.0.2 | ${TG_pf1_mac}[0]
353 | | VPP Add IP Neighbor
354 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 200.0.0.2 | ${TG_pf2_mac}[0]
355 | | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=100.0.0.2
356 | | ... | interface=${DUT1_${int}1}[0] | vrf=${fib_table_1}
357 | | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=200.0.0.2
358 | | ... | interface=${DUT1_${int}2}[0] | vrf=${fib_table_2}
359 | | FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
360 | | | ${fib_table_1}= | Evaluate | ${100}+${number}
361 | | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${1}
362 | | | Configure vhost interfaces | ${dut1}
363 | | | ... | /var/run/vpp/sock-${number}-1 | /var/run/vpp/sock-${number}-2
364 | | | ... | dut1-vhost-${number}-if1 | dut1-vhost-${number}-if2
365 | | | ... | virtio_feature_mask=${virtio_feature_mask}
366 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if1} | up
367 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if2} | up
368 | | | Add Fib Table | ${dut1} | ${fib_table_1}
369 | | | Add Fib Table | ${dut1} | ${fib_table_2}
370 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if1}
371 | | | ... | ${fib_table_1}
372 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if2}
373 | | | ... | ${fib_table_2}
374 | | | VPP Interface Set IP Address
375 | | | ... | ${dut1} | ${dut1-vhost-${number}-if1} | 1.1.1.2 | 30
376 | | | VPP Interface Set IP Address
377 | | | ... | ${dut1} | ${dut1-vhost-${number}-if2} | 1.1.2.2 | 30
378 | | | Run Keyword Unless | ${testpmd_mac}
379 | | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.1.1
380 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
381 | | | Run Keyword Unless | ${testpmd_mac}
382 | | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.2.1
383 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
384 | | | Run Keyword If | ${testpmd_mac}
385 | | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if1}
386 | | | ... | 1.1.2.2 | ${dut1-vhost-${number}-if2_mac}
387 | | | Run Keyword If | ${testpmd_mac}
388 | | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if2}
389 | | | ... | 1.1.1.2 | ${dut1-vhost-${number}-if1_mac}
390 | | | Run Keyword If | ${testpmd_mac}
391 | | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.2.2
392 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
393 | | | Run Keyword If | ${testpmd_mac}
394 | | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.1.2
395 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
396 | | END
397
398 | Initialize IPv4 forwarding with vhost in 3-node circular topology
399 | | [Documentation]
400 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on all
401 | | ... | VPP nodes. Set UP state of all VPP interfaces in path. Create
402 | | ... | nf_nodes+1 FIB tables on each DUT with multipath routing. Assign
403 | | ... | each Virtual interface to FIB table with Physical interface or Virtual
404 | | ... | interface on both nodes. Setup IPv4 addresses with /30 prefix on
405 | | ... | DUT-TG links and /30 prefix on DUT1-DUT2 link. Set routing on all DUT
406 | | ... | nodes in all FIB tables with prefix /8 and next hop of neighbour IPv4
407 | | ... | address. Setup ARP on all VPP interfaces.
408 | |
409 | | ... | *Arguments:*
410 | | ... | - nf_nodes - Number of guest VMs. Type: integer
411 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
412 | | ... | Type: integer
413 | |
414 | | ... | *Note:*
415 | | ... | Socket paths for VM are defined in following format:
416 | | ... | - /var/run/vpp/sock-\${VM_ID}-1
417 | | ... | - /var/run/vpp/sock-\${VM_ID}-2
418 | |
419 | | ... | *Example:*
420 | |
421 | | ... | \| IPv4 forwarding with Vhost-User initialized in a 3-node circular\
422 | | ... | topology \| 1 \|
423 | |
424 | | [Arguments] | ${nf_nodes}=${1} | ${testpmd_mac}=${FALSE}
425 | | ... | ${virtio_feature_mask}=${None}
426 | |
427 | | Set interfaces in path up
428 | | ${fib_table_1}= | Set Variable | ${101}
429 | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${nf_nodes}
430 | | Add Fib Table | ${dut1} | ${fib_table_1}
431 | | Add Fib Table | ${dut1} | ${fib_table_2}
432 | | Add Fib Table | ${dut2} | ${fib_table_1}
433 | | Add Fib Table | ${dut2} | ${fib_table_2}
434 | | Assign Interface To Fib Table
435 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${fib_table_1}
436 | | Assign Interface To Fib Table
437 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${fib_table_2}
438 | | Assign Interface To Fib Table
439 | | ... | ${dut2} | ${DUT2_${int}1}[0] | ${fib_table_1}
440 | | Assign Interface To Fib Table
441 | | ... | ${dut2} | ${DUT2_${int}2}[0] | ${fib_table_2}
442 | | VPP Interface Set IP Address
443 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 100.0.0.1 | 30
444 | | VPP Interface Set IP Address
445 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 150.0.0.1 | 30
446 | | VPP Interface Set IP Address
447 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 150.0.0.2 | 30
448 | | VPP Interface Set IP Address
449 | | ... | ${dut2} | ${DUT2_${int}2}[0] | 200.0.0.1 | 30
450 | | VPP Add IP Neighbor
451 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 100.0.0.2 | ${TG_pf1_mac}[0]
452 | | VPP Add IP Neighbor
453 | | ... | ${dut2} | ${DUT2_${int}2}[0] | 200.0.0.2 | ${TG_pf2_mac}[0]
454 | | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=100.0.0.2
455 | | ... | interface=${DUT1_${int}1}[0] | vrf=${fib_table_1}
456 | | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=150.0.0.2
457 | | ... | interface=${DUT1_${int}2}[0] | vrf=${fib_table_2}
458 | | Vpp Route Add | ${dut2} | 10.0.0.0 | 8 | gateway=150.0.0.1
459 | | ... | interface=${DUT2_${int}1}[0] | vrf=${fib_table_1}
460 | | Vpp Route Add | ${dut2} | 20.0.0.0 | 8 | gateway=200.0.0.2
461 | | ... | interface=${DUT2_${int}2}[0] | vrf=${fib_table_2}
462 | | FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
463 | | | ${fib_table_1}= | Evaluate | ${100}+${number}
464 | | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${1}
465 | | | Configure vhost interfaces | ${dut1}
466 | | | ... | /var/run/vpp/sock-${number}-1 | /var/run/vpp/sock-${number}-2
467 | | | ... | dut1-vhost-${number}-if1 | dut1-vhost-${number}-if2
468 | | | ... | virtio_feature_mask=${virtio_feature_mask}
469 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if1} | up
470 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if2} | up
471 | | | Configure vhost interfaces | ${dut2}
472 | | | ... | /var/run/vpp/sock-${number}-1 | /var/run/vpp/sock-${number}-2
473 | | | ... | dut2-vhost-${number}-if1 | dut2-vhost-${number}-if2
474 | | | ... | virtio_feature_mask=${virtio_feature_mask}
475 | | | Set Interface State | ${dut2} | ${dut2-vhost-${number}-if1} | up
476 | | | Set Interface State | ${dut2} | ${dut2-vhost-${number}-if2} | up
477 | | | Add Fib Table | ${dut1} | ${fib_table_1}
478 | | | Add Fib Table | ${dut1} | ${fib_table_2}
479 | | | Add Fib Table | ${dut2} | ${fib_table_1}
480 | | | Add Fib Table | ${dut2} | ${fib_table_2}
481 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if1}
482 | | | ... | ${fib_table_1}
483 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if2}
484 | | | ... | ${fib_table_2}
485 | | | Assign Interface To Fib Table | ${dut2} | ${dut2-vhost-${number}-if1}
486 | | | ... | ${fib_table_1}
487 | | | Assign Interface To Fib Table | ${dut2} | ${dut2-vhost-${number}-if2}
488 | | | ... | ${fib_table_2}
489 | | | VPP Interface Set IP Address
490 | | | ... | ${dut1} | ${dut1-vhost-${number}-if1} | 1.1.1.2 | 30
491 | | | VPP Interface Set IP Address
492 | | | ... | ${dut1} | ${dut1-vhost-${number}-if2} | 1.1.2.2 | 30
493 | | | VPP Interface Set IP Address
494 | | | ... | ${dut2} | ${dut2-vhost-${number}-if1} | 1.1.1.2 | 30
495 | | | VPP Interface Set IP Address
496 | | | ... | ${dut2} | ${dut2-vhost-${number}-if2} | 1.1.2.2 | 30
497 | | | Run Keyword Unless | ${testpmd_mac}
498 | | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.1.1
499 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
500 | | | Run Keyword Unless | ${testpmd_mac}
501 | | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.2.1
502 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
503 | | | Run Keyword Unless | ${testpmd_mac}
504 | | | ... | Vpp Route Add | ${dut2} | 20.0.0.0 | 8 | gateway=1.1.1.1
505 | | | ... | interface=${dut2-vhost-${number}-if1} | vrf=${fib_table_1}
506 | | | Run Keyword Unless | ${testpmd_mac}
507 | | | ... | Vpp Route Add | ${dut2} | 10.0.0.0 | 8 | gateway=1.1.2.1
508 | | | ... | interface=${dut2-vhost-${number}-if2} | vrf=${fib_table_2}
509 | | | Run Keyword If | ${testpmd_mac}
510 | | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if1}
511 | | | ... | 1.1.2.2 | ${dut1-vhost-${number}-if2_mac}
512 | | | Run Keyword If | ${testpmd_mac}
513 | | | ... | VPP Add IP Neighbor | ${dut1} | ${dut1-vhost-${number}-if2}
514 | | | ... | 1.1.1.2 | ${dut1-vhost-${number}-if1_mac}
515 | | | Run Keyword If | ${testpmd_mac}
516 | | | ... | VPP Add IP Neighbor | ${dut2} | ${dut2-vhost-${number}-if1}
517 | | | ... | 1.1.2.2 | ${dut2-vhost-${number}-if2_mac}
518 | | | Run Keyword If | ${testpmd_mac}
519 | | | ... | VPP Add IP Neighbor | ${dut2} | ${dut2-vhost-${number}-if2}
520 | | | ... | 1.1.1.2 | ${dut2-vhost-${number}-if1_mac}
521 | | | Run Keyword If | ${testpmd_mac}
522 | | | ... | Vpp Route Add | ${dut1} | 20.0.0.0 | 8 | gateway=1.1.2.2
523 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
524 | | | Run Keyword If | ${testpmd_mac}
525 | | | ... | Vpp Route Add | ${dut1} | 10.0.0.0 | 8 | gateway=1.1.1.2
526 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
527 | | | Run Keyword If | ${testpmd_mac}
528 | | | ... | Vpp Route Add | ${dut2} | 20.0.0.0 | 8 | gateway=1.1.2.2
529 | | | ... | interface=${dut2-vhost-${number}-if1} | vrf=${fib_table_1}
530 | | | Run Keyword If | ${testpmd_mac}
531 | | | ... | Vpp Route Add | ${dut2} | 10.0.0.0 | 8 | gateway=1.1.1.2
532 | | | ... | interface=${dut2-vhost-${number}-if2} | vrf=${fib_table_2}
533 | | END
534
535 | Initialize IPv4 forwarding with VLAN dot1q sub-interfaces in circular topology
536 | | [Documentation]
537 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node / 3-node
538 | | ... | circular topology. In case of 3-node topology create VLAN
539 | | ... | sub-interfaces between DUTs. In case of 2-node topology create VLAN
540 | | ... | sub-interface on dut1-if2 interface. Get the interface MAC addresses
541 | | ... | and setup ARPs. Setup IPv4 addresses with /30 prefix on DUT-TG links
542 | | ... | and set routing with prefix /30. In case of 3-node set IPv4 adresses
543 | | ... | with /30 prefix on VLAN and set routing on both DUT nodes with prefix
544 | | ... | /30. Set next hop of neighbour DUT interface IPv4 address. All
545 | | ... | interfaces are brought up.
546 | |
547 | | ... | *Arguments:*
548 | | ... | - tg_if1_net - TG interface 1 IP subnet used by traffic generator.
549 | | ... | Type: integer
550 | | ... | - tg_if2_net - TG interface 2 IP subnet used by traffic generator.
551 | | ... | Type: integer
552 | | ... | - subid - ID of the sub-interface to be created. Type: string
553 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
554 | |
555 | | ... | _NOTE:_ This KW uses following test case variables:
556 | | ... | - dut1 - DUT1 node.
557 | | ... | - dut2 - DUT2 node.
558 | | ... | - dut1_if2 - DUT1 interface towards DUT2.
559 | | ... | - dut2_if1 - DUT2 interface towards DUT1.
560 | |
561 | | ... | *Example:*
562 | |
563 | | ... | \| Initialize IPv4 forwarding with VLAN dot1q sub-interfaces\
564 | | ... | in circular topology \| 10.10.10.0 \| 20.20.20.0 \| 10 \| pop-1 \|
565 | |
566 | | [Arguments] | ${tg_if1_net} | ${tg_if2_net} | ${subid} | ${tag_rewrite}
567 | |
568 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
569 | | ... | Variable Should Exist | ${dut2}
570 | |
571 | | Set interfaces in path up
572 | |
573 | | Run Keyword If | '${dut2_status}' == 'PASS'
574 | | ... | Initialize VLAN dot1q sub-interfaces in circular topology
575 | | ... | ${dut1} | ${DUT1_${int}2}[0]
576 | | ... | ${dut2} | ${DUT2_${int}1}[0] | SUB_ID=${subid}
577 | | ... | ELSE | Initialize VLAN dot1q sub-interfaces in circular topology
578 | | ... | ${dut1} | ${DUT1_${int}2}[0] | SUB_ID=${subid}
579 | | Run Keyword If | '${dut2_status}' == 'PASS'
580 | | ... | Configure L2 tag rewrite method on interfaces
581 | | ... | ${dut1} | ${subif_index_1}
582 | | ... | ${dut2} | ${subif_index_2} | TAG_REWRITE_METHOD=${tag_rewrite}
583 | | ... | ELSE | Configure L2 tag rewrite method on interfaces
584 | | ... | ${dut1} | ${subif_index_1} | TAG_REWRITE_METHOD=${tag_rewrite}
585 | |
586 | | VPP Add IP Neighbor
587 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 1.1.1.1 | ${TG_pf1_mac}[0]
588 | | Run Keyword If | '${dut2_status}' == 'PASS'
589 | | ... | VPP Add IP Neighbor
590 | | ... | ${dut1} | ${subif_index_1} | 2.2.2.2 | ${DUT2_${int}1_mac}[0]
591 | | Run Keyword If | '${dut2_status}' == 'PASS'
592 | | ... | VPP Add IP Neighbor
593 | | ... | ${dut2} | ${subif_index_2} | 2.2.2.1 | ${DUT1_${int}2_mac}[0]
594 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
595 | | ... | Set Variable | ${dut2}
596 | | ... | ELSE | Set Variable | ${dut1}
597 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
598 | | ... | Set Variable | ${DUT2_${int}2}[0]
599 | | ... | ELSE | Set Variable | ${subif_index_1}
600 | | VPP Add IP Neighbor
601 | | ... | ${dut} | ${dut_if2} | 3.3.3.1 | ${TG_pf2_mac}[0]
602 | | VPP Interface Set IP Address
603 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 1.1.1.2 | 30
604 | | Run Keyword If | '${dut2_status}' == 'PASS'
605 | | ... | VPP Interface Set IP Address | ${dut1} | ${subif_index_1}
606 | | ... | 2.2.2.1 | 30
607 | | Run Keyword If | '${dut2_status}' == 'PASS'
608 | | ... | VPP Interface Set IP Address | ${dut2} | ${subif_index_2}
609 | | ... | 2.2.2.2 | 30
610 | | VPP Interface Set IP Address
611 | | ... | ${dut} | ${dut_if2} | 3.3.3.2 | 30
612 | | Vpp Route Add | ${dut1} | ${tg_if1_net} | 30 | gateway=1.1.1.1
613 | | ... | interface=${DUT1_${int}1}[0]
614 | | Run Keyword If | '${dut2_status}' == 'PASS'
615 | | ... | Vpp Route Add | ${dut1} | ${tg_if2_net} | 30 | gateway=2.2.2.2
616 | | ... | interface=${subif_index_1}
617 | | Run Keyword If | '${dut2_status}' == 'PASS'
618 | | ... | Vpp Route Add | ${dut2} | ${tg_if1_net} | 30 | gateway=2.2.2.1
619 | | ... | interface=${subif_index_2}
620 | | Vpp Route Add | ${dut} | ${tg_if2_net} | 30 | gateway=3.3.3.1
621 | | ... | interface=${dut_if2}