]> git.proxmox.com Git - mirror_ovs.git/blame - tests/tunnel.at
raft: Fix raft_is_connected() when there is no leader yet.
[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
d40533fc 58no OpenFlow tunnel port for this packet
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])
a13a0209
AT
105AT_CHECK([tail -3 stdout], [0],
106 [Final flow: unchanged
107Megaflow: 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 108Datapath actions: drop
4863c249
JP
109])
110OVS_VSWITCHD_STOP(["/dropping tunnel packet marked ECN CE but is not ECN capable/d"])
0f538378
EJ
111AT_CLEANUP
112
113AT_SETUP([tunnel - output])
114OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
115 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
116 options:key=5 ofport_request=1\
117 -- add-port br0 p2 -- set Interface p2 type=dummy \
b3632186 118 ofport_request=2])
0f538378
EJ
119AT_DATA([flows.txt], [dnl
120actions=output:1
121])
122
a36de779 123OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
124AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
125
e79a6c83 126AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
127 br0 65534/100: (dummy-internal)
128 p1 1/1: (gre: key=5, local_ip=2.2.2.2, remote_ip=1.1.1.1)
129 p2 2/2: (dummy)
0f538378
EJ
130])
131
132dnl Basic
50aa28fd 133AT_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 134AT_CHECK([tail -1 stdout], [0],
8e4c1621 135 [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
136])
137
138dnl ECN
50aa28fd 139AT_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 140AT_CHECK([tail -1 stdout], [0],
8e4c1621 141 [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
142])
143OVS_VSWITCHD_STOP
144AT_CLEANUP
145
f574ff4a
AA
146AT_SETUP([tunnel - unencrypted tunnel and not setting skb_mark])
147OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
148 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
149 options:key=5 ofport_request=1\
150 -- add-port br0 p2 -- set Interface p2 type=dummy \
151 ofport_request=2 ofport_request=2])
152AT_DATA([flows.txt], [dnl
153actions=output:1
154])
155OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
156AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
157AT_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])
158AT_CHECK([tail -1 stdout], [0],
159 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,ttl=64,flags(df|key))),1
160])
161OVS_VSWITCHD_STOP
162AT_CLEANUP
163
164AT_SETUP([tunnel - unencrypted tunnel and setting skb_mark to 1])
165OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
166 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
167 options:key=5 ofport_request=1\
168 -- add-port br0 p2 -- set Interface p2 type=dummy \
169 ofport_request=2 ofport_request=2])
170AT_DATA([flows.txt], [dnl
171actions=load:0x1->NXM_NX_PKT_MARK[[]],output:1
172])
173OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
174AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
175AT_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])
176AT_CHECK([tail -1 stdout], [0],
177 [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
178])
179OVS_VSWITCHD_STOP
180AT_CLEANUP
181
182AT_SETUP([tunnel - unencrypted tunnel and setting skb_mark to 2])
183OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
184 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
185 options:key=5 ofport_request=1\
186 -- add-port br0 p2 -- set Interface p2 type=dummy \
187 ofport_request=2 ofport_request=2])
188AT_DATA([flows.txt], [dnl
189actions=load:0x2->NXM_NX_PKT_MARK[[]],output:1
190])
191OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
192AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
193AT_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])
194AT_CHECK([tail -1 stdout], [0],
195 [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
196])
a13a0209
AT
197
198AT_CHECK([ovs-appctl netdev-dummy/receive p2 'aa55aa550001f8bc124434b6080045000054ba20000040018486010103580101037001004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
199
200ovs-appctl time/warp 5000
201
202AT_CHECK([
203ovs-appctl coverage/read-counter datapath_drop_invalid_port
204], [0], [dnl
2051
206])
207
f574ff4a
AA
208OVS_VSWITCHD_STOP
209AT_CLEANUP
210
0f538378
EJ
211AT_SETUP([tunnel - ToS and TTL inheritance])
212OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
213 options:remote_ip=1.1.1.1 options:tos=inherit \
214 options:ttl=inherit ofport_request=1 \
215 -- add-port br0 p2 -- set Interface p2 type=dummy \
216 ofport_request=2 ofport_request=2])
217AT_DATA([flows.txt], [dnl
218actions=output:1
219])
220
a36de779 221OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
222AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
223
e79a6c83 224AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
225 br0 65534/100: (dummy-internal)
226 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
227 p2 2/2: (dummy)
0f538378
EJ
228])
229
230dnl Basic
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(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 232AT_CHECK([tail -1 stdout], [0],
65da723b 233 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x4,ttl=128,flags(df))),1
0f538378
EJ
234])
235
236dnl ECN
50aa28fd 237AT_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 238AT_CHECK([tail -1 stdout], [0],
65da723b 239 [Datapath actions: set(tunnel(dst=1.1.1.1,tos=0x5,ttl=128,flags(df))),1
0f538378
EJ
240])
241
242dnl non-IP
50aa28fd 243AT_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 244AT_CHECK([tail -1 stdout], [0],
65da723b 245 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,flags(df))),1
0f538378
EJ
246])
247OVS_VSWITCHD_STOP
248AT_CLEANUP
249
250AT_SETUP([tunnel - set_tunnel])
251OVS_VSWITCHD_START([dnl
252 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
253 options:remote_ip=1.1.1.1 ofport_request=1 \
254 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
255 options:remote_ip=2.2.2.2 ofport_request=2 \
256 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
257 options:remote_ip=3.3.3.3 ofport_request=3 \
258 -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
259 options:remote_ip=4.4.4.4 ofport_request=4])
260AT_DATA([flows.txt], [dnl
261actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
262])
263
a36de779 264OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
265AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
266
e79a6c83 267AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
268 br0 65534/100: (dummy-internal)
269 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
270 p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
271 p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
272 p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
0f538378
EJ
273])
274
50aa28fd 275AT_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 276AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
277set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
278set(tunnel(tun_id=0x2,dst=2.2.2.2,ttl=64,flags(df|key))),1,dnl
279set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,dnl
280set(tunnel(tun_id=0x5,dst=4.4.4.4,ttl=64,flags(df|key))),1
0f538378
EJ
281])
282OVS_VSWITCHD_STOP
283AT_CLEANUP
284
285AT_SETUP([tunnel - key])
286OVS_VSWITCHD_START([dnl
287 add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
288 options:remote_ip=1.1.1.1 ofport_request=1 \
289 -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
290 options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
291 -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
292 options:remote_ip=1.1.1.1 ofport_request=3])
293AT_DATA([flows.txt], [dnl
294actions=IN_PORT,output:1,output:2,output:3
295])
296
a36de779 297OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
298AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
299
e79a6c83 300AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
301 br0 65534/100: (dummy-internal)
302 p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
303 p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
304 p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
0f538378
EJ
305])
306
65da723b 307AT_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 308AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
309set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
310set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
311set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
312])
313
65da723b 314AT_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 315AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
316set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
317set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
318set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
319])
320
65da723b 321AT_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 322AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
8e4c1621
JG
323set(tunnel(tun_id=0x5,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
324set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,flags(df|key))),1,dnl
325set(tunnel(tun_id=0x3,dst=1.1.1.1,ttl=64,flags(df|key))),1
0f538378
EJ
326])
327
65da723b 328AT_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
d40533fc 329no OpenFlow tunnel port for this packet
0f538378
EJ
330ovs-appctl: ovs-vswitchd: server returned an error
331])
6e1fb7e1 332OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
0f538378
EJ
333AT_CLEANUP
334
335AT_SETUP([tunnel - key match])
336OVS_VSWITCHD_START([dnl
337 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
338 options:remote_ip=1.1.1.1 ofport_request=1 \
339 -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
340 options:remote_ip=3.3.3.3 ofport_request=2 \
341 -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
342 -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
343 -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
344AT_DATA([flows.txt], [dnl
345tun_id=2,actions=output:3
346tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
347tun_id=4,actions=output:5
348])
349
a36de779 350OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
351AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
352
e79a6c83 353AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
354 br0 65534/100: (dummy-internal)
355 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
356 p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
357 p3 3/3: (dummy)
358 p4 4/4: (dummy)
359 p5 5/5: (dummy)
0f538378
EJ
360])
361
65da723b 362AT_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
363AT_CHECK([tail -1 stdout], [0], [dnl
364Datapath actions: 3
365])
366
65da723b 367AT_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 368AT_CHECK([tail -1 stdout], [0], [dnl
8e4c1621 369Datapath actions: 4,3,set(tunnel(tun_id=0x3,dst=3.3.3.3,ttl=64,flags(df|key))),1,5
0f538378
EJ
370])
371
65da723b 372AT_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
373AT_CHECK([tail -1 stdout], [0], [dnl
374Datapath actions: 4,3,5
375])
376
65da723b 377AT_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 378AT_CHECK([tail -1 stdout], [0], [dnl
6b83a3c5 379Datapath actions: drop
0f538378
EJ
380])
381
382OVS_VSWITCHD_STOP
383AT_CLEANUP
d302e2e7 384
c1fc1411
JG
385AT_SETUP([tunnel - Geneve])
386OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
387 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=5000])
388
389AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
390 br0 65534/100: (dummy-internal)
391 p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
c1fc1411
JG
392])
393
394OVS_VSWITCHD_STOP
395AT_CLEANUP
396
d302e2e7
KM
397AT_SETUP([tunnel - VXLAN])
398OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
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/4789: (vxlan: remote_ip=1.1.1.1)
d302e2e7
KM
404])
405
406OVS_VSWITCHD_STOP
407AT_CLEANUP
408
ea41c034
FL
409AT_SETUP([tunnel - table version])
410dnl check if changes in the egress bridge flow table affects
411dnl discovering the link layer address of tunnel endpoints.
412OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00])
413AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
414AT_CHECK([ovs-vsctl add-port int-br v1 -- set Interface v1 type=vxlan \
415 options:remote_ip=172.31.1.2 options:key=123 \
416 ofport_request=2 \
417 -- add-port int-br v2 -- set Interface v2 type=internal \
418 ofport_request=3 \
419 ], [0])
420
421AT_CHECK([ovs-appctl dpif/show], [0], [dnl
422dummy@ovs-dummy: hit:0 missed:0
423 br0:
424 br0 65534/100: (dummy-internal)
425 p0 1/1: (dummy)
426 int-br:
427 int-br 65534/2: (dummy-internal)
428 v1 2/4789: (vxlan: key=123, remote_ip=172.31.1.2)
429 v2 3/3: (dummy-internal)
430])
431
432dnl First setup dummy interface IP address, then add the route
433dnl so that tnl-port table can get valid IP address for the device.
434AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 172.31.1.1/24], [0], [OK
435])
436AT_CHECK([ovs-appctl ovs/route/add 172.31.1.0/24 br0], [0], [OK
437])
438
439dnl change the flow table to bump the internal table version
440AT_CHECK([ovs-ofctl add-flow int-br action=normal])
441AT_CHECK([ovs-ofctl add-flow br0 action=normal])
442AT_CHECK([ovs-ofctl del-flows br0])
443AT_CHECK([ovs-ofctl add-flow br0 action=normal])
444AT_CHECK([ovs-ofctl del-flows br0])
445AT_CHECK([ovs-ofctl add-flow br0 action=normal])
446AT_CHECK([ovs-ofctl del-flows br0])
447AT_CHECK([ovs-ofctl add-flow br0 action=normal])
448AT_CHECK([ovs-ofctl del-flows br0])
449AT_CHECK([ovs-ofctl add-flow br0 action=normal])
450AT_CHECK([ovs-ofctl del-flows br0])
451AT_CHECK([ovs-ofctl add-flow br0 action=normal])
452AT_CHECK([ovs-ofctl del-flows br0])
453AT_CHECK([ovs-ofctl add-flow br0 action=normal])
454AT_CHECK([ovs-ofctl del-flows br0])
455AT_CHECK([ovs-ofctl add-flow br0 action=normal])
456
457dnl Check Neighbour discovery.
458AT_CHECK([ovs-vsctl -- set Interface p0 options:pcap=p0.pcap])
459
460AT_CHECK([ovs-appctl netdev-dummy/receive int-br 'in_port(2),eth(src=aa:55:aa:55:00:00,dst=f8:bc:12:ff:ff:ff),eth_type(0x0800),ipv4(src=1.1.3.92,dst=1.1.3.88,proto=1,tos=0,ttl=64,frag=no),icmp(type=0,code=0)'])
461AT_CHECK([ovs-pcap p0.pcap > p0.pcap.txt 2>&1])
462
463dnl When the wrong version is used, the flow is not visible and the
464dnl packet is dropped.
465AT_CHECK([cat p0.pcap.txt | grep ffffffffffffaa55aa55000008060001080006040001aa55aa550000ac1f0101000000000000ac1f0102 | uniq], [0], [dnl
466ffffffffffffaa55aa55000008060001080006040001aa55aa550000ac1f0101000000000000ac1f0102
467])
468OVS_VSWITCHD_STOP
469AT_CLEANUP
470
d302e2e7
KM
471AT_SETUP([tunnel - LISP])
472OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
473 options:remote_ip=1.1.1.1 ofport_request=1])
474
e79a6c83 475AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
476 br0 65534/100: (dummy-internal)
477 p1 1/4341: (lisp: remote_ip=1.1.1.1)
d302e2e7
KM
478])
479
480OVS_VSWITCHD_STOP
481AT_CLEANUP
482
7dc18ae9
WT
483AT_SETUP([tunnel - ERSPAN])
484OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=erspan \
068794b4
GR
485 options:remote_ip=1.1.1.1 options:key=1 options:erspan_ver=1 \
486 options:erspan_idx=0x0 ofport_request=1 \
487 -- add-port br0 p2 -- set Interface p2 type=erspan \
488 options:remote_ip=1.1.1.1 ofport_request=2 \
489 options:key=flow options:erspan_ver=1 options:erspan_idx=flow \
490 -- add-port br0 p3 -- set Interface p3 type=erspan \
491 options:remote_ip=1.1.1.1 ofport_request=3 \
492 options:key=10 options:erspan_ver=2 options:erspan_dir=flow \
493 options:erspan_hwid=flow \
494 -- add-port br0 p4 -- set Interface p4 type=erspan \
495 options:remote_ip=1.2.3.4 ofport_request=4 \
496 options:key=flow options:erspan_ver=flow\
497 ])
7dc18ae9
WT
498
499AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
500 br0 65534/100: (dummy-internal)
501 p1 1/1: (erspan: erspan_idx=0x0, erspan_ver=1, key=1, remote_ip=1.1.1.1)
502 p2 2/1: (erspan: erspan_idx=flow, erspan_ver=1, key=flow, remote_ip=1.1.1.1)
503 p3 3/1: (erspan: erspan_dir=flow, erspan_hwid=flow, erspan_ver=2, key=10, remote_ip=1.1.1.1)
504 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
505])
506
507dnl Check ERSPAN v1 flow-based tunnel push
508AT_CHECK([ovs-ofctl add-flow br0 "in_port=1, actions=set_tunnel:11,set_field:0x1->tun_erspan_idx,2"])
509
510dnl Check ERSPAN v2 flow-based tunnel push
511AT_CHECK([ovs-ofctl add-flow br0 "in_port=2, actions=set_field:1->tun_erspan_dir,set_field:0x0->tun_erspan_hwid,3"])
512
513AT_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"])
514
515AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
516[0], [dnl
517NXST_FLOW reply:
518 in_port=1 actions=set_tunnel:0xb,set_field:0x1->tun_erspan_idx,output:2
519 in_port=2 actions=set_field:1->tun_erspan_dir,set_field:0->tun_erspan_hwid,output:3
520 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
521])
522
523OVS_VSWITCHD_STOP
524AT_CLEANUP
525
d302e2e7
KM
526AT_SETUP([tunnel - different VXLAN UDP port])
527OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
528 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
529
e79a6c83 530AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
531 br0 65534/100: (dummy-internal)
532 p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
d302e2e7
KM
533])
534
535dnl change UDP port
536
537AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
538
e79a6c83 539AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
540 br0 65534/100: (dummy-internal)
541 p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
d302e2e7
KM
542])
543
544dnl change UDP port to default
545
4f2abb7b 546AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
d302e2e7 547
e79a6c83 548AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47
BP
549 br0 65534/100: (dummy-internal)
550 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
d302e2e7 551])
0ad90c84
JR
552OVS_VSWITCHD_STOP
553AT_CLEANUP
d302e2e7 554
0ad90c84
JR
555AT_SETUP([ofproto-dpif - set_field - tun_src/tun_dst/tun_id])
556OVS_VSWITCHD_START([dnl
557 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
558 options:remote_ip=1.1.1.1 ofport_request=1 \
559 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
560 options:remote_ip=flow ofport_request=2 \
561 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
562 options:remote_ip=flow options:local_ip=flow ofport_request=3 \
563 -- add-port br0 p4 -- set Interface p4 type=gre options:key=3 \
564 options:remote_ip=flow ofport_request=4 \
565 -- add-port br0 p5 -- set Interface p5 type=gre options:key=flow \
566 options:remote_ip=5.5.5.5 ofport_request=5])
a36de779
PS
567
568OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
ca5792f0 569add_of_ports br0 90
0ad90c84
JR
570AT_DATA([flows.txt], [dnl
571in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
572in_port=1 actions=set_field:42->tun_id,output:1
573in_port=2 actions=set_field:3.3.3.3->tun_dst,output:2
574in_port=3 actions=set_field:1.1.1.1->tun_src,set_field:4.4.4.4->tun_dst,output:3
575in_port=4 actions=set_field:2.2.2.2->tun_dst,output:4
576in_port=5 actions=set_field:5->tun_id
577])
578AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 579AT_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 580AT_CHECK([tail -1 stdout], [0],
8e4c1621 581 [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 582])
d302e2e7
KM
583OVS_VSWITCHD_STOP
584AT_CLEANUP
9558d2a5 585
98514eea
WT
586AT_SETUP([tunnel - ERSPAN v1/v2 metadata])
587OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy \
588 ofport_request=1 \
589 -- add-port br0 p2 -- set Interface p2 type=dummy \
fe8108c7
BP
590 ofport_request=2])
591
592# Add these ports separately to ensure that they get the datapath port
593# number expected below.
594ovs-vsctl -- add-port br0 p3 \
595 -- set Interface p3 type=erspan \
596 ofport_request=3 \
597 options:remote_ip=1.1.1.1 \
598 options:key=1 options:erspan_ver=1 \
599 options:erspan_idx=7 \
600 -- add-port br0 p4 \
601 -- set Interface p4 type=erspan \
602 ofport_request=4 \
603 options:remote_ip=1.1.1.2 \
604 options:key=2 options:erspan_ver=2 \
605 options:erspan_dir=1 \
606 options:erspan_hwid=7
98514eea
WT
607OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
608
609AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
7be29a47 610 br0 65534/100: (dummy-internal)
fe8108c7 611 p1 1/1: (dummy)
7be29a47 612 p2 2/2: (dummy)
fe8108c7
BP
613 p3 3/3: (erspan: erspan_idx=0x7, erspan_ver=1, key=1, remote_ip=1.1.1.1)
614 p4 4/3: (erspan: erspan_dir=1, erspan_hwid=0x7, erspan_ver=2, key=2, remote_ip=1.1.1.2)
98514eea
WT
615])
616
617AT_DATA([flows.txt], [dnl
618in_port=1,actions=3
619in_port=2,actions=4
620in_port=3,tun_erspan_ver=1,tun_erspan_idx=0x7,actions=1
621in_port=4,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0xf/0x1,actions=2
622])
623AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
624
625dnl test encap: in_port=1,actions=3 (erspan v1 port)
fe8108c7 626AT_CHECK([ovs-appctl ofproto/trace ovs-dummy '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=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
98514eea 627AT_CHECK([tail -1 stdout], [0],
fe8108c7 628 [Datapath actions: set(tunnel(tun_id=0x1,dst=1.1.1.1,ttl=64,erspan(ver=1,idx=0x7),flags(df|key))),3
98514eea
WT
629])
630
631dnl test encap: in_port=2,actions=4 (erspan v2 port)
632AT_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])
633AT_CHECK([tail -1 stdout], [0],
fe8108c7 634 [Datapath actions: set(tunnel(tun_id=0x2,dst=1.1.1.2,ttl=64,erspan(ver=2,dir=1,hwid=0x7),flags(df|key))),3
98514eea
WT
635])
636
637dnl receive packet from ERSPAN port with v1 metadata
fe8108c7 638AT_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(3),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])
98514eea 639AT_CHECK([tail -2 stdout], [0],
068794b4 640 [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
fe8108c7 641Datapath actions: 1
98514eea
WT
642])
643
644dnl receive packet from ERSPAN port with wrong v1 metadata
fe8108c7 645AT_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(3),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])
98514eea 646AT_CHECK([tail -2 stdout], [0],
068794b4 647 [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
648Datapath actions: drop
649])
650
651dnl receive packet from ERSPAN port with v2 metadata
fe8108c7 652AT_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(3),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])
98514eea 653AT_CHECK([tail -2 stdout], [0],
068794b4 654 [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
655Datapath actions: 2
656])
657
658dnl receive packet from ERSPAN port with wrong v2 metadata
fe8108c7 659AT_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(3),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])
98514eea 660AT_CHECK([tail -2 stdout], [0],
068794b4 661 [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
662Datapath actions: drop
663])
664
665dnl test wildcard mask: recevie all v2 regardless of its metadata
666AT_CHECK([ovs-ofctl del-flows br0 in_port=4,tun_erspan_ver=2,tun_erspan_dir=1,tun_erspan_hwid=0xf/0x1])
667AT_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])
668
e4e2009e 669AT_CHECK([ovs-ofctl --sort=in_port dump-flows br0 | ofctl_strip],
98514eea 670[0], [dnl
98514eea
WT
671 in_port=1 actions=output:3
672 in_port=2 actions=output:4
068794b4
GR
673 tun_erspan_ver=1,tun_erspan_idx=0x7,in_port=3 actions=output:1
674 tun_erspan_ver=2,in_port=4 actions=output:2
98514eea
WT
675])
676
677dnl this time it won't drop
fe8108c7 678AT_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(3),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])
98514eea 679AT_CHECK([tail -2 stdout], [0],
068794b4 680 [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
681Datapath actions: 2
682])
683
068794b4
GR
684dnl flow-based erspan_idx options
685AT_CHECK([ovs-vsctl add-port br0 p5 -- set Interface p5 type=erspan \
686 options:remote_ip=1.1.1.2 ofport_request=5 \
687 options:key=flow options:erspan_ver=1 options:erspan_idx=flow])
688
689AT_CHECK([ovs-ofctl del-flows br0])
690AT_CHECK([ovs-ofctl add-flow br0 "in_port=1, actions=set_tunnel:11,set_field:0x7->tun_erspan_idx,5"])
691
692AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
693[0], [dnl
694NXST_FLOW reply:
695 in_port=1 actions=set_tunnel:0xb,set_field:0x7->tun_erspan_idx,output:5
696])
697
fe8108c7 698AT_CHECK([ovs-appctl ofproto/trace ovs-dummy '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=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)'], [0], [stdout])
068794b4 699AT_CHECK([tail -1 stdout], [0],
fe8108c7 700 [Datapath actions: set(tunnel(tun_id=0xb,dst=1.1.1.2,ttl=64,erspan(ver=1,idx=0x7),flags(df|key))),3
068794b4
GR
701])
702
98514eea
WT
703OVS_VSWITCHD_STOP
704AT_CLEANUP
705
9558d2a5
JG
706AT_SETUP([tunnel - Geneve metadata])
707OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
708 options:remote_ip=1.1.1.1 ofport_request=1 \
709 -- add-port br0 p2 -- set Interface p2 type=dummy \
710 ofport_request=2 ofport_request=2])
711OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
712
4e548ad9 713AT_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
714
715AT_DATA([flows.txt], [dnl
716in_port=2,actions=set_field:0xa->tun_metadata0,set_field:0x1234567890abcdef->tun_metadata1,1
717tun_metadata0=0xb/0xf,actions=2
718])
719AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
720
721dnl Option generation
722AT_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])
723AT_CHECK([tail -1 stdout], [0],
998300ec 724 [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
725])
726
727dnl Option match
beb75a40 728AT_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 729AT_CHECK([tail -2 stdout], [0],
e3981271 730 [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
731Datapath actions: 2
732])
733
734dnl Skip unknown option
beb75a40 735AT_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 736AT_CHECK([tail -2 stdout], [0],
e3981271 737 [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
738Datapath actions: 2
739])
740
741dnl Check mapping table constraints
1cb20095 742AT_CHECK([ovs-ofctl del-flows br0])
4e548ad9
ML
743AT_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],
744[OFPT_ERROR (xid=0x4): NXTTMFC_TABLE_FULL
745NXT_TLV_TABLE_MOD (xid=0x4):
9558d2a5 746 ADD mapping table:
5a0e4aec
BP
747 class type length match field
748 ------ ---- ------ --------------
749 0xffff 0x2 124 tun_metadata2
750 0xffff 0x3 124 tun_metadata3
9558d2a5
JG
751])
752
4f7b100c
JG
753AT_CHECK([ovs-ofctl add-flow br0 "tun_metadata0,tun_metadata0,actions=drop"], [1], [ignore],
754[ovs-ofctl: field tun_metadata0 set multiple times
755])
756
757AT_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],
758[ovs-ofctl: field tun_metadata4 exceeds maximum size for tunnel metadata (used 320, max 256)
759])
760
9558d2a5 761dnl Allocation and match with fragmented address space
4e548ad9
ML
762AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=124}->tun_metadata2"])
763AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
764AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=4,len=112}->tun_metadata4"])
765AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata3"])
766AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=8}->tun_metadata3"])
9558d2a5
JG
767
768AT_CHECK([ovs-ofctl add-flow br0 tun_metadata3=0x1234567890abcdef,actions=2])
beb75a40 769AT_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 770AT_CHECK([tail -2 stdout], [0],
e3981271 771 [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
772Datapath actions: 2
773])
774
5c7c16d8
YHW
775AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip],
776[0], [dnl
777NXST_FLOW reply:
778 tun_metadata3=0x1234567890abcdef actions=output:2
779])
780
781dnl A TLV mapping should not be removed if any active flow uses the mapping.
782AT_CHECK([ovs-ofctl del-tlv-map br0], [1], [], [dnl
783OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
784NXT_TLV_TABLE_MOD (xid=0x4):
785 CLEAR
786])
787
788AT_CHECK([ovs-ofctl del-flows br0], [0])
789AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
790
791dnl Flow modification
792AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata0"])
793AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata1"])
794AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata2"])
795
796AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=multipath(eth_src,50,modulo_n,1,0,tun_metadata0[[0..31]])"])
797AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata1[[0..31]],clone(move:tun_metadata2[[0..31]]->reg0[[0..31]])"])
798
799AT_CHECK([ovs-ofctl add-flow br0 "in_port=1 actions=output:4"])
800AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata0"])
801
802AT_CHECK([ovs-ofctl add-flow br0 "in_port=2 actions=push:tun_metadata2[[0..31]]"])
803AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata1"])
804AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=3,len=4}->tun_metadata2"], [1], [], [dnl
805OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
806NXT_TLV_TABLE_MOD (xid=0x4):
807 DEL mapping table:
5a0e4aec
BP
808 class type length match field
809 ------ ---- ------ --------------
810 0xffff 0x3 4 tun_metadata2
5c7c16d8
YHW
811])
812
813AT_CHECK([ovs-ofctl del-flows br0], [0])
814AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
815
816dnl Learn action
817AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"])
818AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata2"])
819AT_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[[]])"])
820AT_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]])"])
821flow1="in_port(2),eth(src=00:00:00:00:00:01,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800)"
822flow2="in_port(2),eth(src=00:00:00:00:00:02,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0800)"
823AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow1" -generate], [0], [stdout])
824AT_CHECK([ovs-appctl ofproto/trace ovs-dummy "$flow2" -generate], [0], [stdout])
825
826dnl Delete flows with learn action
827AT_CHECK([ovs-ofctl del-flows br0 "in_port=2"])
828
829AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"], [1], [], [dnl
830OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
831NXT_TLV_TABLE_MOD (xid=0x4):
832 DEL mapping table:
5a0e4aec
BP
833 class type length match field
834 ------ ---- ------ --------------
835 0xffff 0x1 4 tun_metadata1
5c7c16d8
YHW
836])
837AT_CHECK([ovs-ofctl del-flows br0 "tun_metadata1"])
838AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=1,len=4}->tun_metadata1"])
839
840AT_CHECK([ovs-ofctl del-tlv-map br0 "{class=0xffff,type=2,len=4}->tun_metadata2"], [1], [], [dnl
841OFPT_ERROR (xid=0x4): NXTTMFC_INVALID_TLV_DEL
842NXT_TLV_TABLE_MOD (xid=0x4):
843 DEL mapping table:
5a0e4aec
BP
844 class type length match field
845 ------ ---- ------ --------------
846 0xffff 0x2 4 tun_metadata2
5c7c16d8
YHW
847])
848AT_CHECK([ovs-ofctl del-flows br0 "reg1=0xFF"])
849AT_CHECK([ovs-ofctl del-tlv-map br0], [0])
9558d2a5
JG
850
851OVS_VSWITCHD_STOP
852AT_CLEANUP
1cb20095
JG
853
854AT_SETUP([tunnel - Geneve option present])
855OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
856 options:remote_ip=1.1.1.1 ofport_request=1 \
857 -- add-port br0 p2 -- set Interface p2 type=dummy \
858 ofport_request=2 ofport_request=2])
859OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
860
4e548ad9 861AT_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
862
863AT_DATA([flows.txt], [dnl
864priority=1,tun_metadata0,actions=2
865priority=2,tun_metadata1=0,actions=IN_PORT
866priority=3,tun_metadata2=0,actions=drop
867])
868AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
869
870AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
871[0], [dnl
872 priority=1,tun_metadata0 actions=output:2
873 priority=2,tun_metadata1 actions=IN_PORT
874 priority=3,tun_metadata2=0 actions=drop
875NXST_FLOW reply:
876])
877
beb75a40 878AT_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 879AT_CHECK([tail -2 stdout], [0],
e3981271 880 [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
881Datapath actions: 2
882])
883
beb75a40 884AT_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 885AT_CHECK([tail -2 stdout], [0],
e3981271 886 [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 887Datapath 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
888])
889
110f7c75
TLSC
890OVS_VSWITCHD_STOP
891AT_CLEANUP
892
893AT_SETUP([tunnel - concomitant IPv6 and IPv4 tunnels])
894OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
895 options:remote_ip=1.1.1.1 ofport_request=1 \
896 -- add-port br0 p2 -- set Interface p2 type=vxlan \
897 options:remote_ip=2001:cafe::1 ofport_request=2])
898AT_DATA([flows.txt], [dnl
899in_port=1,actions=2
900in_port=2,actions=1
901])
902OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
903
904AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
905
906AT_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])
907AT_CHECK([tail -1 stdout], [0],
81f9ef5a 908 [Datapath actions: set(tunnel(ipv6_dst=2001:cafe::1,ttl=64,tp_dst=4789,flags(df))),4789
110f7c75
TLSC
909])
910
911AT_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])
912AT_CHECK([tail -1 stdout], [0],
81f9ef5a 913 [Datapath actions: set(tunnel(dst=1.1.1.1,ttl=64,tp_dst=4789,flags(df))),4789
110f7c75
TLSC
914])
915
189de33f
EC
916OVS_VSWITCHD_STOP
917AT_CLEANUP
918
919AT_SETUP([tunnel - concomitant incompatible tunnels on the same port])
920OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
921 options:remote_ip=flow ofport_request=1])
922
923AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=vxlan \
924 options:remote_ip=flow options:exts=gbp options:key=1 ofport_request=2], [0],
925 [], [ignore])
926
927AT_CHECK([grep 'p2: could not set configuration (File exists)' ovs-vswitchd.log | sed "s/^.*\(p2:.*\)$/\1/"], [0],
928 [p2: could not set configuration (File exists)
929])
930
931OVS_VSWITCHD_STOP(["/p2: VXLAN-GBP, and non-VXLAN-GBP tunnels can't be configured on the same dst_port/d
932/p2: could not set configuration (File exists)/d"])
933AT_CLEANUP
934
935AT_SETUP([tunnel - concomitant incompatible tunnels on different ports])
936OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
937 options:remote_ip=flow ofport_request=1])
938
939AT_CHECK([ovs-vsctl add-port br0 p2 -- set Interface p2 type=vxlan options:dst_port=9000 \
940 options:remote_ip=flow options:exts=gbp ofport_request=2])
941
942AT_CHECK([grep p2 ovs-vswitchd.log | sed "s/^.*\(bridge br0:.*\)$/\1/"], [0],
943 [bridge br0: added interface p2 on port 2
944])
110f7c75 945
81f9ef5a
WT
946OVS_VSWITCHD_STOP
947AT_CLEANUP
948
949AT_SETUP([tunnel - Mix Geneve/GRE options])
950OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
951 options:remote_ip=1.1.1.1 options:csum=true ofport_request=1 \
952 -- add-port br0 p2 -- set Interface p2 type=dummy \
953 ofport_request=2 ofport_request=2 \
954 -- add-port br0 p3 -- set Interface p3 type=gre \
955 options:remote_ip=2.2.2.2 options:csum=false options:key=123 ofport_request=3])
956OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
957
958AT_DATA([flows.txt], [dnl
959priority=1,in_port=1,actions=3
960])
961AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
962
963AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort],
964[0], [dnl
965 priority=1,in_port=1 actions=output:3
966NXST_FLOW reply:
967])
968
969dnl the input packet from geneve tunnel has flags(-df+csum+key) flags, making
970dnl sure that the output gre tunnel has (+df-csum+key).
971AT_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])
972AT_CHECK([tail -2 stdout], [0],
973 [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
974Datapath actions: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,flags(df|key))),1
975])
976
c6d87201
WT
977AT_CHECK([ovs-ofctl add-tlv-map br0 "{class=0xffff,type=0,len=4}->tun_metadata0"])
978AT_CHECK([ovs-ofctl del-flows br0])
979
980AT_DATA([flows2.txt], [dnl
981priority=1,in_port=1,tun_metadata0=0x123, actions=3
982])
983AT_CHECK([ovs-ofctl add-flows br0 flows2.txt])
984
985AT_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])
986AT_CHECK([tail -2 stdout], [0],
987 [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
988Datapath actions: set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,flags(df|key))),1
989])
990
991dnl without the fix, the actions have geneve options:
992dnl set(tunnel(tun_id=0x7b,dst=2.2.2.2,ttl=64,geneve({class=0xffff,type=0,len=4,0x123}),flags(df|key))),1
993dnl which is not correct
994
1cb20095
JG
995OVS_VSWITCHD_STOP
996AT_CLEANUP
8416e50f
VD
997
998AT_SETUP([tunnel - neighbor entry add and deletion])
999OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
1000 options:remote_ip=1.1.1.1 options:local_ip=2.2.2.2 \
1001 options:key=5 ofport_request=1 \
1002 -- add-port br0 p2 -- set Interface p2 type=gre \
1003 options:local_ip=3.3.3.3 options:remote_ip=4.4.4.4 \
1004 ofport_request=2])
1005AT_CHECK([ovs-vsctl add-br br1 -- set bridge br1 datapath_type=dummy], [0])
1006
1007dnl Populate tunnel neighbor cache table
1008AT_CHECK([
1009 ovs-appctl tnl/arp/set p1 10.0.0.1 00:00:10:00:00:01
1010 ovs-appctl tnl/arp/set p1 10.0.0.2 00:00:10:00:00:02
1011 ovs-appctl tnl/arp/set p2 10.0.1.1 00:00:10:00:01:01
1012 ovs-appctl tnl/arp/set br0 10.0.2.1 00:00:10:00:02:01
1013 ovs-appctl tnl/arp/set br0 10.0.2.2 00:00:10:00:02:02
1014 ovs-appctl tnl/arp/set br1 20.0.0.1 00:00:20:00:00:01
1015], [0], [stdout])
1016
1017AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl
101810.0.0.1 00:00:10:00:00:01 p1
101910.0.0.2 00:00:10:00:00:02 p1
102010.0.1.1 00:00:10:00:01:01 p2
102110.0.2.1 00:00:10:00:02:01 br0
102210.0.2.2 00:00:10:00:02:02 br0
102320.0.0.1 00:00:20:00:00:01 br1
1024])
1025
1026dnl neighbor table after deleting port p1
1027AT_CHECK([ovs-vsctl del-port br0 p1],[0], [stdout])
1028AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | grep -w p1 | sort], [0], [dnl
1029])
1030
1031dnl neighbor table after deleting bridge br0
1032AT_CHECK([ovs-vsctl del-br br0],[0], [stdout])
1033AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl
103420.0.0.1 00:00:20:00:00:01 br1
1035])
1036
1037dnl neighbor table after deleting bridge br1
1038AT_CHECK([ovs-vsctl del-br br1],[0], [stdout])
1039AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl
1040])
1041
1042OVS_VSWITCHD_STOP
1043AT_CLEANUP