edb264190cf37d26f9485c8d736fb157559576a9
[csit.git] / resources / libraries / robot / ip / ip6.robot
1 # Copyright (c) 2021 Cisco and/or its affiliates.
2 # Licensed under the Apache License, Version 2.0 (the "License");
3 # you may not use this file except in compliance with the License.
4 # You may obtain a copy of the License at:
5 #
6 #     http://www.apache.org/licenses/LICENSE-2.0
7 #
8 # Unless required by applicable law or agreed to in writing, software
9 # distributed under the License is distributed on an "AS IS" BASIS,
10 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 # See the License for the specific language governing permissions and
12 # limitations under the License.
13
14 *** Settings ***
15 | Library | resources.libraries.python.InterfaceUtil
16 | Library | resources.libraries.python.IPUtil
17 | Library | resources.libraries.python.IPv6Util
18 | Library | resources.libraries.python.NodePath
19 |
20 | Documentation | IPv6 keywords
21
22 *** Keywords ***
23 | Initialize IPv6 forwarding in circular topology
24 | | [Documentation]
25 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node / 3-node
26 | | ... | circular topology. Get the interface MAC addresses and setup neighbor
27 | | ... | on all VPP interfaces. Setup IPv6 addresses with /64 prefix on DUT-TG
28 | | ... | links. In case of 3-node topology setup IPv6 adresses with /64 prefix
29 | | ... | on DUT1-DUT2 link and set routing on both DUT nodes with prefix /64
30 | | ... | and next hop of neighbour DUT interface IPv4 address.
31 | |
32 | | ... | *Arguments:*
33 | | ... | - remote_host1_ip - IP address of remote host1 (Optional).
34 | | ... | Type: string
35 | | ... | - remote_host2_ip - IP address of remote host2 (Optional).
36 | | ... | Type: string
37 | |
38 | | ... | *Example:*
39 | |
40 | | ... | \| Initialize IPv6 forwarding in circular topology \
41 | | ... | \| 3ffe:5f::1 \| 3ffe:5f::2 \|
42 | |
43 | | [Arguments] | ${remote_host1_ip}=${NONE} | ${remote_host2_ip}=${NONE}
44 | |
45 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
46 | | ... | Variable Should Exist | ${dut2}
47 | |
48 | | Set interfaces in path up
49 | |
50 | | VPP Add IP Neighbor
51 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2001:1::2 | ${TG_pf1_mac}[0]
52 | | Run Keyword If | '${dut2_status}' == 'PASS'
53 | | ... | VPP Add IP Neighbor
54 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2001:3::2 | ${DUT2_${int}1_mac}[0]
55 | | Run Keyword If | '${dut2_status}' == 'PASS'
56 | | ... | VPP Add IP Neighbor
57 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 2001:3::1 | ${DUT1_${int}2_mac}[0]
58 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
59 | | ... | Set Variable | ${dut2}
60 | | ... | ELSE | Set Variable | ${dut1}
61 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
62 | | ... | Set Variable | ${DUT2_${int}2}[0]
63 | | ... | ELSE | Set Variable | ${DUT1_${int}2}[0]
64 | | VPP Add IP Neighbor
65 | | ... | ${dut} | ${dut_if2} | 2001:2::2 | ${TG_pf2_mac}[0]
66 | |
67 | | VPP Interface Set IP Address
68 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2001:1::1 | 64
69 | | Run Keyword If | '${dut2_status}' == 'PASS'
70 | | ... | VPP Interface Set IP Address
71 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2001:3::1 | 64
72 | | Run Keyword If | '${dut2_status}' == 'PASS'
73 | | ... | VPP Interface Set IP Address
74 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 2001:3::2 | 64
75 | | VPP Interface Set IP Address
76 | | ... | ${dut} | ${dut_if2} | 2001:2::1 | 64
77 | |
78 | | Vpp Interfaces RA Suppress On All Nodes | ${nodes}
79 | |
80 | | Run Keyword If | '${dut2_status}' == 'PASS'
81 | | ... | Vpp Route Add | ${dut1} | 2001:2::0 | 64 | gateway=2001:3::2
82 | | ... | interface=${DUT1_${int}2}[0]
83 | | Run Keyword If | '${dut2_status}' == 'PASS'
84 | | ... | Vpp Route Add | ${dut2} | 2001:1::0 | 64 | gateway=2001:3::1
85 | | ... | interface=${DUT2_${int}1}[0]
86 | |
87 | | Run Keyword Unless | '${remote_host1_ip}' == '${NONE}'
88 | | ... | Vpp Route Add | ${dut1} | ${remote_host1_ip} | 128
89 | | ... | gateway=2001:1::2 | interface=${DUT1_${int}1}[0]
90 | | Run Keyword Unless | '${remote_host2_ip}' == '${NONE}'
91 | | ... | Vpp Route Add | ${dut} | ${remote_host2_ip} | 128
92 | | ... | gateway=2001:2::2 | interface=${dut_if2}
93 | | Run Keyword Unless | '${remote_host1_ip}' == '${NONE}'
94 | | ... | Run Keyword If | '${dut2_status}' == 'PASS'
95 | | ... | Vpp Route Add | ${dut1} | ${remote_host1_ip} | 128
96 | | ... | gateway=2001:3::2 | interface=${DUT1_${int}2}[0]
97 | | Run Keyword Unless | '${remote_host2_ip}' == '${NONE}'
98 | | ... | Run Keyword If | '${dut2_status}' == 'PASS'
99 | | ... | Vpp Route Add | ${dut2} | ${remote_host2_ip} | 128
100 | | ... | gateway=2001:3::1 | interface=${DUT2_${int}1}[0]
101
102 | Initialize IPv6 forwarding with scaling in circular topology
103 | | [Documentation]
104 | | ... | Custom setup of IPv6 topology with scalability of ip routes on all
105 | | ... | DUT nodes in 2-node / 3-node circular topology
106 | |
107 | | ... | *Arguments:*
108 | | ... | - count - IP route count. Type: integer
109 | |
110 | | ... | *Return:*
111 | | ... | - No value returned
112 | |
113 | | ... | *Example:*
114 | |
115 | | ... | \| Initialize IPv6 forwarding with scaling in circular \
116 | | ... | topology \| 100000 \|
117 | |
118 | | [Arguments] | ${count}
119 | |
120 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
121 | | ... | Variable Should Exist | ${dut2}
122 | |
123 | | Set interfaces in path up
124 | |
125 | | ${prefix}= | Set Variable | 64
126 | | ${host_prefix}= | Set Variable | 128
127 | | VPP Interface Set IP Address
128 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2001:3::1 | ${prefix}
129 | | Run Keyword If | '${dut2_status}' == 'PASS'
130 | | ... | VPP Interface Set IP Address
131 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2001:4::1 | ${prefix}
132 | | Run Keyword If | '${dut2_status}' == 'PASS'
133 | | ... | VPP Interface Set IP Address
134 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 2001:4::2 | ${prefix}
135 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
136 | | ... | Set Variable | ${dut2}
137 | | ... | ELSE | Set Variable | ${dut1}
138 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
139 | | ... | Set Variable | ${DUT2_${int}2}[0]
140 | | ... | ELSE | Set Variable | ${DUT1_${int}2}[0]
141 | | VPP Interface Set IP Address
142 | | ... | ${dut} | ${dut_if2} | 2001:5::1 | ${prefix}
143 | | Vpp Interfaces RA Suppress On All Nodes | ${nodes}
144 | | VPP Add IP Neighbor
145 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2001:3::2 | ${TG_pf1_mac}[0]
146 | | Run Keyword If | '${dut2_status}' == 'PASS'
147 | | ... | VPP Add Ip Neighbor
148 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2001:4::2 | ${DUT2_${int}1_mac}[0]
149 | | Run Keyword If | '${dut2_status}' == 'PASS'
150 | | ... | VPP Add Ip Neighbor
151 | | ... | ${dut2} | ${DUT2_${int}1}[0] | 2001:4::1 | ${DUT1_${int}2_mac}[0]
152 | | VPP Add IP Neighbor
153 | | ... | ${dut} | ${dut_if2} | 2001:5::2 | ${TG_pf2_mac}[0]
154 | | Vpp Route Add | ${dut1} | 2001:1::0 | ${host_prefix} | gateway=2001:3::2
155 | | ... | interface=${DUT1_${int}1}[0] | count=${count}
156 | | Run Keyword If | '${dut2_status}' == 'PASS'
157 | | ... | Vpp Route Add | ${dut1} | 2001:2::0 | ${host_prefix}
158 | | ... | gateway=2001:4::2 | interface=${DUT1_${int}2}[0] | count=${count}
159 | | Run Keyword If | '${dut2_status}' == 'PASS'
160 | | ... | Vpp Route Add | ${dut2} | 2001:1::0 | ${host_prefix}
161 | | ... | gateway=2001:4::1 | interface=${DUT2_${int}1}[0] | count=${count}
162 | | Vpp Route Add | ${dut} | 2001:2::0 | ${host_prefix} | gateway=2001:5::2
163 | | ... | interface=${dut_if2} | count=${count}
164
165 | Initialize IPv6 forwarding with vhost in 2-node circular topology
166 | | [Documentation]
167 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on \
168 | | ... | VPP node. Set UP state of all VPP interfaces in path. Create \
169 | | ... | nf_nodes+1 FIB tables on DUT with multipath routing. Assign each \
170 | | ... | Virtual interface to FIB table with Physical interface or Virtual \
171 | | ... | interface on both nodes. Setup IPv6 addresses with /64 prefix on \
172 | | ... | DUT-TG links. Set routing on DUT nodes in all FIB tables with \
173 | | ... | prefix /64 and next hop of neighbour IPv6 address. Setup neighbours \
174 | | ... | on all VPP interfaces.
175 | |
176 | | ... | *Arguments:*
177 | | ... | - nf_nodes - Number of guest VMs. Type: integer
178 | | ... | - virtio_feature_mask - Enabled Virtio features (Optional).
179 | | ... | Type: integer
180 | |
181 | | ... | *Note:*
182 | | ... | Socket paths for VM are defined in following format:
183 | | ... | - /var/run/vpp/sock-${VM_ID}-1
184 | | ... | - /var/run/vpp/sock-${VM_ID}-2
185 | |
186 | | ... | *Example:*
187 | |
188 | | ... | \| IPv6 forwarding with Vhost-User initialized in a 2-node circular\
189 | | ... | topology \| 1 \|
190 | |
191 | | [Arguments] | ${nf_nodes}=${1} | ${virtio_feature_mask}=${None}
192 | |
193 | | Vpp Interfaces RA Suppress On All Nodes | ${nodes}
194 | | Set interfaces in path up
195 | | ${prefix}= | Set Variable | 64
196 | | ${fib_table_1}= | Set Variable | ${101}
197 | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${nf_nodes}
198 | | Add Fib Table | ${dut1} | ${fib_table_1} | ipv6=${True}
199 | | Add Fib Table | ${dut1} | ${fib_table_2} | ipv6=${True}
200 | | Assign Interface To Fib Table
201 | | ... | ${dut1} | ${DUT1_${int}1}[0] | ${fib_table_1}
202 | | ... | ipv6=${True}
203 | | Assign Interface To Fib Table
204 | | ... | ${dut1} | ${DUT1_${int}2}[0] | ${fib_table_2}
205 | | ... | ipv6=${True}
206 | | VPP Interface Set IP Address
207 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2001:100::1
208 | | ... | ${prefix}
209 | | VPP Interface Set IP Address
210 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2001:200::1
211 | | ... | ${prefix}
212 | | VPP Add IP Neighbor
213 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2001:100::2 | ${TG_pf1_mac}[0]
214 | | VPP Add IP Neighbor
215 | | ... | ${dut1} | ${DUT1_${int}2}[0] | 2001:200::2 | ${TG_pf2_mac}[0]
216 | | Vpp Route Add | ${dut1} | 2001:1::0 | 64 | gateway=2001:100::2
217 | | ... | interface=${DUT1_${int}1}[0] | vrf=${fib_table_1}
218 | | Vpp Route Add | ${dut1} | 2001:2::0 | 64 | gateway=2001:200::2
219 | | ... | interface=${DUT1_${int}2}[0] | vrf=${fib_table_2}
220 | | FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
221 | | | ${fib_table_1}= | Evaluate | ${100}+${number}
222 | | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${1}
223 | | | Configure vhost interfaces | ${dut1}
224 | | | ... | /var/run/vpp/sock-${number}-1 | /var/run/vpp/sock-${number}-2
225 | | | ... | dut1-vhost-${number}-if1 | dut1-vhost-${number}-if2
226 | | | ... | virtio_feature_mask=${virtio_feature_mask}
227 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if1} | up
228 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if2} | up
229 | | | Add Fib Table | ${dut1} | ${fib_table_1} | ipv6=${True}
230 | | | Add Fib Table | ${dut1} | ${fib_table_2} | ipv6=${True}
231 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if1}
232 | | | ... | ${fib_table_1} | ipv6=${True}
233 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if2}
234 | | | ... | ${fib_table_2} | ipv6=${True}
235 | | | VPP Interface Set IP Address
236 | | | ... | ${dut1} | ${dut1-vhost-${number}-if1} | 1:1::2 | 64
237 | | | VPP Interface Set IP Address
238 | | | ... | ${dut1} | ${dut1-vhost-${number}-if2} | 1:2::2 | 64
239 | | | Vpp Route Add | ${dut1} | 2001:2::0 | 64 | gateway=1:1::1
240 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
241 | | | Vpp Route Add | ${dut1} | 2001:1::0 | 64 | gateway=1:2::1
242 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
243 | | END
244
245 | Initialize IPv6 forwarding with VLAN dot1q sub-interfaces in circular topology
246 | | [Documentation]
247 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node / 3-node
248 | | ... | circular topology. In case of 3-node topology create VLAN
249 | | ... | sub-interfaces between DUTs. In case of 2-node topology create VLAN
250 | | ... | sub-interface on dut1-if2 interface. Get the interface MAC addresses
251 | | ... | and setup ARPs. Setup IPv6 addresses with /64 prefix on DUT-TG links
252 | | ... | and set routing with prefix /64. In case of 3-node set IPv6 adresses
253 | | ... | with /64 prefix on VLAN and set routing on both DUT nodes with prefix
254 | | ... | /64. Set next hop of neighbour DUT interface IPv6 address. All
255 | | ... | interfaces are brought up.
256 | |
257 | | ... | *Arguments:*
258 | | ... | - tg_if1_net - TG interface 1 IPv6 subnet used by traffic generator.
259 | | ... | Type: integer
260 | | ... | - tg_if2_net - TG interface 2 IPv6 subnet used by traffic generator.
261 | | ... | Type: integer
262 | | ... | - subid - ID of the sub-interface to be created. Type: string
263 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
264 | |
265 | | ... | _NOTE:_ This KW uses following test case variables:
266 | | ... | - dut1 - DUT1 node.
267 | | ... | - dut2 - DUT2 node.
268 | | ... | - dut1_if2 - DUT1 interface towards DUT2.
269 | | ... | - dut2_if1 - DUT2 interface towards DUT1.
270 | |
271 | | ... | *Example:*
272 | |
273 | | ... | \| Initialize IPv6 forwarding with VLAN dot1q sub-interfaces\
274 | | ... | in circular topology \| 2001:1::0 \| 2001:2::0 \| 10 \| pop-1 \|
275 | |
276 | | [Arguments] | ${tg_if1_net} | ${tg_if2_net} | ${subid} | ${tag_rewrite}
277 | |
278 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
279 | | ... | Variable Should Exist | ${dut2}
280 | |
281 | | Set interfaces in path up
282 | |
283 | | Run Keyword If | '${dut2_status}' == 'PASS'
284 | | ... | Initialize VLAN dot1q sub-interfaces in circular topology
285 | | ... | ${dut1} | ${DUT1_${int}2}[0]
286 | | ... | ${dut2} | ${DUT2_${int}1}[0] | SUB_ID=${subid}
287 | | ... | ELSE | Initialize VLAN dot1q sub-interfaces in circular topology
288 | | ... | ${dut1} | ${DUT1_${int}2}[0] | SUB_ID=${subid}
289 | | Run Keyword If | '${dut2_status}' == 'PASS'
290 | | ... | Configure L2 tag rewrite method on interfaces
291 | | ... | ${dut1} | ${subif_index_1}
292 | | ... | ${dut2} | ${subif_index_2} | TAG_REWRITE_METHOD=${tag_rewrite}
293 | | ... | ELSE | Configure L2 tag rewrite method on interfaces
294 | | ... | ${dut1} | ${subif_index_1} | TAG_REWRITE_METHOD=${tag_rewrite}
295 | |
296 | | ${prefix}= | Set Variable | 64
297 | | ${host_prefix}= | Set Variable | 64
298 | | VPP Add IP Neighbor
299 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2002:1::1 | ${TG_pf1_mac}[0]
300 | | Run Keyword If | '${dut2_status}' == 'PASS'
301 | | ... | VPP Add Ip Neighbor
302 | | ... | ${dut1} | ${subif_index_1} | 2002:2::2 | ${DUT2_${int}1_mac}[0]
303 | | Run Keyword If | '${dut2_status}' == 'PASS'
304 | | ... | VPP Add Ip Neighbor
305 | | ... | ${dut2} | ${subif_index_2} | 2002:2::1 | ${DUT1_${int}2_mac}[0]
306 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
307 | | ... | Set Variable | ${dut2}
308 | | ... | ELSE | Set Variable | ${dut1}
309 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
310 | | ... | Set Variable | ${DUT2_${int}2}[0]
311 | | ... | ELSE | Set Variable | ${subif_index_1}
312 | | VPP Add IP Neighbor
313 | | ... | ${dut} | ${dut_if2} | 2002:3::1 | ${TG_pf2_mac}[0]
314 | | VPP Interface Set IP Address
315 | | ... | ${dut1} | ${DUT1_${int}1}[0] | 2002:1::2 | ${prefix}
316 | | Run Keyword If | '${dut2_status}' == 'PASS'
317 | | ... | VPP Interface Set IP Address | ${dut1} | ${subif_index_1} | 2002:2::1
318 | | ... | ${prefix}
319 | | Run Keyword If | '${dut2_status}' == 'PASS'
320 | | ... | VPP Interface Set IP Address | ${dut2} | ${subif_index_2} | 2002:2::2
321 | | ... | ${prefix}
322 | | VPP Interface Set IP Address | ${dut} | ${dut_if2} | 2002:3::2 | ${prefix}
323 | | Vpp Interfaces RA Suppress On All Nodes | ${nodes}
324 | | Vpp Route Add | ${dut1} | ${tg_if1_net} | ${host_prefix}
325 | | ... | gateway=2002:1::1 | interface=${DUT1_${int}1}[0]
326 | | Run Keyword If | '${dut2_status}' == 'PASS'
327 | | ... | Vpp Route Add | ${dut1} | ${tg_if2_net} | ${host_prefix}
328 | | ... | gateway=2002:2::2 | interface=${subif_index_1}
329 | | Run Keyword If | '${dut2_status}' == 'PASS'
330 | | ... | Vpp Route Add | ${dut2} | ${tg_if1_net} | ${host_prefix}
331 | | ... | gateway=2002:2::1 | interface=${subif_index_2}
332 | | Vpp Route Add | ${dut} | ${tg_if2_net} | ${host_prefix}
333 | | ... | gateway=2002:3::1 | interface=${dut_if2}
334