3 AT_SETUP([tunnel - input])
4 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
5 options:remote_ip=1.1.1.1 ofport_request=1\
6 -- add-port br0 p2 -- set Interface p2 type=gre \
7 options:local_ip=2.2.2.2 options:remote_ip=1.1.1.1 \
9 -- add-port br0 p3 -- set Interface p3 type=gre \
10 options:remote_ip=2.2.2.2 ofport_request=3])
11 AT_DATA([flows.txt], [dnl
14 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
16 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
18 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
19 br0 65534/100: (dummy)
20 p1 1/1: (gre: remote_ip=1.1.1.1)
21 p2 2/1: (gre: local_ip=2.2.2.2, remote_ip=1.1.1.1)
22 p3 3/1: (gre: remote_ip=2.2.2.2)
26 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=1.2.3.4,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
27 AT_CHECK([tail -1 stdout], [0],
28 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
31 dnl local_ip, remote_ip
32 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
33 AT_CHECK([tail -1 stdout], [0],
34 [Datapath actions: set(tunnel(src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df))),1
37 dnl reconfigure, local_ip, remote_ip
38 AT_CHECK([ovs-vsctl set Interface p2 type=gre options:local_ip=2.2.2.3 \
39 options:df_default=false options:ttl=1 options:csum=true \
40 -- set Interface p3 type=vxlan])
41 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
42 br0 65534/100: (dummy)
43 p1 1/1: (gre: remote_ip=1.1.1.1)
44 p2 2/1: (gre: csum=true, df_default=false, local_ip=2.2.2.3, remote_ip=1.1.1.1, ttl=1)
45 p3 3/4789: (vxlan: remote_ip=2.2.2.2)
47 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
48 AT_CHECK([tail -1 stdout], [0],
49 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
51 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.3,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
52 AT_CHECK([tail -1 stdout], [0],
53 [Datapath actions: set(tunnel(src=2.2.2.3,dst=1.1.1.1,ttl=1,flags(csum))),1
56 dnl nonexistent tunnel
57 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=5.5.5.5,dst=6.6.6.6,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [2], [ignore], [dnl
59 ovs-appctl: ovs-vswitchd: server returned an error
62 OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
65 AT_SETUP([tunnel - ECN decapsulation])
66 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
67 options:remote_ip=1.1.1.1 ofport_request=1 \
68 -- add-port br0 p2 -- set Interface p2 type=dummy \
70 AT_DATA([flows.txt], [dnl
74 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
76 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
77 br0 65534/100: (dummy)
78 p1 1/1: (gre: remote_ip=1.1.1.1)
82 dnl Tunnel CE and encapsulated packet CE
83 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=3,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
84 AT_CHECK([tail -2 stdout], [0],
85 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_flags=-df-csum-key,in_port=1,nw_ecn=3,nw_frag=no
89 dnl Tunnel CE and encapsulated packet ECT(1)
90 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=1,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
91 AT_CHECK([tail -2 stdout], [0],
92 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_flags=-df-csum-key,in_port=1,nw_ecn=1,nw_frag=no
93 Datapath actions: set(ipv4(tos=0x3/0x3)),2
96 dnl Tunnel CE and encapsulated packet ECT(2)
97 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=2,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
98 AT_CHECK([tail -2 stdout], [0],
99 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_flags=-df-csum-key,in_port=1,nw_ecn=2,nw_frag=no
100 Datapath actions: set(ipv4(tos=0x3/0x3)),2
103 dnl Tunnel CE and encapsulated packet Non-ECT
104 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
105 AT_CHECK([tail -2 stdout], [0],
106 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_flags=-df-csum-key,in_port=1,nw_ecn=0,nw_frag=no
107 Datapath actions: drop
109 OVS_VSWITCHD_STOP(["/dropping tunnel packet marked ECN CE but is not ECN capable/d"])
112 AT_SETUP([tunnel - output])
113 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
114 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
115 options:key=5 ofport_request=1\
116 -- add-port br0 p2 -- set Interface p2 type=dummy \
118 AT_DATA([flows.txt], [dnl
122 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
123 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
125 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
126 br0 65534/100: (dummy)
127 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
132 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
133 AT_CHECK([tail -1 stdout], [0],
134 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),1
138 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=1,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
139 AT_CHECK([tail -1 stdout], [0],
140 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,flags(df|key))),1
145 AT_SETUP([tunnel - unencrypted tunnel and not setting skb_mark])
146 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
147 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
148 options:key=5 ofport_request=1\
149 -- add-port br0 p2 -- set Interface p2 type=dummy \
150 ofport_request=2 ofport_request=2])
151 AT_DATA([flows.txt], [dnl
154 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
155 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
156 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
157 AT_CHECK([tail -1 stdout], [0],
158 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),1
163 AT_SETUP([tunnel - unencrypted tunnel and setting skb_mark to 1])
164 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
165 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
166 options:key=5 ofport_request=1\
167 -- add-port br0 p2 -- set Interface p2 type=dummy \
168 ofport_request=2 ofport_request=2])
169 AT_DATA([flows.txt], [dnl
170 actions=load:0x1->NXM_NX_PKT_MARK[[]],output:1
172 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
173 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
174 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
175 AT_CHECK([tail -1 stdout], [0],
176 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),set(skb_mark(0x1)),1
181 AT_SETUP([tunnel - unencrypted tunnel and setting skb_mark to 2])
182 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
183 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
184 options:key=5 ofport_request=1\
185 -- add-port br0 p2 -- set Interface p2 type=dummy \
186 ofport_request=2 ofport_request=2])
187 AT_DATA([flows.txt], [dnl
188 actions=load:0x2->NXM_NX_PKT_MARK[[]],output:1
190 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
191 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
192 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
193 AT_CHECK([tail -1 stdout], [0],
194 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),set(skb_mark(0x2)),1
199 AT_SETUP([tunnel - encrypted tunnel and not setting skb_mark])
200 AT_SKIP_IF([test $HAVE_PYTHON = no])
201 AT_SKIP_IF([$non_ascii_cwd])
202 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
203 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
204 options:key=5 ofport_request=1\
205 -- add-port br0 p2 -- set Interface p2 type=dummy \
206 ofport_request=2 ofport_request=2])
207 AT_DATA([flows.txt], [dnl
210 OVS_MONITOR_IPSEC_START
211 AT_CHECK([ovs-vsctl set interface p1 type=ipsec_gre options:psk=1234567890])
212 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
213 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
214 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
215 AT_CHECK([tail -1 stdout], [0],
216 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),set(skb_mark(0x1/0x1)),1
221 AT_SETUP([tunnel - encrypted tunnel and setting skb_mark to 1])
222 AT_SKIP_IF([test $HAVE_PYTHON = no])
223 AT_SKIP_IF([$non_ascii_cwd])
224 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
225 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
226 options:key=5 ofport_request=1\
227 -- add-port br0 p2 -- set Interface p2 type=dummy \
228 ofport_request=2 ofport_request=2])
229 AT_DATA([flows.txt], [dnl
230 actions=load:0x1->NXM_NX_PKT_MARK[[]],output:1
232 OVS_MONITOR_IPSEC_START
233 AT_CHECK([ovs-vsctl set interface p1 type=ipsec_gre options:psk=1234567890])
234 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
235 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
236 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
237 AT_CHECK([tail -1 stdout], [0],
238 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),set(skb_mark(0x1)),1
243 AT_SETUP([tunnel - encrypted tunnel and setting skb_mark to 2])
244 AT_SKIP_IF([test $HAVE_PYTHON = no])
245 AT_SKIP_IF([$non_ascii_cwd])
246 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
247 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
248 options:key=5 ofport_request=1\
249 -- add-port br0 p2 -- set Interface p2 type=dummy \
250 ofport_request=2 ofport_request=2])
251 AT_DATA([flows.txt], [dnl
252 actions=load:0x2->NXM_NX_PKT_MARK[[]],output:1
254 OVS_MONITOR_IPSEC_START
255 AT_CHECK([ovs-vsctl set interface p1 type=ipsec_gre options:psk=1234567890])
256 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
257 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
258 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
259 AT_CHECK([tail -1 stdout], [0],
260 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),set(skb_mark(0x3)),1
265 AT_SETUP([tunnel - ToS and TTL inheritance])
266 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
267 options:remote_ip=1.1.1.1 options:tos=inherit \
268 options:ttl=inherit ofport_request=1 \
269 -- add-port br0 p2 -- set Interface p2 type=dummy \
270 ofport_request=2 ofport_request=2])
271 AT_DATA([flows.txt], [dnl
275 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
276 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
278 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
279 br0 65534/100: (dummy)
280 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
285 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=4,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
286 AT_CHECK([tail -1 stdout], [0],
287 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
291 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=5,ttl=128,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
292 AT_CHECK([tail -1 stdout], [0],
293 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
297 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0806),arp(sip=1.2.3.4,tip=5.6.7.8,op=1,sha=00:0f:10:11:12:13,tha=00:14:15:16:17:18)'], [0], [stdout])
298 AT_CHECK([tail -1 stdout], [0],
299 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
304 AT_SETUP([tunnel - set_tunnel])
305 OVS_VSWITCHD_START([dnl
306 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
307 options:remote_ip=1.1.1.1 ofport_request=1 \
308 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
309 options:remote_ip=2.2.2.2 ofport_request=2 \
310 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
311 options:remote_ip=3.3.3.3 ofport_request=3 \
312 -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
313 options:remote_ip=4.4.4.4 ofport_request=4])
314 AT_DATA([flows.txt], [dnl
315 actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
318 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
319 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
321 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
322 br0 65534/100: (dummy)
323 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
324 p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
325 p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
326 p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
329 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(100),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
330 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
331 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
332 set(tunnel(tun_id=0x2,dst=2.2.2.2,ttl=64,flags(df|key))),1,dnl
333 set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,dnl
334 set(tunnel(tun_id=0x5,dst=4.4.4.4,ttl=64,flags(df|key))),1
339 AT_SETUP([tunnel - key])
340 OVS_VSWITCHD_START([dnl
341 add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
342 options:remote_ip=1.1.1.1 ofport_request=1 \
343 -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
344 options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
345 -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
346 options:remote_ip=1.1.1.1 ofport_request=3])
347 AT_DATA([flows.txt], [dnl
348 actions=IN_PORT,output:1,output:2,output:3
351 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
352 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
354 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
355 br0 65534/100: (dummy)
356 p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
357 p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
358 p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
361 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x1,src=1.1.1.1,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
362 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
363 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
364 set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
365 set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
368 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x2,src=1.1.1.1,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
369 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
370 set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
371 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
372 set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
375 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(src=1.1.1.1,dst=2.2.2.2,ttl=64,flags()),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
376 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
377 set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
378 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
379 set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1
382 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0xf,src=1.1.1.1,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [2], [ignore], [dnl
383 Invalid datapath flow
384 ovs-appctl: ovs-vswitchd: server returned an error
386 OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
389 AT_SETUP([tunnel - key match])
390 OVS_VSWITCHD_START([dnl
391 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
392 options:remote_ip=1.1.1.1 ofport_request=1 \
393 -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
394 options:remote_ip=3.3.3.3 ofport_request=2 \
395 -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
396 -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
397 -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
398 AT_DATA([flows.txt], [dnl
399 tun_id=2,actions=output:3
400 tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
401 tun_id=4,actions=output:5
404 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
405 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
407 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
408 br0 65534/100: (dummy)
409 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
410 p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
416 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x2,src=1.1.1.1,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
417 AT_CHECK([tail -1 stdout], [0], [dnl
421 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x3,src=1.1.1.1,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
422 AT_CHECK([tail -1 stdout], [0], [dnl
423 Datapath actions: 4,3,set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,5
426 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x3,src=3.3.3.3,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
427 AT_CHECK([tail -1 stdout], [0], [dnl
428 Datapath actions: 4,3,5
431 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,ttl=64,flags(key)),in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
432 AT_CHECK([tail -1 stdout], [0], [dnl
433 Datapath actions: drop
439 AT_SETUP([tunnel - Geneve])
440 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
441 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=5000])
443 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
444 br0 65534/100: (dummy)
445 p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
451 AT_SETUP([tunnel - VXLAN])
452 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
453 options:remote_ip=1.1.1.1 ofport_request=1])
455 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
456 br0 65534/100: (dummy)
457 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
463 AT_SETUP([tunnel - LISP])
464 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
465 options:remote_ip=1.1.1.1 ofport_request=1])
467 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
468 br0 65534/100: (dummy)
469 p1 1/4341: (lisp: remote_ip=1.1.1.1)
475 AT_SETUP([tunnel - different VXLAN UDP port])
476 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
477 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
479 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
480 br0 65534/100: (dummy)
481 p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
486 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
488 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
489 br0 65534/100: (dummy)
490 p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
493 dnl change UDP port to default
495 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
497 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
498 br0 65534/100: (dummy)
499 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
504 AT_SETUP([ofproto-dpif - set_field - tun_src/tun_dst/tun_id])
505 OVS_VSWITCHD_START([dnl
506 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
507 options:remote_ip=1.1.1.1 ofport_request=1 \
508 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
509 options:remote_ip=flow ofport_request=2 \
510 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
511 options:remote_ip=flow options:local_ip=flow ofport_request=3 \
512 -- add-port br0 p4 -- set Interface p4 type=gre options:key=3 \
513 options:remote_ip=flow ofport_request=4 \
514 -- add-port br0 p5 -- set Interface p5 type=gre options:key=flow \
515 options:remote_ip=5.5.5.5 ofport_request=5])
517 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
519 AT_DATA([flows.txt], [dnl
520 in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
521 in_port=1 actions=set_field:42->tun_id,output:1
522 in_port=2 actions=set_field:3.3.3.3->tun_dst,output:2
523 in_port=3 actions=set_field:1.1.1.1->tun_src,set_field:4.4.4.4->tun_dst,output:3
524 in_port=4 actions=set_field:2.2.2.2->tun_dst,output:4
525 in_port=5 actions=set_field:5->tun_id
527 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
528 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(90),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
529 AT_CHECK([tail -1 stdout], [0],
530 [Datapath actions: set(tunnel(tun_id=0x2a,dst=1.1.1.1,ttl=64,flags(df|key))),1,set(tunnel(tun_id=0x2a,dst=3.3.3.3,ttl=64,flags(df|key))),1,set(tunnel(tun_id=0x2a,src=1.1.1.1,dst=4.4.4.4,ttl=64,flags(df|key))),1,set(tunnel(tun_id=0x3,dst=2.2.2.2,ttl=64,flags(df|key))),1
535 AT_SETUP([tunnel - Geneve metadata])
536 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
537 options:remote_ip=1.1.1.1 ofport_request=1 \
538 -- add-port br0 p2 -- set Interface p2 type=dummy \
539 ofport_request=2 ofport_request=2])
540 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
542 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0,{class=0xffff,type=1,len=8}->tun_metadata1"])
544 AT_DATA([flows.txt], [dnl
545 in_port=2,actions=set_field:0xa->tun_metadata0,set_field:0x1234567890abcdef->tun_metadata1,1
546 tun_metadata0=0xb/0xf,actions=2
548 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
550 dnl Option generation
551 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
552 AT_CHECK([tail -1 stdout], [0],
553 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,geneve({class=0xffff,type=0,len=4,0xa}{class=0xffff,type=0x1,len=8,0x1234567890abcdef}),flags(df))),6081
557 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x0,src=1.1.1.1,dst=1.1.1.2,ttl=64,geneve({class=0xffff,type=0,len=4,0xb}),flags(df|key)),in_port(6081),skb_mark(0),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
558 AT_CHECK([tail -2 stdout], [0],
559 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=+df-csum+key,tun_metadata0=0xb/0xf,in_port=1,nw_frag=no
563 dnl Skip unknown option
564 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x0,src=1.1.1.1,dst=1.1.1.2,ttl=64,geneve({class=0xffff,type=0,len=4,0xb}{class=0xffff,type=2,len=4,0xc}),flags(df|key)),in_port(6081),skb_mark(0),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
565 AT_CHECK([tail -2 stdout], [0],
566 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=+df-csum+key,tun_metadata0=0xb/0xf,in_port=1,nw_frag=no
570 dnl Check mapping table constraints
571 AT_CHECK([ovs-ofctl del-flows br0])
572 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=124}->tun_metadata2,{class=0xffff,type=3,len=124}->tun_metadata3"], [1], [ignore],
573 [OFPT_ERROR (xid=0x4): NXTTMFC_TABLE_FULL
574 NXT_TLV_TABLE_MOD (xid=0x4):
576 class type length match field
577 ----- ---- ------ -----------
578 0xffff 0x2 124 tun_metadata2
579 0xffff 0x3 124 tun_metadata3
582 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0,tun_metadata0,actions=drop"], [1], [ignore],
583 [ovs-ofctl: field tun_metadata0 set multiple times
586 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef,tun_metadata1=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef,tun_metadata2=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef,tun_metadata3=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef,tun_metadata4=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef,actions=drop"], [1], [ignore],
587 [ovs-ofctl: field tun_metadata4 exceeds maximum size for tunnel metadata (used 320, max 256)
590 dnl Allocation and match with fragmented address space
591 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=124}->tun_metadata2"])
592 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
593 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=4,len=112}->tun_metadata4"])
594 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
595 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=8}->tun_metadata3"])
597 AT_CHECK([ovs-ofctl add-flow br0 tun_metadata3=0x1234567890abcdef,actions=2])
598 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x0,src=1.1.1.1,dst=1.1.1.2,ttl=64,geneve({class=0xffff,type=3,len=8,0x1234567890abcdef}),flags(df|key)),in_port(6081),skb_mark(0),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
599 AT_CHECK([tail -2 stdout], [0],
600 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=+df-csum+key,tun_metadata3=0x1234567890abcdef,in_port=1,nw_frag=no
604 AT_CHECK([ovs-ofctl del-tlv-map br0])
609 AT_SETUP([tunnel - Geneve option present])
610 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
611 options:remote_ip=1.1.1.1 ofport_request=1 \
612 -- add-port br0 p2 -- set Interface p2 type=dummy \
613 ofport_request=2 ofport_request=2])
614 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
616 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0,{class=0xffff,type=1,len=0}->tun_metadata1,{class=0xffff,type=2,len=4}->tun_metadata2"])
618 AT_DATA([flows.txt], [dnl
619 priority=1,tun_metadata0,actions=2
620 priority=2,tun_metadata1=0,actions=IN_PORT
621 priority=3,tun_metadata2=0,actions=drop
623 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
625 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
627 priority=1,tun_metadata0 actions=output:2
628 priority=2,tun_metadata1 actions=IN_PORT
629 priority=3,tun_metadata2=0 actions=drop
633 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x0,src=1.1.1.1,dst=1.1.1.2,ttl=64,geneve({class=0xffff,type=0,len=4,0x12345678}),flags(df|key)),in_port(6081),skb_mark(0),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
634 AT_CHECK([tail -2 stdout], [0],
635 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=+df-csum+key,tun_metadata0,tun_metadata1=NP,tun_metadata2=NP,in_port=1,nw_frag=no
639 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x0,src=1.1.1.1,dst=1.1.1.2,ttl=64,geneve({class=0xffff,type=1,len=0}),flags(df|key)),in_port(6081),skb_mark(0),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
640 AT_CHECK([tail -2 stdout], [0],
641 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=+df-csum+key,tun_metadata1,tun_metadata2=NP,in_port=1,nw_ecn=0,nw_frag=no
642 Datapath actions: set(tunnel(tun_id=0x0,dst=1.1.1.1,ttl=64,geneve({class=0xffff,type=0x1,len=0}),flags(df|key))),6081
648 AT_SETUP([tunnel - concomitant IPv6 and IPv4 tunnels])
649 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
650 options:remote_ip=1.1.1.1 ofport_request=1 \
651 -- add-port br0 p2 -- set Interface p2 type=vxlan \
652 options:remote_ip=2001:cafe::1 ofport_request=2])
653 AT_DATA([flows.txt], [dnl
657 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
659 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
661 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0,src=1.1.1.1,dst=1.1.1.2,ttl=64),in_port(4789)'], [0], [stdout])
662 AT_CHECK([tail -1 stdout], [0],
663 [Datapath actions: set(tunnel(tun_id=0x0,ipv6_dst=2001:cafe::1,ttl=64,flags(df|key))),4789
666 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,ipv6_src=2001:cafe::1,ipv6_dst=2001:cafe::2,ttl=64),in_port(4789)'], [0], [stdout])
667 AT_CHECK([tail -1 stdout], [0],
668 [Datapath actions: set(tunnel(tun_id=0x0,dst=1.1.1.1,ttl=64,flags(df|key))),4789