7caba043da12800fac0ead2681b502f2f74beb95
[csit.git] / tests / func / lisp / ipv4_lispgpe_ipv4.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.VPPUtil
20 | Library | resources.libraries.python.InterfaceUtil
21 | Library | resources.libraries.python.VhostUser
22 | Resource | resources/libraries/robot/traffic.robot
23 | Resource | resources/libraries/robot/default.robot
24 | Resource | resources/libraries/robot/interfaces.robot
25 | Resource | resources/libraries/robot/testing_path.robot
26 | Resource | resources/libraries/robot/ipv4.robot
27 | Resource | resources/libraries/robot/vrf.robot
28 | Resource | resources/libraries/robot/qemu.robot
29 | Resource | resources/libraries/robot/bridge_domain.robot
30 | Resource | resources/libraries/robot/lisp/lispgpe.robot
31 # Import configuration and test data:
32 | Variables | resources/test_data/lisp/ipv4_lispgpe_ipv4/ipv4_lispgpe_ipv4.py
33 | ...
34 | Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | LISP
35 | ...
36 | Test Setup | Func Test Setup
37 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
38 | ... | AND | Show vpp trace dump on all DUTs
39 | ... | AND | Show Vpp Settings | ${nodes['DUT1']}
40 | ... | AND | Show Vpp Settings | ${nodes['DUT2']}
41 | ... | AND | Check VPP PID in Teardown
42 | ...
43 | Documentation | *ip4-lispgpe-ip4 encapsulation test cases*
44 | ...
45 | ... | *[Top] Network Topologies:* TG-DUT1-DUT2-TG 3-node circular topology\
46 | ... | with single links between nodes.
47 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-LISP-IPv4-ICMPv4 on DUT1-DUT2,\
48 | ... | Eth-IPv4-ICMPv4 on TG-DUTn for IPv4 routing over LISPoIPv4 tunnel.
49 | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with IPv4\
50 | ... | routing and static routes. LISPoIPv4 tunnel is configured between\
51 | ... | DUT1 and DUT2.
52 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets are sent in\
53 | ... | both directions by TG on links to DUT1 and DUT2; on receive\
54 | ... | TG verifies packets for correctness and their IPv4 src-addr, dst-addr\
55 | ... | and MAC addresses.
56 | ... | *[Ref] Applicable standard specifications:* RFC6830.
57
58 *** Test Cases ***
59 | TC01: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using physical interfaces
60 | | [Documentation]
61 | | ... | [Top] TG-DUT1-DUT2-TG.
62 | | ... | [Enc] Eth-IPv4-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2, Eth-IPv4-ICMPv4 on\
63 | | ... | TG-DUTn.
64 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2.
65 | | ... | [Ver] Case: ip4-lispgpe-ip4 - phy2lisp
66 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
67 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
68 | | ... | received packets are correct.
69 | | ... | [Ref] RFC6830.
70 | | ...
71 | | Given Path for 3-node testing is set
72 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
73 | | And Interfaces in 3-node path are up
74 | | And IP addresses are set on interfaces
75 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4} | ${prefix4}
76 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${prefix4}
77 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4} | ${prefix4}
78 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4} | ${prefix4}
79 | | And VPP IP Probe | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
80 | | And VPP IP Probe | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
81 | | And Add Arp On Dut | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
82 | | ... | ${tg_to_dut2_mac}
83 | | And Add Arp On Dut | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
84 | | ... | ${tg_to_dut1_mac}
85 | | When Set up LISP GPE topology
86 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
87 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
88 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
89 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
90 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
91 | | Then Send Packet And Check Headers
92 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
93 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
94 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
95 | | And Send Packet And Check Headers
96 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
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 IPv4 bidirectionally over LISP GPE tunnel using physical interfaces and VRF is enabled
101 | | [Documentation]
102 | | ... | [Top] TG-DUT1-DUT2-TG.
103 | | ... | [Enc] Eth-IPv4-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2, Eth-IPv4-ICMPv4 on\
104 | | ... | TG-DUTn.
105 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2.
106 | | ... | [Ver] Case: ip4-lispgpe-ip4 - vrf, phy2lisp
107 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
108 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
109 | | ... | received packets are correct.
110 | | ... | [Ref] RFC6830.
111 | | ...
112 | | Given Path for 3-node testing is set
113 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
114 | | And Interfaces in 3-node path are up
115 | | And Assign Interface To Fib Table | ${dut1_node}
116 | | ... | ${dut1_to_tg} | ${fib_table_1}
117 | | And Assign Interface To Fib Table | ${dut2_node}
118 | | ... | ${dut2_to_tg} | ${fib_table_1}
119 | | Add IP Neighbors | ${fib_table_1}
120 | | And IP addresses are set on interfaces
121 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4} | ${prefix4}
122 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${prefix4}
123 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4} | ${prefix4}
124 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4} | ${prefix4}
125 | | When Set up LISP GPE topology
126 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
127 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
128 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
129 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
130 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
131 | | ... | ${dut1_dut2_vni} | ${fib_table_1}
132 | | Then Send Packet And Check Headers
133 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
134 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dut1_to_tg_mac}
135 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
136 | | And Send Packet And Check Headers
137 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
138 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
139 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
140
141 | TC03: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using vhost interfaces
142 | | [Documentation]
143 | | ... | [Top] TG-DUT1-DUT2-TG.
144 | | ... | [Enc] Eth-IPv4-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2, Eth-IPv4-ICMPv4 on\
145 | | ... | TG-DUTn.
146 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2.
147 | | ... | [Ver] Case: ip4-lispgpe-ip4 - main fib, virt2lisp
148 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
149 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
150 | | ... | received packets are correct.
151 | | ...
152 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
153 | | ... | AND | Show vpp trace dump on all DUTs
154 | | ... | AND | Show Vpp Settings | ${nodes['DUT1']}
155 | | ... | AND | Show Vpp Settings | ${nodes['DUT2']}
156 | | ... | AND | Stop and Clear QEMU | ${dut1_node} | ${vm_node}
157 | | ... | AND | Check VPP PID in Teardown
158 | | ...
159 | | Given Path for 3-node testing is set
160 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
161 | | And Interfaces in 3-node path are up
162 | | And IP addresses are set on interfaces
163 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4} | ${prefix4}
164 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${prefix4}
165 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4} | ${prefix4}
166 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4} | ${prefix4}
167 | | And Add Arp On Dut | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
168 | | ... | ${tg_to_dut1_mac}
169 | | And Add Arp On Dut | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
170 | | ... | ${tg_to_dut2_mac}
171 | | And Add Arp On Dut | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
172 | | ... | ${dut2_to_dut1_mac}
173 | | And Add Arp On Dut | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
174 | | ... | ${dut1_to_dut2_mac}
175 | | When Set up LISP GPE topology
176 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
177 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
178 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
179 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
180 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
181 | | And Setup Qemu DUT1
182 | | Then Send Packet And Check Headers
183 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
184 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
185 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
186 | | And Send Packet And Check Headers
187 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
188 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
189 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
190
191 | TC04: DUT1 and DUT2 route IPv4 bidirectionally over LISP GPE tunnel using vhost interfaces and VRF is enabled
192 | | [Documentation]
193 | | ... | [Top] TG-DUT1-DUT2-TG.
194 | | ... | [Enc] Eth-IPv4-LISPGPE-IPv4-ICMPv4 on DUT1-DUT2, Eth-IPv4-ICMPv4 on\
195 | | ... | TG-DUTn.
196 | | ... | [Cfg] Configure IPv4 LISP static adjacencies on DUT1 and DUT2.
197 | | ... | [Ver] Case: ip4-lispgpe-ip4 - vrf, virt2lisp
198 | | ... | Make TG send ICMPv4 Echo Req between its interfaces across both\
199 | | ... | DUTs and LISP GPE tunnel between them; verify IPv4 headers on\
200 | | ... | received packets are correct.
201 | | ... | [Ref] RFC6830.
202 | | ...
203 | | [Teardown] | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
204 | | ... | AND | Show vpp trace dump on all DUTs
205 | | ... | AND | Show Vpp Settings | ${nodes['DUT1']}
206 | | ... | AND | Show Vpp Settings | ${nodes['DUT2']}
207 | | ... | AND | Stop and Clear QEMU | ${dut1_node} | ${vm_node}
208 | | ... | AND | Check VPP PID in Teardown
209 | | ...
210 | | Given Path for 3-node testing is set
211 | | ... | ${nodes['TG']} | ${nodes['DUT1']} | ${nodes['DUT2']} | ${nodes['TG']}
212 | | And Interfaces in 3-node path are up
213 | | And Assign Interface To Fib Table | ${dut1_node}
214 | | ... | ${dut1_to_tg} | ${fib_table_1}
215 | | And Assign Interface To Fib Table | ${dut2_node}
216 | | ... | ${dut2_to_tg} | ${fib_table_1}
217 | | Add IP Neighbors | ${fib_table_1}
218 | | And IP addresses are set on interfaces
219 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${dut1_to_dut2_ip4} | ${prefix4}
220 | | ... | ${dut1_node} | ${dut1_to_tg} | ${dut1_to_tg_ip4} | ${prefix4}
221 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${dut2_to_dut1_ip4} | ${prefix4}
222 | | ... | ${dut2_node} | ${dut2_to_tg} | ${dut2_to_tg_ip4} | ${prefix4}
223 | | When Set up LISP GPE topology
224 | | ... | ${dut1_node} | ${dut1_to_dut2} | ${NONE}
225 | | ... | ${dut2_node} | ${dut2_to_dut1} | ${NONE}
226 | | ... | ${duts_locator_set} | ${dut1_ip4_eid} | ${dut2_ip4_eid}
227 | | ... | ${dut1_to_dut2_ip4_static_adjacency}
228 | | ... | ${dut2_to_dut1_ip4_static_adjacency}
229 | | ... | ${dut1_dut2_vni} | ${fib_table_1}
230 | | And Setup Qemu DUT1 | ${fib_table_1}
231 | | Then Send Packet And Check Headers
232 | | ... | ${tg_node} | ${tg1_ip4} | ${tg2_ip4}
233 | | ... | ${tg_to_dut1} | ${tg_to_dut1_mac} | ${dst_vhost_mac}
234 | | ... | ${tg_to_dut2} | ${dut2_to_tg_mac} | ${tg_to_dut2_mac}
235 | | And Send Packet And Check Headers
236 | | ... | ${tg_node} | ${tg2_ip4} | ${tg1_ip4}
237 | | ... | ${tg_to_dut2} | ${tg_to_dut2_mac} | ${dut2_to_tg_mac}
238 | | ... | ${tg_to_dut1} | ${dut1_to_tg_mac} | ${tg_to_dut1_mac}
239
240 *** Keywords ***
241 | Setup Qemu DUT1
242 | | [Documentation] | Setup Vhosts on DUT1 and setup IP on one of them. Setup\
243 | | ... | Qemu and bridge the vhosts. Optionally, you can set fib table ID\
244 | | ... | where the vhost2 interface should be assigned to.
245 | | ...
246 | | [Arguments] | ${fib_table}=0
247 | | ...
248 | | ${vhost1}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock1}
249 | | ${vhost2}= | Vpp Create Vhost User Interface | ${dut1_node} | ${sock2}
250 | | Set Interface Address | ${dut1_node} | ${vhost2} | ${vhost_ip} | ${prefix4}
251 | | Assign Interface To Fib Table | ${dut1_node}
252 | | ... | ${vhost2} | ${fib_table}
253 | | Set Interface State | ${dut1_node} | ${vhost1} | up
254 | | Set Interface State | ${dut1_node} | ${vhost2} | up
255 | | Bridge domain on DUT node is created | ${dut1_node} | ${bid} | learn=${TRUE}
256 | | Interface is added to bridge domain | ${dut1_node}
257 | | ... | ${dut1_to_tg} | ${bid} | 0
258 | | Interface is added to bridge domain | ${dut1_node}
259 | | ... | ${vhost1} | ${bid} | 0
260 | | ${vhost_mac}= | Get Vhost User Mac By SW Index | ${dut1_node} | ${vhost2}
261 | | Set test variable | ${dst_vhost_mac} | ${vhost_mac}
262 | | VM for Vhost L2BD forwarding is setup | ${dut1_node} | ${sock1} | ${sock2}
263
264 | Add IP Neighbors
265 | | [Documentation]
266 | | ... | Add IP neighbors to physical interfaces on DUTs.\
267 | | ... | You can specify fib table ID for DUT-TG interfaces. Default is 0.
268 | | ...
269 | | [Arguments] | ${fib_id}=0
270 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_tg} | ${tg1_ip4}
271 | | ... | ${tg_to_dut1_mac} | ${fib_id}
272 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_tg} | ${tg2_ip4}
273 | | ... | ${tg_to_dut2_mac} | ${fib_id}
274 | | Add IP Neighbor | ${dut1_node} | ${dut1_to_dut2} | ${dut2_to_dut1_ip4}
275 | | ... | ${dut2_to_dut1_mac}
276 | | Add IP Neighbor | ${dut2_node} | ${dut2_to_dut1} | ${dut1_to_dut2_ip4}
277 | | ... | ${dut1_to_dut2_mac}