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

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.