CSIT-1459: Migrate IP libraries from VAT to PAPI
[csit.git] / tests / vpp / func / ip4_tunnels / gre / eth2p-ethip4gre-ip4base-func.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.IPUtil
16 | Library  | resources.libraries.python.Trace
17 | ...
18 | Resource | resources/libraries/robot/ip/ip4.robot
19 | Resource | resources/libraries/robot/shared/default.robot
20 | Resource | resources/libraries/robot/overlay/gre.robot
21 | Resource | resources/libraries/robot/shared/testing_path.robot
22 | Resource | resources/libraries/robot/shared/traffic.robot
23 | ...
24 | Force Tags | VM_ENV | HW_ENV | 3_NODE_DOUBLE_LINK_TOPO | SKIP_VPP_PATCH
25 | ...
26 | Test Setup | Set up functional test
27 | ...
28 | Test Teardown | Tear down functional test
29 | ...
30 | Documentation | *GREoIPv4 test cases*
31 | ...
32 | ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
33 | ... | between nodes; TG-DUT1-DUT2-TG 3-node circular topology with single
34 | ... | links between nodes.
35 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-GRE-IPv4-ICMPv4 on DUT1-DUT2,
36 | ... | Eth-IPv4-ICMPv4 on TG-DUTn for routing over GRE tunnel; Eth-IPv4-ICMPv4
37 | ... | on TG_if1-DUT, Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT for GREoIPv4
38 | ... | encapsulation and decapsulation verification.
39 | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with IPv4 routing
40 | ... | and static routes. GREoIPv4 tunnel is configured between DUT1 and DUT2.
41 | ... | *[Ver] TG verification:* Test ICMPv4 (or ICMPv6) Echo Request packets are
42 | ... | sent in both directions by TG on links to DUT1 and DUT2; GREoIPv4
43 | ... | encapsulation and decapsulation are verified separately by TG; on
44 | ... | receive TG verifies packets for correctness and their IPv4 (IPv6)
45 | ... | src-addr, dst-addr and MAC addresses.
46 | ... | *[Ref] Applicable standard specifications:* RFC2784.
47
48 *** Variables ***
49 | ${net1_address}= | 192.168.0.0
50 | ${net1_host_address}= | 192.168.0.100
51 | ${net1_gw_address}= | 192.168.0.1
52 | ${net2_address}= | 192.168.2.0
53 | ${net2_host_address}= | 192.168.2.100
54 | ${net3_address}= | 192.168.3.0
55 | ${net3_host_address}= | 192.168.3.100
56 | ${net2_gw_address}= | 192.168.2.1
57 | ${dut1_ip_address}= | 192.168.1.1
58 | ${dut2_ip_address}= | 192.168.1.2
59 | ${dut1_gre_ip}= | 172.16.0.1
60 | ${dut2_gre_ip}= | 172.16.0.2
61 | ${dut_tun0_ip1}= | 172.16.0.1
62 | ${dut_tun0_ip2}= | 172.16.0.2
63 | ${dut_tun1_ip1}= | 172.16.1.1
64 | ${dut_tun1_ip2}= | 172.16.1.2
65 | ${dut1_lo_address}= | 10.0.0.1
66 | ${tun0_dst}= | 10.0.0.2
67 | ${tun1_dst}= | 10.0.0.3
68 | ${prefix}= | 24
69
70 *** Test Cases ***
71 | TC01: DUT1 and DUT2 route over GREoIPv4 tunnel between two TG links
72 | | [Documentation]
73 | | ... | [Top] TG-DUT1-DUT2-TG. [Enc] Eth-IPv4-GRE-IPv4-ICMPv4 on \
74 | | ... | DUT1-DUT2, Eth-IPv4-ICMPv4 on TG-DUTn. [Cfg] On DUT1 and DUT2
75 | | ... | configure GREoIPv4 tunnel with IPv4 routes towards each other.
76 | | ... | [Ver] Make TG send ICMPv4 Echo Req between its interfaces across
77 | | ... | both DUTs and GRE tunnel between them; verify IPv4 headers on
78 | | ... | received packets are correct. [Ref] RFC2784.
79 | | [Tags] | 3_NODE_SINGLE_LINK_TOPO | 3_NODE_DOUBLE_LINK_TOPO
80 | | Given Configure path in 3-node circular topology | ${nodes['TG']}
81 | | ... | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
82 | | And Set interfaces in 3-node circular topology up
83 | | And Configure IP addresses on interfaces
84 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_ip_address} | ${prefix}
85 | | ... | ${dut1_node} | ${dut1_to_tg} | ${net1_gw_address} | ${prefix}
86 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_ip_address} | ${prefix}
87 | | ... | ${dut2_node} | ${dut2_to_tg} | ${net2_gw_address} | ${prefix}
88 | | And VPP IP Probe | ${dut1_node} | ${dut1_to_dut2} | ${dut2_ip_address}
89 | | And VPP IP Probe | ${dut2_node} | ${dut2_to_dut1} | ${dut1_ip_address}
90 | | And VPP Add IP Neighbor | ${dut2_node} | ${dut2_to_tg}
91 | | ... | ${net2_host_address} | ${tg_to_dut2_mac}
92 | | ${dut1_gre_interface} | ${dut1_gre_index}=
93 | | ... | When Create GRE tunnel interface and set it up
94 | | ... | ${dut1_node} | ${dut1_ip_address} | ${dut2_ip_address}
95 | | ${dut2_gre_interface} | ${dut2_gre_index}=
96 | | ... | And Create GRE tunnel interface and set it up
97 | | ... | ${dut2_node} | ${dut2_ip_address} | ${dut1_ip_address}
98 | | And Configure IP addresses on interfaces
99 | | ... | ${dut1_node} | ${dut1_gre_index} | ${dut1_gre_ip} | ${prefix}
100 | | ... | ${dut2_node} | ${dut2_gre_index} | ${dut2_gre_ip} | ${prefix}
101 | | And Vpp Route Add | ${dut1_node} | ${net2_address} | ${prefix}
102 | | ... | gateway=${dut2_gre_ip} | interface=${dut1_gre_index}
103 | | Then Send packet and verify headers | ${tg_node}
104 | | ... | ${net1_host_address} | ${net2_host_address}
105 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
106 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
107
108 | TC02: DUT encapsulates IPv4 into GREoIPv4 tunnel - GRE header verification
109 | | [Documentation]
110 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
111 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure
112 | | ... | GREoIPv4 tunnel with IPv4 route towards TG. [Ver] Make TG send
113 | | ... | non-encapsulated ICMPv4 Echo Req to DUT; verify TG received
114 | | ... | GREoIPv4 encapsulated packet is correct. [Ref] RFC2784.
115 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
116 | | Given Configure path in 2-node circular topology
117 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
118 | | And Set interfaces in 2-node circular topology up
119 | | And Configure IP addresses on interfaces
120 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
121 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
122 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2}
123 | | ... | ${dut2_ip_address} | ${tg_to_dut_if2_mac}
124 | | ${dut1_gre_interface} | ${dut1_gre_index}=
125 | | ... | When Create GRE tunnel interface and set it up
126 | | ... | ${dut_node} | ${dut1_ip_address} | ${dut2_ip_address}
127 | | And Configure IP addresses on interfaces
128 | | ... | ${dut_node} | ${dut1_gre_index} | ${dut1_gre_ip} | ${prefix}
129 | | And Vpp Route Add | ${dut_node} | ${net2_address} | ${prefix}
130 | | ... | gateway=${dut2_gre_ip} | interface=${dut1_gre_index}
131 | | Then Send ICMPv4 and check received GRE header
132 | | ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
133 | | ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if2_mac}
134 | | ... | ${net1_host_address} | ${net2_host_address}
135 | | ... | ${dut1_ip_address} | ${dut2_ip_address}
136
137 | TC03: DUT decapsulates IPv4 from GREoIPv4 tunnel - IPv4 header verification
138 | | [Documentation]
139 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
140 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure
141 | | ... | GREoIPv4 tunnel towards TG. [Ver] Make TG send ICMPv4 Echo Req
142 | | ... | encapsulated into GREoIPv4 towards VPP; verify TG received IPv4
143 | | ... | de-encapsulated packet is correct. [Ref] RFC2784.
144 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
145 | | Given Configure path in 2-node circular topology
146 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
147 | | And Set interfaces in 2-node circular topology up
148 | | And Configure IP addresses on interfaces
149 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
150 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
151 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1}
152 | | ... | ${net1_host_address} | ${tg_to_dut_if1_mac}
153 | | ${dut1_gre_interface} | ${dut1_gre_index}=
154 | | ... | When Create GRE tunnel interface and set it up
155 | | ... | ${dut_node} | ${dut1_ip_address} | ${dut2_ip_address}
156 | | And Configure IP addresses on interfaces
157 | | ... | ${dut_node} | ${dut1_gre_index} | ${dut1_gre_ip} | ${prefix}
158 | | Then Send GRE and check received ICMPv4 header
159 | | ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
160 | | ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if1_mac}
161 | | ... | ${net2_host_address} | ${net1_host_address}
162 | | ... | ${dut2_ip_address} | ${dut1_ip_address}
163
164 | TC04: DUT encapsulates IPv4 into GREoIPv4 different tunnels - GRE header verification
165 | | [Documentation]
166 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
167 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure two
168 | | ... | GRE tunnels with loopback's source address. Destination address of
169 | | ... | tunnels are routed via next hop address of DUT's to TG if2, where
170 | | ... | should be only GRE encapsulated packets. Each tunnel has IPv4 address
171 | | ... | and configured prefix routed through the tunnel. [Ver] Make TG send
172 | | ... | non-encapsulated ICMPv4 Echo Req to DUT; verify TG received GREoIPv4
173 | | ... | encapsulated packet is correct for each tunnel. [Ref] RFC2784.
174 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
175 | | Given Configure path in 2-node circular topology
176 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
177 | | And Set interfaces in 2-node circular topology up
178 | | ${dut1_lo_index}= | And VPP Create loopback | ${dut_node}
179 | | And Set Interface State | ${dut_node} | ${dut1_lo_index} | up
180 | | And Configure IP addresses on interfaces
181 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
182 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
183 | | ... | ${dut_node} | ${dut1_lo_index} | ${dut1_lo_address} | ${32}
184 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2}
185 | | ... | ${dut2_ip_address} | ${tg_to_dut_if2_mac}
186 | | And Vpp Route Add | ${dut_node} | ${tun0_dst} | ${32}
187 | | ... | gateway=${dut2_ip_address} | interface=${dut_to_tg_if2}
188 | | And Vpp Route Add | ${dut_node} | ${tun1_dst} | ${32}
189 | | ... | gateway=${dut2_ip_address} | interface=${dut_to_tg_if2}
190 | | ${dut1_gre0_interface} | ${dut1_gre0_index}=
191 | | ... | When Create GRE tunnel interface and set it up
192 | | ... | ${dut_node} | ${dut1_lo_address} | ${tun0_dst}
193 | | ${dut1_gre1_interface} | ${dut1_gre1_index}=
194 | | ... | And Create GRE tunnel interface and set it up
195 | | ... | ${dut_node} | ${dut1_lo_address} | ${tun1_dst}
196 | | And Configure IP addresses on interfaces
197 | | ... | ${dut_node} | ${dut1_gre0_index} | ${dut_tun0_ip1} | ${prefix}
198 | | ... | ${dut_node} | ${dut1_gre1_index} | ${dut_tun1_ip1} | ${prefix}
199 | | And Vpp Route Add | ${dut_node} | ${net2_address} | ${prefix}
200 | | ... | gateway=${dut_tun0_ip2} | interface=${dut1_gre0_index}
201 | | And Vpp Route Add | ${dut_node} | ${net3_address} | ${prefix}
202 | | ... | gateway=${dut_tun1_ip2} | interface=${dut1_gre1_index}
203 | | Then Send ICMPv4 and check received GRE header
204 | | ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
205 | | ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if2_mac}
206 | | ... | ${net1_host_address} | ${net2_host_address}
207 | | ... | ${dut1_lo_address} | ${tun0_dst}
208 | | And Send ICMPv4 and check received GRE header
209 | | ... | ${tg_node} | ${tg_to_dut_if1} | ${tg_to_dut_if2}
210 | | ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if2_mac}
211 | | ... | ${net1_host_address} | ${net3_host_address}
212 | | ... | ${dut1_lo_address} | ${tun1_dst}
213
214 | TC05: DUT re-encapsulates IPv4 GRE into other GRE tunnel - GRE header verification
215 | | [Documentation]
216 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
217 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure two
218 | | ... | GRE tunnels with loopback's source address. Destination address of
219 | | ... | tunnels are routed via next hop address of DUT's to TG if2, where
220 | | ... | should be only GRE encapsulated packets. Each tunnel has IPv4 address
221 | | ... | and configured prefix routed through the tunnel. [Ver] Make TG send
222 | | ... | encapsulated IPv4 UDP to DUT; Encapsulated IP source is behind
223 | | ... | configured tunnel same as destination; verify TG received GREoIPv4
224 | | ... | encapsulated packet is correct. [Ref] RFC2784.
225 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
226 | | Given Configure path in 2-node circular topology
227 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
228 | | And Set interfaces in 2-node circular topology up
229 | | ${dut1_lo_index}= | And VPP Create loopback | ${dut_node}
230 | | And Set Interface State | ${dut_node} | ${dut1_lo_index} | up
231 | | And Configure IP addresses on interfaces
232 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
233 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
234 | | ... | ${dut_node} | ${dut1_lo_index} | ${dut1_lo_address} | ${32}
235 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2}
236 | | ... | ${dut2_ip_address} | ${tg_to_dut_if2_mac}
237 | | And Vpp Route Add | ${dut_node} | ${tun0_dst} | ${32}
238 | | ... | gateway=${dut2_ip_address} | interface=${dut_to_tg_if2}
239 | | And Vpp Route Add | ${dut_node} | ${tun1_dst} | ${32}
240 | | ... | gateway=${dut2_ip_address} | interface=${dut_to_tg_if2}
241 | | ${dut1_gre0_interface} | ${dut1_gre0_index}=
242 | | ... | When Create GRE tunnel interface and set it up
243 | | ... | ${dut_node} | ${dut1_lo_address} | ${tun0_dst}
244 | | ${dut1_gre1_interface} | ${dut1_gre1_index}=
245 | | ... | And Create GRE tunnel interface and set it up
246 | | ... | ${dut_node} | ${dut1_lo_address} | ${tun1_dst}
247 | | And Configure IP addresses on interfaces
248 | | ... | ${dut_node} | ${dut1_gre0_index} | ${dut_tun0_ip1} | ${prefix}
249 | | ... | ${dut_node} | ${dut1_gre1_index} | ${dut_tun1_ip1} | ${prefix}
250 | | And Vpp Route Add | ${dut_node} | ${net2_address} | ${prefix}
251 | | ... | gateway=${dut_tun0_ip2} | interface=${dut1_gre0_index}
252 | | And Vpp Route Add | ${dut_node} | ${net3_address} | ${prefix}
253 | | ... | gateway=${dut_tun1_ip2} | interface=${dut1_gre1_index}
254 | | Then Send GRE and check received GRE header
255 | | ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if2}
256 | | ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if2_mac}
257 | | ... | ${dut1_lo_address} | ${tun0_dst}
258 | | ... | ${net3_host_address} | ${net2_host_address}
259 | | ... | ${tg_to_dut_if2_mac} | ${dut_to_tg_if2_mac}
260 | | ... | ${tun1_dst} | ${dut1_lo_address}
261
262 | TC06: DUT do not process GRE with wrong tunnel destination IP
263 | | [Documentation]
264 | | ... | [Top] TG=DUT1. [Enc] Eth-IPv4-ICMPv4 on TG_if1-DUT, \
265 | | ... | Eth-IPv4-GRE-IPv4-ICMPv4 on TG_if2_DUT. [Cfg] On DUT1 configure two
266 | | ... | GRE tunnels with loopback's source address. Destination address of
267 | | ... | tunnels are routed via next hop address of DUT's to TG if2, where
268 | | ... | should be only GRE encapsulated packets. On DUT's to TG if1 interface
269 | | ... | is configured test destination host MAC address. [Ver] Make TG send
270 | | ... | GRE encapsulated ICMPv4 Echo Req to DUT; verify TG received
271 | | ... | de-capsulated packet is correct, then send packet with wrong tunnel
272 | | ... | destination address. [Ref] RFC2784.
273 | | ... |
274 | | [Tags] | 3_NODE_DOUBLE_LINK_TOPO
275 | | Given Configure path in 2-node circular topology
276 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['TG']}
277 | | And Set interfaces in 2-node circular topology up
278 | | ${dut1_lo_index}= | And VPP Create loopback | ${dut_node}
279 | | And Set Interface State | ${dut_node} | ${dut1_lo_index} | up
280 | | And Configure IP addresses on interfaces
281 | | ... | ${dut_node} | ${dut_to_tg_if2} | ${dut1_ip_address} | ${prefix}
282 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${net1_gw_address} | ${prefix}
283 | | ... | ${dut_node} | ${dut1_lo_index} | ${dut1_lo_address} | ${32}
284 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if1}
285 | | ... | ${net1_host_address} | ${tg_to_dut_if1_mac}
286 | | And VPP Add IP Neighbor | ${dut_node} | ${dut_to_tg_if2}
287 | | ... | ${dut2_ip_address} | ${tg_to_dut_if2_mac}
288 | | And Vpp Route Add | ${dut_node} | ${tun0_dst} | ${32}
289 | | ... | gateway=${dut2_ip_address} | interface=${dut_to_tg_if2}
290 | | And Vpp Route Add | ${dut_node} | ${tun1_dst} | ${32}
291 | | ... | gateway=${dut2_ip_address} | interface=${dut_to_tg_if2}
292 | | ${dut1_gre0_interface} | ${dut1_gre0_index}=
293 | | ... | When Create GRE tunnel interface and set it up
294 | | ... | ${dut_node} | ${dut1_lo_address} | ${tun0_dst}
295 | | ${dut1_gre1_interface} | ${dut1_gre1_index}=
296 | | ... | And Create GRE tunnel interface and set it up
297 | | ... | ${dut_node} | ${dut1_lo_address} | ${tun1_dst}
298 | | And Configure IP addresses on interfaces
299 | | ... | ${dut_node} | ${dut1_gre0_index} | ${dut_tun0_ip1} | ${prefix}
300 | | ... | ${dut_node} | ${dut1_gre1_index} | ${dut_tun1_ip1} | ${prefix}
301 | | Then Send GRE and check received ICMPv4 header
302 | | ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
303 | | ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if1_mac}
304 | | ... | ${net2_host_address} | ${net1_host_address}
305 | | ... | ${tun0_dst} | ${dut1_lo_address}
306 | | And Run Keyword And Expect Error | ICMP echo Rx timeout
307 | | ... | Send GRE and check received ICMPv4 header |
308 | | ... | ${tg_node} | ${tg_to_dut_if2} | ${tg_to_dut_if1}
309 | | ... | ${dut_to_tg_if2_mac} | ${tg_to_dut_if1_mac}
310 | | ... | ${net2_host_address} | ${net1_host_address}
311 | | ... | ${tun0_dst} | ${dut1_ip_address}