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