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-internal)
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-internal)
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
58 no OpenFlow tunnel port for this packet
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-internal)
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: recirc_id=0,eth,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: recirc_id=0,eth,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: recirc_id=0,eth,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: recirc_id=0,eth,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-internal)
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 - ToS and TTL inheritance])
200 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
201 options:remote_ip=1.1.1.1 options:tos=inherit \
202 options:ttl=inherit ofport_request=1 \
203 -- add-port br0 p2 -- set Interface p2 type=dummy \
204 ofport_request=2 ofport_request=2])
205 AT_DATA([flows.txt], [dnl
209 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
210 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
212 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
213 br0 65534/100: (dummy-internal)
214 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
219 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])
220 AT_CHECK([tail -1 stdout], [0],
221 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
225 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])
226 AT_CHECK([tail -1 stdout], [0],
227 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
231 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])
232 AT_CHECK([tail -1 stdout], [0],
233 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
238 AT_SETUP([tunnel - set_tunnel])
239 OVS_VSWITCHD_START([dnl
240 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
241 options:remote_ip=1.1.1.1 ofport_request=1 \
242 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
243 options:remote_ip=2.2.2.2 ofport_request=2 \
244 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
245 options:remote_ip=3.3.3.3 ofport_request=3 \
246 -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
247 options:remote_ip=4.4.4.4 ofport_request=4])
248 AT_DATA([flows.txt], [dnl
249 actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
252 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
253 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
255 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
256 br0 65534/100: (dummy-internal)
257 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
258 p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
259 p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
260 p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
263 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])
264 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
265 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
266 set(tunnel(tun_id=0x2,dst=2.2.2.2,ttl=64,flags(df|key))),1,dnl
267 set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,dnl
268 set(tunnel(tun_id=0x5,dst=4.4.4.4,ttl=64,flags(df|key))),1
273 AT_SETUP([tunnel - key])
274 OVS_VSWITCHD_START([dnl
275 add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
276 options:remote_ip=1.1.1.1 ofport_request=1 \
277 -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
278 options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
279 -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
280 options:remote_ip=1.1.1.1 ofport_request=3])
281 AT_DATA([flows.txt], [dnl
282 actions=IN_PORT,output:1,output:2,output:3
285 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
286 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
288 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
289 br0 65534/100: (dummy-internal)
290 p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
291 p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
292 p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
295 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])
296 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
297 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
298 set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
299 set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
302 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])
303 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
304 set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
305 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
306 set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
309 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])
310 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
311 set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
312 set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
313 set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1
316 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
317 no OpenFlow tunnel port for this packet
318 ovs-appctl: ovs-vswitchd: server returned an error
320 OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
323 AT_SETUP([tunnel - key match])
324 OVS_VSWITCHD_START([dnl
325 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
326 options:remote_ip=1.1.1.1 ofport_request=1 \
327 -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
328 options:remote_ip=3.3.3.3 ofport_request=2 \
329 -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
330 -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
331 -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
332 AT_DATA([flows.txt], [dnl
333 tun_id=2,actions=output:3
334 tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
335 tun_id=4,actions=output:5
338 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
339 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
341 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
342 br0 65534/100: (dummy-internal)
343 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
344 p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
350 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])
351 AT_CHECK([tail -1 stdout], [0], [dnl
355 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])
356 AT_CHECK([tail -1 stdout], [0], [dnl
357 Datapath actions: 4,3,set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,5
360 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])
361 AT_CHECK([tail -1 stdout], [0], [dnl
362 Datapath actions: 4,3,5
365 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])
366 AT_CHECK([tail -1 stdout], [0], [dnl
367 Datapath actions: drop
373 AT_SETUP([tunnel - Geneve])
374 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
375 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=5000])
377 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
378 br0 65534/100: (dummy-internal)
379 p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
385 AT_SETUP([tunnel - VXLAN])
386 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
387 options:remote_ip=1.1.1.1 ofport_request=1])
389 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
390 br0 65534/100: (dummy-internal)
391 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
397 AT_SETUP([tunnel - LISP])
398 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
399 options:remote_ip=1.1.1.1 ofport_request=1])
401 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
402 br0 65534/100: (dummy-internal)
403 p1 1/4341: (lisp: remote_ip=1.1.1.1)
409 AT_SETUP([tunnel - ERSPAN])
410 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=erspan \
411 options:remote_ip=1.1.1.1 options:key=1 options:erspan_ver=1 \
412 options:erspan_idx=0x0 ofport_request=1 \
413 -- add-port br0 p2 -- set Interface p2 type=erspan \
414 options:remote_ip=1.1.1.1 ofport_request=2 \
415 options:key=flow options:erspan_ver=1 options:erspan_idx=flow \
416 -- add-port br0 p3 -- set Interface p3 type=erspan \
417 options:remote_ip=1.1.1.1 ofport_request=3 \
418 options:key=10 options:erspan_ver=2 options:erspan_dir=flow \
419 options:erspan_hwid=flow \
420 -- add-port br0 p4 -- set Interface p4 type=erspan \
421 options:remote_ip=1.2.3.4 ofport_request=4 \
422 options:key=flow options:erspan_ver=flow\
425 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
426 br0 65534/100: (dummy-internal)
427 p1 1/1: (erspan: erspan_idx=0x0, erspan_ver=1, key=1, remote_ip=1.1.1.1)
428 p2 2/1: (erspan: erspan_idx=flow, erspan_ver=1, key=flow, remote_ip=1.1.1.1)
429 p3 3/1: (erspan: erspan_dir=flow, erspan_hwid=flow, erspan_ver=2, key=10, remote_ip=1.1.1.1)
430 p4 4/1: (erspan: erspan_dir=flow, erspan_hwid=flow, erspan_idx=flow, erspan_ver=flow, key=flow, remote_ip=1.2.3.4)
433 dnl Check ERSPAN v1 flow-based tunnel push
434 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1, actions=set_tunnel:11,set_field:0x1->tun_erspan_idx,2"])
436 dnl Check ERSPAN v2 flow-based tunnel push
437 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2, actions=set_field:1->tun_erspan_dir,set_field:0x0->tun_erspan_hwid,3"])
439 AT_CHECK([ovs-ofctl add-flow br0 "in_port=3, actions=set_field:2->tun_erspan_ver,set_field:1->tun_erspan_dir,set_field:0x0->tun_erspan_hwid,4"])
441 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
444 in_port=1 actions=set_tunnel:0xb,set_field:0x1->tun_erspan_idx,output:2
445 in_port=2 actions=set_field:1->tun_erspan_dir,set_field:0->tun_erspan_hwid,output:3
446 in_port=3 actions=set_field:2->tun_erspan_ver,set_field:1->tun_erspan_dir,set_field:0->tun_erspan_hwid,output:4
452 AT_SETUP([tunnel - different VXLAN UDP port])
453 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
454 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
456 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
457 br0 65534/100: (dummy-internal)
458 p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
463 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
465 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
466 br0 65534/100: (dummy-internal)
467 p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
470 dnl change UDP port to default
472 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
474 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
475 br0 65534/100: (dummy-internal)
476 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
481 AT_SETUP([ofproto-dpif - set_field - tun_src/tun_dst/tun_id])
482 OVS_VSWITCHD_START([dnl
483 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
484 options:remote_ip=1.1.1.1 ofport_request=1 \
485 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
486 options:remote_ip=flow ofport_request=2 \
487 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
488 options:remote_ip=flow options:local_ip=flow ofport_request=3 \
489 -- add-port br0 p4 -- set Interface p4 type=gre options:key=3 \
490 options:remote_ip=flow ofport_request=4 \
491 -- add-port br0 p5 -- set Interface p5 type=gre options:key=flow \
492 options:remote_ip=5.5.5.5 ofport_request=5])
494 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
496 AT_DATA([flows.txt], [dnl
497 in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
498 in_port=1 actions=set_field:42->tun_id,output:1
499 in_port=2 actions=set_field:3.3.3.3->tun_dst,output:2
500 in_port=3 actions=set_field:1.1.1.1->tun_src,set_field:4.4.4.4->tun_dst,output:3
501 in_port=4 actions=set_field:2.2.2.2->tun_dst,output:4
502 in_port=5 actions=set_field:5->tun_id
504 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
505 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])
506 AT_CHECK([tail -1 stdout], [0],
507 [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
512 AT_SETUP([tunnel - ERSPAN v1/v2 metadata])
513 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy \
515 -- add-port br0 p2 -- set Interface p2 type=dummy \
518 # Add these ports separately to ensure that they get the datapath port
519 # number expected below.
520 ovs-vsctl -- add-port br0 p3 \
521 -- set Interface p3 type=erspan \
523 options:remote_ip=1.1.1.1 \
524 options:key=1 options:erspan_ver=1 \
525 options:erspan_idx=7 \
527 -- set Interface p4 type=erspan \
529 options:remote_ip=1.1.1.2 \
530 options:key=2 options:erspan_ver=2 \
531 options:erspan_dir=1 \
532 options:erspan_hwid=7
533 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
535 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
536 br0 65534/100: (dummy-internal)
539 p3 3/3: (erspan: erspan_idx=0x7, erspan_ver=1, key=1, remote_ip=1.1.1.1)
540 p4 4/3: (erspan: erspan_dir=1, erspan_hwid=0x7, erspan_ver=2, key=2, remote_ip=1.1.1.2)
543 AT_DATA([flows.txt], [dnl
546 in_port=3,tun_erspan_ver=1,tun_erspan_idx=0x7,actions=1
547 in_port=4,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0xf/0x1,actions=2
549 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
551 dnl test encap: in_port=1,actions=3 (erspan v1 port)
552 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy '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=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
553 AT_CHECK([tail -1 stdout], [0],
554 [Datapath actions: set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,erspan(ver=1,idx=0x7),flags(df|key))),3
557 dnl test encap: in_port=2,actions=4 (erspan v2 port)
558 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])
559 AT_CHECK([tail -1 stdout], [0],
560 [Datapath actions: set(tunnel(tun_id=0x2,dst=1.1.1.2,ttl=64,erspan(ver=2,dir=1,hwid=0x7),flags(df|key))),3
563 dnl receive packet from ERSPAN port with v1 metadata
564 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x1,src=1.1.1.1,dst=2.2.2.2,ttl=64,erspan(ver=1,idx=0x7),flags(df|key)),in_port(3),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
565 AT_CHECK([tail -2 stdout], [0],
566 [Megaflow: recirc_id=0,eth,ip,tun_id=0x1,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=0,tun_erspan_ver=1,tun_erspan_idx=0x7,tun_flags=+df-csum+key,in_port=3,nw_frag=no
570 dnl receive packet from ERSPAN port with wrong v1 metadata
571 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x1,src=1.1.1.1,dst=2.2.2.2,ttl=64,erspan(ver=1,idx=0xabcd),flags(df|key)),in_port(3),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
572 AT_CHECK([tail -2 stdout], [0],
573 [Megaflow: recirc_id=0,eth,ip,tun_id=0x1,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=0,tun_erspan_ver=1,tun_erspan_idx=0xabcd,tun_flags=+df-csum+key,in_port=3,nw_frag=no
574 Datapath actions: drop
577 dnl receive packet from ERSPAN port with v2 metadata
578 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x2,src=1.1.1.2,dst=2.2.2.2,ttl=64,erspan(ver=2,dir=1,hwid=0x7),flags(df|key)),in_port(3),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
579 AT_CHECK([tail -2 stdout], [0],
580 [Megaflow: recirc_id=0,eth,ip,tun_id=0x2,tun_src=1.1.1.2,tun_dst=2.2.2.2,tun_tos=0,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0x1,tun_flags=+df-csum+key,in_port=4,nw_frag=no
584 dnl receive packet from ERSPAN port with wrong v2 metadata
585 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x2,src=1.1.1.2,dst=2.2.2.2,ttl=64,erspan(ver=2,dir=0,hwid=0x17),flags(df|key)),in_port(3),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
586 AT_CHECK([tail -2 stdout], [0],
587 [Megaflow: recirc_id=0,eth,ip,tun_id=0x2,tun_src=1.1.1.2,tun_dst=2.2.2.2,tun_tos=0,tun_erspan_ver=2,tun_erspan_dir=0,tun_erspan_hwid=0x1,tun_flags=+df-csum+key,in_port=4,nw_frag=no
588 Datapath actions: drop
591 dnl test wildcard mask: recevie all v2 regardless of its metadata
592 AT_CHECK([ovs-ofctl del-flows br0 in_port=4,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0xf/0x1])
593 AT_CHECK([ovs-ofctl add-flow br0 in_port=4,tun_erspan_ver=2,tun_erspan_dir=0/0,tun_erspan_hwid=0x0/0x0,actions=2])
595 AT_CHECK([ovs-ofctl --sort=in_port dump-flows br0 | ofctl_strip],
597 in_port=1 actions=output:3
598 in_port=2 actions=output:4
599 tun_erspan_ver=1,tun_erspan_idx=0x7,in_port=3 actions=output:1
600 tun_erspan_ver=2,in_port=4 actions=output:2
603 dnl this time it won't drop
604 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(0),tunnel(tun_id=0x2,src=1.1.1.2,dst=2.2.2.2,ttl=64,erspan(ver=2,dir=0,hwid=0x17),flags(df|key)),in_port(3),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
605 AT_CHECK([tail -2 stdout], [0],
606 [Megaflow: recirc_id=0,eth,ip,tun_id=0x2,tun_src=1.1.1.2,tun_dst=2.2.2.2,tun_tos=0,tun_erspan_ver=2,tun_flags=+df-csum+key,in_port=4,nw_frag=no
610 dnl flow-based erspan_idx options
611 AT_CHECK([ovs-vsctl add-port br0 p5 -- set Interface p5 type=erspan \
612 options:remote_ip=1.1.1.2 ofport_request=5 \
613 options:key=flow options:erspan_ver=1 options:erspan_idx=flow])
615 AT_CHECK([ovs-ofctl del-flows br0])
616 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1, actions=set_tunnel:11,set_field:0x7->tun_erspan_idx,5"])
618 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
621 in_port=1 actions=set_tunnel:0xb,set_field:0x7->tun_erspan_idx,output:5
624 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy '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=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
625 AT_CHECK([tail -1 stdout], [0],
626 [Datapath actions: set(tunnel(tun_id=0xb,dst=1.1.1.2,ttl=64,erspan(ver=1,idx=0x7),flags(df|key))),3
632 AT_SETUP([tunnel - Geneve metadata])
633 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
634 options:remote_ip=1.1.1.1 ofport_request=1 \
635 -- add-port br0 p2 -- set Interface p2 type=dummy \
636 ofport_request=2 ofport_request=2])
637 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
639 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0,{class=0xffff,type=1,len=8}->tun_metadata1"])
641 AT_DATA([flows.txt], [dnl
642 in_port=2,actions=set_field:0xa->tun_metadata0,set_field:0x1234567890abcdef->tun_metadata1,1
643 tun_metadata0=0xb/0xf,actions=2
645 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
647 dnl Option generation
648 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])
649 AT_CHECK([tail -1 stdout], [0],
650 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=6081,geneve({class=0xffff,type=0,len=4,0xa}{class=0xffff,type=0x1,len=8,0x1234567890abcdef}),flags(df))),6081
654 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(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
655 AT_CHECK([tail -2 stdout], [0],
656 [Megaflow: recirc_id=0,eth,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
660 dnl Skip unknown option
661 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(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
662 AT_CHECK([tail -2 stdout], [0],
663 [Megaflow: recirc_id=0,eth,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
667 dnl Check mapping table constraints
668 AT_CHECK([ovs-ofctl del-flows br0])
669 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],
670 [OFPT_ERROR (xid=0x4): NXTTMFC_TABLE_FULL
671 NXT_TLV_TABLE_MOD (xid=0x4):
673 class type length match field
674 ------ ---- ------ --------------
675 0xffff 0x2 124 tun_metadata2
676 0xffff 0x3 124 tun_metadata3
679 AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0,tun_metadata0,actions=drop"], [1], [ignore],
680 [ovs-ofctl: field tun_metadata0 set multiple times
683 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],
684 [ovs-ofctl: field tun_metadata4 exceeds maximum size for tunnel metadata (used 320, max 256)
687 dnl Allocation and match with fragmented address space
688 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=124}->tun_metadata2"])
689 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
690 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=4,len=112}->tun_metadata4"])
691 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
692 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=8}->tun_metadata3"])
694 AT_CHECK([ovs-ofctl add-flow br0 tun_metadata3=0x1234567890abcdef,actions=2])
695 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(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
696 AT_CHECK([tail -2 stdout], [0],
697 [Megaflow: recirc_id=0,eth,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
701 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
704 tun_metadata3=0x1234567890abcdef actions=output:2
707 dnl A TLV mapping should not be removed if any active flow uses the mapping.
708 AT_CHECK([ovs-ofctl del-tlv-map br0], [1], [], [dnl
709 OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
710 NXT_TLV_TABLE_MOD (xid=0x4):
714 AT_CHECK([ovs-ofctl del-flows br0], [0])
715 AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
717 dnl Flow modification
718 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata0"])
719 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata1"])
720 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata2"])
722 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[0..31]])"])
723 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]],clone(move:tun_metadata2[[0..31]]->reg0[[0..31]])"])
725 AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=output:4"])
726 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata0"])
728 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata2[[0..31]]"])
729 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata1"])
730 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata2"], [1], [], [dnl
731 OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
732 NXT_TLV_TABLE_MOD (xid=0x4):
734 class type length match field
735 ------ ---- ------ --------------
736 0xffff 0x3 4 tun_metadata2
739 AT_CHECK([ovs-ofctl del-flows br0], [0])
740 AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
743 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"])
744 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata2"])
745 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2, eth_src=00:00:00:00:00:01 actions=learn(tun_metadata1[[0..31]]=reg1, output:NXM_OF_IN_PORT[[]])"])
746 AT_CHECK([ovs-ofctl add-flow br0 "in_port=2, eth_src=00:00:00:00:00:02 actions=learn(reg1[[0..31]]=0xFF, load:reg1[[0..31]]->tun_metadata2[[0..31]])"])
747 flow1="in_port(2),eth(src=00:00:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800)"
748 flow2="in_port(2),eth(src=00:00:00:00:00:02,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800)"
749 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow1" -generate], [0], [stdout])
750 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow2" -generate], [0], [stdout])
752 dnl Delete flows with learn action
753 AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"])
755 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"], [1], [], [dnl
756 OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
757 NXT_TLV_TABLE_MOD (xid=0x4):
759 class type length match field
760 ------ ---- ------ --------------
761 0xffff 0x1 4 tun_metadata1
763 AT_CHECK([ovs-ofctl del-flows br0 "tun_metadata1"])
764 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"])
766 AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata2"], [1], [], [dnl
767 OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
768 NXT_TLV_TABLE_MOD (xid=0x4):
770 class type length match field
771 ------ ---- ------ --------------
772 0xffff 0x2 4 tun_metadata2
774 AT_CHECK([ovs-ofctl del-flows br0 "reg1=0xFF"])
775 AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
780 AT_SETUP([tunnel - Geneve option present])
781 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
782 options:remote_ip=1.1.1.1 ofport_request=1 \
783 -- add-port br0 p2 -- set Interface p2 type=dummy \
784 ofport_request=2 ofport_request=2])
785 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
787 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"])
789 AT_DATA([flows.txt], [dnl
790 priority=1,tun_metadata0,actions=2
791 priority=2,tun_metadata1=0,actions=IN_PORT
792 priority=3,tun_metadata2=0,actions=drop
794 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
796 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
798 priority=1,tun_metadata0 actions=output:2
799 priority=2,tun_metadata1 actions=IN_PORT
800 priority=3,tun_metadata2=0 actions=drop
804 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(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
805 AT_CHECK([tail -2 stdout], [0],
806 [Megaflow: recirc_id=0,eth,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
810 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(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
811 AT_CHECK([tail -2 stdout], [0],
812 [Megaflow: recirc_id=0,eth,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
813 Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=6081,geneve({class=0xffff,type=0x1,len=0}),flags(df))),6081
819 AT_SETUP([tunnel - concomitant IPv6 and IPv4 tunnels])
820 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
821 options:remote_ip=1.1.1.1 ofport_request=1 \
822 -- add-port br0 p2 -- set Interface p2 type=vxlan \
823 options:remote_ip=2001:cafe::1 ofport_request=2])
824 AT_DATA([flows.txt], [dnl
828 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
830 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
832 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])
833 AT_CHECK([tail -1 stdout], [0],
834 [Datapath actions: set(tunnel(ipv6_dst=2001:cafe::1,ttl=64,tp_dst=4789,flags(df))),4789
837 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])
838 AT_CHECK([tail -1 stdout], [0],
839 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=4789,flags(df))),4789
845 AT_SETUP([tunnel - concomitant incompatible tunnels on the same port])
846 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
847 options:remote_ip=flow ofport_request=1])
849 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=vxlan \
850 options:remote_ip=flow options:exts=gbp options:key=1 ofport_request=2], [0],
853 AT_CHECK([grep 'p2: could not set configuration (File exists)' ovs-vswitchd.log | sed "s/^.*\(p2:.*\)$/\1/"], [0],
854 [p2: could not set configuration (File exists)
857 OVS_VSWITCHD_STOP(["/p2: VXLAN-GBP, and non-VXLAN-GBP tunnels can't be configured on the same dst_port/d
858 /p2: could not set configuration (File exists)/d"])
861 AT_SETUP([tunnel - concomitant incompatible tunnels on different ports])
862 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
863 options:remote_ip=flow ofport_request=1])
865 AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=vxlan options:dst_port=9000 \
866 options:remote_ip=flow options:exts=gbp ofport_request=2])
868 AT_CHECK([grep p2 ovs-vswitchd.log | sed "s/^.*\(bridge br0:.*\)$/\1/"], [0],
869 [bridge br0: added interface p2 on port 2
875 AT_SETUP([tunnel - Mix Geneve/GRE options])
876 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
877 options:remote_ip=1.1.1.1 options:csum=true ofport_request=1 \
878 -- add-port br0 p2 -- set Interface p2 type=dummy \
879 ofport_request=2 ofport_request=2 \
880 -- add-port br0 p3 -- set Interface p3 type=gre \
881 options:remote_ip=2.2.2.2 options:csum=false options:key=123 ofport_request=3])
882 OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
884 AT_DATA([flows.txt], [dnl
885 priority=1,in_port=1,actions=3
887 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
889 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
891 priority=1,in_port=1 actions=output:3
895 dnl the input packet from geneve tunnel has flags(-df+csum+key) flags, making
896 dnl sure that the output gre tunnel has (+df-csum+key).
897 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(csum|key)),in_port(6081),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
898 AT_CHECK([tail -2 stdout], [0],
899 [Megaflow: recirc_id=0,eth,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=1.1.1.2,tun_tos=0,tun_flags=-df+csum+key,in_port=1,nw_ecn=0,nw_frag=no
900 Datapath actions: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,flags(df|key))),1
903 AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
904 AT_CHECK([ovs-ofctl del-flows br0])
906 AT_DATA([flows2.txt], [dnl
907 priority=1,in_port=1,tun_metadata0=0x123, actions=3
909 AT_CHECK([ovs-ofctl add-flows br0 flows2.txt])
911 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,0x123}),flags(csum|key)),in_port(6081),skb_mark(0),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(frag=no)'], [0], [stdout])
912 AT_CHECK([tail -2 stdout], [0],
913 [Megaflow: recirc_id=0,eth,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=0x123,in_port=1,nw_ecn=0,nw_frag=no
914 Datapath actions: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,flags(df|key))),1
917 dnl without the fix, the actions have geneve options:
918 dnl set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,geneve({class=0xffff,type=0,len=4,0x123}),flags(df|key))),1
919 dnl which is not correct