socket-util: af_inet_ioctl() for Windows.
[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 -1 stdout], [0],
84   [Datapath actions: 2
85 ])
86
87 dnl Tunnel CE and encapsulated packet ECT(1)
88 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])
89 AT_CHECK([tail -1 stdout], [0],
90   [Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0x3,ttl=64,frag=no)),2
91 ])
92
93 dnl Tunnel CE and encapsulated packet ECT(2)
94 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])
95 AT_CHECK([tail -1 stdout], [0],
96   [Datapath actions: set(ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0x3,ttl=64,frag=no)),2
97 ])
98
99 dnl Tunnel CE and encapsulated packet Non-ECT
100 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])
101 AT_CHECK([tail -1 stdout], [0],
102   [Datapath actions: drop
103 ])
104 OVS_VSWITCHD_STOP(["/dropping tunnel packet marked ECN CE but is not ECN capable/d"])
105 AT_CLEANUP
106
107 AT_SETUP([tunnel - output])
108 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
109                     options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
110                     options:key=5 ofport_request=1\
111                     -- add-port br0 p2 -- set Interface p2 type=dummy \
112                     ofport_request=2 ofport_request=2])
113 AT_DATA([flows.txt], [dnl
114 actions=output:1
115 ])
116
117 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
118
119 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
120                 br0 65534/100: (dummy)
121                 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
122                 p2 2/2: (dummy)
123 ])
124
125 dnl Basic
126 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])
127 AT_CHECK([tail -1 stdout], [0],
128   [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
129 ])
130
131 dnl ECN
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=1,ttl=64,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,tos=0x1,ttl=64,flags(df,key))),1
135 ])
136 OVS_VSWITCHD_STOP
137 AT_CLEANUP
138
139 AT_SETUP([tunnel - ToS and TTL inheritance])
140 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
141                     options:remote_ip=1.1.1.1 options:tos=inherit \
142                     options:ttl=inherit ofport_request=1 \
143                     -- add-port br0 p2 -- set Interface p2 type=dummy \
144                     ofport_request=2 ofport_request=2])
145 AT_DATA([flows.txt], [dnl
146 actions=output:1
147 ])
148
149 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
150
151 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
152                 br0 65534/100: (dummy)
153                 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
154                 p2 2/2: (dummy)
155 ])
156
157 dnl Basic
158 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])
159 AT_CHECK([tail -1 stdout], [0],
160   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
161 ])
162
163 dnl ECN
164 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])
165 AT_CHECK([tail -1 stdout], [0],
166   [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
167 ])
168
169 dnl non-IP
170 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])
171 AT_CHECK([tail -1 stdout], [0],
172   [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 ])
174 OVS_VSWITCHD_STOP
175 AT_CLEANUP
176
177 AT_SETUP([tunnel - set_tunnel])
178 OVS_VSWITCHD_START([dnl
179     add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
180         options:remote_ip=1.1.1.1 ofport_request=1 \
181     -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
182         options:remote_ip=2.2.2.2 ofport_request=2 \
183     -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
184         options:remote_ip=3.3.3.3 ofport_request=3 \
185     -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
186         options:remote_ip=4.4.4.4 ofport_request=4])
187 AT_DATA([flows.txt], [dnl
188 actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
189 ])
190
191 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
192
193 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
194                 br0 65534/100: (dummy)
195                 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
196                 p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
197                 p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
198                 p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
199 ])
200
201 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])
202 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
203 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
204 set(tunnel(tun_id=0x2,src=0.0.0.0,dst=2.2.2.2,tos=0x0,ttl=64,flags(df,key))),1,dnl
205 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=3.3.3.3,tos=0x0,ttl=64,flags(df,key))),1,dnl
206 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=4.4.4.4,tos=0x0,ttl=64,flags(df,key))),1
207 ])
208 OVS_VSWITCHD_STOP
209 AT_CLEANUP
210
211 AT_SETUP([tunnel - key])
212 OVS_VSWITCHD_START([dnl
213     add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
214         options:remote_ip=1.1.1.1 ofport_request=1 \
215     -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
216         options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
217     -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
218         options:remote_ip=1.1.1.1 ofport_request=3])
219 AT_DATA([flows.txt], [dnl
220 actions=IN_PORT,output:1,output:2,output:3
221 ])
222
223 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
224
225 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
226                 br0 65534/100: (dummy)
227                 p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
228                 p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
229                 p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
230 ])
231
232 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])
233 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
234 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
235 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
236 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
237 ])
238
239 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])
240 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
241 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
242 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
243 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
244 ])
245
246 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])
247 AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
248 set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
249 set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1,dnl
250 set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0x0,ttl=64,flags(df,key))),1
251 ])
252
253 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
254 Invalid datapath flow
255 ovs-appctl: ovs-vswitchd: server returned an error
256 ])
257 OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
258 AT_CLEANUP
259
260 AT_SETUP([tunnel - key match])
261 OVS_VSWITCHD_START([dnl
262     add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
263         options:remote_ip=1.1.1.1 ofport_request=1 \
264     -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
265         options:remote_ip=3.3.3.3 ofport_request=2 \
266     -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
267     -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
268     -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
269 AT_DATA([flows.txt], [dnl
270 tun_id=2,actions=output:3
271 tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
272 tun_id=4,actions=output:5
273 ])
274
275 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
276
277 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
278                 br0 65534/100: (dummy)
279                 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
280                 p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
281                 p3 3/3: (dummy)
282                 p4 4/4: (dummy)
283                 p5 5/5: (dummy)
284 ])
285
286 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])
287 AT_CHECK([tail -1 stdout], [0], [dnl
288 Datapath actions: 3
289 ])
290
291 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])
292 AT_CHECK([tail -1 stdout], [0], [dnl
293 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
294 ])
295
296 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])
297 AT_CHECK([tail -1 stdout], [0], [dnl
298 Datapath actions: 4,3,5
299 ])
300
301 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])
302 AT_CHECK([tail -1 stdout], [0], [dnl
303         - Sends "packet-in" messages to the OpenFlow controller.
304 ])
305
306 OVS_VSWITCHD_STOP
307 AT_CLEANUP
308
309 AT_SETUP([tunnel - VXLAN])
310 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
311                     options:remote_ip=1.1.1.1 ofport_request=1])
312
313 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
314                 br0 65534/100: (dummy)
315                 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
316 ])
317
318 OVS_VSWITCHD_STOP
319 AT_CLEANUP
320
321 AT_SETUP([tunnel - LISP])
322 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
323                     options:remote_ip=1.1.1.1 ofport_request=1])
324
325 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
326                 br0 65534/100: (dummy)
327                 p1 1/4341: (lisp: remote_ip=1.1.1.1)
328 ])
329
330 OVS_VSWITCHD_STOP
331 AT_CLEANUP
332
333 AT_SETUP([tunnel - different VXLAN UDP port])
334 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
335                     options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
336
337 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
338                 br0 65534/100: (dummy)
339                 p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
340 ])
341
342 dnl change UDP port
343
344 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
345
346 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
347                 br0 65534/100: (dummy)
348                 p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
349 ])
350
351 dnl change UDP port to default
352
353 AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
354
355 AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
356                 br0 65534/100: (dummy)
357                 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
358 ])
359 OVS_VSWITCHD_STOP
360 AT_CLEANUP
361
362 AT_SETUP([ofproto-dpif - set_field - tun_src/tun_dst/tun_id])
363 OVS_VSWITCHD_START([dnl
364     add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
365         options:remote_ip=1.1.1.1 ofport_request=1 \
366     -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
367         options:remote_ip=flow ofport_request=2 \
368     -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
369         options:remote_ip=flow options:local_ip=flow ofport_request=3 \
370     -- add-port br0 p4 -- set Interface p4 type=gre options:key=3 \
371         options:remote_ip=flow ofport_request=4 \
372     -- add-port br0 p5 -- set Interface p5 type=gre options:key=flow \
373         options:remote_ip=5.5.5.5 ofport_request=5])
374 ADD_OF_PORTS([br0], [90])
375 AT_DATA([flows.txt], [dnl
376 in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
377 in_port=1 actions=set_field:42->tun_id,output:1
378 in_port=2 actions=set_field:3.3.3.3->tun_dst,output:2
379 in_port=3 actions=set_field:1.1.1.1->tun_src,set_field:4.4.4.4->tun_dst,output:3
380 in_port=4 actions=set_field:2.2.2.2->tun_dst,output:4
381 in_port=5 actions=set_field:5->tun_id
382 ])
383 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
384 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])
385 AT_CHECK([tail -1 stdout], [0],
386   [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
387 ])
388 OVS_VSWITCHD_STOP
389 AT_CLEANUP