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