464d4a5768e610eabf96b704ed60aca139c6e99f
[csit.git] / tests / vpp / func / vm_vhost / ip4 / eth2p-ethip4ipsectptlispgpe-ip4base-eth-2vhost-1vm-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 | ... | EXPECTED_FAILING
37 | ...
38 | Test Setup | Set up functional test
39 | ...
40 | Test Teardown | Tear down LISP functional test with QEMU | ${vm_node}
41 | ...
42 | Documentation | *IPv4-ip4-ipsec-lispgpe-ip4 - main fib, vrf (gpe_vni-to-vrf)*
43 | ...
44 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
45 | ... | with single links between nodes.
46 | ... | *[Enc] Packet Encapsulations:* ICMPv4-IPv4-IPSec-LISPGPE-IPv4-ICMPv4.
47 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
48 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
49 | ... | on RLOC interface or lisp_gpe0 interface.
50 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1\
51 | ... | via VM to DUT2 where it is forwarded to TG(if2).
52 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
53
54 *** Variables ***
55 | ${dut2_spi}= | ${1000}
56 | ${dut1_spi}= | ${1001}
57
58 | ${ESP_PROTO}= | ${50}
59
60 | ${sock1}= | /tmp/sock1
61 | ${sock2}= | /tmp/sock2
62
63 | ${bid}= | 10
64
65 *** Test Cases ***
66 | TC01: DUT1 and DUT2 route IPv4 over Vhost to LISP GPE tunnel using IPsec (transport) on RLOC Int.
67 | | [Documentation]
68 | | ... | [Top] TG-DUT1-DUT2-TG.
69 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv4-ICMP on DUT1-DUT2, Eth-IPv4-ICMP\
70 | | ... | on TG-DUTn.
71 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
72 | | ... | IPsec in between DUTS. Create Qemu vm on DUT1 and configure bridge\
73 | | ... | between two vhosts.
74 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip4 - main fib, virt2lisp\
75 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across\
76 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
77 | | ... | received packets are correct.
78 | | ... | [Ref] RFC6830, RFC4303.
79 | | ...
80 | | ${encr_alg}= | Crypto Alg AES CBC 128
81 | | ${auth_alg}= | Integ Alg SHA1 96
82 | | Given Setup 3-node Topology
83 | | And Add IP Neighbors
84 | | And Setup Qemu DUT1
85 | | And Configure LISP GPE topology in 3-node circular topology
86 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
87 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
88 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
89 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
90 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
91 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
92 | | When Configure manual keyed connection for IPSec
93 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
94 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
95 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
96 | | And Configure manual keyed connection for IPSec
97 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
98 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
99 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
100 | | Then Send packet and verify headers
101 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
102 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
103 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
104 | | And Send packet and verify headers
105 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
106 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
107 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
108
109 | TC02: DUT1 and DUT2 route IPv4 over Vhost to LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
110 | | [Documentation]
111 | | ... | [Top] TG-DUT1-DUT2-TG.
112 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2,\
113 | | ... | Eth-IPv4-ICMPv4 on TG-DUTn.
114 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
115 | | ... | IPsec in between DUTS.
116 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip4 - main fib, virt2lisp\
117 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across\
118 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
119 | | ... | received packets are correct.
120 | | ... | [Ref] RFC6830, RFC4303.
121 | | ...
122 | | ${encr_alg}= | Crypto Alg AES CBC 128
123 | | ${auth_alg}= | Integ Alg SHA1 96
124 | | Given Setup 3-node Topology
125 | | And Add IP Neighbors
126 | | And Setup Qemu DUT1
127 | | And Configure LISP GPE topology in 3-node circular topology
128 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
129 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
130 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
131 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
132 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
133 | | ${lisp1_if_idx}= | resources.libraries.python.InterfaceUtil.Get Sw If Index
134 | | ... | ${dut1_node} | lisp_gpe0
135 | | ${lisp2_if_idx}= | resources.libraries.python.InterfaceUtil.Get Sw If Index
136 | | ... | ${dut2_node} | lisp_gpe0
137 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
138 | | When Configure manual keyed connection for IPSec
139 | | ... | ${dut1_node} | ${lisp1_if_idx} | ${encr_alg} | ${encr_key}
140 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
141 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
142 | | And Configure manual keyed connection for IPSec
143 | | ... | ${dut2_node} | ${lisp2_if_idx} | ${encr_alg} | ${encr_key}
144 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
145 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
146 | | Then Send packet and verify headers
147 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
148 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
149 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
150 | | And Send packet and verify headers
151 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
152 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
153 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
154
155 *** Keywords ***
156 | Setup 3-node Topology
157 | | [Documentation]
158 | | ... | Setup 3-node topology for this test suite. Set all physical\
159 | | ... | interfaces up and assing IP adresses to them.\
160 | | ... | You can specify fib table ID where the DUT-TG interfaces assign to.\
161 | | ... | Default is 0.
162 | | ...
163 | | [Arguments] | ${fib_table}=0
164 | | Configure path in 3-node circular topology
165 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
166 | | Set interfaces in 3-node circular topology up
167 | | And Add Fib Table | ${dut1_node} | ${fib_table}
168 | | And Add Fib Table | ${dut2_node} | ${fib_table}
169 | | Assign Interface To Fib Table | ${dut1_node}
170 | | ... | ${dut1_to_tg} | ${fib_table}
171 | | Assign Interface To Fib Table | ${dut2_node}
172 | | ... | ${dut2_to_tg} | ${fib_table}
173 | | Set Interface Address | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4}
174 | | ... | ${prefix4}
175 | | Set Interface Address | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4}
176 | | ... | ${prefix4}
177 | | Set Interface Address | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4}
178 | | ... | ${prefix4}
179 | | Set Interface Address | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4}
180 | | ... | ${prefix4}
181
182 | Add IP Neighbors
183 | | [Documentation]
184 | | ... | Add IP neighbors to physical interfaces on DUTs.
185 | | ...
186 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
187 | | ... | ${tg_to_dut1_mac}
188 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
189 | | ... | ${tg_to_dut2_mac}
190 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
191 | | ... | ${dut2_to_dut1_mac}
192 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
193 | | ... | ${dut1_to_dut2_mac}
194
195 | Setup Qemu DUT1
196 | | [Documentation] | Setup Vhosts on DUT1 and setup IP to one of them. Setup \
197 | | ... | Qemu and bridge the vhosts.
198 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
199 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
200 | | Set Interface Address | ${dut1_node} | ${vhost2} | 6.6.1.9
201 | | ... | ${prefix4}
202 | | Set Interface State | ${dut1_node} | ${vhost1} | up
203 | | Set Interface State | ${dut1_node} | ${vhost2} | up
204 | | Create bridge domain | ${dut1_node} | ${bid} | learn=${TRUE}
205 | | Add interface to bridge domain | ${dut1_node}
206 | | ... | ${dut1_to_tg} | ${bid} | 0
207 | | Add interface to bridge domain | ${dut1_node}
208 | | ... | ${vhost1} | ${bid} | 0
209 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
210 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
211 | | Configure VM for vhost L2BD forwarding | ${dut1_node} | ${sock1} | ${sock2}