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