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