d2083612d089a90172eb6877a5e9cd1e0acf3056
[csit.git] / tests / vpp / func / vm_vhost / ip6 / eth2p-ethip6ipsectptlispgpe-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.IPUtil
19 | Library | resources.libraries.python.L2Util
20 | Library | resources.libraries.python.LispUtil
21 | Library | resources.libraries.python.IPsecUtil
22 | Library | resources.libraries.python.VatJsonUtil
23 | Library | resources.libraries.python.IPv6Setup
24 | Library | resources.libraries.python.VhostUser
25 | Library  | resources.libraries.python.VPPUtil
26 | Library | String
27 | Resource | resources/libraries/robot/shared/traffic.robot
28 | Resource | resources/libraries/robot/shared/default.robot
29 | Resource | resources/libraries/robot/shared/interfaces.robot
30 | Resource | resources/libraries/robot/shared/testing_path.robot
31 | Resource | resources/libraries/robot/ip/ip6.robot
32 | Resource | resources/libraries/robot/crypto/ipsec.robot
33 | Resource | resources/libraries/robot/overlay/lispgpe.robot
34 | Resource | resources/libraries/robot/l2/l2_bridge_domain.robot
35 # Import configuration and test data:
36 | Variables | resources/test_data/lisp/ipv4_lispgpe_ipv6/ipv4_lispgpe_ipsec_ipv6.py
37 | ...
38 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP | SKIP_VPP_PATCH
39 | ...
40 | Test Setup | Set up functional test
41 | ...
42 | Test Teardown | Tear down LISP functional test with QEMU
43 | ...
44 | Documentation | *IPv6 - ip4-ipsec-lispgpe-ip6 - main fib, virt2lisp, phy2lisp*
45 | ...
46 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
47 | ... | with single links between nodes.
48 | ... | *[Enc] Packet Encapsulations:* Eth-IPv6-LISPGPE-IPSec-IPv4-ICMP,\
49 | ... | Eth-IPv6-IPSec-LISPGPE-IPv4-ICMP
50 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
51 | ... | IPsec is in transport mode. Test 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 to\
54 | ... | DUT2 where it is forwarded to TG(if2).
55 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
56
57 *** Test Cases ***
58 | TC01: DUT1 and DUT2 route IPv4 over Vhost to LISP GPE tunnel using IPsec (transport) on RLOC Int.
59 | | [Documentation]
60 | | ... | [Top] TG-DUT1-DUT2-TG.
61 | | ... | [Enc] Eth-IPv6-LISPGPE-IPSec-IPv4-ICMP on DUT1-DUT2, Eth-IPv4-ICMP\
62 | | ... | on TG-DUTn.
63 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
64 | | ... | IPsec in between DUTS. Create Qemu vm on DUT1 and configure bridge\
65 | | ... | between two vhosts.
66 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip4 - main fib, virt2lisp\
67 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
68 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
69 | | ... | received packets are correct.
70 | | ... | [Ref] RFC6830, RFC4303.
71 | | ...
72 | | ${encr_alg}= | Crypto Alg AES CBC 128
73 | | ${auth_alg}= | Integ Alg SHA1 96
74 | | Given Setup Topology And Lisp
75 | | And Setup Qemu DUT1
76 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
77 | | When Configure manual keyed connection for IPSec
78 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
79 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
80 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
81 | | And Configure manual keyed connection for IPSec
82 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
83 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
84 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
85 | | Then Send packet and verify headers
86 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
87 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
88 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
89 | | And Send packet and verify 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 over Vhost to LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
95 | | [Documentation]
96 | | ... | [Top] TG-DUT1-DUT2-TG.
97 | | ... | [Enc] Eth-IPv6-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
98 | | ... | Eth-IPv6-ICMPv6, on TG-DUTn.
99 | | ... | [Cfg] Configure IPv6 LISP static adjacencies on DUT1 and DUT2 with\
100 | | ... | IPsec in between DUTS.
101 | | ... | [Ver] Case: ip6-ipsec-lispgpe-ip4 - main fib, virt2lisp\
102 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
103 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 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 Topology And Lisp
110 | | And Setup Qemu DUT1
111 | | ${lisp1_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
112 | | ... | ${dut1_node} | ${lisp_gpe_int}
113 | | ${lisp2_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
114 | | ... | ${dut2_node} | ${lisp_gpe_int}
115 | | And Generate keys for IPSec | ${encr_alg} | ${auth_alg}
116 | | When Configure manual keyed connection for IPSec
117 | | ... | ${dut1_node} | ${lisp1_if_idx} | ${encr_alg} | ${encr_key}
118 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
119 | | ... | ${dut1_to_dut2_ip6} | ${dut2_to_dut1_ip6}
120 | | And Configure manual keyed connection for IPSec
121 | | ... | ${dut2_node} | ${lisp2_if_idx} | ${encr_alg} | ${encr_key}
122 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
123 | | ... | ${dut2_to_dut1_ip6} | ${dut1_to_dut2_ip6}
124 | | Then Send packet and verify headers
125 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
126 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
127 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
128 | | And Send packet and verify headers
129 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
130 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
131 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
132
133 *** Keywords ***
134 | Setup Topology And Lisp
135 | | [Documentation] | Setup IPs and neighbors for interfaces on DUT1 and DUT2\
136 | | ... | and then setup LISP.
137 | | Configure path in 3-node circular topology
138 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
139 | | Set interfaces in 3-node circular topology up
140 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
141 | | ... | ${prefix6}
142 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip6}
143 | | ... | ${prefix6}
144 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4}
145 | | ... | ${prefix4}
146 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip6}
147 | | ... | ${prefix6}
148 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4}
149 | | ... | ${prefix4}
150 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
151 | | ... | ${tg_to_dut2_mac}
152 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip6}
153 | | ... | ${dut2_to_dut1_mac}
154 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip6}
155 | | ... | ${dut1_to_dut2_mac}
156 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
157 | | ... | ${tg_to_dut1_mac}
158 | | Vpp All RA Suppress Link Layer | ${nodes}
159 | | Configure LISP GPE topology in 3-node circular topology
160 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
161 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
162 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
163 | | ... | ${dut1_to_dut2_ip_static_adjacency}
164 | | ... | ${dut2_to_dut1_ip_static_adjacency}
165
166 | Setup Qemu DUT1
167 | | [Documentation] | Setup Vhosts on DUT1 and setup IP to one of them. Setup\
168 | | ... | Qemu and bridge the vhosts.
169 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
170 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
171 | | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix4}
172 | | Set Interface State | ${dut1_node} | ${vhost1} | up
173 | | Set Interface State | ${dut1_node} | ${vhost2} | up
174 | | Create bridge domain | ${dut1_node} | ${bid} | learn=${TRUE}
175 | | Add interface to bridge domain | ${dut1_node}
176 | | ... | ${dut1_to_tg} | ${bid} | 0
177 | | Add interface to bridge domain | ${dut1_node}
178 | | ... | ${vhost1} | ${bid} | 0
179 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
180 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
181 | | Configure VM for vhost L2BD forwarding | ${dut1_node} | ${sock1} | ${sock2}