386e7e7efbf3ba8fa965b1d1b1b3f1b2ae1a5a5f
[csit.git] / tests / func / lisp / eth2p-ethip4ipsectptlispgpe-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.IPsecUtil
22 | Library | resources.libraries.python.VatJsonUtil
23 | Library | resources.libraries.python.IPv6Setup
24 | Library | resources.libraries.python.VhostUser
25 | Library | resources.libraries.python.QemuUtils
26 | Library | resources.libraries.python.VPPUtil
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_ipv4/ipv6_lispgpe_ipsec_ipv4.py
39 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP
40 | ...
41 | Test Setup | Func Test Setup
42 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
43 | ... | AND | Show VAT History On All DUTs | ${nodes}
44 | ... | AND | Show Vpp Settings | ${nodes['DUT1']}
45 | ... | AND | Show Vpp Settings | ${nodes['DUT2']}
46 | ... | AND | Stop and Clear QEMU | ${nodes['DUT1']} | ${vm_node}
47 | ... | AND | Check VPP PID in Teardown
48 | ...
49 | Documentation | *IPv6 - ip4-ipsec-lispgpe-ip6 - main fib, vrf, virt2lisp,\
50 | ... | phy2lisp*
51 | ...
52 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
53 | ... | with single links between nodes.
54 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-LISPGPE-IPSec-IPv6-ICMP,\
55 | ... | Eth-IPv4-IPSec-LISPGPE-IPv6-ICMP
56 | ... | *[Cfg] DUT configuration:* Each DUT is configured with LISP and IPsec.\
57 | ... | IPsec is in transport mode. Tests cases are for IPsec configured both\
58 | ... | on RLOC interface or lisp_gpe0 interface.
59 | ... | *[Ver] TG verification:* Packet is send from TG(if1) across the DUT1\
60 | ... | via VM to DUT2 where it is forwarded to TG(if2).
61 | ... | *[Ref] Applicable standard specifications:* RFC6830, RFC4303.
62
63 *** Test Cases ***
64 | TC01: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on RLOC Int.
65 | | [Documentation]
66 | | ... | [Top] TG-DUT1-DUT2-TG.
67 | | ... | [Enc] Eth-IPv4-LISPGPE-IPSec-IPv6-ICMP on DUT1-DUT2, Eth-IPv6-ICMP\
68 | | ... | on TG-DUTn.
69 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
70 | | ... | IPsec in between DUTS. Create Qemu vm on DUT1 and configure bridge\
71 | | ... | between two vhosts.
72 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip6 - main fib, virt2lisp\
73 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
74 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
75 | | ... | received packets are correct.
76 | | ... | [Ref] RFC6830, RFC4303.
77 | | ...
78 | | ${encr_alg}= | Crypto Alg AES CBC 128
79 | | ${auth_alg}= | Integ Alg SHA1 96
80 | | Given Setup Topology And Lisp
81 | | And Setup Qemu DUT1
82 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
83 | | When VPP Setup IPsec Manual Keyed Connection
84 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${encr_alg} | ${encr_key}
85 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
86 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
87 | | And VPP Setup IPsec Manual Keyed Connection
88 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${encr_alg} | ${encr_key}
89 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
90 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
91 | | Then Send Packet And Check Headers
92 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
93 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
94 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
95 | | And Send Packet And Check Headers
96 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
97 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
98 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
99
100 | TC02: DUT1 and DUT2 route IPv6 over Vhost to LISP GPE tunnel using IPsec (transport) on lisp_gpe0 Int.
101 | | [Documentation]
102 | | ... | [Top] TG-DUT1-DUT2-TG.
103 | | ... | [Enc] Eth-IPv4-IPSec-LISPGPE-IPv6-ICMPv6 on DUT1-DUT2,\
104 | | ... | Eth-IPv6-ICMPv6, on TG-DUTn.
105 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2 with\
106 | | ... | IPsec in between DUTS.
107 | | ... | [Ver] Case: ip4-ipsec-lispgpe-ip6 - main fib, virt2lisp\
108 | | ... | Make TG send ICMPv6 Echo Req between its interfaces across\
109 | | ... | both DUTs and LISP GPE tunnel between them; verify IPv6 headers on\
110 | | ... | received packets are correct.
111 | | ... | [Ref] RFC6830, RFC4303.
112 | | ...
113 | | ${encr_alg}= | Crypto Alg AES CBC 128
114 | | ${auth_alg}= | Integ Alg SHA1 96
115 | | Given Setup Topology And Lisp
116 | | And Setup Qemu DUT1
117 | | ${lisp1_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
118 | | ... | ${dut1_node} | ${lisp_gpe_int}
119 | | ${lisp2_if_idx}= | resources.libraries.python.InterfaceUtil.get sw if index
120 | | ... | ${dut2_node} | ${lisp_gpe_int}
121 | | And IPsec Generate Keys | ${encr_alg} | ${auth_alg}
122 | | When VPP Setup IPsec Manual Keyed Connection
123 | | ... | ${dut1_node} | ${lisp1_if_idx} | ${encr_alg} | ${encr_key}
124 | | ... | ${auth_alg} | ${auth_key} | ${dut1_spi} | ${dut2_spi}
125 | | ... | ${dut1_to_dut2_ip4} | ${dut2_to_dut1_ip4}
126 | | And VPP Setup IPsec Manual Keyed Connection
127 | | ... | ${dut2_node} | ${lisp2_if_idx} | ${encr_alg} | ${encr_key}
128 | | ... | ${auth_alg} | ${auth_key} | ${dut2_spi} | ${dut1_spi}
129 | | ... | ${dut2_to_dut1_ip4} | ${dut1_to_dut2_ip4}
130 | | Then Send Packet And Check Headers
131 | | ... | ${tg_node} | ${tg1_ip6} | ${tg2_ip6}
132 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
133 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
134 | | And Send Packet And Check Headers
135 | | ... | ${tg_node} | ${tg2_ip6} | ${tg1_ip6}
136 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
137 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
138
139 *** Keywords ***
140 | Setup Topology And Lisp
141 | | [Documentation] | Setup IPs and neighbors for interfaces on DUT1 and DUT2\
142 | | ... | and then setup LISP.
143 | | [Arguments] | ${fib_table}=0 | ${vni_table}=0 | ${ip6}=${FALSE}
144 | | Path for 3-node testing is set
145 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
146 | | Interfaces in 3-node path are up
147 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4}
148 | | ... | ${prefix4}
149 | | Vpp Set If IPv6 Addr | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip6}
150 | | ... | ${prefix6}
151 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4}
152 | | ... | ${prefix4}
153 | | Vpp Set If IPv6 Addr | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip6}
154 | | ... | ${prefix6}
155 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip6}
156 | | ... | ${tg_to_dut2_mac}
157 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
158 | | ... | ${dut2_to_dut1_mac}
159 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
160 | | ... | ${dut1_to_dut2_mac}
161 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip6}
162 | | ... | ${tg_to_dut1_mac}
163 | | Vpp All RA Suppress Link Layer | ${nodes}
164 | | Set up LISP GPE topology
165 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
166 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
167 | | ... | ${duts_locator_set} | ${dut1_ip6_eid} | ${dut2_ip6_eid}
168 | | ... | ${dut1_to_dut2_ip_static_adjacency}
169 | | ... | ${dut2_to_dut1_ip_static_adjacency}
170 | | ... | ${vni_table} | ${fib_table}
171
172 | Setup Qemu DUT1
173 | | [Documentation] | Setup Vhosts on DUT1 and setup IP to one of them. Setup\
174 | | ... | Qemu and bridge the vhosts.
175 | | ${vhost1}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
176 | | ${vhost2}= | And Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
177 | | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix6}
178 | | Set Interface State | ${dut1_node} | ${vhost1} | up
179 | | Set Interface State | ${dut1_node} | ${vhost2} | up
180 | | Vpp RA Suppress Link Layer | ${dut1_node} | ${vhost2}
181 | | Bridge domain on DUT node is created | ${dut1_node} | ${bid} | learn=${TRUE}
182 | | Interface is added to bridge domain | ${dut1_node}
183 | | ... | ${dut1_to_tg} | ${bid} | 0
184 | | Interface is added to bridge domain | ${dut1_node}
185 | | ... | ${vhost1} | ${bid} | 0
186 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
187 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
188 | | VM for Vhost L2BD forwarding is setup | ${dut1_node} | ${sock1} | ${sock2}
189