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
15 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
17 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
18 br0 (dummy@ovs-dummy):
19 lookups: hit:0 missed:0 lost:0
21 br0 65534/100: (dummy)
22 p1 1/1: (gre: remote_ip=1.1.1.1)
23 p2 2/1: (gre: local_ip=2.2.2.2, remote_ip=1.1.1.1)
24 p3 3/1: (gre: remote_ip=2.2.2.2)
28 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=1.1.1.1,dst=1.2.3.4,tos=0x0,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])
29 AT_CHECK([tail -1 stdout], [0],
30 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
33 dnl local_ip, remote_ip
34 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
35 AT_CHECK([tail -1 stdout], [0],
36 [Datapath actions: set(tunnel(tun_id=0x0,src=2.2.2.2,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
39 dnl reconfigure, local_ip, remote_ip
40 AT_CHECK([ovs-vsctl set Interface p2 type=gre options:local_ip=2.2.2.3 \
41 options:df_default=false options:ttl=1 options:csum=true \
42 -- set Interface p3 type=gre64])
43 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
44 br0 (dummy@ovs-dummy):
45 lookups: hit:0 missed:0 lost:0
47 br0 65534/100: (dummy)
48 p1 1/1: (gre: remote_ip=1.1.1.1)
49 p2 2/1: (gre: csum=true, df_default=false, local_ip=2.2.2.3, remote_ip=1.1.1.1, ttl=1)
50 p3 3/64: (gre64: remote_ip=2.2.2.2)
52 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
53 AT_CHECK([tail -1 stdout], [0],
54 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
56 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.3,tos=0x0,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])
57 AT_CHECK([tail -1 stdout], [0],
58 [Datapath actions: set(tunnel(tun_id=0x0,src=2.2.2.3,dst=1.1.1.1,tos=0x0,ttl=1,flags(csum))),1
61 dnl nonexistent tunnel
62 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=5.5.5.5,dst=6.6.6.6,tos=0x0,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
64 ovs-appctl: ovs-vswitchd: server returned an error
70 AT_SETUP([tunnel - ECN decapsulation])
71 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
72 options:remote_ip=1.1.1.1 ofport_request=1 \
73 -- add-port br0 p2 -- set Interface p2 type=dummy \
75 AT_DATA([flows.txt], [dnl
79 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
81 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
82 br0 (dummy@ovs-dummy):
83 lookups: hit:0 missed:0 lost:0
85 br0 65534/100: (dummy)
86 p1 1/1: (gre: remote_ip=1.1.1.1)
90 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,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 -1 stdout], [0],
97 AT_SETUP([tunnel - output])
98 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
99 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
100 options:key=5 ofport_request=1\
101 -- add-port br0 p2 -- set Interface p2 type=dummy \
102 ofport_request=2 ofport_request=2])
103 AT_DATA([flows.txt], [dnl
107 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
109 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
110 br0 (dummy@ovs-dummy):
111 lookups: hit:0 missed:0 lost:0
113 br0 65534/100: (dummy)
114 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
119 AT_CHECK([ovs-appctl ofproto/trace br0 '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])
120 AT_CHECK([tail -1 stdout], [0],
121 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
125 AT_CHECK([ovs-appctl ofproto/trace br0 '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])
126 AT_CHECK([tail -1 stdout], [0],
127 [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
132 AT_SETUP([tunnel - ToS and TTL inheritance])
133 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
134 options:remote_ip=1.1.1.1 options:tos=inherit \
135 options:ttl=inherit ofport_request=1 \
136 -- add-port br0 p2 -- set Interface p2 type=dummy \
137 ofport_request=2 ofport_request=2])
138 AT_DATA([flows.txt], [dnl
142 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
144 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
145 br0 (dummy@ovs-dummy):
146 lookups: hit:0 missed:0 lost:0
148 br0 65534/100: (dummy)
149 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
154 AT_CHECK([ovs-appctl ofproto/trace br0 '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])
155 AT_CHECK([tail -1 stdout], [0],
156 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
160 AT_CHECK([ovs-appctl ofproto/trace br0 '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])
161 AT_CHECK([tail -1 stdout], [0],
162 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
166 AT_CHECK([ovs-appctl ofproto/trace br0 '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])
167 AT_CHECK([tail -1 stdout], [0],
168 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
173 AT_SETUP([tunnel - set_tunnel])
174 OVS_VSWITCHD_START([dnl
175 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
176 options:remote_ip=1.1.1.1 ofport_request=1 \
177 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
178 options:remote_ip=2.2.2.2 ofport_request=2 \
179 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
180 options:remote_ip=3.3.3.3 ofport_request=3 \
181 -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
182 options:remote_ip=4.4.4.4 ofport_request=4])
183 AT_DATA([flows.txt], [dnl
184 actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
187 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
189 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
190 br0 (dummy@ovs-dummy):
191 lookups: hit:0 missed:0 lost:0
193 br0 65534/100: (dummy)
194 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
195 p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
196 p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
197 p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
200 AT_CHECK([ovs-appctl ofproto/trace br0 '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])
201 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
202 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
203 set(tunnel(tun_id=0x2,src=0.0.0.0,dst=2.2.2.2,tos=0x0,ttl=64,flags(df,key))),1,dnl
204 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=3.3.3.3,tos=0x0,ttl=64,flags(df,key))),1,dnl
205 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=4.4.4.4,tos=0x0,ttl=64,flags(df,key))),1
210 AT_SETUP([tunnel - key])
211 OVS_VSWITCHD_START([dnl
212 add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
213 options:remote_ip=1.1.1.1 ofport_request=1 \
214 -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
215 options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
216 -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
217 options:remote_ip=1.1.1.1 ofport_request=3])
218 AT_DATA([flows.txt], [dnl
219 actions=IN_PORT,output:1,output:2,output:3
222 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
224 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
225 br0 (dummy@ovs-dummy):
226 lookups: hit:0 missed:0 lost:0
228 br0 65534/100: (dummy)
229 p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
230 p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
231 p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
234 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x1,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
235 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
236 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
237 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
238 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
241 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x2,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
242 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
243 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
244 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
245 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
248 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
249 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
250 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
251 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
252 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
255 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0xf,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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
257 ovs-appctl: ovs-vswitchd: server returned an error
262 AT_SETUP([tunnel - key match])
263 OVS_VSWITCHD_START([dnl
264 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
265 options:remote_ip=1.1.1.1 ofport_request=1 \
266 -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
267 options:remote_ip=3.3.3.3 ofport_request=2 \
268 -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
269 -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
270 -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
271 AT_DATA([flows.txt], [dnl
272 tun_id=2,actions=output:3
273 tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
274 tun_id=4,actions=output:5
277 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
279 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
280 br0 (dummy@ovs-dummy):
281 lookups: hit:0 missed:0 lost:0
283 br0 65534/100: (dummy)
284 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
285 p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
291 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x2,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
292 AT_CHECK([tail -1 stdout], [0], [dnl
296 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x3,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
297 AT_CHECK([tail -1 stdout], [0], [dnl
298 Datapath actions: 4,3,set(tunnel(tun_id=0x3,src=0.0.0.0,dst=3.3.3.3,tos=0x0,ttl=64,flags(df,key))),1,5
301 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x3,src=3.3.3.3,dst=2.2.2.2,tos=0x0,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])
302 AT_CHECK([tail -1 stdout], [0], [dnl
303 Datapath actions: 4,3,5
306 AT_CHECK([ovs-appctl ofproto/trace br0 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x0,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])
307 AT_CHECK([tail -1 stdout], [0], [dnl
308 - Sends "packet-in" messages to the OpenFlow controller.