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