dpif: Fix initialization order.
[cascardo/ovs.git] / tests / tunnel-push-pop.at
1 AT_BANNER([tunnel_push_pop])
2
3 AT_SETUP([tunnel_push_pop - action])
4
5 dnl ovs router is commands are only supported on Linux for now.
6 AT_SKIP_IF([test "$IS_WIN32" = "yes"])
7 AT_SKIP_IF([test "$IS_BSD" = "yes"])
8
9 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
10 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
11 AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
12                        options:remote_ip=1.1.2.92 options:key=123 ofport_request=2\
13                     -- add-port int-br t1 -- set Interface t1 type=gre \
14                        options:remote_ip=1.1.2.92 options:key=456 ofport_request=3], [0])
15
16 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
17 dummy@ovs-dummy: hit:0 missed:0
18         br0:
19                 br0 65534/100: (dummy)
20                 p0 1/1: (dummy)
21         int-br:
22                 int-br 65534/2: (dummy)
23                 t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
24                 t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
25 ])
26
27 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
28 ])
29 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
30 ])
31
32 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
33
34 dnl Check ARP Snoop
35 AT_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=1,sha=f8:bc:12:44:34:b6,tha=00:00:00:00:00:00)'])
36
37 AT_CHECK([ovs-appctl tnl/arp/show], [0], [dnl
38 IP               MAC                 Bridge
39 =============================================
40 1.1.2.92         f8:bc:12:44:34:b6   br0
41 ])
42
43 dnl Check VXLAN tunnel pop
44 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),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])
45 AT_CHECK([tail -1 stdout], [0],
46   [Datapath actions: tnl_pop(4789)
47 ])
48
49 dnl Check GRE tunnel pop
50 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
51 AT_CHECK([tail -1 stdout], [0],
52   [Datapath actions: tnl_pop(3)
53 ])
54
55 dnl Check VXLAN tunnel push
56 AT_CHECK([ovs-ofctl add-flow int-br action=2])
57 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
58 AT_CHECK([tail -1 stdout], [0],
59   [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=0x40),udp(src=0,dst=4789),vxlan(flags=0x8000000,vni=0x7b00)),out_port(100))
60 ])
61
62 dnl Check GRE tunnel push
63 AT_CHECK([ovs-ofctl add-flow int-br action=3])
64 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth_type(0x0800),ipv4(src=1.1.3.88,dst=1.1.3.112,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout])
65 AT_CHECK([tail -1 stdout], [0],
66   [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=0x40),gre((flags=0x20,proto=0x6558),key=0x1c8)),out_port(100))
67 ])
68
69 OVS_VSWITCHD_STOP
70 AT_CLEANUP