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