Clean: Various libraries
[csit.git] / resources / libraries / robot / ip / ip6.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 | 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 | ${dut1} | ${dut1_if1} | 2001:1::2 | ${tg_if1_mac}
51 | | Run Keyword If | '${dut2_status}' == 'PASS'
52 | | ... | VPP Add IP Neighbor
53 | | ... | ${dut1} | ${dut1_if2} | 2001:3::1 | ${dut2_if1_mac}
54 | | Run Keyword If | '${dut2_status}' == 'PASS'
55 | | ... | VPP Add IP Neighbor
56 | | ... | ${dut2} | ${dut2_if1} | 2001:3::2 | ${dut1_if2_mac}
57 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
58 | | ... | Set Variable | ${dut2}
59 | | ... | ELSE | Set Variable | ${dut1}
60 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
61 | | ... | Set Variable | ${dut2_if2}
62 | | ... | ELSE | Set Variable | ${dut1_if2}
63 | | VPP Add IP Neighbor | ${dut} | ${dut_if2} | 2001:2::2 | ${tg_if2_mac}
64 | | ...
65 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 2001:1::1 | 64
66 | | Run Keyword If | '${dut2_status}' == 'PASS'
67 | | ... | VPP Interface Set IP Address | ${dut1} | ${dut1_if2} | 2001:3::1 | 64
68 | | Run Keyword If | '${dut2_status}' == 'PASS'
69 | | ... | VPP Interface Set IP Address | ${dut2} | ${dut2_if1} | 2001:3::2 | 64
70 | | VPP Interface Set IP Address | ${dut} | ${dut_if2} | 2001:2::1 | 64
71 | | ...
72 | | Vpp All Ra Suppress Link Layer | ${nodes}
73 | | ...
74 | | Run Keyword If | '${dut2_status}' == 'PASS'
75 | | ... | Vpp Route Add | ${dut1} | 2001:2::0 | 64 | gateway=2001:3::2
76 | | ... | interface=${dut1_if2}
77 | | Run Keyword If | '${dut2_status}' == 'PASS'
78 | | ... | Vpp Route Add | ${dut2} | 2001:1::0 | 64 | gateway=2001:3::1
79 | | ... | interface=${dut2_if1}
80 | | ...
81 | | Run Keyword Unless | '${remote_host1_ip}' == '${NONE}'
82 | | ... | Vpp Route Add | ${dut1} | ${remote_host1_ip} | 128
83 | | ... | gateway=2001:1::2 | interface=${dut1_if1}
84 | | Run Keyword Unless | '${remote_host2_ip}' == '${NONE}'
85 | | ... | Vpp Route Add | ${dut} | ${remote_host2_ip} | 128
86 | | ... | gateway=2001:2::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} | 128
90 | | ... | gateway=2001:3::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} | 128
94 | | ... | gateway=2001:3::1 | interface=${dut2_if1}
95
96 | Initialize IPv6 forwarding with scaling in circular topology
97 | | [Documentation]
98 | | ... | Custom setup of IPv6 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 IPv6 forwarding with scaling in 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 | | ${prefix}= | Set Variable | 64
120 | | ${host_prefix}= | Set Variable | 128
121 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 2001:3::1 | ${prefix}
122 | | Run Keyword If | '${dut2_status}' == 'PASS'
123 | | ... | VPP Interface Set IP Address
124 | | ... | ${dut1} | ${dut1_if2} | 2001:4::1 | ${prefix}
125 | | Run Keyword If | '${dut2_status}' == 'PASS'
126 | | ... | VPP Interface Set IP Address
127 | | ... | ${dut2} | ${dut2_if1} | 2001:4::2 | ${prefix}
128 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
129 | | ... | Set Variable | ${dut2}
130 | | ... | ELSE | Set Variable | ${dut1}
131 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
132 | | ... | Set Variable | ${dut2_if2}
133 | | ... | ELSE | Set Variable | ${dut1_if2}
134 | | VPP Interface Set IP Address | ${dut} | ${dut_if2} | 2001:5::1 | ${prefix}
135 | | Vpp All Ra Suppress Link Layer | ${nodes}
136 | | VPP Add IP Neighbor | ${dut1} | ${dut1_if1} | 2001:3::2 | ${tg_if1_mac}
137 | | Run Keyword If | '${dut2_status}' == 'PASS'
138 | | ... | VPP Add Ip Neighbor
139 | | ... | ${dut1} | ${dut1_if2} | 2001:4::2 | ${dut2_if1_mac}
140 | | Run Keyword If | '${dut2_status}' == 'PASS'
141 | | ... | VPP Add Ip Neighbor
142 | | ... | ${dut2} | ${dut2_if1} | 2001:4::1 | ${dut1_if2_mac}
143 | | VPP Add IP Neighbor | ${dut} | ${dut_if2} | 2001:5::2 | ${tg_if2_mac}
144 | | Vpp Route Add | ${dut1} | 2001:1::0 | ${host_prefix} | gateway=2001:3::2
145 | | ... | interface=${dut1_if1} | count=${count}
146 | | Run Keyword If | '${dut2_status}' == 'PASS'
147 | | ... | Vpp Route Add | ${dut1} | 2001:2::0 | ${host_prefix}
148 | | ... | gateway=2001:4::2 | interface=${dut1_if2} | count=${count}
149 | | Run Keyword If | '${dut2_status}' == 'PASS'
150 | | ... | Vpp Route Add | ${dut2} | 2001:1::0 | ${host_prefix}
151 | | ... | gateway=2001:4::1 | interface=${dut2_if1} | count=${count}
152 | | Vpp Route Add | ${dut} | 2001:2::0 | ${host_prefix} | gateway=2001:5::2
153 | | ... | interface=${dut_if2} | count=${count}
154
155 | Initialize IPv6 forwarding with vhost in 2-node circular topology
156 | | [Documentation]
157 | | ... | Create pairs of Vhost-User interfaces for defined number of VMs on \
158 | | ... | VPP node. Set UP state of all VPP interfaces in path. Create \
159 | | ... | nf_nodes+1 FIB tables on DUT with multipath routing. Assign each \
160 | | ... | Virtual interface to FIB table with Physical interface or Virtual \
161 | | ... | interface on both nodes. Setup IPv6 addresses with /64 prefix on \
162 | | ... | DUT-TG links. Set routing on DUT nodes in all FIB tables with \
163 | | ... | prefix /64 and next hop of neighbour IPv6 address. Setup neighbours \
164 | | ... | on all VPP interfaces.
165 | | ...
166 | | ... | *Arguments:*
167 | | ... | - nf_nodes - Number of guest VMs. Type: integer
168 | | ...
169 | | ... | *Note:*
170 | | ... | Socket paths for VM are defined in following format:
171 | | ... | - /var/run/vpp/sock-${VM_ID}-1
172 | | ... | - /var/run/vpp/sock-${VM_ID}-2
173 | | ...
174 | | ... | *Example:*
175 | | ...
176 | | ... | \| IPv6 forwarding with Vhost-User initialized in a 2-node circular\
177 | | ... | topology \| 1 \|
178 | | ...
179 | | [Arguments] | ${nf_nodes}=${1}
180 | | ...
181 | | Vpp All Ra Suppress Link Layer | ${nodes}
182 | | Set interfaces in path up
183 | | ${prefix}= | Set Variable | 64
184 | | ${fib_table_1}= | Set Variable | ${101}
185 | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${nf_nodes}
186 | | Add Fib Table | ${dut1} | ${fib_table_1} | ipv6=${True}
187 | | Add Fib Table | ${dut1} | ${fib_table_2} | ipv6=${True}
188 | | Assign Interface To Fib Table | ${dut1} | ${dut1_if1} | ${fib_table_1}
189 | | ... | ipv6=${True}
190 | | Assign Interface To Fib Table | ${dut1} | ${dut1_if2} | ${fib_table_2}
191 | | ... | ipv6=${True}
192 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 2001:100::1
193 | | ... | ${prefix}
194 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if2} | 2001:200::1
195 | | ... | ${prefix}
196 | | VPP Add IP Neighbor | ${dut1} | ${dut1_if1} | 2001:100::2 | ${tg_if1_mac}
197 | | VPP Add IP Neighbor | ${dut1} | ${dut1_if2} | 2001:200::2 | ${tg_if2_mac}
198 | | Vpp Route Add | ${dut1} | 2001:1::0 | 64 | gateway=2001:100::2
199 | | ... | interface=${dut1_if1} | vrf=${fib_table_1}
200 | | Vpp Route Add | ${dut1} | 2001:2::0 | 64 | gateway=2001:200::2
201 | | ... | interface=${dut1_if2} | vrf=${fib_table_2}
202 | | :FOR | ${number} | IN RANGE | 1 | ${nf_nodes}+1
203 | | | ${fib_table_1}= | Evaluate | ${100}+${number}
204 | | | ${fib_table_2}= | Evaluate | ${fib_table_1}+${1}
205 | | | Configure vhost interfaces | ${dut1}
206 | | | ... | /var/run/vpp/sock-${number}-1 | /var/run/vpp/sock-${number}-2
207 | | | ... | dut1-vhost-${number}-if1 | dut1-vhost-${number}-if2
208 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if1} | up
209 | | | Set Interface State | ${dut1} | ${dut1-vhost-${number}-if2} | up
210 | | | Add Fib Table | ${dut1} | ${fib_table_1} | ipv6=${True}
211 | | | Add Fib Table | ${dut1} | ${fib_table_2} | ipv6=${True}
212 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if1}
213 | | | ... | ${fib_table_1} | ipv6=${True}
214 | | | Assign Interface To Fib Table | ${dut1} | ${dut1-vhost-${number}-if2}
215 | | | ... | ${fib_table_2} | ipv6=${True}
216 | | | VPP Interface Set IP Address
217 | | | ... | ${dut1} | ${dut1-vhost-${number}-if1} | 1:1::2 | 64
218 | | | VPP Interface Set IP Address
219 | | | ... | ${dut1} | ${dut1-vhost-${number}-if2} | 1:2::2 | 64
220 | | | Vpp Route Add | ${dut1} | 2001:2::0 | 64 | gateway=1:1::1
221 | | | ... | interface=${dut1-vhost-${number}-if1} | vrf=${fib_table_1}
222 | | | Vpp Route Add | ${dut1} | 2001:1::0 | 64 | gateway=1:2::1
223 | | | ... | interface=${dut1-vhost-${number}-if2} | vrf=${fib_table_2}
224
225 | Initialize IPv6 forwarding with VLAN dot1q sub-interfaces in circular topology
226 | | [Documentation]
227 | | ... | Set UP state on VPP interfaces in path on nodes in 2-node / 3-node
228 | | ... | circular topology. In case of 3-node topology create VLAN
229 | | ... | sub-interfaces between DUTs. In case of 2-node topology create VLAN
230 | | ... | sub-interface on dut1-if2 interface. Get the interface MAC addresses
231 | | ... | and setup ARPs. Setup IPv6 addresses with /64 prefix on DUT-TG links
232 | | ... | and set routing with prefix /64. In case of 3-node set IPv6 adresses
233 | | ... | with /64 prefix on VLAN and set routing on both DUT nodes with prefix
234 | | ... | /64. Set next hop of neighbour DUT interface IPv6 address. All
235 | | ... | interfaces are brought up.
236 | | ...
237 | | ... | *Arguments:*
238 | | ... | - tg_if1_net - TG interface 1 IPv6 subnet used by traffic generator.
239 | | ... | Type: integer
240 | | ... | - tg_if2_net - TG interface 2 IPv6 subnet used by traffic generator.
241 | | ... | Type: integer
242 | | ... | - subid - ID of the sub-interface to be created. Type: string
243 | | ... | - tag_rewrite - Method of tag rewrite. Type: string
244 | | ...
245 | | ... | _NOTE:_ This KW uses following test case variables:
246 | | ... | - dut1 - DUT1 node.
247 | | ... | - dut2 - DUT2 node.
248 | | ... | - dut1_if2 - DUT1 interface towards DUT2.
249 | | ... | - dut2_if1 - DUT2 interface towards DUT1.
250 | | ...
251 | | ... | *Example:*
252 | | ...
253 | | ... | \| Initialize IPv6 forwarding with VLAN dot1q sub-interfaces\
254 | | ... | in circular topology \| 2001:1::0 \| 2001:2::0 \| 10 \| pop-1 \|
255 | | ...
256 | | [Arguments] | ${tg_if1_net} | ${tg_if2_net} | ${subid} | ${tag_rewrite}
257 | | ...
258 | | ${dut2_status} | ${value}= | Run Keyword And Ignore Error
259 | | ... | Variable Should Exist | ${dut2}
260 | | ...
261 | | Set interfaces in path up
262 | | ...
263 | | Run Keyword If | '${dut2_status}' == 'PASS'
264 | | ... | Initialize VLAN dot1q sub-interfaces in circular topology
265 | | ... | ${dut1} | ${dut1_if2} | ${dut2} | ${dut2_if1} | ${subid}
266 | | ... | ELSE | Initialize VLAN dot1q sub-interfaces in circular topology
267 | | ... | ${dut1} | ${dut1_if2} | SUB_ID=${subid}
268 | | Run Keyword If | '${dut2_status}' == 'PASS'
269 | | ... | Configure L2 tag rewrite method on interfaces | ${dut1}
270 | | ... | ${subif_index_1} | ${dut2} | ${subif_index_2} | ${tag_rewrite}
271 | | ... | ELSE | Configure L2 tag rewrite method on interfaces
272 | | ... | ${dut1} | ${subif_index_1} | TAG_REWRITE_METHOD=${tag_rewrite}
273 | | ...
274 | | ${prefix}= | Set Variable | 64
275 | | ${host_prefix}= | Set Variable | 64
276 | | VPP Add IP Neighbor | ${dut1} | ${dut1_if1} | 2002:1::1 | ${tg_if1_mac}
277 | | Run Keyword If | '${dut2_status}' == 'PASS'
278 | | ... | VPP Add Ip Neighbor
279 | | ... | ${dut1} | ${subif_index_1} | 2002:2::2 | ${dut2_if1_mac}
280 | | Run Keyword If | '${dut2_status}' == 'PASS'
281 | | ... | VPP Add Ip Neighbor
282 | | ... | ${dut2} | ${subif_index_2} | 2002:2::1 | ${dut1_if2_mac}
283 | | ${dut}= | Run Keyword If | '${dut2_status}' == 'PASS'
284 | | ... | Set Variable | ${dut2}
285 | | ... | ELSE | Set Variable | ${dut1}
286 | | ${dut_if2}= | Run Keyword If | '${dut2_status}' == 'PASS'
287 | | ... | Set Variable | ${dut2_if2}
288 | | ... | ELSE | Set Variable | ${subif_index_1}
289 | | VPP Add IP Neighbor | ${dut} | ${dut_if2} | 2002:3::1 | ${tg_if2_mac}
290 | | VPP Interface Set IP Address | ${dut1} | ${dut1_if1} | 2002:1::2 | ${prefix}
291 | | Run Keyword If | '${dut2_status}' == 'PASS'
292 | | ... | VPP Interface Set IP Address | ${dut1} | ${subif_index_1} | 2002:2::1
293 | | ... | ${prefix}
294 | | Run Keyword If | '${dut2_status}' == 'PASS'
295 | | ... | VPP Interface Set IP Address | ${dut2} | ${subif_index_2} | 2002:2::2
296 | | ... | ${prefix}
297 | | VPP Interface Set IP Address | ${dut} | ${dut_if2} | 2002:3::2 | ${prefix}
298 | | Vpp All Ra Suppress Link Layer | ${nodes}
299 | | Vpp Route Add | ${dut1} | ${tg_if1_net} | ${host_prefix}
300 | | ... | gateway=2002:1::1 | interface=${dut1_if1}
301 | | Run Keyword If | '${dut2_status}' == 'PASS'
302 | | ... | Vpp Route Add | ${dut1} | ${tg_if2_net} | ${host_prefix}
303 | | ... | gateway=2002:2::2 | interface=${subif_index_1}
304 | | Run Keyword If | '${dut2_status}' == 'PASS'
305 | | ... | Vpp Route Add | ${dut2} | ${tg_if1_net} | ${host_prefix}
306 | | ... | gateway=2002:2::1 | interface=${subif_index_2}
307 | | Vpp Route Add | ${dut} | ${tg_if2_net} | ${host_prefix}
308 | | ... | gateway=2002:3::1 | interface=${dut_if2}
309