]>
Commit | Line | Data |
---|---|---|
526cf4e1 JS |
1 | AT_BANNER([packet-type-aware pipeline]) |
2 | ||
3 | AT_SETUP([ptap - legal flow entries in ptap bridge]) | |
4 | ||
5 | OVS_VSWITCHD_START | |
6 | ||
7 | AT_CHECK([ | |
8 | ovs-ofctl del-flows br0 | |
9 | ovs-ofctl -Oopenflow13 add-flow br0 priority=1,dl_src=11:22:33:44:55:66,eth_type=0x1234,actions=drop | |
10 | ovs-ofctl -Oopenflow14 add-flow br0 priority=1,ip,nw_dst=10.11.12.13,actions=drop | |
11 | ovs-ofctl -Oopenflow15 add-flow br0 priority=1,ipv6,nw_proto=6,actions=drop | |
12 | ovs-ofctl -Oopenflow14 add-flow br0 priority=2,packet_type=\(0,0x0\),dl_src=11:22:33:44:55:66,dl_type=0x4567,actions=drop | |
13 | ovs-ofctl -Oopenflow15 add-flow br0 priority=2,packet_type=\(0,0x0\),arp,arp_tpa=10.11.12.13,actions=drop | |
14 | ovs-ofctl -Oopenflow15 add-flow br0 priority=3,packet_type=\(1,0x806\),arp_tpa=10.11.12.13,actions=drop | |
15 | ovs-ofctl -Oopenflow13 add-flow br0 priority=3,packet_type=\(1,0x800\),nw_dst=10.11.12.13,actions=drop | |
16 | ovs-ofctl -Oopenflow14 add-flow br0 priority=3,packet_type=\(1,0x86dd\),ipv6_dst=1234:5678::/32,actions=drop | |
17 | ], [0]) | |
18 | ||
19 | AT_CHECK([ovs-ofctl -Oopenflow15 dump-flows br0 | ofctl_strip | sort | grep actions], [0], [dnl | |
20 | priority=1,dl_src=11:22:33:44:55:66,dl_type=0x1234 actions=drop | |
21 | priority=1,ip,nw_dst=10.11.12.13 actions=drop | |
22 | priority=1,tcp6 actions=drop | |
23 | priority=2,arp,arp_tpa=10.11.12.13 actions=drop | |
24 | priority=2,dl_src=11:22:33:44:55:66,dl_type=0x4567 actions=drop | |
25 | priority=3,packet_type=(1,0x800),nw_dst=10.11.12.13 actions=drop | |
26 | priority=3,packet_type=(1,0x806),arp_tpa=10.11.12.13 actions=drop | |
27 | priority=3,packet_type=(1,0x86dd),ipv6_dst=1234:5678::/32 actions=drop | |
28 | ]) | |
29 | ||
30 | OVS_VSWITCHD_STOP | |
31 | AT_CLEANUP | |
32 | ||
33 | ||
34 | AT_SETUP([ptap - triangle bridge setup with L2 and L3 GRE tunnels]) | |
35 | ||
36 | ######################## | |
37 | # GRE tunneling test setup for PTAP bridge | |
38 | # | |
39 | # 192.168.10.10 192.168.10.20 192.168.10.30 | |
40 | # n1 n2 n3 | |
41 | # | | | | |
42 | # +------o------+ +------o------+ +------o------+ | |
43 | # | br-in1 | | br-in2 | | br-in3 | | |
44 | # | | | (PTAP) | | | | |
45 | # +------o------+ +------o------+ +------o------+ | |
46 | # gre gre gre | |
47 | # 10.0.0.1 (10.0.0.2) (10.0.0.3) | |
48 | # (20.0.0.1) 20.0.0.2 (20.0.0.3) | |
49 | # (30.0.0.1) LOCAL (30.0.0.2) LOCAL 30.0.0.3 LOCAL | |
50 | # +-----------o-+ +-----------o-+ +-----------o-+ | |
51 | # | br-p1 | | br-p2 | | br-p3 | | |
52 | # +------o------+ +------o------+ +------o------+ | |
53 | # p1-0 | | p2-0 | p3-0 | |
54 | # p0-1 | | p0-2 | p0-3 | |
55 | # +--o------------------------o-------------------------o--+ | |
56 | # | br0 | | |
57 | # +--------------------------------------------------------+ | |
58 | #" | |
59 | # GRE tunnel ports: | |
60 | # No Bridge Name Packet-type Remote bridge & ports | |
61 | # ----------------------------------------------------------------------- | |
62 | # 1020 br-in1 gre-12 legacy-l2 br-in2 2010 (ptap) | |
63 | # 1021 br-in1 gre-12_l3 legacy-l3 same | |
64 | # 1030 br-in1 gre-13 legacy-l2 br-in3 3010 (l2) | |
65 | # 2010 br-in2 gre-21 ptap br-in1 1020 (l2), 1021 (l3) | |
66 | # 2030 br-in2 gre-23 ptap br-in3 3020 (l2), 3021 (l3) | |
5dbfe239 ZB |
67 | # 3010 br-in3 gre-31 legacy-l2 br-in1 1030 (l2) |
68 | # 3020 br-in3 gre-32 legacy-l2 br-in2 2010 (ptap) | |
69 | # 3021 br-in3 gre-32_l3 legacy-l3 same | |
526cf4e1 JS |
70 | |
71 | HWADDR_BRP1=aa:55:00:00:00:01 | |
72 | HWADDR_BRP2=aa:55:00:00:00:02 | |
73 | HWADDR_BRP3=aa:55:00:00:00:03 | |
74 | ||
75 | OVS_VSWITCHD_START([dnl | |
76 | -- add-br br-in1 \ | |
77 | -- set bridge br-in1 datapath_type=dummy fail-mode=secure \ | |
78 | -- add-br br-in2 \ | |
79 | -- set bridge br-in2 datapath_type=dummy fail-mode=secure \ | |
80 | -- add-br br-in3 \ | |
81 | -- set bridge br-in3 datapath_type=dummy fail-mode=secure \ | |
82 | -- add-br br-p1 -- \ | |
83 | -- set bridge br-p1 datapath_type=dummy fail-mode=secure other-config:hwaddr=\"$HWADDR_BRP1\" \ | |
84 | -- add-br br-p2 -- \ | |
85 | -- set bridge br-p2 datapath_type=dummy fail-mode=secure other-config:hwaddr=\"$HWADDR_BRP2\" \ | |
86 | -- add-br br-p3 -- \ | |
87 | -- set bridge br-p3 datapath_type=dummy fail-mode=secure other-config:hwaddr=\"$HWADDR_BRP3\" \ | |
88 | -- add-port br-p1 p1-0 \ | |
89 | -- set interface p1-0 type=patch options:peer=p0-1 ofport_request=2 \ | |
90 | -- add-port br-p2 p2-0 \ | |
91 | -- set interface p2-0 type=patch options:peer=p0-2 ofport_request=2 \ | |
92 | -- add-port br-p3 p3-0 \ | |
93 | -- set interface p3-0 type=patch options:peer=p0-3 ofport_request=2 \ | |
94 | -- add-port br0 p0-1 \ | |
95 | -- set interface p0-1 type=patch options:peer=p1-0 ofport_request=10 \ | |
96 | -- add-port br0 p0-2 \ | |
97 | -- set interface p0-2 type=patch options:peer=p2-0 ofport_request=20 \ | |
98 | -- add-port br0 p0-3 \ | |
99 | -- set interface p0-3 type=patch options:peer=p3-0 ofport_request=30 \ | |
100 | -- add-port br-in1 gre12 \ | |
101 | -- set interface gre12 type=gre options:remote_ip=10.0.0.2 \ | |
102 | ofport_request=1020 \ | |
103 | -- add-port br-in1 gre12_l3 \ | |
104 | -- set interface gre12_l3 type=gre options:remote_ip=10.0.0.2 \ | |
105 | ofport_request=1021 options:packet_type=legacy_l3 \ | |
106 | -- add-port br-in1 gre13 \ | |
107 | -- set interface gre13 type=gre options:remote_ip=10.0.0.3 \ | |
108 | ofport_request=1030 \ | |
109 | -- add-port br-in2 gre21 \ | |
110 | -- set interface gre21 type=gre options:remote_ip=20.0.0.1 \ | |
111 | ofport_request=2010 options:packet_type=ptap \ | |
112 | -- add-port br-in2 gre23 \ | |
113 | -- set interface gre23 type=gre options:remote_ip=20.0.0.3 \ | |
114 | ofport_request=2030 options:packet_type=ptap \ | |
115 | -- add-port br-in3 gre31 \ | |
116 | -- set interface gre31 type=gre options:remote_ip=30.0.0.1 \ | |
117 | ofport_request=3010 \ | |
118 | -- add-port br-in3 gre32 \ | |
119 | -- set interface gre32 type=gre options:remote_ip=30.0.0.2 \ | |
120 | ofport_request=3020 \ | |
121 | -- add-port br-in3 gre32_l3 \ | |
122 | -- set interface gre32_l3 type=gre options:remote_ip=30.0.0.2 \ | |
123 | ofport_request=3021 options:packet_type=legacy_l3 | |
124 | ]) | |
125 | ||
126 | # Setup bridge infrastructure | |
127 | AT_CHECK([ | |
128 | # Populate the MAC table of br0 | |
129 | ovs-ofctl del-flows br0 && | |
130 | ovs-ofctl add-flow br0 dl_dst=$HWADDR_BRP1,actions=10 && | |
131 | ovs-ofctl add-flow br0 dl_dst=$HWADDR_BRP2,actions=20 && | |
132 | ovs-ofctl add-flow br0 dl_dst=$HWADDR_BRP3,actions=30 && | |
133 | ||
134 | ovs-ofctl del-flows br-in1 && | |
135 | ovs-ofctl del-flows br-in2 && | |
136 | ovs-ofctl del-flows br-in3 && | |
137 | ovs-ofctl del-flows br-p1 && | |
138 | ovs-ofctl del-flows br-p2 && | |
139 | ovs-ofctl del-flows br-p3 | |
140 | ], [0]) | |
141 | ||
142 | ### Setup GRE tunnels | |
143 | AT_CHECK([ | |
144 | ovs-appctl netdev-dummy/ip4addr br-p1 10.0.0.1/24 && | |
145 | ovs-appctl ovs/route/add 10.0.0.0/24 br-p1 && | |
146 | ovs-appctl tnl/arp/set br-p1 10.0.0.1 $HWADDR_BRP1 && | |
147 | ovs-appctl tnl/arp/set br-p1 10.0.0.2 $HWADDR_BRP2 && | |
148 | ovs-appctl tnl/arp/set br-p1 10.0.0.3 $HWADDR_BRP3 && | |
149 | ||
150 | ovs-appctl netdev-dummy/ip4addr br-p2 20.0.0.2/24 && | |
151 | ovs-appctl ovs/route/add 20.0.0.0/24 br-p2 && | |
152 | ovs-appctl tnl/arp/set br-p2 20.0.0.1 $HWADDR_BRP1 && | |
153 | ovs-appctl tnl/arp/set br-p2 20.0.0.2 $HWADDR_BRP2 && | |
154 | ovs-appctl tnl/arp/set br-p2 20.0.0.3 $HWADDR_BRP3 && | |
155 | ||
156 | ovs-appctl netdev-dummy/ip4addr br-p3 30.0.0.3/24 && | |
157 | ovs-appctl ovs/route/add 30.0.0.0/24 br-p3 && | |
158 | ovs-appctl tnl/arp/set br-p3 30.0.0.1 $HWADDR_BRP1 && | |
159 | ovs-appctl tnl/arp/set br-p3 30.0.0.2 $HWADDR_BRP2 && | |
160 | ovs-appctl tnl/arp/set br-p3 30.0.0.3 $HWADDR_BRP3 | |
161 | ], [0], [ignore]) | |
162 | ||
163 | AT_CHECK([ | |
164 | ovs-appctl ovs/route/show | grep User: | |
165 | ], [0], [dnl | |
166 | User: 10.0.0.0/24 dev br-p1 SRC 10.0.0.1 | |
167 | User: 20.0.0.0/24 dev br-p2 SRC 20.0.0.2 | |
168 | User: 30.0.0.0/24 dev br-p3 SRC 30.0.0.3 | |
169 | ]) | |
170 | ||
171 | AT_CHECK([ | |
172 | ovs-appctl tnl/neigh/show | grep br-p | sort | |
173 | ], [0], [ignore]) | |
174 | ||
175 | ### Flows in br-p<x>to twist TEP IP addresses in tunnel IP headers | |
176 | AT_CHECK([ | |
177 | ovs-ofctl add-flow br-p1 in_port:LOCAL,actions=2 | |
178 | ovs-ofctl add-flow br-p1 in_port:2,ip,nw_dst:20.0.0.1,actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.2,LOCAL | |
179 | ovs-ofctl add-flow br-p1 in_port:2,ip,nw_dst:30.0.0.1,actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.3,LOCAL | |
180 | ||
181 | ovs-ofctl add-flow br-p2 in_port:LOCAL,actions=2 | |
182 | ovs-ofctl add-flow br-p2 in_port:2,ip,nw_dst:10.0.0.2,actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.1,LOCAL | |
183 | ovs-ofctl add-flow br-p2 in_port:2,ip,nw_dst:30.0.0.2,actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.3,LOCAL | |
184 | ||
185 | ovs-ofctl add-flow br-p3 in_port:LOCAL,actions=2 | |
186 | ovs-ofctl add-flow br-p3 in_port:2,ip,nw_dst:10.0.0.3,actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.1,LOCAL | |
187 | ovs-ofctl add-flow br-p3 in_port:2,ip,nw_dst:20.0.0.3,actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.2,LOCAL | |
188 | ], [0]) | |
189 | ||
190 | AT_CHECK([ | |
191 | ovs-ofctl dump-flows br-p1 | ofctl_strip | sort | grep actions | |
192 | ovs-ofctl dump-flows br-p2 | ofctl_strip | sort | grep actions | |
193 | ovs-ofctl dump-flows br-p3 | ofctl_strip | sort | grep actions | |
194 | ], [0], [dnl | |
195 | in_port=LOCAL actions=output:2 | |
196 | ip,in_port=2,nw_dst=20.0.0.1 actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.2,LOCAL | |
197 | ip,in_port=2,nw_dst=30.0.0.1 actions=mod_nw_dst:10.0.0.1,mod_nw_src:10.0.0.3,LOCAL | |
198 | in_port=LOCAL actions=output:2 | |
199 | ip,in_port=2,nw_dst=10.0.0.2 actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.1,LOCAL | |
200 | ip,in_port=2,nw_dst=30.0.0.2 actions=mod_nw_dst:20.0.0.2,mod_nw_src:20.0.0.3,LOCAL | |
201 | in_port=LOCAL actions=output:2 | |
202 | ip,in_port=2,nw_dst=10.0.0.3 actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.1,LOCAL | |
203 | ip,in_port=2,nw_dst=20.0.0.3 actions=mod_nw_dst:30.0.0.3,mod_nw_src:30.0.0.2,LOCAL | |
204 | ]) | |
205 | ||
206 | ### Setup test ports for traffic injection | |
207 | N1_IP=192.168.10.10 | |
208 | N2_IP=192.168.10.20 | |
209 | N3_IP=192.168.10.30 | |
210 | N1_MAC=aa:55:aa:55:00:01 | |
211 | N2_MAC=aa:55:aa:55:00:02 | |
212 | N3_MAC=aa:55:aa:55:00:03 | |
213 | N1_OFPORT=10 | |
214 | N2_OFPORT=20 | |
215 | N3_OFPORT=30 | |
216 | ||
217 | AT_CHECK([ | |
218 | ovs-vsctl \ | |
219 | -- add-port br-in1 n1 \ | |
220 | -- set interface n1 type=dummy ofport_request=$N1_OFPORT \ | |
221 | options:tx_pcap=n1.pcap \ | |
222 | -- add-port br-in2 n2 \ | |
223 | -- set interface n2 type=dummy ofport_request=$N2_OFPORT \ | |
224 | options:tx_pcap=n2.pcap \ | |
225 | -- add-port br-in3 n3 \ | |
226 | -- set interface n3 type=dummy ofport_request=$N3_OFPORT \ | |
227 | options:tx_pcap=n3.pcap | |
228 | ], [0]) | |
229 | ||
230 | #N1_DPPORT=$(ovs-appctl dpif/show | grep "n1 10" | sed 's|.*/\([[0-9]]*\):.*|\1|') | |
231 | #N2_DPPORT=$(ovs-appctl dpif/show | grep "n2 20" | sed 's|.*/\([[0-9]]*\):.*|\1|') | |
232 | #N3_DPPORT=$(ovs-appctl dpif/show | grep "n3 30" | sed 's|.*/\([[0-9]]*\):.*|\1|') | |
233 | ||
234 | ### Verify datapath configuration | |
235 | AT_CHECK([ | |
7be29a47 | 236 | ovs-appctl dpif/show | grep -v hit | sed 's./[[0-9]]\{1,\}..' |
526cf4e1 | 237 | ], [0], [dnl |
7be29a47 BP |
238 | br-in1: |
239 | br-in1 65534: (dummy-internal) | |
240 | gre12 1020: (gre: remote_ip=10.0.0.2) | |
241 | gre12_l3 1021: (gre: packet_type=legacy_l3, remote_ip=10.0.0.2) | |
242 | gre13 1030: (gre: remote_ip=10.0.0.3) | |
243 | n1 10: (dummy) | |
244 | br-in2: | |
245 | br-in2 65534: (dummy-internal) | |
246 | gre21 2010: (gre: packet_type=ptap, remote_ip=20.0.0.1) | |
247 | gre23 2030: (gre: packet_type=ptap, remote_ip=20.0.0.3) | |
248 | n2 20: (dummy) | |
249 | br-in3: | |
250 | br-in3 65534: (dummy-internal) | |
251 | gre31 3010: (gre: remote_ip=30.0.0.1) | |
252 | gre32 3020: (gre: remote_ip=30.0.0.2) | |
253 | gre32_l3 3021: (gre: packet_type=legacy_l3, remote_ip=30.0.0.2) | |
254 | n3 30: (dummy) | |
255 | br-p1: | |
256 | br-p1 65534: (dummy-internal) | |
257 | p1-0 2/none: (patch: peer=p0-1) | |
258 | br-p2: | |
259 | br-p2 65534: (dummy-internal) | |
260 | p2-0 2/none: (patch: peer=p0-2) | |
261 | br-p3: | |
262 | br-p3 65534: (dummy-internal) | |
263 | p3-0 2/none: (patch: peer=p0-3) | |
264 | br0: | |
265 | br0 65534: (dummy-internal) | |
266 | p0-1 10/none: (patch: peer=p1-0) | |
267 | p0-2 20/none: (patch: peer=p2-0) | |
268 | p0-3 30/none: (patch: peer=p3-0) | |
526cf4e1 JS |
269 | ]) |
270 | ||
271 | ### Test L3 forwarding flows | |
272 | AT_CHECK([ | |
273 | ovs-ofctl add-flow br-in1 ip,nw_dst=$N1_IP,actions=mod_dl_dst:$N1_MAC,$N1_OFPORT # Local route to N1 | |
274 | ovs-ofctl add-flow br-in1 ip,nw_dst=$N2_IP,actions=1020 # Route to N2 via the L2 tunnel to br-in2 | |
275 | ovs-ofctl add-flow br-in1 ip,nw_dst=$N3_IP,actions=1030 # Route to N3 direct through L2 tunnel | |
276 | ||
277 | ovs-ofctl add-flow br-in2 ip,nw_dst=$N2_IP,actions=mod_dl_dst:$N2_MAC,$N2_OFPORT # Local route to N2 for ethernet packets | |
278 | ovs-ofctl add-flow br-in2 ip,nw_dst=$N1_IP,actions=2010 # Route to N1 for ethernet packet | |
279 | ovs-ofctl add-flow br-in2 packet_type=\(1,0x800\),nw_dst=$N1_IP,actions=2010 # Route to N1 for IP packets | |
280 | ovs-ofctl add-flow br-in2 ip,nw_dst=$N3_IP,actions=2010 # Indirect route to N3 via br-in1 for ethernet packet | |
281 | ovs-ofctl add-flow br-in2 packet_type=\(1,0x800\),nw_dst=$N3_IP,actions=2030 # Direct route to N3 for IP packets | |
282 | ||
283 | ovs-ofctl add-flow br-in3 ip,nw_dst=$N3_IP,actions=mod_dl_dst:$N3_MAC,$N3_OFPORT # Local route to N1 | |
284 | ovs-ofctl add-flow br-in3 ip,nw_dst=$N2_IP,actions=3020 # Route to N2 via the L2 tunnel | |
285 | ovs-ofctl add-flow br-in3 ip,nw_dst=$N1_IP,actions=3021 # Route to N1 via br-in2 through L3 tunnel | |
286 | ], [0]) | |
287 | ||
288 | AT_CHECK([ | |
289 | ovs-ofctl dump-flows br-in1 | ofctl_strip | sort | grep actions | |
290 | ], [0], [dnl | |
291 | ip,nw_dst=192.168.10.10 actions=mod_dl_dst:aa:55:aa:55:00:01,output:10 | |
292 | ip,nw_dst=192.168.10.20 actions=output:1020 | |
293 | ip,nw_dst=192.168.10.30 actions=output:1030 | |
294 | ]) | |
295 | ||
296 | AT_CHECK([ | |
297 | ovs-ofctl dump-flows br-in2 | ofctl_strip | sort | grep actions | |
298 | ], [0], [dnl | |
299 | ip,nw_dst=192.168.10.10 actions=output:2010 | |
300 | ip,nw_dst=192.168.10.20 actions=mod_dl_dst:aa:55:aa:55:00:02,output:20 | |
301 | ip,nw_dst=192.168.10.30 actions=output:2010 | |
302 | packet_type=(1,0x800),nw_dst=192.168.10.10 actions=output:2010 | |
303 | packet_type=(1,0x800),nw_dst=192.168.10.30 actions=output:2030 | |
304 | ]) | |
305 | ||
306 | AT_CHECK([ | |
307 | ovs-ofctl dump-flows br-in3 | ofctl_strip | sort | grep actions | |
308 | ], [0], [dnl | |
309 | ip,nw_dst=192.168.10.10 actions=output:3021 | |
310 | ip,nw_dst=192.168.10.20 actions=output:3020 | |
311 | ip,nw_dst=192.168.10.30 actions=mod_dl_dst:aa:55:aa:55:00:03,output:30 | |
312 | ]) | |
313 | ||
314 | ### Inject ICMP Echo request test packets | |
315 | ||
316 | ovs-appctl vlog/set any:file:dbg | |
317 | ||
318 | # N1 to N3, via the L2 GRE tunnel between br-in1 and br-in3 | |
319 | AT_CHECK([ | |
320 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
321 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
322 | ], [0], [ignore]) | |
323 | ||
324 | ovs-appctl time/warp 1000 | |
325 | ||
326 | AT_CHECK([ | |
327 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 328 | ], [0], [flow-dump from the main thread: |
7c12dfc5 | 329 | recirc_id(0),in_port(n1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.30,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:03,src=aa:55:00:00:00:01,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.3,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x6558))),out_port(br-p1)),set(ipv4(src=30.0.0.1,dst=30.0.0.3)),tnl_pop(gre_sys)) |
526cf4e1 JS |
330 | tunnel(src=30.0.0.1,dst=30.0.0.3,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(dst=192.168.10.30,frag=no), packets:1, bytes:98, used:0.0s, actions:set(eth(dst=aa:55:aa:55:00:03)),n3 |
331 | ]) | |
332 | ||
333 | # Clear up megaflow cache | |
334 | ovs-appctl time/warp 11000 | |
335 | ||
336 | # N1 to N2 via the L2 GRE tunnel between br-in1 and br-in2 | |
337 | AT_CHECK([ | |
338 | ovs-appctl netdev-dummy/receive n1 461e7d1a95a13a6dd2099cab080045000054500b40004001552fc0a80a0ac0a80a140800531f09a90001e9509a580000000055ba030000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
339 | ovs-appctl netdev-dummy/receive n1 461e7d1a95a13a6dd2099cab08004500005450934000400154a7c0a80a0ac0a80a140800f41d09a90002ea509a5800000000b3ba030000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
340 | ], [0], [ignore]) | |
341 | ||
342 | ovs-appctl time/warp 1000 | |
343 | ||
344 | AT_CHECK([ | |
345 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 346 | ], [0], [flow-dump from the main thread: |
7c12dfc5 | 347 | recirc_id(0),in_port(n1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.20,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:02,src=aa:55:00:00:00:01,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x6558))),out_port(br-p1)),set(ipv4(src=20.0.0.1,dst=20.0.0.2)),tnl_pop(gre_sys)) |
526cf4e1 JS |
348 | tunnel(src=20.0.0.1,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=46:1e:7d:1a:95:a1),eth_type(0x0800),ipv4(dst=192.168.10.20,frag=no), packets:1, bytes:98, used:0.0s, actions:set(eth(dst=aa:55:aa:55:00:02)),n2 |
349 | ]) | |
350 | ||
351 | # Clear up megaflow cache | |
352 | ovs-appctl time/warp 11000 | |
353 | ||
354 | # N2 to N1 via the L2 GRE tunnel between br-in2 and br-in1 | |
355 | AT_CHECK([ | |
356 | ovs-appctl netdev-dummy/receive n2 3a6dd2099cab461e7d1a95a10800450000542c1f40004001791bc0a80a14c0a80a0a0800154b0b6800011b519a580000000054cf0e0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
357 | ovs-appctl netdev-dummy/receive n2 3a6dd2099cab461e7d1a95a10800450000542c744000400178c6c0a80a14c0a80a0a08003f420b6800021c519a580000000029d70e0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
358 | ], [0], [ignore]) | |
359 | ||
360 | ovs-appctl time/warp 1000 | |
361 | ||
362 | AT_CHECK([ | |
363 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 364 | ], [0], [flow-dump from the main thread: |
7c12dfc5 | 365 | recirc_id(0),in_port(n2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.10,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:01,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x6558))),out_port(br-p2)),set(ipv4(src=10.0.0.2,dst=10.0.0.1)),tnl_pop(gre_sys)) |
526cf4e1 JS |
366 | tunnel(src=10.0.0.2,dst=10.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=3a:6d:d2:09:9c:ab),eth_type(0x0800),ipv4(dst=192.168.10.10,frag=no), packets:1, bytes:98, used:0.0s, actions:set(eth(dst=aa:55:aa:55:00:01)),n1 |
367 | ]) | |
368 | ||
369 | # Clear up megaflow cache | |
370 | ovs-appctl time/warp 11000 | |
371 | ||
372 | # N2 to N3 via br-in1 using the L2 GRE tunnel between br-in2 and br-in1 and the L2 GRE tunnel between br-in1 and br-in3 | |
373 | AT_CHECK([ | |
374 | ovs-appctl netdev-dummy/receive n2 1e2ce92a669e461e7d1a95a1080045000054f7d440004001ad51c0a80a14c0a80a1e08000e760c1e000131519a580000000047ee0b0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
375 | ovs-appctl netdev-dummy/receive n2 1e2ce92a669e461e7d1a95a1080045000054f89540004001ac90c0a80a14c0a80a1e0800736f0c1e000232519a5800000000e1f30b0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
376 | ], [0], [ignore]) | |
377 | ||
378 | ovs-appctl time/warp 1000 | |
379 | ||
380 | AT_CHECK([ | |
381 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 382 | ], [0], [flow-dump from the main thread: |
7c12dfc5 SC |
383 | recirc_id(0),in_port(n2),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.30,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:01,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x6558))),out_port(br-p2)),set(ipv4(src=10.0.0.2,dst=10.0.0.1)),tnl_pop(gre_sys)) |
384 | tunnel(src=10.0.0.2,dst=10.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.30,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:03,src=aa:55:00:00:00:01,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.3,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x6558))),out_port(br-p1)),set(ipv4(src=30.0.0.1,dst=30.0.0.3)),tnl_pop(gre_sys)) | |
526cf4e1 JS |
385 | tunnel(src=30.0.0.1,dst=30.0.0.3,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(dst=192.168.10.30,frag=no), packets:1, bytes:98, used:0.0s, actions:set(eth(dst=aa:55:aa:55:00:03)),n3 |
386 | ]) | |
387 | ||
388 | # Clear up megaflow cache | |
389 | ovs-appctl time/warp 11000 | |
390 | ||
391 | # N3 to N1 via br-in2 using the L3 GRE tunnel between br-in3 and br-in2 and the L3 GRE tunnel between br-in2 and br-in1 | |
392 | AT_CHECK([ | |
393 | ovs-appctl netdev-dummy/receive n3 3a6dd2099cab1e2ce92a669e080045000054b80440004001ed2bc0a80a1ec0a80a0a0800e17a77d5015e64509a5800000000d3d50c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
394 | ovs-appctl netdev-dummy/receive n3 3a6dd2099cab1e2ce92a669e080045000054b8a240004001ec8dc0a80a1ec0a80a0a0800627177d5015f65509a580000000051de0c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
395 | ], [0], [ignore]) | |
396 | ||
397 | ovs-appctl time/warp 1000 | |
398 | ||
399 | AT_CHECK([ | |
400 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 401 | ], [0], [flow-dump from the main thread: |
7c12dfc5 | 402 | recirc_id(0),in_port(n3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.10,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:02,src=aa:55:00:00:00:03,dl_type=0x0800),ipv4(src=30.0.0.3,dst=30.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br-p3)),set(ipv4(src=20.0.0.3,dst=20.0.0.2)),tnl_pop(gre_sys)) |
29b5c0c3 BP |
403 | tunnel(src=10.0.0.2,dst=10.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(dst=192.168.10.10,frag=no), packets:1, bytes:84, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=aa:55:aa:55:00:01),n1 |
404 | tunnel(src=20.0.0.3,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(dst=192.168.10.10,tos=0/0x3,frag=no), packets:1, bytes:84, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:01,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=20.0.0.2,dst=20.0.0.1,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br-p2)),set(ipv4(src=10.0.0.2,dst=10.0.0.1)),tnl_pop(gre_sys)) | |
526cf4e1 JS |
405 | ]) |
406 | ||
407 | # Clear up megaflow cache | |
408 | ovs-appctl time/warp 11000 | |
409 | ||
410 | # N3 to N2 via L3 GRE tunnel between br-in3 and br-in2 | |
411 | AT_CHECK([ | |
412 | ovs-appctl netdev-dummy/receive n3 461e7d1a95a11e2ce92a669e080045000054e5b540004001bf70c0a80a1ec0a80a140800b3f1065b000188509a580000000050360c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
413 | ovs-appctl netdev-dummy/receive n3 461e7d1a95a11e2ce92a669e080045000054e5cf40004001bf56c0a80a1ec0a80a140800a2ed065b000289509a580000000060390c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
414 | ], [0], [ignore]) | |
415 | ||
416 | ovs-appctl time/warp 1000 | |
417 | ||
418 | AT_CHECK([ | |
419 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 420 | ], [0], [flow-dump from the main thread: |
7c12dfc5 | 421 | recirc_id(0),in_port(n3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.20,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:02,src=aa:55:00:00:00:03,dl_type=0x0800),ipv4(src=30.0.0.3,dst=30.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x6558))),out_port(br-p3)),set(ipv4(src=20.0.0.3,dst=20.0.0.2)),tnl_pop(gre_sys)) |
526cf4e1 JS |
422 | tunnel(src=20.0.0.3,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=46:1e:7d:1a:95:a1),eth_type(0x0800),ipv4(dst=192.168.10.20,frag=no), packets:1, bytes:98, used:0.0s, actions:set(eth(dst=aa:55:aa:55:00:02)),n2 |
423 | ]) | |
424 | ||
425 | ### Check the received packets | |
426 | ||
427 | AT_CHECK([ | |
428 | ovs-pcap n1.pcap | |
429 | ], [0], [dnl | |
430 | aa55aa550001461e7d1a95a10800450000542c1f40004001791bc0a80a14c0a80a0a0800154b0b6800011b519a580000000054cf0e0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
431 | aa55aa550001461e7d1a95a10800450000542c744000400178c6c0a80a14c0a80a0a08003f420b6800021c519a580000000029d70e0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
432 | aa55aa550001000000000000080045000054b80440004001ed2bc0a80a1ec0a80a0a0800e17a77d5015e64509a5800000000d3d50c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
433 | aa55aa550001000000000000080045000054b8a240004001ec8dc0a80a1ec0a80a0a0800627177d5015f65509a580000000051de0c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
434 | ]) | |
435 | ||
436 | AT_CHECK([ | |
437 | ovs-pcap n2.pcap | |
438 | ], [0], [dnl | |
439 | aa55aa5500023a6dd2099cab080045000054500b40004001552fc0a80a0ac0a80a140800531f09a90001e9509a580000000055ba030000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
440 | aa55aa5500023a6dd2099cab08004500005450934000400154a7c0a80a0ac0a80a140800f41d09a90002ea509a5800000000b3ba030000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
441 | aa55aa5500021e2ce92a669e080045000054e5b540004001bf70c0a80a1ec0a80a140800b3f1065b000188509a580000000050360c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
442 | aa55aa5500021e2ce92a669e080045000054e5cf40004001bf56c0a80a1ec0a80a140800a2ed065b000289509a580000000060390c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
443 | ]) | |
444 | ||
445 | AT_CHECK([ | |
446 | ovs-pcap n3.pcap | |
447 | ], [0], [dnl | |
448 | aa55aa5500033a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
449 | aa55aa5500033a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
450 | aa55aa550003461e7d1a95a1080045000054f7d440004001ad51c0a80a14c0a80a1e08000e760c1e000131519a580000000047ee0b0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
451 | aa55aa550003461e7d1a95a1080045000054f89540004001ac90c0a80a14c0a80a1e0800736f0c1e000232519a5800000000e1f30b0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
452 | ]) | |
453 | ||
5dbfe239 ZB |
454 | |
455 | # N3 to N2, from L3 GRE to PTAP port between br-in3 and br-in2. Dropping L3 packet on L2 dummy port in br-in2. | |
456 | ||
457 | # Strips 'n_packets=...' from ovs-ofctl output. | |
458 | strip_n_packets () { | |
459 | sed 's/n_packets=[[0-9]]*, //' | |
460 | } | |
461 | ||
462 | # Strips 'n_bytes=...' from ovs-ofctl output. | |
463 | strip_n_bytes () { | |
464 | sed 's/n_bytes=[[0-9]]*, //' | |
465 | } | |
466 | ||
467 | # Modify flow rules to receive L3 packet in br-in2. | |
468 | AT_CHECK([ | |
469 | ovs-ofctl add-flow br-in2 packet_type=\(1,0x800\),nw_dst=$N2_IP,actions=$N2_OFPORT # Route L3 packet to N2 in br-in2 | |
470 | ovs-ofctl add-flow br-in3 ip,nw_dst=$N2_IP,actions=3021 # Route to N2 via the L3 tunnel | |
471 | ], [0]) | |
472 | ||
473 | AT_CHECK([ | |
474 | ovs-ofctl dump-flows br-in2 | ofctl_strip | strip_n_bytes | strip_n_packets | sort | grep actions | |
475 | ], [0], [dnl | |
476 | ip,nw_dst=192.168.10.10 actions=output:2010 | |
477 | ip,nw_dst=192.168.10.20 actions=mod_dl_dst:aa:55:aa:55:00:02,output:20 | |
478 | ip,nw_dst=192.168.10.30 actions=output:2010 | |
479 | packet_type=(1,0x800),nw_dst=192.168.10.10 actions=output:2010 | |
480 | packet_type=(1,0x800),nw_dst=192.168.10.20 actions=output:20 | |
481 | packet_type=(1,0x800),nw_dst=192.168.10.30 actions=output:2030 | |
482 | ]) | |
483 | ||
484 | AT_CHECK([ | |
485 | ovs-ofctl dump-flows br-in3 | ofctl_strip | strip_n_bytes | strip_n_packets | sort | grep actions | |
486 | ], [0], [dnl | |
487 | ip,nw_dst=192.168.10.10 actions=output:3021 | |
488 | ip,nw_dst=192.168.10.20 actions=output:3021 | |
489 | ip,nw_dst=192.168.10.30 actions=mod_dl_dst:aa:55:aa:55:00:03,output:30 | |
490 | ]) | |
491 | ||
492 | # Clear up megaflow cache | |
493 | ovs-appctl time/warp 11000 | |
494 | ||
495 | # N3 to N2 via L3 GRE tunnel between br-in3 and br-in2 | |
496 | AT_CHECK([ | |
497 | ovs-appctl netdev-dummy/receive n3 461e7d1a95a11e2ce92a669e080045000054e5b540004001bf70c0a80a1ec0a80a140800b3f1065b000188509a580000000050360c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
498 | ovs-appctl netdev-dummy/receive n3 461e7d1a95a11e2ce92a669e080045000054e5cf40004001bf56c0a80a1ec0a80a140800a2ed065b000289509a580000000060390c0000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
499 | ], [0], [ignore]) | |
500 | ||
501 | ovs-appctl time/warp 1000 | |
502 | ||
503 | ||
504 | AT_CHECK([ | |
505 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 506 | ], [0], [flow-dump from the main thread: |
7c12dfc5 | 507 | recirc_id(0),in_port(n3),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(dst=192.168.10.20,tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=aa:55:00:00:00:02,src=aa:55:00:00:00:03,dl_type=0x0800),ipv4(src=30.0.0.3,dst=30.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br-p3)),set(ipv4(src=20.0.0.3,dst=20.0.0.2)),tnl_pop(gre_sys)) |
29b5c0c3 | 508 | tunnel(src=20.0.0.3,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x800),eth_type(0x0800),ipv4(dst=192.168.10.20,frag=no), packets:1, bytes:84, used:0.0s, actions:drop |
5dbfe239 ZB |
509 | ]) |
510 | ||
526cf4e1 JS |
511 | OVS_VSWITCHD_STOP(["/The Open vSwitch kernel module is probably not loaded/d"]) |
512 | AT_CLEANUP | |
d03d0cf2 ZB |
513 | |
514 | ||
515 | AT_SETUP([ptap - check decap() prerequisits]) | |
516 | OVS_VSWITCHD_START | |
517 | ||
518 | # Decap IP header, then set IP destination address. This should fail. | |
519 | AT_CHECK([ | |
520 | ovs-ofctl add-flow br0 "in_port=1,packet_type=(1,0x800),actions=decap(),set_field:1.1.1.1->nw_dst" | |
521 | ], [1], [stdout], [stderr]) | |
522 | ||
523 | AT_CHECK([ | |
524 | cat stderr | cut -d '|' -f 3- | |
525 | ], [0], [dnl | |
526 | ofp_actions|WARN|set_field ip_dst lacks correct prerequisites | |
527 | ovs-ofctl: actions are invalid with specified match (OFPBAC_MATCH_INCONSISTENT) | |
528 | ]) | |
529 | ||
530 | # Decap Ethernet header, then set IP destination address. This should work. | |
531 | AT_CHECK([ | |
532 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=1,ip,actions=decap(),set_field:1.1.1.1->nw_dst" | |
533 | ], [0]) | |
534 | ||
535 | # Decap IP header, then set metadata. This should work. | |
536 | AT_CHECK([ | |
537 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=1,packet_type=(1,0x800),actions=decap(),set_field:1234->metadata" | |
538 | ], [0]) | |
539 | ||
540 | OVS_VSWITCHD_STOP | |
541 | AT_CLEANUP | |
542 | ||
543 | ||
544 | AT_SETUP([ptap - check encap/decap VLAN tagged Ethernet frame]) | |
545 | OVS_VSWITCHD_START([dnl | |
546 | -- add-port br0 n1 -- set interface n1 type=dummy ofport_request=1 \ | |
547 | -- add-port br0 n2 -- set interface n2 type=dummy ofport_request=2 \ | |
548 | -- add-port br0 p1 -- set interface p1 type=patch options:peer=p2 ofport_request=3 \ | |
549 | -- add-port br0 p2 -- set interface p2 type=patch options:peer=p1 ofport_request=4 | |
550 | ]) | |
551 | ||
552 | # Decap VLAN tagged Ethernet frames -> should be dropped | |
553 | AT_CHECK([ | |
554 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=1,actions=push_vlan:0x8100,mod_vlan_vid:100,decap(),3" | |
555 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=4,actions=encap(ethernet),2" | |
556 | ], [0]) | |
557 | ||
558 | AT_CHECK([ | |
559 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
560 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
561 | ], [0], [ignore]) | |
562 | ||
563 | ovs-appctl time/warp 1000 | |
564 | ||
565 | AT_CHECK([ | |
566 | ovs-appctl dpctl/dump-flows | strip_used | grep -v ipv6 | sort | |
138d30a9 | 567 | ], [0], [flow-dump from the main thread: |
d03d0cf2 ZB |
568 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:drop |
569 | ]) | |
570 | ||
571 | # Encap(ethernet) on Ethernet frame -> should be droped | |
572 | AT_CHECK([ | |
573 | ovs-ofctl del-flows br0 | |
574 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=1,actions=3" | |
575 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=4,actions=encap(ethernet),2" | |
576 | ]) | |
577 | ||
578 | ovs-appctl time/warp 11000 | |
579 | ||
580 | AT_CHECK([ | |
581 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
582 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
583 | ], [0], [ignore]) | |
584 | ||
585 | ovs-appctl time/warp 1000 | |
586 | ||
587 | AT_CHECK([ | |
588 | ovs-appctl dpctl/dump-flows | strip_used | grep -v ipv6 | sort | |
138d30a9 | 589 | ], [0], [flow-dump from the main thread: |
d03d0cf2 ZB |
590 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:drop |
591 | ]) | |
592 | ||
593 | # Encap(ethernet) on VLAN tagged Ethernet frame -> should be droped | |
594 | AT_CHECK([ | |
595 | ovs-ofctl del-flows br0 | |
596 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=1,actions=push_vlan:0x8100,mod_vlan_vid:100,encap(ethernet),3" | |
597 | ovs-ofctl add-flow br0 -OOpenFlow13 "in_port=4,actions=2" | |
598 | ]) | |
599 | ||
600 | ovs-appctl time/warp 11000 | |
601 | ||
602 | AT_CHECK([ | |
603 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
604 | ovs-appctl netdev-dummy/receive n1 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
605 | ], [0], [ignore]) | |
606 | ||
607 | ovs-appctl time/warp 1000 | |
608 | ||
609 | AT_CHECK([ | |
610 | ovs-appctl dpctl/dump-flows | strip_used | grep -v ipv6 | sort | |
138d30a9 | 611 | ], [0], [flow-dump from the main thread: |
d03d0cf2 ZB |
612 | recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:drop |
613 | ]) | |
614 | ||
615 | OVS_VSWITCHD_STOP | |
616 | AT_CLEANUP | |
617 | ||
618 | ||
619 | AT_SETUP([ptap - L3 over patch port]) | |
620 | ||
621 | ######################## | |
622 | # L3 over patch port | |
623 | # | |
624 | # (192.168.10.10) (192.168.10.30) | |
625 | # n0 n1 | |
626 | # | | | |
627 | # +--o------+ +--o------+ | |
628 | # | br0 | | br1 | | |
629 | # +------o--+ +--o---o--+ | |
630 | # p0 | p1 | gre1 (ptap) | |
631 | # +---------------+ 10.0.0.1 | |
632 | # | |
633 | # LOCAL | |
634 | # +------o--+ | |
635 | # | br2 | | |
636 | # +------o--+ | |
637 | # | | |
638 | # n2 | |
639 | # 10.0.0.2 | |
640 | ||
641 | HWADDR_BRP2=aa:55:00:00:00:02 | |
642 | ||
643 | OVS_VSWITCHD_START([dnl | |
644 | -- add-br br1 \ | |
645 | -- set bridge br1 datapath_type=dummy fail-mode=secure \ | |
646 | -- add-br br2 \ | |
647 | -- set bridge br2 datapath_type=dummy fail-mode=secure \ | |
648 | other_config:hwaddr=\"$HWADDR_BRP2\" \ | |
649 | -- add-port br0 p0 \ | |
650 | -- set interface p0 type=patch options:peer=p1 ofport_request=10 \ | |
651 | -- add-port br1 p1 \ | |
652 | -- set interface p1 type=patch options:peer=p0 ofport_request=20 \ | |
653 | -- add-port br0 n0 \ | |
654 | -- set interface n0 type=dummy ofport_request=30 \ | |
655 | -- add-port br1 n1 \ | |
656 | -- set interface n1 type=dummy options:tx_pcap=n1.pcap ofport_request=40 \ | |
657 | -- add-port br2 n2 \ | |
658 | -- set interface n2 type=dummy options:tx_pcap=n2.pcap ofport_request=50 \ | |
659 | -- add-port br1 gre1 \ | |
660 | -- set interface gre1 type=gre options:remote_ip=10.0.0.2 \ | |
661 | options:packet_type=ptap ofport_request=100 | |
662 | ]) | |
663 | ||
664 | ### Verify datapath configuration | |
665 | AT_CHECK([ | |
7be29a47 | 666 | ovs-appctl dpif/show | grep -v hit | sed 's./[[0-9]]\{1,\}..' |
d03d0cf2 | 667 | ], [0], [dnl |
7be29a47 BP |
668 | br0: |
669 | br0 65534: (dummy-internal) | |
670 | n0 30: (dummy) | |
671 | p0 10/none: (patch: peer=p1) | |
672 | br1: | |
673 | br1 65534: (dummy-internal) | |
674 | gre1 100: (gre: packet_type=ptap, remote_ip=10.0.0.2) | |
675 | n1 40: (dummy) | |
676 | p1 20/none: (patch: peer=p0) | |
677 | br2: | |
678 | br2 65534: (dummy-internal) | |
679 | n2 50: (dummy) | |
d03d0cf2 ZB |
680 | ]) |
681 | ||
682 | AT_CHECK([ | |
683 | ovs-appctl netdev-dummy/ip4addr br2 10.0.0.1/24 && | |
684 | ovs-appctl ovs/route/add 10.0.0.0/24 br2 && | |
685 | ovs-appctl tnl/arp/set br2 10.0.0.2 de:af:be:ef:ba:be | |
686 | ], [0], [ignore]) | |
687 | ||
688 | AT_CHECK([ | |
689 | ovs-appctl ovs/route/show | grep User: | |
690 | ], [0], [dnl | |
691 | User: 10.0.0.0/24 dev br2 SRC 10.0.0.1 | |
692 | ]) | |
693 | ||
694 | ||
695 | AT_CHECK([ | |
696 | ovs-ofctl del-flows br0 && | |
697 | ovs-ofctl del-flows br1 && | |
698 | ovs-ofctl del-flows br2 && | |
699 | ovs-ofctl add-flow br0 in_port=n0,actions=decap,output=p0 -OOpenFlow13 && | |
dc0bd12f | 700 | ovs-ofctl add-flow br1 in_port=p1,actions=NORMAL && |
d03d0cf2 ZB |
701 | ovs-ofctl add-flow br2 in_port=LOCAL,actions=output=n2 |
702 | ], [0]) | |
703 | ||
704 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | grep actions], | |
705 | [0], [dnl | |
706 | in_port=30 actions=decap(),output:10 | |
707 | ]) | |
708 | ||
709 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br1 | ofctl_strip | grep actions], | |
710 | [0], [dnl | |
dc0bd12f | 711 | reset_counts in_port=20 actions=NORMAL |
d03d0cf2 ZB |
712 | ]) |
713 | ||
714 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br2 | ofctl_strip | grep actions], | |
715 | [0], [dnl | |
716 | reset_counts in_port=LOCAL actions=output:50 | |
717 | ]) | |
718 | ||
719 | AT_CHECK([ | |
720 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
721 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
722 | ], [0], [ignore]) | |
723 | ||
724 | ovs-appctl time/warp 1000 | |
725 | ||
726 | AT_CHECK([ | |
727 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 728 | ], [0], [flow-dump from the main thread: |
dc0bd12f | 729 | recirc_id(0),in_port(n0),packet_type(ns=0,id=0),eth(src=3a:6d:d2:09:9c:ab,dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=de:af:be:ef:ba:be,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br2)),n2) |
d03d0cf2 ZB |
730 | ]) |
731 | ||
732 | AT_CHECK([ | |
733 | ovs-pcap n2.pcap | |
734 | ], [0], [dnl | |
735 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
736 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
737 | ]) | |
738 | ||
739 | ||
740 | dnl output L3 to ports with different packet_type properties | |
741 | ovs-appctl time/warp 11000 | |
742 | ||
743 | ## L3 packet over L2 legacy port | |
744 | ||
745 | AT_CHECK([ | |
746 | ovs-ofctl del-flows br0 && | |
747 | ovs-ofctl del-flows br1 && | |
748 | ovs-ofctl del-flows br2 && | |
749 | ovs-ofctl add-flow br0 -OOpenFlow13 in_port=n0,actions=decap,output=p0 && | |
750 | ovs-ofctl add-flow br1 in_port=p1,actions=output=n1 | |
751 | ], [0]) | |
752 | ||
753 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
754 | [0], [dnl | |
755 | in_port=30 actions=decap(),output:10 | |
756 | ]) | |
757 | ||
758 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br1 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
759 | [0], [dnl | |
760 | in_port=20 actions=output:40 | |
761 | ]) | |
762 | ||
763 | AT_CHECK([ | |
764 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
765 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
766 | ], [0], [ignore]) | |
767 | ||
768 | ovs-appctl time/warp 1000 | |
769 | ||
770 | AT_CHECK([ | |
771 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 772 | ], [0], [flow-dump from the main thread: |
d03d0cf2 ZB |
773 | recirc_id(0),in_port(n0),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:1, bytes:98, used:0.0s, actions:drop |
774 | ]) | |
775 | ||
776 | AT_CHECK([ | |
777 | ovs-pcap n1.pcap | |
778 | ], [0], [dnl | |
779 | ]) | |
780 | ||
781 | ## L3 packet over ptap and L2 legacy port | |
782 | ||
783 | AT_CHECK([ | |
784 | ovs-ofctl del-flows br0 && | |
785 | ovs-ofctl del-flows br1 && | |
786 | ovs-ofctl del-flows br2 && | |
787 | ovs-ofctl add-flow br0 in_port=n0,actions=decap,output=p0 -OOpenFlow13 && | |
788 | ovs-ofctl add-flow br1 in_port=p1,actions=output=n1,gre1 && | |
789 | ovs-ofctl add-flow br2 in_port=LOCAL,actions=output=n2 | |
790 | ], [0]) | |
791 | ||
792 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br0 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
793 | [0], [dnl | |
794 | in_port=30 actions=decap(),output:10 | |
795 | ]) | |
796 | ||
797 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br1 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
798 | [0], [dnl | |
799 | in_port=20 actions=output:40,output:100 | |
800 | ]) | |
801 | ||
802 | AT_CHECK([ovs-ofctl -OOpenFlow13 dump-flows br2 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
803 | [0], [dnl | |
804 | in_port=LOCAL actions=output:50 | |
805 | ]) | |
806 | ||
807 | AT_CHECK([ | |
808 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
809 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
810 | ], [0], [ignore]) | |
811 | ||
812 | ovs-appctl time/warp 1000 | |
813 | ||
814 | AT_CHECK([ | |
815 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 816 | ], [0], [flow-dump from the main thread: |
d03d0cf2 ZB |
817 | recirc_id(0),in_port(n0),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:pop_eth,clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=de:af:be:ef:ba:be,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br2)),n2) |
818 | ]) | |
819 | ||
820 | AT_CHECK([ | |
821 | ovs-pcap n1.pcap | |
822 | ], [0], [dnl | |
823 | ]) | |
824 | ||
825 | AT_CHECK([ | |
826 | ovs-pcap n2.pcap | |
827 | ], [0], [dnl | |
828 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
829 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
830 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
831 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
832 | ]) | |
833 | ||
834 | ||
835 | ## L2 packet over L3 legacy port and L2 legacy port | |
836 | ovs-appctl time/warp 11000 | |
837 | ||
838 | AT_CHECK([ | |
839 | ovs-vsctl set interface gre1 type=gre options:remote_ip=10.0.0.2 \ | |
840 | options:packet_type=legacy_l3 ofport_request=100 | |
841 | ], [0]) | |
842 | ||
843 | ### Verify datapath configuration | |
844 | AT_CHECK([ | |
7be29a47 | 845 | ovs-appctl dpif/show | grep -v hit | sed 's./[[0-9]]\{1,\}..' |
d03d0cf2 | 846 | ], [0], [dnl |
7be29a47 BP |
847 | br0: |
848 | br0 65534: (dummy-internal) | |
849 | n0 30: (dummy) | |
850 | p0 10/none: (patch: peer=p1) | |
851 | br1: | |
852 | br1 65534: (dummy-internal) | |
853 | gre1 100: (gre: packet_type=legacy_l3, remote_ip=10.0.0.2) | |
854 | n1 40: (dummy) | |
855 | p1 20/none: (patch: peer=p0) | |
856 | br2: | |
857 | br2 65534: (dummy-internal) | |
858 | n2 50: (dummy) | |
d03d0cf2 ZB |
859 | ]) |
860 | ||
861 | AT_CHECK([ | |
862 | ovs-ofctl del-flows br0 && | |
863 | ovs-ofctl del-flows br1 && | |
864 | ovs-ofctl del-flows br2 && | |
865 | ovs-ofctl add-flow br0 in_port=n0,actions=output=p0 && | |
866 | ovs-ofctl add-flow br1 in_port=p1,actions=output=n1,gre1 && | |
867 | ovs-ofctl add-flow br2 in_port=LOCAL,actions=output=n2 | |
868 | ], [0]) | |
869 | ||
870 | AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
871 | [0], [dnl | |
872 | in_port=30 actions=output:10 | |
873 | ]) | |
874 | ||
875 | AT_CHECK([ovs-ofctl dump-flows br1 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
876 | [0], [dnl | |
877 | in_port=20 actions=output:40,output:100 | |
878 | ]) | |
879 | ||
880 | AT_CHECK([ovs-ofctl dump-flows br2 | ofctl_strip | grep actions | sed 's/reset_counts //'], | |
881 | [0], [dnl | |
882 | in_port=LOCAL actions=output:50 | |
883 | ]) | |
884 | ||
885 | AT_CHECK([ | |
886 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
887 | ovs-appctl netdev-dummy/receive n0 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
888 | ], [0], [ignore]) | |
889 | ||
890 | ovs-appctl time/warp 1000 | |
891 | ||
892 | AT_CHECK([ | |
893 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 894 | ], [0], [flow-dump from the main thread: |
dc0bd12f | 895 | recirc_id(0),in_port(n0),packet_type(ns=0,id=0),eth(dst=1e:2c:e9:2a:66:9e),eth_type(0x0800),ipv4(tos=0/0x3,frag=no), packets:1, bytes:98, used:0.0s, actions:n1,pop_eth,clone(tnl_push(tnl_port(gre_sys),header(size=38,type=3,eth(dst=de:af:be:ef:ba:be,src=aa:55:00:00:00:02,dl_type=0x0800),ipv4(src=10.0.0.1,dst=10.0.0.2,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x0,proto=0x800))),out_port(br2)),n2) |
d03d0cf2 ZB |
896 | ]) |
897 | ||
898 | AT_CHECK([ | |
899 | ovs-pcap n1.pcap | |
900 | ], [0], [dnl | |
901 | 1e2ce92a669e3a6dd2099cab0800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
902 | 1e2ce92a669e3a6dd2099cab0800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
903 | ]) | |
904 | ||
905 | AT_CHECK([ | |
906 | ovs-pcap n2.pcap | |
907 | ], [0], [dnl | |
908 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
909 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
910 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
911 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
912 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a53400040011addc0a80a0ac0a80a1e08006f200a4d0001fc509a58000000002715020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
913 | deafbeefbabeaa550000000208004500006c00004000402f26610a0000010a00000200000800450000548a83400040011aadc0a80a0ac0a80a1e0800b7170a4d0002fd509a5800000000de1c020000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
914 | ]) | |
915 | ||
916 | OVS_VSWITCHD_STOP | |
917 | AT_CLEANUP | |
00135b86 ZB |
918 | |
919 | ||
920 | AT_SETUP([ptap - recirculate after packet_type change]) | |
921 | ||
922 | ######################## | |
923 | # --<--+ | |
924 | # LOCAL | | |
925 | # +--o------+ | |
926 | # | int-br | | |
927 | # +------o--+ | |
928 | # L3 tunnel (remote : 20.0.0.2/24) | |
929 | # +--o------+ | |
930 | # | br0 | <- 20.0.0.1/24 | |
931 | # +------o--+ | |
932 | # p0 | | |
933 | # +--<-- | |
934 | ||
935 | OVS_VSWITCHD_START([dnl | |
936 | -- set bridge br0 other-config:hwaddr=aa:bb:cc:00:00:01 \ | |
937 | -- add-port br0 p0 \ | |
938 | -- set interface p0 type=dummy other_config:hwaddr=aa:bb:cc:00:00:01 ofport_request=1 \ | |
939 | -- add-br int-br -- set bridge int-br datapath_type=dummy \ | |
940 | -- add-port int-br tunnel \ | |
941 | -- set interface tunnel type=gre options:packet_type=legacy_l3 options:remote_ip=20.0.0.2 ofport_request=2 | |
942 | ]) | |
943 | ||
944 | ### Verify datapath configuration | |
945 | AT_CHECK([ | |
7be29a47 | 946 | ovs-appctl dpif/show | grep -v hit | sed 's./[[0-9]]\{1,\}..' |
00135b86 | 947 | ], [0], [dnl |
7be29a47 BP |
948 | br0: |
949 | br0 65534: (dummy-internal) | |
950 | p0 1: (dummy) | |
951 | int-br: | |
952 | int-br 65534: (dummy-internal) | |
953 | tunnel 2: (gre: packet_type=legacy_l3, remote_ip=20.0.0.2) | |
00135b86 ZB |
954 | ]) |
955 | ||
956 | AT_CHECK([ | |
957 | ovs-appctl netdev-dummy/ip4addr br0 20.0.0.1/24 && | |
958 | ovs-appctl ovs/route/add 20.0.0.2/24 br0 && | |
959 | ovs-appctl tnl/neigh/set br0 20.0.0.1 aa:bb:cc:00:00:01 && | |
960 | ovs-appctl tnl/neigh/set br0 20.0.0.2 aa:bb:cc:00:00:02 | |
961 | ], [0], [ignore]) | |
962 | ||
963 | ovs-appctl time/warp 1000 | |
964 | ||
965 | AT_CHECK([ | |
966 | ovs-appctl ovs/route/show | grep User | |
967 | ],[0], [dnl | |
968 | User: 20.0.0.0/24 dev br0 SRC 20.0.0.1 | |
969 | ]) | |
970 | ||
971 | AT_CHECK([ | |
972 | ovs-appctl tnl/neigh/show | grep br | tr -s ' ' | sort | |
973 | ],[0], [dnl | |
974 | 20.0.0.1 aa:bb:cc:00:00:01 br0 | |
975 | 20.0.0.2 aa:bb:cc:00:00:02 br0 | |
976 | ]) | |
977 | ||
978 | # Goto_table after pop_mpls triggers recirculation. | |
979 | AT_CHECK([ | |
980 | ovs-ofctl del-flows br0 && | |
981 | ovs-ofctl del-flows int-br && | |
982 | ovs-ofctl add-flow br0 "actions=normal" | |
983 | ovs-ofctl add-flow int-br "table=0,in_port=tunnel,actions=pop_mpls:0x800,goto_table:20" && | |
984 | ovs-ofctl add-flow int-br "table=20,actions=dec_ttl,output:LOCAL" | |
985 | ], [0], [ignore]) | |
986 | ||
987 | ovs-appctl time/warp 1000 | |
988 | ||
989 | AT_CHECK([ | |
990 | ovs-ofctl dump-flows br0 -OOpenFlow13 | ofctl_strip | grep actions | sed 's/reset_counts //' | |
991 | ], [0], [dnl | |
992 | actions=NORMAL | |
993 | ]) | |
994 | ||
995 | AT_CHECK([ | |
996 | ovs-ofctl dump-flows int-br -OOpenFlow13 | ofctl_strip | grep actions | sed 's/reset_counts //' | |
997 | ], [0], [dnl | |
998 | in_port=2 actions=pop_mpls:0x0800,resubmit(,20) | |
999 | table=20, actions=dec_ttl,LOCAL | |
1000 | ]) | |
1001 | ||
1002 | # Receive MPLS over L3 GRE packet in underlay bridge. | |
1003 | AT_CHECK([ | |
1004 | ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
1005 | ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
1006 | ], [0], [ignore]) | |
1007 | ||
1008 | ovs-appctl time/warp 1000 | |
1009 | ||
1010 | AT_CHECK([ | |
1011 | ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
1012 | ovs-appctl netdev-dummy/receive p0 aabbcc000001aabbcc00000208004500007000004000402f125d140000021400000100008847003e71404500005470f5400040013445c0a80a14c0a80a0a08004e1adbfc0001566b575a00000000604f010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637 | |
1013 | ], [0], [ignore]) | |
1014 | ||
1015 | ovs-appctl time/warp 1000 | |
1016 | ||
1017 | # After packet has been received on L3 port in overlay bridge, its packet_type changes to Ethernet. | |
1018 | # Resubmit after pop_mpls recirculates the L2 packet. | |
1019 | AT_CHECK([ | |
1020 | ovs-appctl dpctl/dump-flows --names dummy@ovs-dummy | strip_used | grep -v ipv6 | sort | |
138d30a9 | 1021 | ], [0], [flow-dump from the main thread: |
00135b86 | 1022 | recirc_id(0),in_port(p0),packet_type(ns=0,id=0),eth(src=aa:bb:cc:00:00:02,dst=aa:bb:cc:00:00:01),eth_type(0x0800),ipv4(dst=20.0.0.1,proto=47,frag=no), packets:3, bytes:378, used:0.0s, actions:tnl_pop(gre_sys) |
29b5c0c3 | 1023 | tunnel(src=20.0.0.2,dst=20.0.0.1,flags(-df-csum)),recirc_id(0),in_port(gre_sys),packet_type(ns=1,id=0x8847),eth_type(0x8847),mpls(label=999/0x0,tc=0/0,ttl=64/0x0,bos=1/1), packets:3, bytes:264, used:0.0s, actions:push_eth(src=00:00:00:00:00:00,dst=00:00:00:00:00:00),pop_mpls(eth_type=0x800),recirc(0x1) |
00135b86 ZB |
1024 | tunnel(src=20.0.0.2,dst=20.0.0.1,flags(-df-csum)),recirc_id(0x1),in_port(gre_sys),packet_type(ns=0,id=0),eth(dst=00:00:00:00:00:00),eth_type(0x0800),ipv4(ttl=64,frag=no), packets:3, bytes:294, used:0.0s, actions:set(ipv4(ttl=63)),int-br |
1025 | ]) | |
1026 | ||
1027 | ovs-appctl time/warp 1000 | |
1028 | ||
1029 | AT_CHECK([ | |
aac61d07 BN |
1030 | ovs-ofctl dump-ports int-br LOCAL |
1031 | ovs-ofctl dump-ports int-br 2 | |
1032 | ], [0], [OFPST_PORT reply (xid=0x2): 1 ports | |
00135b86 ZB |
1033 | port LOCAL: rx pkts=0, bytes=0, drop=?, errs=?, frame=?, over=?, crc=? |
1034 | tx pkts=4, bytes=392, drop=?, errs=?, coll=? | |
aac61d07 | 1035 | OFPST_PORT reply (xid=0x2): 1 ports |
00135b86 ZB |
1036 | port 2: rx pkts=4, bytes=352, drop=?, errs=?, frame=?, over=?, crc=? |
1037 | tx pkts=0, bytes=0, drop=?, errs=?, coll=? | |
1038 | ]) | |
1039 | ||
1040 | OVS_VSWITCHD_STOP | |
1041 | AT_CLEANUP |