]> git.proxmox.com Git - mirror_ovs.git/blame - tests/tunnel.at
dpif_packet: Rename to dp_packet
[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
dc54ef36
EJ
19 br0 65534/100: (dummy)
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
ac6073e3 26AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=1.2.3.4,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
ac6073e3 28 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df))),1
0f538378
EJ
29])
30
31dnl local_ip, remote_ip
ac6073e3 32AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
ac6073e3 34 [Datapath actions: set(tunnel(tun_id=0x0,src=2.2.2.2,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 \
40 -- set Interface p3 type=gre64])
e79a6c83 41AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36
EJ
42 br0 65534/100: (dummy)
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/64: (gre64: remote_ip=2.2.2.2)
0f538378 46])
ac6073e3 47AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
ac6073e3 49 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df))),1
0f538378 50])
ac6073e3 51AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.3,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
ac6073e3 53 [Datapath actions: set(tunnel(tun_id=0x0,src=2.2.2.3,dst=1.1.1.1,tos=0,ttl=1,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(csum))),1
0f538378
EJ
54])
55
56dnl nonexistent tunnel
ac6073e3 57AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=5.5.5.5,dst=6.6.6.6,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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
dc54ef36
EJ
77 br0 65534/100: (dummy)
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
ac6073e3 83AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
16194afd 85 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_ttl=64,,in_port=1,nw_ecn=3,nw_frag=no
ce58df5b 86Datapath actions: 2
4863c249
JP
87])
88
89dnl Tunnel CE and encapsulated packet ECT(1)
ac6073e3 90AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
16194afd 92 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_ttl=64,,in_port=1,nw_ecn=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)
ac6073e3 97AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
16194afd 99 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_ttl=64,,in_port=1,nw_ecn=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
ac6073e3 104AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0x3,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
16194afd 106 [Megaflow: pkt_mark=0,recirc_id=0,ip,tun_id=0,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=3,tun_ttl=64,,in_port=1,nw_ecn=0,nw_frag=no
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 \
117 ofport_request=2 ofport_request=2])
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
dc54ef36
EJ
126 br0 65534/100: (dummy)
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],
ac6073e3 134 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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],
ac6073e3 140 [Datapath actions: set(tunnel(tun_id=0x5,src=2.2.2.2,dst=1.1.1.1,tos=0x1,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1
0f538378
EJ
141])
142OVS_VSWITCHD_STOP
143AT_CLEANUP
144
145AT_SETUP([tunnel - ToS and TTL inheritance])
146OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=gre \
147 options:remote_ip=1.1.1.1 options:tos=inherit \
148 options:ttl=inherit 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])
154
a36de779 155OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
156AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
157
e79a6c83 158AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36
EJ
159 br0 65534/100: (dummy)
160 p1 1/1: (gre: remote_ip=1.1.1.1, tos=inherit, ttl=inherit)
161 p2 2/2: (dummy)
0f538378
EJ
162])
163
164dnl Basic
50aa28fd 165AT_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 166AT_CHECK([tail -1 stdout], [0],
ac6073e3 167 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x4,ttl=128,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df))),1
0f538378
EJ
168])
169
170dnl ECN
50aa28fd 171AT_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 172AT_CHECK([tail -1 stdout], [0],
ac6073e3 173 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0x5,ttl=128,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df))),1
0f538378
EJ
174])
175
176dnl non-IP
50aa28fd 177AT_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 178AT_CHECK([tail -1 stdout], [0],
ac6073e3 179 [Datapath actions: set(tunnel(tun_id=0x0,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df))),1
0f538378
EJ
180])
181OVS_VSWITCHD_STOP
182AT_CLEANUP
183
184AT_SETUP([tunnel - set_tunnel])
185OVS_VSWITCHD_START([dnl
186 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
187 options:remote_ip=1.1.1.1 ofport_request=1 \
188 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
189 options:remote_ip=2.2.2.2 ofport_request=2 \
190 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
191 options:remote_ip=3.3.3.3 ofport_request=3 \
192 -- add-port br0 p4 -- set Interface p4 type=gre options:key=flow \
193 options:remote_ip=4.4.4.4 ofport_request=4])
194AT_DATA([flows.txt], [dnl
195actions=set_tunnel:1,output:1,set_tunnel:2,output:2,set_tunnel:3,output:3,set_tunnel:5,output:4
196])
197
a36de779 198OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
199AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
200
e79a6c83 201AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36
EJ
202 br0 65534/100: (dummy)
203 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
204 p2 2/1: (gre: key=flow, remote_ip=2.2.2.2)
205 p3 3/1: (gre: key=flow, remote_ip=3.3.3.3)
206 p4 4/1: (gre: key=flow, remote_ip=4.4.4.4)
0f538378
EJ
207])
208
50aa28fd 209AT_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 210AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
ac6073e3
MC
211set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
212set(tunnel(tun_id=0x2,src=0.0.0.0,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
213set(tunnel(tun_id=0x3,src=0.0.0.0,dst=3.3.3.3,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
214set(tunnel(tun_id=0x5,src=0.0.0.0,dst=4.4.4.4,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1
0f538378
EJ
215])
216OVS_VSWITCHD_STOP
217AT_CLEANUP
218
219AT_SETUP([tunnel - key])
220OVS_VSWITCHD_START([dnl
221 add-port br0 p1 -- set Interface p1 type=gre options:key=1 \
222 options:remote_ip=1.1.1.1 ofport_request=1 \
223 -- add-port br0 p2 -- set Interface p2 type=gre options:in_key=2 \
224 options:out_key=3 options:remote_ip=1.1.1.1 ofport_request=2 \
225 -- add-port br0 p3 -- set Interface p3 type=gre options:out_key=5 \
226 options:remote_ip=1.1.1.1 ofport_request=3])
227AT_DATA([flows.txt], [dnl
228actions=IN_PORT,output:1,output:2,output:3
229])
230
a36de779 231OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
232AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
233
e79a6c83 234AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36
EJ
235 br0 65534/100: (dummy)
236 p1 1/1: (gre: key=1, remote_ip=1.1.1.1)
237 p2 2/1: (gre: in_key=2, out_key=3, remote_ip=1.1.1.1)
238 p3 3/1: (gre: out_key=5, remote_ip=1.1.1.1)
0f538378
EJ
239])
240
ac6073e3 241AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x1,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 242AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
ac6073e3
MC
243set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
244set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
245set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1
0f538378
EJ
246])
247
ac6073e3 248AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x2,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 249AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
ac6073e3
MC
250set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
251set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
252set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1
0f538378
EJ
253])
254
ac6073e3 255AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 256AT_CHECK([tail -1 stdout], [0], [Datapath actions: dnl
ac6073e3
MC
257set(tunnel(tun_id=0x5,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
258set(tunnel(tun_id=0x1,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,dnl
259set(tunnel(tun_id=0x3,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1
0f538378
EJ
260])
261
ac6073e3 262AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0xf,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 263Invalid datapath flow
0f538378
EJ
264ovs-appctl: ovs-vswitchd: server returned an error
265])
6e1fb7e1 266OVS_VSWITCHD_STOP(["/receive tunnel port not found/d"])
0f538378
EJ
267AT_CLEANUP
268
269AT_SETUP([tunnel - key match])
270OVS_VSWITCHD_START([dnl
271 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
272 options:remote_ip=1.1.1.1 ofport_request=1 \
273 -- add-port br0 p2 -- set Interface p2 type=gre options:key=3 \
274 options:remote_ip=3.3.3.3 ofport_request=2 \
275 -- add-port br0 p3 -- set Interface p3 type=dummy ofport_request=3 \
276 -- add-port br0 p4 -- set Interface p4 type=dummy ofport_request=4 \
277 -- add-port br0 p5 -- set Interface p5 type=dummy ofport_request=5])
278AT_DATA([flows.txt], [dnl
279tun_id=2,actions=output:3
280tun_id=3,actions=output:4,set_tunnel:2,resubmit:99,set_tunnel:4,output:2,resubmit:99
281tun_id=4,actions=output:5
282])
283
a36de779 284OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0f538378
EJ
285AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
286
e79a6c83 287AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36
EJ
288 br0 65534/100: (dummy)
289 p1 1/1: (gre: key=flow, remote_ip=1.1.1.1)
290 p2 2/1: (gre: key=3, remote_ip=3.3.3.3)
291 p3 3/3: (dummy)
292 p4 4/4: (dummy)
293 p5 5/5: (dummy)
0f538378
EJ
294])
295
ac6073e3 296AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x2,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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
297AT_CHECK([tail -1 stdout], [0], [dnl
298Datapath actions: 3
299])
300
ac6073e3 301AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x3,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 302AT_CHECK([tail -1 stdout], [0], [dnl
ac6073e3 303Datapath actions: 4,3,set(tunnel(tun_id=0x3,src=0.0.0.0,dst=3.3.3.3,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,5
0f538378
EJ
304])
305
ac6073e3 306AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x3,src=3.3.3.3,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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
307AT_CHECK([tail -1 stdout], [0], [dnl
308Datapath actions: 4,3,5
309])
310
ac6073e3 311AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'tunnel(tun_id=0x0,src=1.1.1.1,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,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 312AT_CHECK([tail -1 stdout], [0], [dnl
6b83a3c5 313Datapath actions: drop
0f538378
EJ
314])
315
316OVS_VSWITCHD_STOP
317AT_CLEANUP
d302e2e7 318
c1fc1411
JG
319AT_SETUP([tunnel - Geneve])
320OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=geneve \
321 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=5000])
322
323AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
324 br0 65534/100: (dummy)
325 p1 1/5000: (geneve: dst_port=5000, remote_ip=1.1.1.1)
326])
327
328OVS_VSWITCHD_STOP
329AT_CLEANUP
330
d302e2e7
KM
331AT_SETUP([tunnel - VXLAN])
332OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
333 options:remote_ip=1.1.1.1 ofport_request=1])
334
e79a6c83 335AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36 336 br0 65534/100: (dummy)
ff073a71 337 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
d302e2e7
KM
338])
339
340OVS_VSWITCHD_STOP
341AT_CLEANUP
342
343AT_SETUP([tunnel - LISP])
344OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=lisp \
345 options:remote_ip=1.1.1.1 ofport_request=1])
346
e79a6c83 347AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36 348 br0 65534/100: (dummy)
ff073a71 349 p1 1/4341: (lisp: remote_ip=1.1.1.1)
d302e2e7
KM
350])
351
352OVS_VSWITCHD_STOP
353AT_CLEANUP
354
355AT_SETUP([tunnel - different VXLAN UDP port])
356OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=vxlan \
357 options:remote_ip=1.1.1.1 ofport_request=1 options:dst_port=4341])
358
e79a6c83 359AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36 360 br0 65534/100: (dummy)
ff073a71 361 p1 1/4341: (vxlan: dst_port=4341, remote_ip=1.1.1.1)
d302e2e7
KM
362])
363
364dnl change UDP port
365
366AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=5000])
367
e79a6c83 368AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36 369 br0 65534/100: (dummy)
ff073a71 370 p1 1/5000: (vxlan: dst_port=5000, remote_ip=1.1.1.1)
d302e2e7
KM
371])
372
373dnl change UDP port to default
374
4f2abb7b 375AT_CHECK([ovs-vsctl -- set Interface p1 options:dst_port=4789])
d302e2e7 376
e79a6c83 377AT_CHECK([ovs-appctl dpif/show | tail -n +3], [0], [dnl
dc54ef36 378 br0 65534/100: (dummy)
ff073a71 379 p1 1/4789: (vxlan: remote_ip=1.1.1.1)
d302e2e7 380])
0ad90c84
JR
381OVS_VSWITCHD_STOP
382AT_CLEANUP
d302e2e7 383
0ad90c84
JR
384AT_SETUP([ofproto-dpif - set_field - tun_src/tun_dst/tun_id])
385OVS_VSWITCHD_START([dnl
386 add-port br0 p1 -- set Interface p1 type=gre options:key=flow \
387 options:remote_ip=1.1.1.1 ofport_request=1 \
388 -- add-port br0 p2 -- set Interface p2 type=gre options:key=flow \
389 options:remote_ip=flow ofport_request=2 \
390 -- add-port br0 p3 -- set Interface p3 type=gre options:key=flow \
391 options:remote_ip=flow options:local_ip=flow ofport_request=3 \
392 -- add-port br0 p4 -- set Interface p4 type=gre options:key=3 \
393 options:remote_ip=flow ofport_request=4 \
394 -- add-port br0 p5 -- set Interface p5 type=gre options:key=flow \
395 options:remote_ip=5.5.5.5 ofport_request=5])
a36de779
PS
396
397OVS_VSWITCHD_DISABLE_TUNNEL_PUSH_POP
0ad90c84
JR
398ADD_OF_PORTS([br0], [90])
399AT_DATA([flows.txt], [dnl
400in_port=90 actions=resubmit:1,resubmit:2,resubmit:3,resubmit:4,resubmit:5
401in_port=1 actions=set_field:42->tun_id,output:1
402in_port=2 actions=set_field:3.3.3.3->tun_dst,output:2
403in_port=3 actions=set_field:1.1.1.1->tun_src,set_field:4.4.4.4->tun_dst,output:3
404in_port=4 actions=set_field:2.2.2.2->tun_dst,output:4
405in_port=5 actions=set_field:5->tun_id
406])
407AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
50aa28fd 408AT_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 409AT_CHECK([tail -1 stdout], [0],
ac6073e3 410 [Datapath actions: set(tunnel(tun_id=0x2a,src=0.0.0.0,dst=1.1.1.1,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,set(tunnel(tun_id=0x2a,src=0.0.0.0,dst=3.3.3.3,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,set(tunnel(tun_id=0x2a,src=1.1.1.1,dst=4.4.4.4,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1,set(tunnel(tun_id=0x3,src=0.0.0.0,dst=2.2.2.2,tos=0,ttl=64,tp_src=0,tp_dst=0,gbp_id=0,gbp_flags=0,flags(df,key))),1
0ad90c84 411])
d302e2e7
KM
412OVS_VSWITCHD_STOP
413AT_CLEANUP