]> git.proxmox.com Git - ovs.git/blame - tests/tunnel-push-pop.at
System-tests: Improve reliability of an icmp test.
[ovs.git] / tests / tunnel-push-pop.at
CommitLineData
a36de779
PS
1AT_BANNER([tunnel_push_pop])
2
3AT_SETUP([tunnel_push_pop - action])
4
7f9b8504 5OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00])
d32754b4
JR
6AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
7AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
a36de779
PS
8 options:remote_ip=1.1.2.92 options:key=123 ofport_request=2\
9 -- add-port int-br t1 -- set Interface t1 type=gre \
c876a4bb
RL
10 options:remote_ip=1.1.2.92 options:key=456 ofport_request=3\
11 -- add-port int-br t3 -- set Interface t3 type=vxlan \
8e45fe7c 12 options:remote_ip=1.1.2.93 options:out_key=flow options:csum=true ofport_request=4\
e5a1caee 13 -- add-port int-br t4 -- set Interface t4 type=geneve \
eaac0f22 14 options:remote_ip=flow options:key=123 ofport_request=5\
bf4bbd0d
PS
15 -- add-port int-br t5 -- set Interface t5 type=geneve \
16 options:remote_ip=1.1.2.93 options:out_key=flow options:egress_pkt_mark=1234 ofport_request=6\
63171f04 17 -- add-port int-br t6 -- set Interface t6 type=gre \
875ab130 18 options:remote_ip=1.1.2.92 options:key=456 options:packet_type=legacy_l3 ofport_request=7\
439f39cb
GS
19 -- add-port int-br t7 -- set Interface t7 type=vxlan \
20 options:remote_ip=1.1.2.92 options:key=345 options:exts=gpe ofport_request=8\
c876a4bb 21 ], [0])
a36de779
PS
22
23AT_CHECK([ovs-appctl dpif/show], [0], [dnl
24dummy@ovs-dummy: hit:0 missed:0
25 br0:
e98d0cb3 26 br0 65534/100: (dummy-internal)
d32754b4 27 p0 1/1: (dummy)
a36de779 28 int-br:
e98d0cb3 29 int-br 65534/2: (dummy-internal)
d32754b4 30 t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
a36de779 31 t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
8e45fe7c 32 t3 4/4789: (vxlan: csum=true, out_key=flow, remote_ip=1.1.2.93)
eaac0f22 33 t4 5/6081: (geneve: key=123, remote_ip=flow)
bf4bbd0d 34 t5 6/6081: (geneve: egress_pkt_mark=1234, out_key=flow, remote_ip=1.1.2.93)
875ab130 35 t6 7/3: (gre: key=456, packet_type=legacy_l3, remote_ip=1.1.2.92)
439f39cb 36 t7 8/4789: (vxlan: key=345, remote_ip=1.1.2.92)
a36de779
PS
37])
38
7f9b8504
PS
39dnl First setup dummy interface IP address, then add the route
40dnl so that tnl-port table can get valid IP address for the device.
a36de779
PS
41AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
42])
80c4589a
PS
43AT_CHECK([ovs-appctl netdev-dummy/ip6addr br0 2001:cafe::88/24], [0], [OK
44])
45
7f9b8504
PS
46AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
47])
a36de779 48
ed52ca57
PS
49AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0 pkt_mark=1234], [0], [OK
50])
51
a36de779
PS
52AT_CHECK([ovs-ofctl add-flow br0 action=normal])
53
80c4589a
PS
54dnl Check ARP request
55AT_CHECK([ovs-vsctl -- set Interface p0 options:pcap=p0.pcap])
56
57AT_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)'])
e9407a81
DDP
58
59dnl Wait for the two ARP requests to be sent. Sometimes the system
60dnl can be slow (e.g. under valgrind)
61OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | sort | uniq | wc -l` -ge 2])
62
56e18591 63AT_CHECK([ovs-pcap p0.pcap > p0.pcap.txt 2>&1])
80c4589a 64
56e18591
PS
65AT_CHECK([cat p0.pcap.txt | grep 101025c | uniq], [0], [dnl
66ffffffffffffaa55aa55000008060001080006040001aa55aa550000010102580000000000000101025c
80c4589a 67])
56e18591
PS
68AT_CHECK([cat p0.pcap.txt | grep 101025d | uniq], [0], [dnl
69ffffffffffffaa55aa55000008060001080006040001aa55aa550000010102580000000000000101025d
80c4589a
PS
70])
71
a36de779 72dnl Check ARP Snoop
b23ddcc5
PS
73AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
74AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),eth(src=f8:bc:12:44:34:b7,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.93,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b7,tha=00:00:00:00:00:00)'])
a36de779 75
7eca52f1 76AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl
4673650f
TLSC
771.1.2.92 f8:bc:12:44:34:b6 br0
781.1.2.93 f8:bc:12:44:34:b7 br0
a36de779
PS
79])
80
6d9e94b5
AZ
81AT_CHECK([ovs-appctl tnl/ports/show |sort], [0], [dnl
82Listening ports:
7f9b8504
PS
83genev_sys_6081 (6081)
84gre_sys (3)
85vxlan_sys_4789 (4789)
6d9e94b5
AZ
86])
87
a36de779 88dnl Check VXLAN tunnel pop
7f9b8504 89AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'], [0], [stdout])
a36de779
PS
90AT_CHECK([tail -1 stdout], [0],
91 [Datapath actions: tnl_pop(4789)
92])
93
94dnl Check GRE tunnel pop
7f9b8504 95AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
a36de779 96AT_CHECK([tail -1 stdout], [0],
d32754b4 97 [Datapath actions: tnl_pop(3)
a36de779
PS
98])
99
e5a1caee 100dnl Check Geneve tunnel pop
7f9b8504 101AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=6081)'], [0], [stdout])
e5a1caee
JG
102AT_CHECK([tail -1 stdout], [0],
103 [Datapath actions: tnl_pop(6081)
104])
105
bf4bbd0d
PS
106dnl Check Geneve tunnel (t6) pop
107AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.2.96,dst=1.1.2.88,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=6081)'], [0], [stdout])
108AT_CHECK([tail -1 stdout], [0],
109 [Datapath actions: tnl_pop(6081)
110])
111
a36de779
PS
112dnl Check VXLAN tunnel push
113AT_CHECK([ovs-ofctl add-flow int-br action=2])
beb75a40 114AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
a36de779 115AT_CHECK([tail -1 stdout], [0],
f5f64552 116 [Datapath actions: tnl_push(tnl_port(4789),header(size=50,type=4,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0x8000000,vni=0x7b)),out_port(100))
a36de779
PS
117])
118
439f39cb
GS
119dnl Check VXLAN GPE tunnel push
120AT_CHECK([ovs-ofctl add-flow int-br action=8])
121AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:01),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
122AT_CHECK([tail -1 stdout], [0],
123 [Datapath actions: tnl_push(tnl_port(4789),header(size=50,type=4,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0xc000003,vni=0x159)),out_port(100))
124])
125
8e45fe7c 126dnl Check VXLAN tunnel push set tunnel id by flow and checksum
c876a4bb 127AT_CHECK([ovs-ofctl add-flow int-br "actions=set_tunnel:124,4"])
beb75a40 128AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
c876a4bb 129AT_CHECK([tail -1 stdout], [0],
f5f64552 130 [Datapath actions: tnl_push(tnl_port(4789),header(size=50,type=4,eth(dst=f8:bc:12:44:34:b7,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.93,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0xffff),vxlan(flags=0x8000000,vni=0x7c)),out_port(100))
c876a4bb
RL
131])
132
a36de779
PS
133dnl Check GRE tunnel push
134AT_CHECK([ovs-ofctl add-flow int-br action=3])
beb75a40 135AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
a36de779 136AT_CHECK([tail -1 stdout], [0],
f5f64552 137 [Datapath actions: tnl_push(tnl_port(3),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x2000,proto=0x6558),key=0x1c8)),out_port(100))
a36de779
PS
138])
139
63171f04
JS
140dnl Check L3GRE tunnel push
141AT_CHECK([ovs-ofctl add-flow int-br action=7])
142AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:01),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
143AT_CHECK([tail -1 stdout], [0],
144 [Datapath actions: pop_eth,tnl_push(tnl_port(3),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x2000,proto=0x800),key=0x1c8)),out_port(100))
145])
146
e5a1caee 147dnl Check Geneve tunnel push
eaac0f22 148AT_CHECK([ovs-ofctl add-flow int-br "actions=set_field:1.1.2.92->tun_dst,5"])
beb75a40 149AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
e5a1caee 150AT_CHECK([tail -1 stdout], [0],
f5f64552 151 [Datapath actions: tnl_push(tnl_port(6081),header(size=50,type=5,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=6081,csum=0x0),geneve(vni=0x7b)),out_port(100))
e5a1caee
JG
152])
153
bf4bbd0d
PS
154dnl Check Geneve tunnel push with pkt-mark
155AT_CHECK([ovs-ofctl add-flow int-br "actions=set_tunnel:234,6"])
beb75a40 156AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
bf4bbd0d 157AT_CHECK([tail -1 stdout], [0],
f5f64552 158 [Datapath actions: set(skb_mark(0x4d2)),tnl_push(tnl_port(6081),header(size=50,type=5,eth(dst=f8:bc:12:44:34:b7,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.93,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=6081,csum=0x0),geneve(vni=0xea)),out_port(100))
bf4bbd0d
PS
159])
160
5bb08b0e 161dnl Check Geneve tunnel push with options
4e548ad9 162AT_CHECK([ovs-ofctl add-tlv-map int-br "{class=0xffff,type=0x80,len=4}->tun_metadata0"])
5bb08b0e 163AT_CHECK([ovs-ofctl add-flow int-br "actions=set_field:1.1.2.92->tun_dst,set_field:0xa->tun_metadata0,5"])
beb75a40 164AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
5bb08b0e 165AT_CHECK([tail -1 stdout], [0],
f5f64552 166 [Datapath actions: tnl_push(tnl_port(6081),header(size=58,type=5,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=6081,csum=0x0),geneve(crit,vni=0x7b,options({class=0xffff,type=0x80,len=4,0xa}))),out_port(100))
5bb08b0e
JG
167])
168
6432e527 169dnl Check decapsulation of GRE packet
f41256d7 170AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007e79464000402fba550101025c0101025820006558000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
63171f04
JS
171AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007e79464000402fba550101025c0101025820006558000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
172AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007e79464000402fba550101025c0101025820006558000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
6432e527
JG
173ovs-appctl time/warp 1000
174
175AT_CHECK([ovs-ofctl dump-ports int-br | grep 'port 3'], [0], [dnl
63171f04 176 port 3: rx pkts=3, bytes=294, drop=?, errs=?, frame=?, over=?, crc=?
6432e527
JG
177])
178
63171f04
JS
179dnl Check decapsulation of L3GRE packet
180AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007079464000402fba630101025c0101025820000800000001c845000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
181AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007079464000402fba630101025c0101025820000800000001c845000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
182AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007079464000402fba630101025c0101025820000800000001c845000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
183ovs-appctl time/warp 1000
6432e527
JG
184ovs-appctl time/warp 1000
185
63171f04
JS
186AT_CHECK([ovs-ofctl dump-ports int-br | grep 'port 7'], [0], [dnl
187 port 7: rx pkts=3, bytes=252, drop=?, errs=?, frame=?, over=?, crc=?
188])
189
190dnl Check GREL3 only accepts non-fragmented packets?
191AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab6408004500007e79464000402fba550101025c0101025820000800000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
192
193AT_CHECK([ovs-ofctl dump-ports int-br | grep 'port [[37]]' | sort], [0], [dnl
194 port 3: rx pkts=3, bytes=294, drop=?, errs=?, frame=?, over=?, crc=?
195 port 7: rx pkts=3, bytes=252, drop=?, errs=?, frame=?, over=?, crc=?
6432e527
JG
196])
197
5bb08b0e 198dnl Check decapsulation of Geneve packet with options
2234a7db
JG
199AT_CAPTURE_FILE([ofctl_monitor.log])
200AT_CHECK([ovs-ofctl monitor int-br 65534 --detach --no-chdir --pidfile 2> ofctl_monitor.log])
201
5bb08b0e 202AT_CHECK([ovs-ofctl del-flows int-br])
2234a7db 203AT_CHECK([ovs-ofctl add-flow int-br "tun_metadata0=0xa/0xf,actions=5,controller"])
f41256d7 204AT_CHECK([ovs-appctl netdev-dummy/receive p0 'aa55aa550000001b213cab64080045000096794640004011ba5b0101025c01010258308817c1008200000400655800007b00ffff80010000000affff00010000000bfe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
5bb08b0e 205
2234a7db
JG
206OVS_WAIT_UNTIL([test `wc -l < ofctl_monitor.log` -ge 2])
207OVS_APP_EXIT_AND_WAIT(ovs-ofctl)
208
209AT_CHECK([cat ofctl_monitor.log], [0], [dnl
6409e008 210NXT_PACKET_IN2 (xid=0x0): cookie=0x0 total_len=98 tun_id=0x7b,tun_src=1.1.2.92,tun_dst=1.1.2.88,tun_metadata0=0xa,in_port=5 (via action) data_len=98 (unbuffered)
2234a7db
JG
211icmp,vlan_tci=0x0000,dl_src=be:b6:f4:e1:49:4a,dl_dst=fe:71:d8:83:72:4f,nw_src=30.0.0.1,nw_dst=30.0.0.2,nw_tos=0,nw_ecn=0,nw_ttl=64,icmp_type=0,icmp_code=0 icmp_csum:4227
212])
213
5bb08b0e 214AT_CHECK([ovs-ofctl dump-ports int-br | grep 'port 5'], [0], [dnl
d6e3feb5 215 port 5: rx pkts=1, bytes=98, drop=?, errs=?, frame=?, over=?, crc=?
5bb08b0e 216])
f5ca7ec2 217AT_CHECK([ovs-appctl dpif/dump-flows int-br | grep 'in_port(6081)'], [0], [dnl
3d4b2e6e 218tunnel(tun_id=0x7b,src=1.1.2.92,dst=1.1.2.88,geneve({class=0xffff,type=0x80,len=4,0xa/0xf}{class=0xffff,type=0,len=4}),flags(-df-csum+key)),recirc_id(0),in_port(6081),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:userspace(pid=0,slow_path(controller))
5bb08b0e
JG
219])
220
a36de779
PS
221OVS_VSWITCHD_STOP
222AT_CLEANUP
8a41d7c3
DDP
223
224AT_SETUP([tunnel_push_pop - packet_out])
225
226OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00])
227AT_CHECK([ovs-appctl vlog/set dpif_netdev:dbg])
228AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy])
229AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=geneve \
230 options:remote_ip=1.1.2.92 options:key=123 ofport_request=2 \
231 ])
232
233dnl First setup dummy interface IP address, then add the route
234dnl so that tnl-port table can get valid IP address for the device.
235AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
236])
237
238AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
239])
240
241AT_CHECK([ovs-ofctl add-flow br0 action=normal])
242
243dnl This ARP reply from p0 has two effects:
244dnl 1. The ARP cache will learn that 1.1.2.92 is at f8:bc:12:44:34:b6.
245dnl 2. The br0 mac learning will learn that f8:bc:12:44:34:b6 is on p0.
246AT_CHECK([ovs-appctl netdev-dummy/receive p0 'recirc_id(0),in_port(2),eth(src=f8:bc:12:44:34:b6,dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
247
248AT_CHECK([ovs-vsctl -- set Interface p0 options:tx_pcap=p0.pcap])
249
250dnl Output to tunnel from a int-br internal port
251AT_CHECK([ovs-ofctl add-flow int-br "in_port=LOCAL,actions=output:2"])
252AT_CHECK([ovs-appctl netdev-dummy/receive int-br '50540000000a5054000000091234'])
253OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep 50540000000a5054000000091234 | wc -l` -ge 1])
254
255dnl Output to tunnel from the controller
256AT_CHECK([ovs-ofctl -O OpenFlow13 packet-out int-br CONTROLLER "output:2" '50540000000a5054000000091235'])
257OVS_WAIT_UNTIL([test `ovs-pcap p0.pcap | grep 50540000000a5054000000091235 | wc -l` -ge 1])
258
259OVS_VSWITCHD_STOP
260AT_CLEANUP
621268a6
WT
261
262AT_SETUP([tunnel_push_pop - underlay bridge match])
263
264OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1 other-config:hwaddr=aa:55:aa:55:00:00])
265AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
266AT_CHECK([ovs-vsctl add-port int-br t1 -- set Interface t1 type=gre \
267 options:remote_ip=1.1.2.92 options:key=456 ofport_request=3], [0])
268
269AT_CHECK([ovs-appctl dpif/show], [0], [dnl
270dummy@ovs-dummy: hit:0 missed:0
271 br0:
272 br0 65534/100: (dummy-internal)
273 p0 1/1: (dummy)
274 int-br:
275 int-br 65534/2: (dummy-internal)
276 t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
277])
278
279AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
280])
281AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
282])
283AT_CHECK([ovs-ofctl add-flow br0 'arp,priority=1,action=normal'])
284
285dnl Use arp reply to achieve tunnel next hop mac binding
286AT_CHECK([ovs-appctl netdev-dummy/receive br0 'recirc_id(0),in_port(100),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0806),arp(sip=1.1.2.92,tip=1.1.2.88,op=2,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
287
288AT_CHECK([ovs-appctl tnl/neigh/show | tail -n+3 | sort], [0], [dnl
2891.1.2.92 f8:bc:12:44:34:b6 br0
290])
291
292AT_CHECK([ovs-ofctl add-flow br0 'ip,ip_proto=47,nw_tos=0,eth_src=aa:55:aa:55:00:00,eth_dst=f8:bc:12:44:34:b6,ip_src=1.1.2.88,ip_dst=1.1.2.92,priority=99,action=normal'])
293
294dnl Direct traffic from the integration bridge to the GRE tunnel
295AT_CHECK([ovs-ofctl add-flow int-br action=3])
296
beb75a40 297AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=f8:bc:12:44:34:b6,dst=aa:55:aa:55:00:00),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=17,tos=0,ttl=64,frag=no),udp(src=51283,dst=4789)'], [0], [stdout])
621268a6
WT
298AT_CHECK([tail -1 stdout], [0],
299 [Datapath actions: tnl_push(tnl_port(3),header(size=42,type=3,eth(dst=f8:bc:12:44:34:b6,src=aa:55:aa:55:00:00,dl_type=0x0800),ipv4(src=1.1.2.88,dst=1.1.2.92,proto=47,tos=0,ttl=64,frag=0x4000),gre((flags=0x2000,proto=0x6558),key=0x1c8)),out_port(100))
300])
301
302dnl Verify outer L2 and L3 header flow fields can be matched in the underlay bridge
303AT_CHECK([ovs-appctl netdev-dummy/receive int-br '50540000000a5054000000091234'])
304AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sort], [0], [dnl)
305 n_packets=1, n_bytes=42, priority=1,arp actions=NORMAL
306 n_packets=1, n_bytes=56, priority=99,ip,dl_src=aa:55:aa:55:00:00,dl_dst=f8:bc:12:44:34:b6,nw_src=1.1.2.88,nw_dst=1.1.2.92,nw_proto=47,nw_tos=0 actions=NORMAL
307NXST_FLOW reply:
308])
309
310OVS_VSWITCHD_STOP
311AT_CLEANUP