ofproto-dpif: Keep track of exact-match flow info
[sliver-openvswitch.git] / tests / tunnel.at
1 AT_BANNER([tunnel])
2
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 \
8                     ofport_request=2 \
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
12 actions=IN_PORT
13 ])
14
15 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
16
17 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
18 br0 (dummy@ovs-dummy):
19         lookups: hit:0 missed:0
20         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
21                 overall avg: add rate: 0.000/min, del rate: 0.000/min
22         br0 65534/100: (dummy)
23         p1 1/1: (gre: remote_ip=1.1.1.1)
24         p2 2/1: (gre: local_ip=2.2.2.2, remote_ip=1.1.1.1)
25         p3 3/1: (gre: remote_ip=2.2.2.2)
26 ])
27
28 dnl remote_ip
29 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])
30 AT_CHECK([tail -1 stdout], [0],
31   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
32 ])
33
34 dnl local_ip, remote_ip
35 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])
36 AT_CHECK([tail -1 stdout], [0],
37   [Datapath actions: set(tunnel(tun_id=0x0,src=2.2.2.2,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
38 ])
39
40 dnl reconfigure, local_ip, remote_ip
41 AT_CHECK([ovs-vsctl set Interface p2 type=gre options:local_ip=2.2.2.3 \
42           options:df_default=false options:ttl=1 options:csum=true \
43           -- set Interface p3 type=gre64])
44 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
45 br0 (dummy@ovs-dummy):
46         lookups: hit:0 missed:0
47         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
48                 overall avg: add rate: 0.000/min, del rate: 0.000/min
49         br0 65534/100: (dummy)
50         p1 1/1: (gre: remote_ip=1.1.1.1)
51         p2 2/1: (gre: csum=true, df_default=false, local_ip=2.2.2.3, remote_ip=1.1.1.1, ttl=1)
52         p3 3/64: (gre64: remote_ip=2.2.2.2)
53 ])
54 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])
55 AT_CHECK([tail -1 stdout], [0],
56   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
57 ])
58 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])
59 AT_CHECK([tail -1 stdout], [0],
60   [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 ])
62
63 dnl nonexistent tunnel
64 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
65 Invalid flow
66 ovs-appctl: ovs-vswitchd: server returned an error
67 ])
68
69 OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
70 AT_CLEANUP
71
72 AT_SETUP([tunnel - ECN decapsulation])
73 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
74                     options:remote_ip=1.1.1.1 ofport_request=1 \
75                     -- add-port br0 p2 -- set Interface p2 type=dummy \
76                     ofport_request=2])
77 AT_DATA([flows.txt], [dnl
78 actions=2
79 ])
80
81 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
82
83 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
84 br0 (dummy@ovs-dummy):
85         lookups: hit:0 missed:0
86         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
87                 overall avg: add rate: 0.000/min, del rate: 0.000/min
88         br0 65534/100: (dummy)
89         p1 1/1: (gre: remote_ip=1.1.1.1)
90         p2 2/2: (dummy)
91 ])
92
93 dnl Tunnel CE and encapsulated packet CE
94 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=3,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
95 AT_CHECK([tail -1 stdout], [0],
96   [Datapath actions: 2
97 ])
98
99 dnl Tunnel CE and encapsulated packet ECT(1)
100 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])
101 AT_CHECK([tail -1 stdout], [0],
102   [Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0x3,ttl=64,frag=no)),2
103 ])
104
105 dnl Tunnel CE and encapsulated packet ECT(2)
106 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=2,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
107 AT_CHECK([tail -1 stdout], [0],
108   [Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0x3,ttl=64,frag=no)),2
109 ])
110
111 dnl Tunnel CE and encapsulated packet Non-ECT
112 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=0,ttl=64,frag=no),tcp(src=8,dst=9)'], [0], [stdout])
113 AT_CHECK([tail -1 stdout], [0],
114   [Datapath actions: drop
115 ])
116 OVS_VSWITCHD_STOP(["/dropping tunnel packet marked ECN CE but is not ECN capable/d"])
117 AT_CLEANUP
118
119 AT_SETUP([tunnel - output])
120 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
121                     options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
122                     options:key=5 ofport_request=1\
123                     -- add-port br0 p2 -- set Interface p2 type=dummy \
124                     ofport_request=2 ofport_request=2])
125 AT_DATA([flows.txt], [dnl
126 actions=output:1
127 ])
128
129 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
130
131 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
132 br0 (dummy@ovs-dummy):
133         lookups: hit:0 missed:0
134         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
135                 overall avg: add rate: 0.000/min, del rate: 0.000/min
136         br0 65534/100: (dummy)
137         p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
138         p2 2/2: (dummy)
139 ])
140
141 dnl Basic
142 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])
143 AT_CHECK([tail -1 stdout], [0],
144   [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
145 ])
146
147 dnl ECN
148 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])
149 AT_CHECK([tail -1 stdout], [0],
150   [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
151 ])
152 OVS_VSWITCHD_STOP
153 AT_CLEANUP
154
155 AT_SETUP([tunnel - ToS and TTL inheritance])
156 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
157                     options:remote_ip=1.1.1.1 options:tos=inherit \
158                     options:ttl=inherit ofport_request=1 \
159                     -- add-port br0 p2 -- set Interface p2 type=dummy \
160                     ofport_request=2 ofport_request=2])
161 AT_DATA([flows.txt], [dnl
162 actions=output:1
163 ])
164
165 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
166
167 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
168 br0 (dummy@ovs-dummy):
169         lookups: hit:0 missed:0
170         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
171                 overall avg: add rate: 0.000/min, del rate: 0.000/min
172         br0 65534/100: (dummy)
173         p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
174         p2 2/2: (dummy)
175 ])
176
177 dnl Basic
178 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])
179 AT_CHECK([tail -1 stdout], [0],
180   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
181 ])
182
183 dnl ECN
184 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])
185 AT_CHECK([tail -1 stdout], [0],
186   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
187 ])
188
189 dnl non-IP
190 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])
191 AT_CHECK([tail -1 stdout], [0],
192   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df))),1
193 ])
194 OVS_VSWITCHD_STOP
195 AT_CLEANUP
196
197 AT_SETUP([tunnel - set_tunnel])
198 OVS_VSWITCHD_START([dnl
199     add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
200         options:remote_ip=1.1.1.1 ofport_request=1 \
201     -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
202         options:remote_ip=2.2.2.2 ofport_request=2 \
203     -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
204         options:remote_ip=3.3.3.3 ofport_request=3 \
205     -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
206         options:remote_ip=4.4.4.4 ofport_request=4])
207 AT_DATA([flows.txt], [dnl
208 actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
209 ])
210
211 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
212
213 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
214 br0 (dummy@ovs-dummy):
215         lookups: hit:0 missed:0
216         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
217                 overall avg: add rate: 0.000/min, del rate: 0.000/min
218         br0 65534/100: (dummy)
219         p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
220         p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
221         p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
222         p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
223 ])
224
225 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])
226 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
227 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
228 set(tunnel(tun_id=0x2,src=0.0.0.0,dst=2.2.2.2,tos=0x0,ttl=64,flags(df,key))),1,dnl
229 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=3.3.3.3,tos=0x0,ttl=64,flags(df,key))),1,dnl
230 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=4.4.4.4,tos=0x0,ttl=64,flags(df,key))),1
231 ])
232 OVS_VSWITCHD_STOP
233 AT_CLEANUP
234
235 AT_SETUP([tunnel - key])
236 OVS_VSWITCHD_START([dnl
237     add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
238         options:remote_ip=1.1.1.1 ofport_request=1 \
239     -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
240         options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
241     -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
242         options:remote_ip=1.1.1.1 ofport_request=3])
243 AT_DATA([flows.txt], [dnl
244 actions=IN_PORT,output:1,output:2,output:3
245 ])
246
247 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
248
249 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
250 br0 (dummy@ovs-dummy):
251         lookups: hit:0 missed:0
252         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
253                 overall avg: add rate: 0.000/min, del rate: 0.000/min
254         br0 65534/100: (dummy)
255         p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
256         p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
257         p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
258 ])
259
260 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])
261 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
262 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
263 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
264 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
265 ])
266
267 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])
268 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
269 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
270 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
271 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
272 ])
273
274 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])
275 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
276 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
277 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
278 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
279 ])
280
281 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
282 Invalid flow
283 ovs-appctl: ovs-vswitchd: server returned an error
284 ])
285 OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
286 AT_CLEANUP
287
288 AT_SETUP([tunnel - key match])
289 OVS_VSWITCHD_START([dnl
290     add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
291         options:remote_ip=1.1.1.1 ofport_request=1 \
292     -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
293         options:remote_ip=3.3.3.3 ofport_request=2 \
294     -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
295     -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
296     -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
297 AT_DATA([flows.txt], [dnl
298 tun_id=2,actions=output:3
299 tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
300 tun_id=4,actions=output:5
301 ])
302
303 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
304
305 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
306 br0 (dummy@ovs-dummy):
307         lookups: hit:0 missed:0
308         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
309                 overall avg: add rate: 0.000/min, del rate: 0.000/min
310         br0 65534/100: (dummy)
311         p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
312         p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
313         p3 3/3: (dummy)
314         p4 4/4: (dummy)
315         p5 5/5: (dummy)
316 ])
317
318 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])
319 AT_CHECK([tail -1 stdout], [0], [dnl
320 Datapath actions: 3
321 ])
322
323 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])
324 AT_CHECK([tail -1 stdout], [0], [dnl
325 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
326 ])
327
328 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])
329 AT_CHECK([tail -1 stdout], [0], [dnl
330 Datapath actions: 4,3,5
331 ])
332
333 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])
334 AT_CHECK([tail -1 stdout], [0], [dnl
335         - Sends "packet-in" messages to the OpenFlow controller.
336 ])
337
338 OVS_VSWITCHD_STOP
339 AT_CLEANUP
340
341 AT_SETUP([tunnel - VXLAN])
342 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
343                     options:remote_ip=1.1.1.1 ofport_request=1])
344
345 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
346 br0 (dummy@ovs-dummy):
347         lookups: hit:0 missed:0
348         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
349                 overall avg: add rate: 0.000/min, del rate: 0.000/min
350         br0 65534/100: (dummy)
351         p1 1/1: (vxlan: remote_ip=1.1.1.1)
352 ])
353
354 OVS_VSWITCHD_STOP
355 AT_CLEANUP
356
357 AT_SETUP([tunnel - LISP])
358 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
359                     options:remote_ip=1.1.1.1 ofport_request=1])
360
361 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
362 br0 (dummy@ovs-dummy):
363         lookups: hit:0 missed:0
364         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
365                 overall avg: add rate: 0.000/min, del rate: 0.000/min
366         br0 65534/100: (dummy)
367         p1 1/1: (lisp: remote_ip=1.1.1.1)
368 ])
369
370 OVS_VSWITCHD_STOP
371 AT_CLEANUP
372
373 AT_SETUP([tunnel - different VXLAN UDP port])
374 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
375                     options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
376
377 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
378 br0 (dummy@ovs-dummy):
379         lookups: hit:0 missed:0
380         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
381                 overall avg: add rate: 0.000/min, del rate: 0.000/min
382         br0 65534/100: (dummy)
383         p1 1/1: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
384 ])
385
386 dnl change UDP port
387
388 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
389
390 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
391 br0 (dummy@ovs-dummy):
392         lookups: hit:0 missed:0
393         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
394                 overall avg: add rate: 0.000/min, del rate: 0.000/min
395         br0 65534/100: (dummy)
396         p1 1/2: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
397 ])
398
399 dnl change UDP port to default
400
401 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=8472])
402
403 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
404 br0 (dummy@ovs-dummy):
405         lookups: hit:0 missed:0
406         flows: cur: 0, avg: 0.000, max: 0, life span: 0(ms)
407                 overall avg: add rate: 0.000/min, del rate: 0.000/min
408         br0 65534/100: (dummy)
409         p1 1/1: (vxlan: remote_ip=1.1.1.1)
410 ])
411
412 OVS_VSWITCHD_STOP
413 AT_CLEANUP