CSIT-664: Refactor setups and teardowns
[csit.git] / tests / func / lisp / eth2p-ethip6ipsectptlispgpe-ip6base-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.IPUtil
19 | Library | resources.libraries.python.L2Util
20 | Library | resources.libraries.python.LispUtil
21 | Library | resources.libraries.python.VPPUtil
22 | Library | resources.libraries.python.IPsecUtil
23 | Library | resources.libraries.python.VatJsonUtil
24 | Library | resources.libraries.python.IPv6Setup
25 | Library | resources.libraries.python.VhostUser
26 | Library | resources.libraries.python.QemuUtils
27 | Library | String
28 | Resource | resources/libraries/robot/traffic.robot
29 | Resource | resources/libraries/robot/default.robot
30 | Resource | resources/libraries/robot/interfaces.robot
31 | Resource | resources/libraries/robot/testing_path.robot
32 | Resource | resources/libraries/robot/ipv6.robot
33 | Resource | resources/libraries/robot/ipsec.robot
34 | Resource | resources/libraries/robot/qemu.robot
35 | Resource | resources/libraries/robot/lisp/lispgpe.robot
36 | Resource | resources/libraries/robot/bridge_domain.robot
37 # Import configuration and test data:
38 | Variables | resources/test_data/lisp/ipv6_lispgpe_ipv6/ipv6_lispgpe_ipsec_ipv6.py
39 | ...
40 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP | SKIP_VPP_PATCH
41 | ...
42 | Test Setup | Run Keywords | Set up functional test
43 | ...        | AND          | Vpp All Ra Suppress Link Layer | ${nodes}
44 | ...
45 | Test Teardown | Tear down LISP functional test with QEMU | ${vm_node}
46 | ...
47 | Documentation | *IPv6 - ip6-ipsec-lispgpe-ip6 - main fib,
48 | ... | vrf (gpe_vni-to-vrf), phy2lisp, virt2lisp*
49 | ...
50 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
51 | ... | with single links between nodes.
52 | ... | *[Enc] Packet Encapsulations:* Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6,\
53 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
54 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
55 | ... | on RLOC interface or lisp_gpe0 interface.
56 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1\
57 | ... | via VM to DUT2 where it is forwarded to TG(if2).
58 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
59
60 *** Variables ***
61 | ${dut2_spi}= | ${1000}
62 | ${dut1_spi}= | ${1001}
63
64 | ${ESP_PROTO}= | ${50}
65
66 | ${sock1}= | /tmp/sock1
67 | ${sock2}= | /tmp/sock2
68
69 | ${bid}= | 10
70
71 *** Test Cases ***
72 | TC01: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on RLOC Int.
73 | | [Documentation]
74 | | ... | [Top] TG-DUT1-DUT2-TG.
75 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMP on DUT1-DUT2, Eth-IPv6-ICMP\
76 | | ... | on TG-DUTn.
77 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
78 | | ... | IPsec in between DUTS. Create Qemu vm on DUT1 and configure bridge\
79 | | ... | between two vhosts.
80 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip6 - main fib, virt2lisp\
81 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
82 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
83 | | ... | received packets are correct.
84 | | ... | [Ref] RFC6830, RFC4303.
85 | | ...
86 | | ${encr_alg}= | Crypto Alg AES CBC 128
87 | | ${auth_alg}= | Integ Alg SHA1 96
88 | | Given Setup Topology
89 | | And Setup Qemu DUT1
90 | | And Configure LISP GPE topology in 3-node circular topology
91 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
92 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
93 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
94 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
95 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
96 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
97 | | When Configure manual keyed connection for IPSec
98 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
99 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
100 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
101 | | And Configure manual keyed connection for IPSec
102 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
103 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
104 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
105 | | Then Send packet and verify headers
106 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
107 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
108 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
109 | | And Send packet and verify headers
110 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
111 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
112 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
113
114 | TC02: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
115 | | [Documentation]
116 | | ... | [Top] TG-DUT1-DUT2-TG.
117 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
118 | | ... | Eth-IPv6-ICMPv6 on TG-DUTn.
119 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
120 | | ... | IPsec in between DUTS.
121 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip6 - main fib, virt2lisp\
122 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
123 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
124 | | ... | received packets are correct.
125 | | ... | [Ref] RFC6830, RFC4303.
126 | | ...
127 | | ${encr_alg}= | Crypto Alg AES CBC 128
128 | | ${auth_alg}= | Integ Alg SHA1 96
129 | | Given Setup Topology
130 | | And Setup Qemu DUT1
131 | | And Configure LISP GPE topology in 3-node circular topology
132 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
133 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
134 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
135 | | ... | ${dut1_to_dut2_ip6_static_adjacency}
136 | | ... | ${dut2_to_dut1_ip6_static_adjacency}
137 | | ${lisp1_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
138 | | ... | ${dut1_node} | lisp_gpe0
139 | | ${lisp2_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
140 | | ... | ${dut2_node} | lisp_gpe0
141 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
142 | | When Configure manual keyed connection for IPSec
143 | | ... | ${dut1_node} | ${lisp1_if_idx} | ${encr_alg} | ${encr_key}
144 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
145 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
146 | | And Configure manual keyed connection for IPSec
147 | | ... | ${dut2_node} | ${lisp2_if_idx} | ${encr_alg} | ${encr_key}
148 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
149 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
150 | | Then Send packet and verify headers
151 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
152 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
153 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
154 | | And Send packet and verify headers
155 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
156 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
157 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
158
159 *** Keywords ***
160 | Setup Topology
161 | | Configure path in 3-node circular topology
162 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
163 | | Set interfaces in 3-node circular topology up
164 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
165 | | ... | ${prefix6}
166 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
167 | | ... | ${prefix6}
168 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip6}
169 | | ... | ${prefix6}
170 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip6}
171 | | ... | ${prefix6}
172 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip6}
173 | | ... | ${prefix6}
174 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip6}
175 | | ... | ${tg_to_dut1_mac}
176 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip6}
177 | | ... | ${tg_to_dut2_mac}
178 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip6}
179 | | ... | ${dut2_to_dut1_mac}
180 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip6}
181 | | ... | ${dut1_to_dut2_mac}
182 | | Vpp All RA Suppress Link Layer | ${nodes}
183
184 | Setup Qemu DUT1
185 | | [Documentation] | Setup Vhosts on DUT1 and setup IP to one of them. Setup \
186 | | ... | Qemu and bridge the vhosts.
187 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
188 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
189 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${vhost2} | 2001:cdba:1::9
190 | | ... | ${prefix6}
191 | | Set Interface State | ${dut1_node} | ${vhost1} | up
192 | | Set Interface State | ${dut1_node} | ${vhost2} | up
193 | | Vpp RA Suppress Link Layer | ${dut1_node} | ${vhost2}
194 | | Create bridge domain | ${dut1_node} | ${bid} | learn=${TRUE}
195 | | Add interface to bridge domain | ${dut1_node}
196 | | ... | ${dut1_to_tg} | ${bid} | 0
197 | | Add interface to bridge domain | ${dut1_node}
198 | | ... | ${vhost1} | ${bid} | 0
199 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
200 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
201 | | Configure VM for vhost L2BD forwarding | ${dut1_node} | ${sock1} | ${sock2}