CSIT-450: Refactor LISP files
[csit.git] / tests / func / lisp / ipsec_ipv6_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.VPPUtil
22 | Library | resources.libraries.python.IPsecUtil
23 | Library | resources.libraries.python.VatJsonUtil
24 | Library | resources.libraries.python.IPv6Setup
25 | Library | resources.libraries.python.VhostUser
26 | Library | resources.libraries.python.QemuUtils
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_ipv6/ipv6_lispgpe_ipsec_ipv6.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 | ...        | AND          | Vpp All Ra Suppress Link Layer | ${nodes}
45 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
46 | ...           | AND          | Show vpp trace dump on all DUTs
47 | ...           | AND          | Show VPP Settings | ${nodes['DUT1']}
48 | ...           | AND          | Show VPP Settings | ${nodes['DUT2']}
49 | ...
50 | Documentation | *IPv6 - ip6-ipsec-lispgpe-ip6 - main fib,
51 | ... | vrf (gpe_vni-to-vrf), phy2lisp, virt2lisp*
52 | ...
53 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
54 | ... | with single links between nodes.
55 | ... | *[Enc] Packet Encapsulations:*Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6,\
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\
60 | ... | to DUT2 where it is forwarded to TG(if2).
61 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
62
63 *** Variables ***
64 | ${dut2_spi}= | ${1000}
65 | ${dut1_spi}= | ${1001}
66 | ${ESP_PROTO}= | ${50}
67 | ${sock1}= | /tmp/sock1
68 | ${sock2}= | /tmp/sock2
69 | ${bid}= | 10
70
71 *** Test Cases ***
72 | TC01: DUT1 and DUT2 route IPv6 bidirectionally over LISP GPE tunnel using IPsec (transport) on RLOC Int.
73 | | [Documentation]
74 | | ... | [Top] TG-DUT1-DUT2-TG.
75 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
76 | | ... | Eth-IPv6-ICMPv6 on TG-DUTn.
77 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
78 | | ... | IPsec in between DUTS.
79 | | ... | [Ver] Case: ip6-lispgpe-ipsec-ip6 - main fib, phys2lisp\
80 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
81 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
82 | | ... | received packets are correct.
83 | | ... | [Ref] RFC6830, RFC4303.
84 | | ...
85 | | ${encr_alg}= | Crypto Alg AES CBC 128
86 | | ${auth_alg}= | Integ Alg SHA1 96
87 | | Given Setup Topology
88 | | And Set up LISP GPE topology
89 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
90 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
91 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
92 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
93 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
94 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
95 | | When VPP Setup IPsec Manual Keyed Connection
96 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
97 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
98 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
99 | | And VPP Setup IPsec Manual Keyed Connection
100 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
101 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
102 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
103 | | Then Send Packet And Check Headers
104 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
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 | | And Send Packet And Check Headers
108 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
109 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
110 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
111
112 | TC02: DUT1 and DUT2 route IPv6 bidirectionally over LISP GPE tunnel using IPsec (transport) lisp_gpe0 Int.
113 | | [Documentation]
114 | | ... | [Top] TG-DUT1-DUT2-TG.
115 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
116 | | ... | Eth-IPv6-ICMPv6 on TG-DUTn.
117 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
118 | | ... | IPsec in between DUTS.
119 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip6 - main fib, phys2lisp\
120 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
121 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
122 | | ... | received packets are correct.
123 | | ... | [Ref] RFC6830, RFC4303.
124 | | ...
125 | | ${encr_alg}= | Crypto Alg AES CBC 128
126 | | ${auth_alg}= | Integ Alg SHA1 96
127 | | Given Setup Topology
128 | | And Set up LISP GPE topology
129 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
130 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
131 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
132 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
133 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
134 | | ${lisp_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
135 | | ... | ${dut1_node} | lisp_gpe0
136 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
137 | | When VPP Setup IPsec Manual Keyed Connection
138 | | ... | ${dut1_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
139 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi} | ${tg1_ip6}
140 | | ... | ${tg2_ip6}
141 | | And VPP Setup IPsec Manual Keyed Connection
142 | | ... | ${dut2_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
143 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi} | ${tg2_ip6}
144 | | ... | ${tg1_ip6}
145 | | Then Send Packet And Check Headers
146 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
147 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
148 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
149 | | And Send Packet And Check Headers
150 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
151 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
152 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
153
154 | TC03: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on RLOC Int.
155 | | [Documentation]
156 | | ... | [Top] TG-DUT1-DUT2-TG.
157 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMP on DUT1-DUT2, Eth-IPv6-ICMP\
158 | | ... | on TG-DUTn.
159 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
160 | | ... | IPsec in between DUTS. Create Qemu vm on DUT1 and configure bridge\
161 | | ... | between two vhosts.
162 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip6 - main fib, virt2lisp\
163 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
164 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
165 | | ... | received packets are correct.
166 | | ... | [Ref] RFC6830, RFC4303.
167 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
168 | | ...           | AND       | Show vpp trace dump on all DUTs
169 | | ...           | AND       | VPP Show Errors | ${nodes['DUT1']}
170 | | ...           | AND       | VPP Show Errors | ${nodes['DUT2']}
171 | | ...           | AND       | Stop and Clear QEMU | ${dut1_node} | ${vm_node}
172 | | ...           | AND       | Show VPP Settings | ${dut1_node}
173 | | ...
174 | | ${encr_alg}= | Crypto Alg AES CBC 128
175 | | ${auth_alg}= | Integ Alg SHA1 96
176 | | Given Setup Topology
177 | | And Setup Qemu DUT1
178 | | And Set up LISP GPE topology
179 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
180 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
181 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
182 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
183 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
184 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
185 | | When VPP Setup IPsec Manual Keyed Connection
186 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
187 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
188 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
189 | | And VPP Setup IPsec Manual Keyed Connection
190 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
191 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
192 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
193 | | Then Send Packet And Check Headers
194 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
195 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
196 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
197 | | And Send Packet And Check Headers
198 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
199 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
200 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
201
202 | TC04: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
203 | | [Documentation]
204 | | ... | [Top] TG-DUT1-DUT2-TG.
205 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
206 | | ... | Eth-IPv6-ICMPv6 on TG-DUTn.
207 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
208 | | ... | IPsec in between DUTS.
209 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip6 - main fib, virt2lisp\
210 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
211 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
212 | | ... | received packets are correct.
213 | | ... | [Ref] RFC6830, RFC4303.
214 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
215 | | ...           | AND       | Show vpp trace dump on all DUTs
216 | | ...           | AND       | VPP Show Errors | ${nodes['DUT1']}
217 | | ...           | AND       | VPP Show Errors | ${nodes['DUT2']}
218 | | ...           | AND       | Stop and Clear QEMU | ${dut1_node} | ${vm_node}
219 | | ...           | AND       | Show VPP Settings | ${dut1_node}
220 | | ...
221 | | ${encr_alg}= | Crypto Alg AES CBC 128
222 | | ${auth_alg}= | Integ Alg SHA1 96
223 | | Given Setup Topology
224 | | And Setup Qemu DUT1
225 | | And Set up LISP GPE topology
226 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
227 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
228 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
229 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
230 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
231 | | ${lisp1_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
232 | | ... | ${dut1_node} | lisp_gpe0
233 | | ${lisp2_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
234 | | ... | ${dut2_node} | lisp_gpe0
235 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
236 | | When VPP Setup IPsec Manual Keyed Connection
237 | | ... | ${dut1_node} | ${lisp1_if_idx} | ${encr_alg} | ${encr_key}
238 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
239 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
240 | | And VPP Setup IPsec Manual Keyed Connection
241 | | ... | ${dut2_node} | ${lisp2_if_idx} | ${encr_alg} | ${encr_key}
242 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
243 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
244 | | Then Send Packet And Check Headers
245 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
246 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
247 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
248 | | And Send Packet And Check Headers
249 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
250 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
251 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
252
253 *** Keywords ***
254 | Setup Topology
255 | | Path for 3-node testing is set
256 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
257 | | Interfaces in 3-node path are up
258 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
259 | | ... | ${prefix6}
260 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
261 | | ... | ${prefix6}
262 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip6}
263 | | ... | ${prefix6}
264 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip6}
265 | | ... | ${prefix6}
266 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip6}
267 | | ... | ${prefix6}
268 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip6}
269 | | ... | ${tg_to_dut1_mac}
270 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip6}
271 | | ... | ${tg_to_dut2_mac}
272 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip6}
273 | | ... | ${dut2_to_dut1_mac}
274 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip6}
275 | | ... | ${dut1_to_dut2_mac}
276
277 | Setup Qemu DUT1
278 | | [Documentation] | Setup Vhosts on DUT1 and setup IP to one of them. Setup \
279 | | ... | Qemu and bridge the vhosts.
280 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
281 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
282 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${vhost2} | 2001:cdba:1::9
283 | | ... | ${prefix6}
284 | | Set Interface State | ${dut1_node} | ${vhost1} | up
285 | | Set Interface State | ${dut1_node} | ${vhost2} | up
286 | | Bridge domain on DUT node is created | ${dut1_node} | ${bid} | learn=${TRUE}
287 | | Interface is added to bridge domain | ${dut1_node}
288 | | ... | ${dut1_to_tg} | ${bid} | 0
289 | | Interface is added to bridge domain | ${dut1_node}
290 | | ... | ${vhost1} | ${bid} | 0
291 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
292 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
293 | | VM for Vhost L2BD forwarding is setup | ${dut1_node} | ${sock1} | ${sock2}