266a4450110bee4996fd0d07db41ceeedb0a5f2f
[csit.git] / tests / func / lisp / ipsec_ipv6_lispgpe_ipv4.robot
1 # Copyright (c) 2016 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.topology.Topology
16 | Library | resources.libraries.python.NodePath
17 | Library | resources.libraries.python.Trace
18 | Library | resources.libraries.python.IPUtil
19 | Library | resources.libraries.python.L2Util
20 | Library | resources.libraries.python.LispUtil
21 | Library | resources.libraries.python.IPsecUtil
22 | Library | resources.libraries.python.VatJsonUtil
23 | Library | resources.libraries.python.IPv6Setup
24 | Library | resources.libraries.python.VhostUser
25 | Library | resources.libraries.python.QemuUtils
26 | Library | resources.libraries.python.VPPUtil
27 | Library | String
28 | Resource | resources/libraries/robot/traffic.robot
29 | Resource | resources/libraries/robot/default.robot
30 | Resource | resources/libraries/robot/interfaces.robot
31 | Resource | resources/libraries/robot/testing_path.robot
32 | Resource | resources/libraries/robot/ipv6.robot
33 | Resource | resources/libraries/robot/ipsec.robot
34 | Resource | resources/libraries/robot/qemu.robot
35 | Resource | resources/libraries/robot/lisp/lispgpe.robot
36 | Resource | resources/libraries/robot/bridge_domain.robot
37 # Import configuration and test data:
38 | Variables | resources/test_data/lisp/ipv6_lispgpe_ipv4/ipv6_lispgpe_ipsec_ipv4.py
39 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP
40 | ...
41 | Test Setup | Run Keywords | Setup all DUTs before test
42 | ...        | AND          | Setup all TGs before traffic script
43 | ...        | AND          | Update All Interface Data On All Nodes | ${nodes}
44 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
45 | ...           | AND          | Show vpp trace dump on all DUTs
46 | ...           | AND          | Show Vpp Settings | ${nodes['DUT1']}
47 | ...           | AND          | Show Vpp Settings | ${nodes['DUT2']}
48 | ...
49 | Documentation | *IPv6 - ip4-ipsec-lispgpe-ip6 - main fib, vrf, virt2lisp,\
50 | ... | phy2lisp*
51 | ...
52 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
53 | ... | with single links between nodes.
54 | ... | *[Enc] Packet Encapsulations:*Eth-IPv4-LISPGPE-IPSec-IPv6-ICMP,\
55 | ... | Eth-IPv4-IPSec-LISPGPE-IPv6-ICMP
56 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
57 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
58 | ... | on RLOC interface or lisp_gpe0 interface.
59 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1 to\
60 | ... | DUT2 where it is forwarded to TG(if2).
61 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
62
63 *** Test Cases ***
64 | TC01: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on RLOC Int.
65 | | [Documentation]
66 | | ... | [Top] TG-DUT1-DUT2-TG.
67 | | ... | [Enc] Eth-IPv4-LISPGPE-IPSec-IPv6-ICMP on DUT1-DUT2, Eth-IPv6-ICMP\
68 | | ... | on TG-DUTn.
69 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
70 | | ... | IPsec in between DUTS.
71 | | ... | [Ver] Make TG send ICMPv6 Echo Req between its interfaces across\
72 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
73 | | ... | received packets are correct.
74 | | ... | [Ref] RFC6830, RFC4303.
75 | | ...
76 | | ${encr_alg}= | Crypto Alg AES CBC 128
77 | | ${auth_alg}= | Integ Alg SHA1 96
78 | | Given Setup Topology And Lisp
79 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
80 | | When VPP Setup IPsec Manual Keyed Connection
81 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
82 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
83 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
84 | | And VPP Setup IPsec Manual Keyed Connection
85 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
86 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
87 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
88 | | Then Send Packet And Check Headers
89 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
90 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
91 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
92 | | And Send Packet And Check Headers
93 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
94 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
95 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
96
97 | TC02: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
98 | | [Documentation]
99 | | ... | [Top] TG-DUT1-DUT2-TG.
100 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2, Eth-IPv6-ICMP\
101 | | ... | on TG-DUTn.
102 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
103 | | ... | IPsec in between DUTS.
104 | | ... | [Ver] Make TG send ICMPv6 Echo Req between its interfaces across\
105 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
106 | | ... | received packets are correct.
107 | | ... | [Ref] RFC6830, RFC4303.
108 | | ...
109 | | ${encr_alg}= | Crypto Alg AES CBC 128
110 | | ${auth_alg}= | Integ Alg SHA1 96
111 | | Given Setup Topology And Lisp
112 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
113 | | ${lisp_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
114 | | ... | ${dut1_node} | ${lisp_gpe_int}
115 | | When VPP Setup IPsec Manual Keyed Connection
116 | | ... | ${dut1_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
117 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
118 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
119 | | And VPP Setup IPsec Manual Keyed Connection
120 | | ... | ${dut2_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
121 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
122 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
123 | | Then Send Packet And Check Headers
124 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
125 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
126 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
127 | | And Send Packet And Check Headers
128 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
129 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
130 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
131
132 | TC03: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on RLOC Int.
133 | | [Documentation]
134 | | ... | [Top] TG-DUT1-DUT2-TG.
135 | | ... | [Enc] Eth-IPv4-LISPGPE-IPSec-IPv6-ICMP on DUT1-DUT2, Eth-IPv6-ICMP\
136 | | ... | on TG-DUTn.
137 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
138 | | ... | IPsec in between DUTS. Create Qemu vm on DUT1 and configure bridge\
139 | | ... | between two vhosts.
140 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip6 - main fib, virt2lisp\
141 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
142 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
143 | | ... | received packets are correct.
144 | | ... | [Ref] RFC6830, RFC4303.
145 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
146 | | ...           | AND       | Show vpp trace dump on all DUTs
147 | | ...           | AND       | Show Vpp Settings | ${nodes['DUT1']}
148 | | ...           | AND       | Show Vpp Settings | ${nodes['DUT2']}
149 | | ...           | AND       | Stop and Clear QEMU | ${dut1_node} | ${vm_node}
150 | | ...
151 | | ${encr_alg}= | Crypto Alg AES CBC 128
152 | | ${auth_alg}= | Integ Alg SHA1 96
153 | | Given Setup Topology And Lisp
154 | | And Setup Qemu DUT1
155 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
156 | | When VPP Setup IPsec Manual Keyed Connection
157 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
158 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
159 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
160 | | And VPP Setup IPsec Manual Keyed Connection
161 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
162 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
163 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
164 | | Then Send Packet And Check Headers
165 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
166 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
167 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
168 | | And Send Packet And Check Headers
169 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
170 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
171 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
172
173 | TC04: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
174 | | [Documentation]
175 | | ... | [Top] TG-DUT1-DUT2-TG.
176 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
177 | | ... | Eth-IPv6-ICMPv6, on TG-DUTn.
178 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
179 | | ... | IPsec in between DUTS.
180 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip6 - main fib, virt2lisp\
181 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
182 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
183 | | ... | received packets are correct.
184 | | ... | [Ref] RFC6830, RFC4303.
185 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
186 | | ...           | AND       | Show vpp trace dump on all DUTs
187 | | ...           | AND       | Show Vpp Settings | ${nodes['DUT1']}
188 | | ...           | AND       | Show Vpp Settings | ${nodes['DUT2']}
189 | | ...           | AND       | Stop and Clear QEMU | ${dut1_node} | ${vm_node}
190 | | ...
191 | | ${encr_alg}= | Crypto Alg AES CBC 128
192 | | ${auth_alg}= | Integ Alg SHA1 96
193 | | Given Setup Topology And Lisp
194 | | And Setup Qemu DUT1
195 | | ${lisp1_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
196 | | ... | ${dut1_node} | ${lisp_gpe_int}
197 | | ${lisp2_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
198 | | ... | ${dut2_node} | ${lisp_gpe_int}
199 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
200 | | When VPP Setup IPsec Manual Keyed Connection
201 | | ... | ${dut1_node} | ${lisp1_if_idx} | ${encr_alg} | ${encr_key}
202 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
203 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
204 | | And VPP Setup IPsec Manual Keyed Connection
205 | | ... | ${dut2_node} | ${lisp2_if_idx} | ${encr_alg} | ${encr_key}
206 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
207 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
208 | | Then Send Packet And Check Headers
209 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
210 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
211 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
212 | | And Send Packet And Check Headers
213 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
214 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
215 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
216
217 | TC05: DUT1 and DUT2 route IPv6 bidirectionally over LISP GPE tunnel using physical interfaces and VRF is enabled
218 | | [Documentation]
219 | | ... | [Top] TG-DUT1-DUT2-TG.
220 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
221 | | ... | Eth-IPv6-ICMPv6, on TG-DUTn.
222 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
223 | | ... | IPsec in between DUTS.
224 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip6 - vrf, phy2lisp
225 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across both\
226 | | ... | DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
227 | | ... | received packets are correct.
228 | | ... | [Ref] RFC6830, RFC4303.
229 | | ...
230 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
231 | | ... | AND | Show vpp trace dump on all DUTs
232 | | ... | AND | Show Vpp Settings | ${nodes['DUT1']}
233 | | ... | AND | Show Vpp Settings | ${nodes['DUT2']}
234 | | ...
235 | | ${encr_alg}= | Crypto Alg AES CBC 128
236 | | ${auth_alg}= | Integ Alg SHA1 96
237 | | Given Path for 3-node testing is set
238 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
239 | | And Interfaces in 3-node path are up
240 | | Assign Interface To Fib Table | ${dut1_node}
241 | | ... | ${dut1_to_tg} | ${fib_table_1} | ip6=${TRUE}
242 | | Assign Interface To Fib Table | ${dut2_node}
243 | | ... | ${dut2_to_tg} | ${fib_table_1} | ip6=${TRUE}
244 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
245 | | When VPP Setup IPsec Manual Keyed Connection
246 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
247 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
248 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
249 | | And VPP Setup IPsec Manual Keyed Connection
250 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
251 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
252 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
253 | | Setup Topology And Lisp | ${fib_table_1} | ${dut1_dut2_vni}
254 | | Then Send Packet And Check Headers
255 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
256 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
257 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
258 | | And Send Packet And Check Headers
259 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
260 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
261 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
262
263 *** Keywords ***
264 | Setup Topology And Lisp
265 | | [Documentation] | Setup IPs and neighbors for interfaces on DUT1 and DUT2\
266 | | ... | and then setup LISP.
267 | | [Arguments] | ${fib_table}=0 | ${vni_table}=0 | ${ip6}=${FALSE}
268 | | Path for 3-node testing is set
269 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
270 | | Interfaces in 3-node path are up
271 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4}
272 | | ... | ${prefix4}
273 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip6}
274 | | ... | ${prefix6}
275 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4}
276 | | ... | ${prefix4}
277 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip6}
278 | | ... | ${prefix6}
279 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip6}
280 | | ... | ${tg_to_dut2_mac} | ${fib_table}
281 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
282 | | ... | ${dut2_to_dut1_mac}
283 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
284 | | ... | ${dut1_to_dut2_mac}
285 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip6}
286 | | ... | ${tg_to_dut1_mac} | ${fib_table}
287 | | Set up LISP GPE topology
288 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
289 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
290 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
291 | | ... | ${dut1_to_dut2_ip_static_adjacency}
292 | | ... | ${dut2_to_dut1_ip_static_adjacency}
293 | | ... | ${vni_table} | ${fib_table}
294
295 | Setup Qemu DUT1
296 | | [Documentation] | Setup Vhosts on DUT1 and setup IP to one of them. Setup\
297 | | ... | Qemu and bridge the vhosts.
298 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
299 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
300 | | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix6}
301 | | Set Interface State | ${dut1_node} | ${vhost1} | up
302 | | Set Interface State | ${dut1_node} | ${vhost2} | up
303 | | Bridge domain on DUT node is created | ${dut1_node} | ${bid} | learn=${TRUE}
304 | | Interface is added to bridge domain | ${dut1_node}
305 | | ... | ${dut1_to_tg} | ${bid} | 0
306 | | Interface is added to bridge domain | ${dut1_node}
307 | | ... | ${vhost1} | ${bid} | 0
308 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
309 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
310 | | VM for Vhost L2BD forwarding is setup | ${dut1_node} | ${sock1} | ${sock2}
311