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