]> git.proxmox.com Git - mirror_ovs.git/blame - tests/tunnel.at
treewide: Convert leading tabs to spaces.
[mirror_ovs.git] / tests / tunnel.at
CommitLineData
0f538378
EJ
1AT_BANNER([tunnel])
2
3AT_SETUP([tunnel - input])
4OVS_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])
11AT_DATA([flows.txt], [dnl
12actions=IN_PORT
13])
a36de779 14OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
15
16AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
17
e79a6c83 18AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
0f538378
EJ
23])
24
25dnl remote_ip
65da723b 26AT_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])
0f538378 27AT_CHECK([tail -1 stdout], [0],
65da723b 28 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
0f538378
EJ
29])
30
31dnl local_ip, remote_ip
65da723b 32AT_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])
0f538378 33AT_CHECK([tail -1 stdout], [0],
65da723b 34 [Datapath actions: set(tunnel(src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df))),1
0f538378
EJ
35])
36
37dnl reconfigure, local_ip, remote_ip
38AT_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 \
99e7b077 40 -- set Interface p3 type=vxlan])
e79a6c83 41AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
0f538378 46])
65da723b 47AT_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])
0f538378 48AT_CHECK([tail -1 stdout], [0],
65da723b 49 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
0f538378 50])
65da723b 51AT_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])
0f538378 52AT_CHECK([tail -1 stdout], [0],
65da723b 53 [Datapath actions: set(tunnel(src=2.2.2.3,dst=1.1.1.1,ttl=1,flags(csum))),1
0f538378
EJ
54])
55
56dnl nonexistent tunnel
65da723b 57AT_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
50aa28fd 58Invalid datapath flow
0f538378
EJ
59ovs-appctl: ovs-vswitchd: server returned an error
60])
61
6e1fb7e1 62OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
0f538378
EJ
63AT_CLEANUP
64
65AT_SETUP([tunnel - ECN decapsulation])
66OVS_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 \
69 ofport_request=2])
70AT_DATA([flows.txt], [dnl
71actions=2
72])
73
74AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
75
e79a6c83 76AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
77 br0 65534/100: (dummy-internal)
78 p1 1/1: (gre: remote_ip=1.1.1.1)
79 p2 2/2: (dummy)
0f538378
EJ
80])
81
4863c249 82dnl Tunnel CE and encapsulated packet CE
65da723b 83AT_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])
ce58df5b 84AT_CHECK([tail -2 stdout], [0],
e3981271 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
ce58df5b 86Datapath actions: 2
4863c249
JP
87])
88
89dnl Tunnel CE and encapsulated packet ECT(1)
65da723b 90AT_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])
ce58df5b 91AT_CHECK([tail -2 stdout], [0],
e3981271 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
d23df9a8 93Datapath actions: set(ipv4(tos=0x3/0x3)),2
0f538378 94])
4863c249
JP
95
96dnl Tunnel CE and encapsulated packet ECT(2)
65da723b 97AT_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])
ce58df5b 98AT_CHECK([tail -2 stdout], [0],
e3981271 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
d23df9a8 100Datapath actions: set(ipv4(tos=0x3/0x3)),2
4863c249
JP
101])
102
103dnl Tunnel CE and encapsulated packet Non-ECT
65da723b 104AT_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])
ce58df5b 105AT_CHECK([tail -2 stdout], [0],
e3981271 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
ce58df5b 107Datapath actions: drop
4863c249
JP
108])
109OVS_VSWITCHD_STOP(["/dropping tunnel packet marked ECN CE but is not ECN capable/d"])
0f538378
EJ
110AT_CLEANUP
111
112AT_SETUP([tunnel - output])
113OVS_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 \
b3632186 117 ofport_request=2])
0f538378
EJ
118AT_DATA([flows.txt], [dnl
119actions=output:1
120])
121
a36de779 122OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
123AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
124
e79a6c83 125AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
128 p2 2/2: (dummy)
0f538378
EJ
129])
130
131dnl Basic
50aa28fd 132AT_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])
0f538378 133AT_CHECK([tail -1 stdout], [0],
8e4c1621 134 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
135])
136
137dnl ECN
50aa28fd 138AT_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])
0f538378 139AT_CHECK([tail -1 stdout], [0],
8e4c1621 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
0f538378
EJ
141])
142OVS_VSWITCHD_STOP
143AT_CLEANUP
144
f574ff4a
AA
145AT_SETUP([tunnel - unencrypted tunnel and not setting skb_mark])
146OVS_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])
151AT_DATA([flows.txt], [dnl
152actions=output:1
153])
154OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
155AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
156AT_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])
157AT_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
159])
160OVS_VSWITCHD_STOP
161AT_CLEANUP
162
163AT_SETUP([tunnel - unencrypted tunnel and setting skb_mark to 1])
164OVS_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])
169AT_DATA([flows.txt], [dnl
170actions=load:0x1->NXM_NX_PKT_MARK[[]],output:1
171])
172OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
173AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
174AT_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])
175AT_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
177])
178OVS_VSWITCHD_STOP
179AT_CLEANUP
180
181AT_SETUP([tunnel - unencrypted tunnel and setting skb_mark to 2])
182OVS_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])
187AT_DATA([flows.txt], [dnl
188actions=load:0x2->NXM_NX_PKT_MARK[[]],output:1
189])
190OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
191AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
192AT_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])
193AT_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
195])
196OVS_VSWITCHD_STOP
197AT_CLEANUP
198
0f538378
EJ
199AT_SETUP([tunnel - ToS and TTL inheritance])
200OVS_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])
205AT_DATA([flows.txt], [dnl
206actions=output:1
207])
208
a36de779 209OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
210AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
211
e79a6c83 212AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
213 br0 65534/100: (dummy-internal)
214 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
215 p2 2/2: (dummy)
0f538378
EJ
216])
217
218dnl Basic
50aa28fd 219AT_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])
0f538378 220AT_CHECK([tail -1 stdout], [0],
65da723b 221 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
0f538378
EJ
222])
223
224dnl ECN
50aa28fd 225AT_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])
0f538378 226AT_CHECK([tail -1 stdout], [0],
65da723b 227 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
0f538378
EJ
228])
229
230dnl non-IP
50aa28fd 231AT_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])
0f538378 232AT_CHECK([tail -1 stdout], [0],
65da723b 233 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
0f538378
EJ
234])
235OVS_VSWITCHD_STOP
236AT_CLEANUP
237
238AT_SETUP([tunnel - set_tunnel])
239OVS_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])
248AT_DATA([flows.txt], [dnl
249actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
250])
251
a36de779 252OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
253AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
254
e79a6c83 255AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
0f538378
EJ
261])
262
50aa28fd 263AT_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])
0f538378 264AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
265set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
266set(tunnel(tun_id=0x2,dst=2.2.2.2,ttl=64,flags(df|key))),1,dnl
267set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,dnl
268set(tunnel(tun_id=0x5,dst=4.4.4.4,ttl=64,flags(df|key))),1
0f538378
EJ
269])
270OVS_VSWITCHD_STOP
271AT_CLEANUP
272
273AT_SETUP([tunnel - key])
274OVS_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])
281AT_DATA([flows.txt], [dnl
282actions=IN_PORT,output:1,output:2,output:3
283])
284
a36de779 285OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
286AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
287
e79a6c83 288AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
0f538378
EJ
293])
294
65da723b 295AT_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])
0f538378 296AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
297set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
298set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
299set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
300])
301
65da723b 302AT_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])
0f538378 303AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
304set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
305set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
306set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
307])
308
65da723b 309AT_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])
0f538378 310AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
311set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
312set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
313set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
314])
315
65da723b 316AT_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
50aa28fd 317Invalid datapath flow
0f538378
EJ
318ovs-appctl: ovs-vswitchd: server returned an error
319])
6e1fb7e1 320OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
0f538378
EJ
321AT_CLEANUP
322
323AT_SETUP([tunnel - key match])
324OVS_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])
332AT_DATA([flows.txt], [dnl
333tun_id=2,actions=output:3
334tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
335tun_id=4,actions=output:5
336])
337
a36de779 338OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
339AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
340
e79a6c83 341AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
345 p3 3/3: (dummy)
346 p4 4/4: (dummy)
347 p5 5/5: (dummy)
0f538378
EJ
348])
349
65da723b 350AT_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])
0f538378
EJ
351AT_CHECK([tail -1 stdout], [0], [dnl
352Datapath actions: 3
353])
354
65da723b 355AT_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])
0f538378 356AT_CHECK([tail -1 stdout], [0], [dnl
8e4c1621 357Datapath actions: 4,3,set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,5
0f538378
EJ
358])
359
65da723b 360AT_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])
0f538378
EJ
361AT_CHECK([tail -1 stdout], [0], [dnl
362Datapath actions: 4,3,5
363])
364
65da723b 365AT_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])
0f538378 366AT_CHECK([tail -1 stdout], [0], [dnl
6b83a3c5 367Datapath actions: drop
0f538378
EJ
368])
369
370OVS_VSWITCHD_STOP
371AT_CLEANUP
d302e2e7 372
c1fc1411
JG
373AT_SETUP([tunnel - Geneve])
374OVS_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])
376
377AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
378 br0 65534/100: (dummy-internal)
379 p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
c1fc1411
JG
380])
381
382OVS_VSWITCHD_STOP
383AT_CLEANUP
384
d302e2e7
KM
385AT_SETUP([tunnel - VXLAN])
386OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
387 options:remote_ip=1.1.1.1 ofport_request=1])
388
e79a6c83 389AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
390 br0 65534/100: (dummy-internal)
391 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
d302e2e7
KM
392])
393
394OVS_VSWITCHD_STOP
395AT_CLEANUP
396
397AT_SETUP([tunnel - LISP])
398OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
399 options:remote_ip=1.1.1.1 ofport_request=1])
400
e79a6c83 401AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
402 br0 65534/100: (dummy-internal)
403 p1 1/4341: (lisp: remote_ip=1.1.1.1)
d302e2e7
KM
404])
405
406OVS_VSWITCHD_STOP
407AT_CLEANUP
408
7dc18ae9
WT
409AT_SETUP([tunnel - ERSPAN])
410OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=erspan \
068794b4
GR
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\
423 ])
7dc18ae9
WT
424
425AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
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)
068794b4
GR
431])
432
433dnl Check ERSPAN v1 flow-based tunnel push
434AT_CHECK([ovs-ofctl add-flow br0 "in_port=1, actions=set_tunnel:11,set_field:0x1->tun_erspan_idx,2"])
435
436dnl Check ERSPAN v2 flow-based tunnel push
437AT_CHECK([ovs-ofctl add-flow br0 "in_port=2, actions=set_field:1->tun_erspan_dir,set_field:0x0->tun_erspan_hwid,3"])
438
439AT_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"])
440
441AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
442[0], [dnl
443NXST_FLOW reply:
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
7dc18ae9
WT
447])
448
449OVS_VSWITCHD_STOP
450AT_CLEANUP
451
d302e2e7
KM
452AT_SETUP([tunnel - different VXLAN UDP port])
453OVS_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])
455
e79a6c83 456AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
457 br0 65534/100: (dummy-internal)
458 p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
d302e2e7
KM
459])
460
461dnl change UDP port
462
463AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
464
e79a6c83 465AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
466 br0 65534/100: (dummy-internal)
467 p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
d302e2e7
KM
468])
469
470dnl change UDP port to default
471
4f2abb7b 472AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
d302e2e7 473
e79a6c83 474AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
475 br0 65534/100: (dummy-internal)
476 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
d302e2e7 477])
0ad90c84
JR
478OVS_VSWITCHD_STOP
479AT_CLEANUP
d302e2e7 480
0ad90c84
JR
481AT_SETUP([ofproto-dpif - set_field - tun_src/tun_dst/tun_id])
482OVS_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])
a36de779
PS
493
494OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
ca5792f0 495add_of_ports br0 90
0ad90c84
JR
496AT_DATA([flows.txt], [dnl
497in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
498in_port=1 actions=set_field:42->tun_id,output:1
499in_port=2 actions=set_field:3.3.3.3->tun_dst,output:2
500in_port=3 actions=set_field:1.1.1.1->tun_src,set_field:4.4.4.4->tun_dst,output:3
501in_port=4 actions=set_field:2.2.2.2->tun_dst,output:4
502in_port=5 actions=set_field:5->tun_id
503])
504AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 505AT_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])
0ad90c84 506AT_CHECK([tail -1 stdout], [0],
8e4c1621 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
0ad90c84 508])
d302e2e7
KM
509OVS_VSWITCHD_STOP
510AT_CLEANUP
9558d2a5 511
98514eea
WT
512AT_SETUP([tunnel - ERSPAN v1/v2 metadata])
513OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy \
514 ofport_request=1 \
515 -- add-port br0 p2 -- set Interface p2 type=dummy \
516 ofport_request=2 \
517 -- add-port br0 p3 -- set Interface p3 type=erspan \
518 options:remote_ip=1.1.1.1 ofport_request=3 \
519 options:key=1 options:erspan_ver=1 options:erspan_idx=7 \
520 -- add-port br0 p4 -- set Interface p4 type=erspan \
521 options:remote_ip=1.1.1.2 ofport_request=4 \
522 options:key=2 options:erspan_ver=2 options:erspan_dir=1 options:erspan_hwid=7 \
523 ])
524OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
525
526AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
527 br0 65534/100: (dummy-internal)
528 p1 1/3: (dummy)
529 p2 2/2: (dummy)
530 p3 3/1: (erspan: erspan_idx=0x7, erspan_ver=1, key=1, remote_ip=1.1.1.1)
531 p4 4/1: (erspan: erspan_dir=1, erspan_hwid=0x7, erspan_ver=2, key=2, remote_ip=1.1.1.2)
98514eea
WT
532])
533
534AT_DATA([flows.txt], [dnl
535in_port=1,actions=3
536in_port=2,actions=4
537in_port=3,tun_erspan_ver=1,tun_erspan_idx=0x7,actions=1
538in_port=4,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0xf/0x1,actions=2
539])
540AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
541
542dnl test encap: in_port=1,actions=3 (erspan v1 port)
543AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),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])
544AT_CHECK([tail -1 stdout], [0],
545 [Datapath actions: set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,erspan(ver=1,idx=0x7),flags(df|key))),1
546])
547
548dnl test encap: in_port=2,actions=4 (erspan v2 port)
549AT_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])
550AT_CHECK([tail -1 stdout], [0],
551 [Datapath actions: set(tunnel(tun_id=0x2,dst=1.1.1.2,ttl=64,erspan(ver=2,dir=1,hwid=0x7),flags(df|key))),1
552])
553
554dnl receive packet from ERSPAN port with v1 metadata
555AT_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(1),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])
556AT_CHECK([tail -2 stdout], [0],
068794b4 557 [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
98514eea
WT
558Datapath actions: 3
559])
560
561dnl receive packet from ERSPAN port with wrong v1 metadata
562AT_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(1),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])
563AT_CHECK([tail -2 stdout], [0],
068794b4 564 [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
98514eea
WT
565Datapath actions: drop
566])
567
568dnl receive packet from ERSPAN port with v2 metadata
569AT_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(1),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])
570AT_CHECK([tail -2 stdout], [0],
068794b4 571 [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
98514eea
WT
572Datapath actions: 2
573])
574
575dnl receive packet from ERSPAN port with wrong v2 metadata
576AT_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(1),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])
577AT_CHECK([tail -2 stdout], [0],
068794b4 578 [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
98514eea
WT
579Datapath actions: drop
580])
581
582dnl test wildcard mask: recevie all v2 regardless of its metadata
583AT_CHECK([ovs-ofctl del-flows br0 in_port=4,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0xf/0x1])
584AT_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])
585
586AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
587[0], [dnl
588NXST_FLOW reply:
589 in_port=1 actions=output:3
590 in_port=2 actions=output:4
068794b4
GR
591 tun_erspan_ver=1,tun_erspan_idx=0x7,in_port=3 actions=output:1
592 tun_erspan_ver=2,in_port=4 actions=output:2
98514eea
WT
593])
594
595dnl this time it won't drop
596AT_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(1),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])
597AT_CHECK([tail -2 stdout], [0],
068794b4 598 [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
98514eea
WT
599Datapath actions: 2
600])
601
068794b4
GR
602dnl flow-based erspan_idx options
603AT_CHECK([ovs-vsctl add-port br0 p5 -- set Interface p5 type=erspan \
604 options:remote_ip=1.1.1.2 ofport_request=5 \
605 options:key=flow options:erspan_ver=1 options:erspan_idx=flow])
606
607AT_CHECK([ovs-ofctl del-flows br0])
608AT_CHECK([ovs-ofctl add-flow br0 "in_port=1, actions=set_tunnel:11,set_field:0x7->tun_erspan_idx,5"])
609
610AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
611[0], [dnl
612NXST_FLOW reply:
613 in_port=1 actions=set_tunnel:0xb,set_field:0x7->tun_erspan_idx,output:5
614])
615
616AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(3),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])
617AT_CHECK([tail -1 stdout], [0],
618 [Datapath actions: set(tunnel(tun_id=0xb,dst=1.1.1.2,ttl=64,erspan(ver=1,idx=0x7),flags(df|key))),1
619])
620
98514eea
WT
621OVS_VSWITCHD_STOP
622AT_CLEANUP
623
9558d2a5
JG
624AT_SETUP([tunnel - Geneve metadata])
625OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
626 options:remote_ip=1.1.1.1 ofport_request=1 \
627 -- add-port br0 p2 -- set Interface p2 type=dummy \
628 ofport_request=2 ofport_request=2])
629OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
630
4e548ad9 631AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0,{class=0xffff,type=1,len=8}->tun_metadata1"])
9558d2a5
JG
632
633AT_DATA([flows.txt], [dnl
634in_port=2,actions=set_field:0xa->tun_metadata0,set_field:0x1234567890abcdef->tun_metadata1,1
635tun_metadata0=0xb/0xf,actions=2
636])
637AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
638
639dnl Option generation
640AT_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])
641AT_CHECK([tail -1 stdout], [0],
998300ec 642 [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
9558d2a5
JG
643])
644
645dnl Option match
beb75a40 646AT_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])
9558d2a5 647AT_CHECK([tail -2 stdout], [0],
e3981271 648 [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
9558d2a5
JG
649Datapath actions: 2
650])
651
652dnl Skip unknown option
beb75a40 653AT_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])
9558d2a5 654AT_CHECK([tail -2 stdout], [0],
e3981271 655 [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
9558d2a5
JG
656Datapath actions: 2
657])
658
659dnl Check mapping table constraints
1cb20095 660AT_CHECK([ovs-ofctl del-flows br0])
4e548ad9
ML
661AT_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],
662[OFPT_ERROR (xid=0x4): NXTTMFC_TABLE_FULL
663NXT_TLV_TABLE_MOD (xid=0x4):
9558d2a5 664 ADD mapping table:
5a0e4aec
BP
665 class type length match field
666 ------ ---- ------ --------------
667 0xffff 0x2 124 tun_metadata2
668 0xffff 0x3 124 tun_metadata3
9558d2a5
JG
669])
670
4f7b100c
JG
671AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0,tun_metadata0,actions=drop"], [1], [ignore],
672[ovs-ofctl: field tun_metadata0 set multiple times
673])
674
675AT_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],
676[ovs-ofctl: field tun_metadata4 exceeds maximum size for tunnel metadata (used 320, max 256)
677])
678
9558d2a5 679dnl Allocation and match with fragmented address space
4e548ad9
ML
680AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=124}->tun_metadata2"])
681AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
682AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=4,len=112}->tun_metadata4"])
683AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
684AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=8}->tun_metadata3"])
9558d2a5
JG
685
686AT_CHECK([ovs-ofctl add-flow br0 tun_metadata3=0x1234567890abcdef,actions=2])
beb75a40 687AT_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])
9558d2a5 688AT_CHECK([tail -2 stdout], [0],
e3981271 689 [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
9558d2a5
JG
690Datapath actions: 2
691])
692
5c7c16d8
YHW
693AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
694[0], [dnl
695NXST_FLOW reply:
696 tun_metadata3=0x1234567890abcdef actions=output:2
697])
698
699dnl A TLV mapping should not be removed if any active flow uses the mapping.
700AT_CHECK([ovs-ofctl del-tlv-map br0], [1], [], [dnl
701OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
702NXT_TLV_TABLE_MOD (xid=0x4):
703 CLEAR
704])
705
706AT_CHECK([ovs-ofctl del-flows br0], [0])
707AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
708
709dnl Flow modification
710AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata0"])
711AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata1"])
712AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata2"])
713
714AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[0..31]])"])
715AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]],clone(move:tun_metadata2[[0..31]]->reg0[[0..31]])"])
716
717AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=output:4"])
718AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata0"])
719
720AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata2[[0..31]]"])
721AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata1"])
722AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata2"], [1], [], [dnl
723OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
724NXT_TLV_TABLE_MOD (xid=0x4):
725 DEL mapping table:
5a0e4aec
BP
726 class type length match field
727 ------ ---- ------ --------------
728 0xffff 0x3 4 tun_metadata2
5c7c16d8
YHW
729])
730
731AT_CHECK([ovs-ofctl del-flows br0], [0])
732AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
733
734dnl Learn action
735AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"])
736AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata2"])
737AT_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[[]])"])
738AT_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]])"])
739flow1="in_port(2),eth(src=00:00:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800)"
740flow2="in_port(2),eth(src=00:00:00:00:00:02,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800)"
741AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow1" -generate], [0], [stdout])
742AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow2" -generate], [0], [stdout])
743
744dnl Delete flows with learn action
745AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"])
746
747AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"], [1], [], [dnl
748OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
749NXT_TLV_TABLE_MOD (xid=0x4):
750 DEL mapping table:
5a0e4aec
BP
751 class type length match field
752 ------ ---- ------ --------------
753 0xffff 0x1 4 tun_metadata1
5c7c16d8
YHW
754])
755AT_CHECK([ovs-ofctl del-flows br0 "tun_metadata1"])
756AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"])
757
758AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata2"], [1], [], [dnl
759OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
760NXT_TLV_TABLE_MOD (xid=0x4):
761 DEL mapping table:
5a0e4aec
BP
762 class type length match field
763 ------ ---- ------ --------------
764 0xffff 0x2 4 tun_metadata2
5c7c16d8
YHW
765])
766AT_CHECK([ovs-ofctl del-flows br0 "reg1=0xFF"])
767AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
9558d2a5
JG
768
769OVS_VSWITCHD_STOP
770AT_CLEANUP
1cb20095
JG
771
772AT_SETUP([tunnel - Geneve option present])
773OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
774 options:remote_ip=1.1.1.1 ofport_request=1 \
775 -- add-port br0 p2 -- set Interface p2 type=dummy \
776 ofport_request=2 ofport_request=2])
777OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
778
4e548ad9 779AT_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"])
1cb20095
JG
780
781AT_DATA([flows.txt], [dnl
782priority=1,tun_metadata0,actions=2
783priority=2,tun_metadata1=0,actions=IN_PORT
784priority=3,tun_metadata2=0,actions=drop
785])
786AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
787
788AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
789[0], [dnl
790 priority=1,tun_metadata0 actions=output:2
791 priority=2,tun_metadata1 actions=IN_PORT
792 priority=3,tun_metadata2=0 actions=drop
793NXST_FLOW reply:
794])
795
beb75a40 796AT_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])
1cb20095 797AT_CHECK([tail -2 stdout], [0],
e3981271 798 [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
1cb20095
JG
799Datapath actions: 2
800])
801
beb75a40 802AT_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])
1cb20095 803AT_CHECK([tail -2 stdout], [0],
e3981271 804 [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
81f9ef5a 805Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=6081,geneve({class=0xffff,type=0x1,len=0}),flags(df))),6081
1cb20095
JG
806])
807
110f7c75
TLSC
808OVS_VSWITCHD_STOP
809AT_CLEANUP
810
811AT_SETUP([tunnel - concomitant IPv6 and IPv4 tunnels])
812OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
813 options:remote_ip=1.1.1.1 ofport_request=1 \
814 -- add-port br0 p2 -- set Interface p2 type=vxlan \
815 options:remote_ip=2001:cafe::1 ofport_request=2])
816AT_DATA([flows.txt], [dnl
817in_port=1,actions=2
818in_port=2,actions=1
819])
820OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
821
822AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
823
824AT_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])
825AT_CHECK([tail -1 stdout], [0],
81f9ef5a 826 [Datapath actions: set(tunnel(ipv6_dst=2001:cafe::1,ttl=64,tp_dst=4789,flags(df))),4789
110f7c75
TLSC
827])
828
829AT_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])
830AT_CHECK([tail -1 stdout], [0],
81f9ef5a 831 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=4789,flags(df))),4789
110f7c75
TLSC
832])
833
834
81f9ef5a
WT
835OVS_VSWITCHD_STOP
836AT_CLEANUP
837
838AT_SETUP([tunnel - Mix Geneve/GRE options])
839OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
840 options:remote_ip=1.1.1.1 options:csum=true ofport_request=1 \
841 -- add-port br0 p2 -- set Interface p2 type=dummy \
842 ofport_request=2 ofport_request=2 \
843 -- add-port br0 p3 -- set Interface p3 type=gre \
844 options:remote_ip=2.2.2.2 options:csum=false options:key=123 ofport_request=3])
845OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
846
847AT_DATA([flows.txt], [dnl
848priority=1,in_port=1,actions=3
849])
850AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
851
852AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
853[0], [dnl
854 priority=1,in_port=1 actions=output:3
855NXST_FLOW reply:
856])
857
858dnl the input packet from geneve tunnel has flags(-df+csum+key) flags, making
859dnl sure that the output gre tunnel has (+df-csum+key).
860AT_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])
861AT_CHECK([tail -2 stdout], [0],
862 [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
863Datapath actions: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,flags(df|key))),1
864])
865
c6d87201
WT
866AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
867AT_CHECK([ovs-ofctl del-flows br0])
868
869AT_DATA([flows2.txt], [dnl
870priority=1,in_port=1,tun_metadata0=0x123, actions=3
871])
872AT_CHECK([ovs-ofctl add-flows br0 flows2.txt])
873
874AT_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])
875AT_CHECK([tail -2 stdout], [0],
876 [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
877Datapath actions: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,flags(df|key))),1
878])
879
880dnl without the fix, the actions have geneve options:
881dnl set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,geneve({class=0xffff,type=0,len=4,0x123}),flags(df|key))),1
882dnl which is not correct
883
1cb20095
JG
884OVS_VSWITCHD_STOP
885AT_CLEANUP