tests: gre: fix flags endianness
[cascardo/ovs.git] / tests / tunnel-push-pop.at
1 AT_BANNER([tunnel_push_pop])
2
3 AT_SETUP([tunnel_push_pop - action])
4
5 OVS_VSWITCHD_START([add-port br0 p0 -- set Interface p0 type=dummy ofport_request=1])
6 AT_CHECK([ovs-vsctl add-br int-br -- set bridge int-br datapath_type=dummy], [0])
7 AT_CHECK([ovs-vsctl add-port int-br t2 -- set Interface t2 type=vxlan \
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 \
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 \
12                        options:remote_ip=1.1.2.93 options:out_key=flow options:csum=true ofport_request=4\
13                     -- add-port int-br t4 -- set Interface t4 type=geneve \
14                        options:remote_ip=1.1.2.92 options:key=123 ofport_request=5\
15                        ], [0])
16
17 AT_CHECK([ovs-appctl dpif/show], [0], [dnl
18 dummy@ovs-dummy: hit:0 missed:0
19         br0:
20                 br0 65534/100: (dummy)
21                 p0 1/1: (dummy)
22         int-br:
23                 int-br 65534/2: (dummy)
24                 t1 3/3: (gre: key=456, remote_ip=1.1.2.92)
25                 t2 2/4789: (vxlan: key=123, remote_ip=1.1.2.92)
26                 t3 4/4789: (vxlan: csum=true, out_key=flow, remote_ip=1.1.2.93)
27                 t4 5/6081: (geneve: key=123, remote_ip=1.1.2.92)
28 ])
29
30 AT_CHECK([ovs-appctl ovs/route/add 1.1.2.92/24 br0], [0], [OK
31 ])
32 AT_CHECK([ovs-appctl netdev-dummy/ip4addr br0 1.1.2.88/24], [0], [OK
33 ])
34
35 AT_CHECK([ovs-ofctl add-flow br0 action=normal])
36
37 dnl Check ARP Snoop
38 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)'])
39 AT_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=1,sha=f8:bc:12:44:34:b7,tha=00:00:00:00:00:00)'])
40
41 AT_CHECK([ovs-appctl tnl/arp/show], [0], [dnl
42 IP               MAC                 Bridge
43 =============================================
44 1.1.2.92         f8:bc:12:44:34:b6   br0
45 1.1.2.93         f8:bc:12:44:34:b7   br0
46 ])
47
48 dnl Check VXLAN tunnel pop
49 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])
50 AT_CHECK([tail -1 stdout], [0],
51   [Datapath actions: tnl_pop(4789)
52 ])
53
54 dnl Check GRE tunnel pop
55 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])
56 AT_CHECK([tail -1 stdout], [0],
57   [Datapath actions: tnl_pop(3)
58 ])
59
60 dnl Check Geneve tunnel pop
61 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=6081)'], [0], [stdout])
62 AT_CHECK([tail -1 stdout], [0],
63   [Datapath actions: tnl_pop(6081)
64 ])
65
66 dnl Check VXLAN tunnel push
67 AT_CHECK([ovs-ofctl add-flow int-br action=2])
68 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])
69 AT_CHECK([tail -1 stdout], [0],
70   [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,csum=0x0),vxlan(flags=0x8000000,vni=0x7b)),out_port(100))
71 ])
72
73 dnl Check VXLAN tunnel push set tunnel id by flow and checksum
74 AT_CHECK([ovs-ofctl add-flow int-br "actions=set_tunnel:124,4"])
75 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])
76 AT_CHECK([tail -1 stdout], [0],
77   [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=0x40),udp(src=0,dst=4789,csum=0xffff),vxlan(flags=0x8000000,vni=0x7c)),out_port(100))
78 ])
79
80 dnl Check GRE tunnel push
81 AT_CHECK([ovs-ofctl add-flow int-br action=3])
82 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])
83 AT_CHECK([tail -1 stdout], [0],
84   [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=0x2000,proto=0x6558),key=0x1c8)),out_port(100))
85 ])
86
87 dnl Check Geneve tunnel push
88 AT_CHECK([ovs-ofctl add-flow int-br action=5])
89 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])
90 AT_CHECK([tail -1 stdout], [0],
91   [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=0x40),udp(src=0,dst=6081,csum=0x0),geneve(vni=0x7b)),out_port(100))
92 ])
93
94 dnl Check decapsulation of GRE packet
95 AT_CHECK([ovs-appctl netdev-dummy/receive p0 '001b213cac30001b213cab6408004500007e79464000402f99080101025c0101025820006558000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
96 ovs-appctl time/warp 1000
97
98 AT_CHECK([ovs-ofctl dump-ports int-br | grep 'port  3'], [0], [dnl
99   port  3: rx pkts=1, bytes=98, drop=0, errs=0, frame=0, over=0, crc=0
100 ])
101
102 dnl Check GRE only accepts encapsulated Ethernet frames
103 AT_CHECK([ovs-appctl netdev-dummy/receive p0 '001b213cac30001b213cab6408004500007e79464000402f99080101025c0101025820000800000001c8fe71d883724fbeb6f4e1494a080045000054ba200000400184861e0000011e00000200004227e75400030af3195500000000f265010000000000101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3031323334353637'])
104 ovs-appctl time/warp 1000
105
106 AT_CHECK([ovs-ofctl dump-ports int-br | grep 'port  3'], [0], [dnl
107   port  3: rx pkts=1, bytes=98, drop=0, errs=0, frame=0, over=0, crc=0
108 ])
109
110 OVS_VSWITCHD_STOP
111 AT_CLEANUP