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