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