Convert functional tests to statefull QemuUtils
[csit.git] / tests / vpp / func / crypto / default / eth2p-ethip4ipsectptlispgpe-ip4base-func.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.LispUtil
19 | Library | resources.libraries.python.VPPUtil
20 | Library | resources.libraries.python.IPsecUtil
21 | Resource | resources/libraries/robot/shared/traffic.robot
22 | Resource | resources/libraries/robot/shared/default.robot
23 | Resource | resources/libraries/robot/shared/interfaces.robot
24 | Resource | resources/libraries/robot/shared/testing_path.robot
25 | Resource | resources/libraries/robot/crypto/ipsec.robot
26 | Resource | resources/libraries/robot/vm/qemu.robot
27 | Resource | resources/libraries/robot/overlay/lispgpe.robot
28 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
29 | Resource | resources/libraries/robot/overlay/l2lisp.robot
30 # Import configuration and test data:
31 | Variables | resources/test_data/lisp/ipv4_ipsec_lispgpe_ipv4/ipv4_ipsec_lispgpe_ipv4.py
32 | ...
33 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP | SKIP_VPP_PATCH
34 | ...
35 | Test Setup | Set up functional test
36 | ...
37 | Test Teardown | Tear down LISP functional test
38 | ...
39 | Documentation | *IPv4-ip4-ipsec-lispgpe-ip4 - main fib, vrf (gpe_vni-to-vrf)*
40 | ...
41 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
42 | ... | with single links between nodes.
43 | ... | *[Enc] Packet Encapsulations:* ICMPv4-IPv4-IPSec-LISPGPE-IPv4-ICMPv4.
44 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
45 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
46 | ... | on RLOC interface or lisp_gpe0 interface.
47 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1 to\
48 | ... | DUT2 where it is forwarded to TG(if2).
49 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
50
51 *** Variables ***
52 | ${dut2_spi}= | ${1000}
53 | ${dut1_spi}= | ${1001}
54
55 | ${ESP_PROTO}= | ${50}
56
57 | ${bid}= | 10
58
59 *** Test Cases ***
60 | TC01: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on RLOC Int.
61 | | [Documentation]
62 | | ... | [Top] TG-DUT1-DUT2-TG.
63 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2,\
64 | | ... | Eth-IPv4-ICMPv4 on TG-DUTn.
65 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
66 | | ... | IPsec in between DUTs.
67 | | ... | [Ver] Case: ip4-lispgpe-ipsec-ip4 - main fib
68 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
69 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
70 | | ... | received packets are correct.
71 | | ... | [Ref] RFC6830, RFC4303.
72 | | ...
73 | | ${encr_alg}= | Crypto Alg AES CBC 128
74 | | ${auth_alg}= | Integ Alg SHA1 96
75 | | Given Setup 3-node Topology
76 | | And Add IP Neighbors
77 | | And Configure LISP GPE topology in 3-node circular topology
78 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
79 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
80 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
81 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
82 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
83 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
84 | | When Configure manual keyed connection for IPSec
85 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
86 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
87 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
88 | | And Configure manual keyed connection for IPSec
89 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
90 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
91 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
92 | | Then Send packet and verify headers
93 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
94 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
95 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
96 | | And Send packet and verify headers
97 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
98 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
99 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
100
101 | TC02: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) lisp_gpe0 Int.
102 | | [Documentation]
103 | | ... | [Top] TG-DUT1-DUT2-TG.
104 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2,\
105 | | ... | Eth-IPv4-ICMPv4 on TG-DUTn.
106 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
107 | | ... | IPsec in between DUTs.
108 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip4 - main fib
109 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
110 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
111 | | ... | received packets are correct.
112 | | ... | [Ref] RFC6830, RFC4303.
113 | | ...
114 | | ${encr_alg}= | Crypto Alg AES CBC 128
115 | | ${auth_alg}= | Integ Alg SHA1 96
116 | | Given Setup 3-node Topology
117 | | And Add IP Neighbors
118 | | And Configure LISP GPE topology in 3-node circular topology
119 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
120 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
121 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
122 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
123 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
124 | | ${lisp_if_idx}= | resources.libraries.python.InterfaceUtil.Get sw if index
125 | | ... | ${dut1_node} | lisp_gpe0
126 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
127 | | When Configure manual keyed connection for IPSec
128 | | ... | ${dut1_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
129 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi} | ${tg1_ip4}
130 | | ... | ${tg2_ip4}
131 | | And Configure manual keyed connection for IPSec
132 | | ... | ${dut2_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
133 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi} | ${tg2_ip4}
134 | | ... | ${tg1_ip4}
135 | | Then Send packet and verify headers
136 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
137 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
138 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
139 | | And Send packet and verify headers
140 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
141 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
142 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
143
144 | TC03: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on RLOC Int and VRF on EID is enabled.
145 | | [Documentation]
146 | | ... | [Top] TG-DUT1-DUT2-TG.
147 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2,\
148 | | ... | Eth-IPv4-ICMPv4 on TG-DUTn.
149 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
150 | | ... | IPsec in between DUTs.
151 | | ... | [Ver] Case: ip4-lispgpe-ipsec-ip4 - vrf, main fib
152 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
153 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
154 | | ... | received packets are correct.
155 | | ... | [Ref] RFC6830, RFC4303.
156 | | ...
157 | | ${encr_alg}= | Crypto Alg AES CBC 128
158 | | ${auth_alg}= | Integ Alg SHA1 96
159 | | Given Setup 3-node Topology | ${fib_table_1}
160 | | And Add IP Neighbors
161 | | When Generate keys for IPSec | ${encr_alg} | ${auth_alg}
162 | | And Configure LISP GPE topology in 3-node circular topology
163 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
164 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
165 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
166 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
167 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
168 | | ... | ${dut1_dut2_vni} | ${fib_table_1}
169 | | And Configure manual keyed connection for IPSec
170 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
171 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
172 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
173 | | And Configure manual keyed connection for IPSec
174 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
175 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
176 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
177 | | Then Send packet and verify headers
178 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
179 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
180 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
181 | | And Send packet and verify headers
182 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
183 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
184 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
185
186 | TC04: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int and VRF is enabled.
187 | | [Documentation]
188 | | ... | [Top] TG-DUT1-DUT2-TG.
189 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2,\
190 | | ... | Eth-IPv4-ICMPv4 on TG-DUTn.
191 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
192 | | ... | IPsec in between DUTs.
193 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip4 - vrf, main fib
194 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
195 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
196 | | ... | received packets are correct.
197 | | ... | [Ref] RFC6830, RFC4303.
198 | | ...
199 | | ${encr_alg}= | Crypto Alg AES CBC 128
200 | | ${auth_alg}= | Integ Alg SHA1 96
201 | | Given Setup 3-node Topology | ${fib_table_1}
202 | | And Add IP Neighbors
203 | | And Configure LISP GPE topology in 3-node circular topology
204 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
205 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
206 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
207 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
208 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
209 | | ... | ${dut1_dut2_vni} | ${fib_table_1}
210 | | When Generate keys for IPSec | ${encr_alg} | ${auth_alg}
211 | | ${lisp_if_idx}= | resources.libraries.python.InterfaceUtil.Get sw if index
212 | | ... | ${dut1_node} | lisp_gpe0
213 | | And Configure manual keyed connection for IPSec
214 | | ... | ${dut1_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
215 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi} | ${tg1_ip4}
216 | | ... | ${tg2_ip4}
217 | | And Configure manual keyed connection for IPSec
218 | | ... | ${dut2_node} | ${lisp_if_idx} | ${encr_alg} | ${encr_key}
219 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi} | ${tg2_ip4}
220 | | ... | ${tg1_ip4}
221 | | Then Send packet and verify headers
222 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
223 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
224 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
225 | | And Send packet and verify headers
226 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
227 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
228 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
229
230 *** Keywords ***
231 | Setup 3-node Topology
232 | | [Documentation]
233 | | ... | Setup 3-node topology for this test suite. Set all physical\
234 | | ... | interfaces up and assing IP adresses to them.\
235 | | ... | You can specify fib table ID where the DUT-TG interfaces assign to.\
236 | | ... | Default is 0.
237 | | ...
238 | | [Arguments] | ${fib_table}=0
239 | | Configure path in 3-node circular topology
240 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
241 | | Set interfaces in 3-node circular topology up
242 | | And Add Fib Table | ${dut1_node} | ${fib_table}
243 | | Assign Interface To Fib Table | ${dut1_node}
244 | | ... | ${dut1_to_tg} | ${fib_table}
245 | | And Add Fib Table | ${dut2_node} | ${fib_table}
246 | | Assign Interface To Fib Table | ${dut2_node}
247 | | ... | ${dut2_to_tg} | ${fib_table}
248 | | Set Interface Address | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4}
249 | | ... | ${prefix4}
250 | | Set Interface Address | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4}
251 | | ... | ${prefix4}
252 | | Set Interface Address | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4}
253 | | ... | ${prefix4}
254 | | Set Interface Address | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4}
255 | | ... | ${prefix4}
256
257 | Add IP Neighbors
258 | | [Documentation]
259 | | ... | Add IP neighbors to physical interfaces on DUTs.
260 | | ...
261 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
262 | | ... | ${tg_to_dut1_mac}
263 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
264 | | ... | ${tg_to_dut2_mac}
265 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
266 | | ... | ${dut2_to_dut1_mac}
267 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
268 | | ... | ${dut1_to_dut2_mac}