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