13a8e619fb9fd5593101458cafd1cf1a97806a86
[csit.git] / tests / func / tap / tap_interface.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 | Resource | resources/libraries/robot/default.robot
16 | Resource | resources/libraries/robot/ipv4.robot
17 | Resource | resources/libraries/robot/ipv6.robot
18 | Resource | resources/libraries/robot/interfaces.robot
19 | Resource | resources/libraries/robot/bridge_domain.robot
20 | Resource | resources/libraries/robot/testing_path.robot
21 | Resource | resources/libraries/robot/traffic.robot
22 | Library  | resources.libraries.python.Trace
23 | Library  | resources.libraries.python.Tap
24 | Library  | resources.libraries.python.Namespaces
25 | Library  | resources.libraries.python.IPUtil
26 | Force Tags | HW_ENV | VM_ENV | 3_NODE_DOUBLE_LINK_TOPO
27 | Test Setup | Run Keywords | Setup all DUTs before test
28 | ...        | AND          | Setup all TGs before traffic script
29 | ...        | AND          | Clean Up Namespaces | ${nodes['DUT1']}
30 | Test Teardown | Run Keywords | Show Packet Trace on All DUTs | ${nodes}
31 | ...        | AND          | Clean Up Namespaces | ${nodes['DUT1']}
32 | Documentation | *Tap Interface Traffic Tests*
33 | ... | *[Top] Network Topologies:* TG=DUT1 2-node topology with two links
34 | ... | between nodes.
35 | ... | *[Enc] Packet Encapsulations:* Eth-IPv4-ICMPv4 for L2 switching of
36 | ... | IPv4.
37 | ... | *[Cfg] DUT configuration:* DUT1 and DUT2 are configured with L2
38 | ... | bridge-domain (L2BD) MAC learning enabled; Split Horizon Groups (SHG)
39 | ... | are set depending on test case; Namespaces (NM)
40 | ... | are set on DUT1 with attached linux-TAP.
41 | ... | *[Ver] TG verification:* Test ICMPv4 Echo Request packets
42 | ... | are sent by TG on link to DUT1; On receipt TG verifies packets
43 | ... | for correctness and their IPv4 src-addr, dst-addr, and MAC addresses.
44 | ... | *[Ref] Applicable standard specifications:*
45
46 *** Variables ***
47 | ${tap1_VPP_ip}= | 16.0.10.1
48 | ${tap2_VPP_ip}= | 16.0.20.1
49
50 | ${tap1_NM_ip}= | 16.0.10.2
51 | ${tap2_NM_ip}= | 16.0.20.2
52 | ${tap2_NM_SHG}= | 16.0.10.3
53
54 | ${bid_from_TG}= | 19
55 | ${bid_to_TG}= | 20
56 | ${bid_NM}= | container1_br
57 | ${bid_TAP}= | tapBr
58 | ${bd_id1}= | 21
59 | ${bd_id2}= | 22
60 | ${shg1}= | 2
61 | ${shg2}= | 3
62
63 | ${tap1_NM_mac}= | 02:00:00:00:00:02
64 | ${tap2_NM_mac}= | 02:00:00:00:00:04
65
66 | ${tap_int1}= | tap_int1
67 | ${tap_int2}= | tap_int2
68 | ${mod_tap_name}= | tap_int1MOD
69
70 | ${namespace1}= | nmspace1
71 | ${namespace2}= | nmspace2
72
73 | ${dut_ip_address}= | 192.168.0.1
74 | ${tg_ip_address}= | 192.168.0.2
75 | ${tg_ip_address_SHG}= | 16.0.10.20
76 | ${tg_ip_address_GW}= | 192.168.0.0
77
78 | ${prefix}= | 24
79
80 *** Test Cases ***
81 | TC01: Tap Interface Simple BD
82 | | [Documentation]
83 | | ... | [Top] TG-DUT1-TG.
84 | | ... | [Enc] Eth-IPv4-ICMPv4.
85 | | ... | [Cfg] On DUT1 configure two
86 | | ... | L2BD with two if's for each L2BD with MAC learning and one L2BD
87 | | ... | joining two linux-TAP interfaces created by VPP located in namespace.
88 | | ... | [Ver] Packet sent from TG is passed through all L2BD and received
89 | | ... | back on TG. Then src_ip, dst_ip and MAC are checked.
90 | | ...
91 | | [Teardown] | Run Keywords
92 | | ... | Linux Del Bridge | ${dut_node} | ${bid_TAP} | AND
93 | | ... | Show Packet Trace on All DUTs | ${nodes} | AND
94 | | ... | Clean Up Namespaces | ${nodes['DUT1']}
95 | | ...
96 | | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
97 | | ... | ${nodes['TG']}
98 | | And Interfaces in 2-node path are up
99 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1}
100 | | ${int2}= | And Add Tap Interface | ${dut_node} | ${tap_int2}
101 | | And Set Interface State | ${dut_node} | ${int1} | up
102 | | And Set Interface State | ${dut_node} | ${int2} | up
103 | | And Bridge domain on DUT node is created | ${dut_node}
104 | | ... | ${bid_from_TG} | learn=${TRUE}
105 | | And Bridge domain on DUT node is created | ${dut_node}
106 | | ... | ${bid_to_TG} | learn=${TRUE}
107 | | And Linux Add Bridge | ${dut_node}
108 | | ... | ${bid_TAP} | ${tap_int1} | ${tap_int2}
109 | | And Interface is added to bridge domain | ${dut_node}
110 | | ... | ${int1} | ${bid_to_TG} | 0
111 | | And Interface is added to bridge domain | ${dut_node}
112 | | ... | ${dut_to_tg_if1} | ${bid_to_TG} | 0
113 | | And Interface is added to bridge domain | ${dut_node}
114 | | ... | ${int2} | ${bid_from_TG} | 0
115 | | And Interface is added to bridge domain | ${dut_node}
116 | | ... | ${dut_to_tg_if2} | ${bid_from_TG} | 0
117 | | Then Send and receive ICMP Packet | ${tg_node}
118 | | ... | ${tg_to_dut_if1} | ${tg_to_dut_if2}
119
120 | TC02: Tap Interface IP Ping Without Namespace
121 | | [Documentation]
122 | | ... | [Top] TG-DUT1-TG.
123 | | ... | [Enc] Eth-IPv4-ICMPv4.
124 | | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which
125 | | ... | one is TAP interface ( dut_to_tg_if and TAP ).
126 | | ... | and one is linux-TAP.
127 | | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is
128 | | ... | received on TG.
129 | | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
130 | | ... | ${nodes['TG']}
131 | | And Interfaces in 2-node path are up
132 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1} |
133 | | And Set Interface Address
134 | | ... | ${dut_node} | ${int1} | ${tap1_VPP_ip} | ${prefix}
135 | | And Set Interface Address
136 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip_address} | ${prefix}
137 | | And Set Interface State | ${dut_node} | ${int1} | up
138 | | And Set Linux Interface MAC | ${dut_node} | ${tap_int1} | ${tap1_NM_mac}
139 | | And Set Linux Interface IP | ${dut_node}
140 | | ... | ${tap_int1} | ${tap1_NM_ip} | ${prefix}
141 | | And Add Route | ${dut_node}
142 | | ... | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip}
143 | | And Add Arp On Dut | ${dut_node} | ${dut_to_tg_if1}
144 | | ... | ${tg_ip_address} | ${tg_to_dut_if1_mac}
145 | | And Add Arp On Dut | ${dut_node} | ${int1}
146 | | ... | ${tap1_NM_ip} | ${tap1_NM_mac}
147 | | Then Node replies to ICMP echo request | ${tg_node} | ${tg_to_dut_if1}
148 | | ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if1_mac}
149 | | ... | ${tap1_NM_ip} | ${tg_ip_address}
150
151 | TC03: Tap Interface IP Ping With Namespace
152 | | [Documentation]
153 | | ... | [Top] TG-DUT1-TG.
154 | | ... | [Enc] Eth-IPv4-ICMPv4.
155 | | ... | [Cfg] On DUT1 configure two interface addresses with IPv4 of which
156 | | ... | one is TAP interface ( dut_to_tg_if and TAP ).
157 | | ... | and one is linux-TAP in namespace.
158 | | ... | [Ver] Packet sent from TG gets to the destination and ICMP-reply is
159 | | ... | received on TG.
160 | | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
161 | | ... | ${nodes['TG']}
162 | | And Interfaces in 2-node path are up
163 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1} |
164 | | And Set Interface Address
165 | | ... | ${dut_node} | ${int1} | ${tap1_VPP_ip} | ${prefix}
166 | | And Set Interface Address
167 | | ... | ${dut_node} | ${dut_to_tg_if1} | ${dut_ip_address} | ${prefix}
168 | | And Set Interface State | ${dut_node} | ${int1} | up
169 | | When Create Namespace | ${dut_node} | ${namespace1}
170 | | And Attach Interface To Namespace | ${dut_node}
171 | | ... | ${namespace1} | ${tap_int1}
172 | | And Set Linux Interface MAC | ${dut_node}
173 | | ... | ${tap_int1} | ${tap1_NM_mac} | ${namespace1}
174 | | And Set Linux Interface IP | ${dut_node}
175 | | ... | ${tap_int1} | ${tap1_NM_ip} | ${prefix} | ${namespace1}
176 | | And Add Arp On Dut | ${dut_node} | ${dut_to_tg_if1}
177 | | ... | ${tg_ip_address} | ${tg_to_dut_if1_mac}
178 | | And Add Arp On Dut | ${dut_node} | ${int1}
179 | | ... | ${tap1_NM_ip} | ${tap1_NM_mac}
180 | | And Add Route | ${dut_node}
181 | | ... | ${tg_ip_address_GW} | ${prefix} | ${tap1_VPP_ip} | ${namespace1}
182 | | Then Node replies to ICMP echo request | ${tg_node} | ${tg_to_dut_if1}
183 | | ... | ${dut_to_tg_if1_mac} | ${tg_to_dut_if1_mac}
184 | | ... | ${tap1_NM_ip} | ${tg_ip_address}
185
186 | TC04: Tap Interface BD - Different Split Horizon
187 | | [Documentation]
188 | | ... | [Top] TG-DUT1-TG.
189 | | ... | [Enc] Eth-IPv4-ICMPv4.
190 | | ... | [Cfg] On DUT1
191 | | ... | configure one if into L2BD with MAC learning. Add two TAP interfaces
192 | | ... | into this L2BD and assign them different SHG. Setup two namespaces
193 | | ... | and assign two linux-TAP interfaces to it respectively.
194 | | ... | [Ver] Packet is sent from TG to both linux-TAP interfaces and reply
195 | | ... | is checked. Ping from First linux-TAP to another should pass.
196 | | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
197 | | ... | ${nodes['TG']}
198 | | And Interfaces in 2-node path are up
199 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1}
200 | | ${int2}= | And Add Tap Interface | ${dut_node} | ${tap_int2}
201 | | And Set Interface State | ${dut_node} | ${int1} | up
202 | | And Set Interface State | ${dut_node} | ${int2} | up
203 | | When Create Namespace | ${dut_node} | ${namespace1}
204 | | And Attach Interface To Namespace | ${dut_node}
205 | | ... | ${namespace1} | ${tap_int1}
206 | | And Create Namespace | ${dut_node} | ${namespace2}
207 | | And Attach Interface To Namespace | ${dut_node}
208 | | ... | ${namespace2} | ${tap_int2}
209 | | And Set Linux Interface IP | ${dut_node} | ${tap_int1}
210 | | ... | ${tap1_NM_ip} | ${prefix} | ${namespace1}
211 | | And Set Linux Interface IP | ${dut_node} | ${tap_int2}
212 | | ... | ${tap2_NM_SHG} | ${prefix} | ${namespace2}
213 | | And Set Linux Interface MAC | ${dut_node}
214 | | ... | ${tap_int1} | ${tap1_NM_mac} | ${namespace1}
215 | | And Set Linux Interface MAC | ${dut_node}
216 | | ... | ${tap_int2} | ${tap2_NM_mac} | ${namespace2}
217 | | And Set Linux Interface ARP | ${dut_node} | ${tap_int1}
218 | | ... | ${tg_ip_address_SHG} | ${tg_to_dut_if1_mac} | ${namespace1}
219 | | And Set Linux Interface ARP | ${dut_node} | ${tap_int2}
220 | | ... | ${tg_ip_address_SHG} | ${tg_to_dut_if1_mac} | ${namespace2}
221 | | And Bridge domain on DUT node is created | ${dut_node}
222 | | ... | ${bd_id1} | learn=${TRUE}
223 | | And Interface is added to bridge domain | ${dut_node} | ${dut_to_tg_if1}
224 | | ...                                     | ${bd_id1}
225 | | And Interface is added to bridge domain | ${dut_node} | ${int1}
226 | | ...                                     | ${bd_id1} | ${shg1}
227 | | And Interface is added to bridge domain | ${dut_node} | ${int2}
228 | | ...                                     | ${bd_id1} | ${shg2}
229 | | Then Node replies to ICMP echo request | ${tg_node} | ${tg_to_dut_if1}
230 | | ... | ${tap1_NM_mac} | ${tg_to_dut_if1_mac}
231 | | ... | ${tap1_NM_ip} | ${tg_ip_address_SHG}
232 | | And Node replies to ICMP echo request | ${tg_node} | ${tg_to_dut_if1}
233 | | ... | ${tap2_NM_mac} | ${tg_to_dut_if1_mac}
234 | | ... | ${tap2_NM_SHG} | ${tg_ip_address_SHG}
235 | | And Send Ping From Node To Dst | ${dut_node} | ${tap1_NM_ip} | namespace=${namespace2}
236 | | And Send Ping From Node To Dst | ${dut_node} | ${tap2_NM_SHG} | namespace=${namespace1}
237
238 | TC05: Tap Interface BD - Same Split Horizon
239 | | [Documentation]
240 | | ... | [Top] TG-DUT1-TG.
241 | | ... | [Enc] Eth-IPv4-ICMPv4.
242 | | ... | [Cfg] On DUT1
243 | | ... | configure one if into L2BD with MAC learning. Add two TAP interfaces
244 | | ... | into this L2BD and assign them same SHG. Setup two namespaces
245 | | ... | and assign two linux-TAP interfaces to it respectively.
246 | | ... | [Ver] Packet is sent from TG to both linux-TAP interfaces and reply
247 | | ... | is checked. Ping from First linux-TAP to another should fail.
248 | | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
249 | | ... | ${nodes['TG']}
250 | | And Interfaces in 2-node path are up
251 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1}
252 | | ${int2}= | And Add Tap Interface | ${dut_node} | ${tap_int2}
253 | | And Set Interface State | ${dut_node} | ${int1} | up
254 | | And Set Interface State | ${dut_node} | ${int2} | up
255 | | When Create Namespace | ${dut_node} | ${namespace1}
256 | | And Attach Interface To Namespace | ${dut_node}
257 | | ... | ${namespace1} | ${tap_int1}
258 | | And Create Namespace | ${dut_node} | ${namespace2}
259 | | And Attach Interface To Namespace | ${dut_node}
260 | | ... | ${namespace2} | ${tap_int2}
261 | | And Set Linux Interface IP | ${dut_node} | ${tap_int1}
262 | | ... | ${tap1_NM_ip} | ${prefix} | ${namespace1}
263 | | And Set Linux Interface IP | ${dut_node} | ${tap_int2}
264 | | ... | ${tap2_NM_SHG} | ${prefix} | ${namespace2}
265 | | And Set Linux Interface MAC | ${dut_node}
266 | | ... | ${tap_int1} | ${tap1_NM_mac} | ${namespace1}
267 | | And Set Linux Interface MAC | ${dut_node}
268 | | ... | ${tap_int2} | ${tap2_NM_mac} | ${namespace2}
269 | | And Set Linux Interface ARP | ${dut_node} | ${tap_int1}
270 | | ... | ${tg_ip_address_SHG} | ${tg_to_dut_if1_mac} | ${namespace1}
271 | | And Set Linux Interface ARP | ${dut_node} | ${tap_int2}
272 | | ... | ${tg_ip_address_SHG} | ${tg_to_dut_if1_mac} | ${namespace2}
273 | | And Bridge domain on DUT node is created | ${dut_node}
274 | | ... | ${bd_id1} | learn=${TRUE}
275 | | And Interface is added to bridge domain | ${dut_node} | ${dut_to_tg_if1}
276 | | ...                                     | ${bd_id1}
277 | | And Interface is added to bridge domain | ${dut_node} | ${int1}
278 | | ...                                     | ${bd_id1} | ${shg1}
279 | | And Interface is added to bridge domain | ${dut_node} | ${int2}
280 | | ...                                     | ${bd_id1} | ${shg1}
281 | | Then Node replies to ICMP echo request | ${tg_node} | ${tg_to_dut_if1}
282 | | ... | ${tap1_NM_mac} | ${tg_to_dut_if1_mac}
283 | | ... | ${tap1_NM_ip} | ${tg_ip_address_SHG}
284 | | And Node replies to ICMP echo request | ${tg_node} | ${tg_to_dut_if1}
285 | | ... | ${tap2_NM_mac} | ${tg_to_dut_if1_mac}
286 | | ... | ${tap2_NM_SHG} | ${tg_ip_address_SHG}
287 | | And Run Keyword And Expect Error | Ping Not Successful | Send Ping From Node To Dst
288 | | ... | ${dut_node} | ${tap2_NM_SHG} | namespace=${namespace1}
289 | | And Run Keyword And Expect Error | Ping Not Successful | Send Ping From Node To Dst
290 | | ... | ${dut_node} | ${tap1_NM_ip} | namespace=${namespace2}
291
292 | TC06: Tap Interface Modify And Delete
293 | | [Documentation]
294 | | ... | [Top] TG-DUT1-TG.
295 | | ... | [Enc] Eth-IPv4-ICMPv4.
296 | | ... | [Cfg] Set two TAP interfaces.
297 | | ... | [Ver] Verify that TAP interface can be modified, deleted, and no other
298 | | ... | TAP interface is affected.
299 | | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']}
300 | | ... | ${nodes['TG']}
301 | | And Interfaces in 2-node path are up
302 | | ${int1}= | And Add Tap Interface | ${dut_node} | ${tap_int1}
303 | | ${int2}= | And Add Tap Interface | ${dut_node} | ${tap_int2}
304 | | And Set Interface State | ${dut_node} | ${int1} | up
305 | | And Set Interface State | ${dut_node} | ${int2} | up
306 | | When Modify Tap Interface | ${dut_node} | ${int1} | ${mod_tap_name}
307 | | Then Check Tap Present | ${dut_node} | ${mod_tap_name}
308 | | When Delete Tap Interface | ${dut_node} | ${int1}
309 | | Then Run Keyword And Expect Error
310 | | ... | Tap interface :${mod_tap_name} does not exist
311 | | ... | Check Tap Present | ${dut_node} | ${mod_tap_name}
312 | | And Check Tap Present | ${dut_node} | ${tap_int2}
313 | | When Delete Tap Interface | ${dut_node} | ${int2}
314 | | Then Run Keyword And Expect Error
315 | | ... | ValueError: No JSON object could be decoded
316 | | ... | Check Tap Present | ${dut_node} | ${tap_int2}