ofp-util: Work on decoding OF1.1 flow_mods.
[openvswitch] / tests / odp.at
1 AT_BANNER([datapath parsing and formatting])
2
3 AT_SETUP([OVS datapath key parsing and formatting - valid forms])
4 dnl We could add a test for invalid forms, but that's less important.
5 AT_DATA([odp-base.txt], [dnl
6 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15)
7 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x1234)
8 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=5,tos=0x80,ttl=128,frag=no)
9 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=5,tos=0x81,ttl=128,frag=no)
10 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=5,tos=0x80,ttl=128,frag=first)
11 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=5,tos=0x80,ttl=128,frag=later)
12 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=6,tos=0,ttl=128,frag=no),tcp(src=80,dst=8080)
13 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=17,tos=0,ttl=128,frag=no),udp(src=81,dst=6632)
14 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x0800),ipv4(src=35.8.2.41,dst=172.16.0.20,proto=1,tos=0,ttl=128,frag=no),icmp(type=1,code=2)
15 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no)
16 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x71,hlimit=128,frag=no)
17 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=first)
18 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=later)
19 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=6,tclass=0,hlimit=128,frag=no),tcp(src=80,dst=8080)
20 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=17,tclass=0,hlimit=128,frag=no),udp(src=6630,dst=22)
21 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tclass=0,hlimit=128,frag=no),icmpv6(type=1,code=2)
22 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tclass=0,hlimit=128,frag=no),icmpv6(type=135,code=0),nd(target=::3)
23 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tclass=0,hlimit=128,frag=no),icmpv6(type=135,code=0),nd(target=::3,sll=00:05:06:07:08:09)
24 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tclass=0,hlimit=128,frag=no),icmpv6(type=136,code=0),nd(target=::3,tll=00:0a:0b:0c:0d:0e)
25 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),eth_type(0x86dd),ipv6(src=::1,dst=::2,label=0,proto=58,tclass=0,hlimit=128,frag=no),icmpv6(type=136,code=0),nd(target=::3,sll=00:05:06:07:08:09,tll=00:0a:0b:0c:0d:0e)
26 in_port(1),eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15),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)
27 ])
28
29 (echo '# Valid forms without tun_id or VLAN header.'
30  cat odp-base.txt
31
32  echo
33  echo '# Valid forms with tun_id header.'
34  sed 's/^/tun_id(0x7f10354),/' odp-base.txt
35
36  echo
37  echo '# Valid forms with VLAN header.'
38  sed 's/\(eth([[^)]]*)\),*/\1,eth_type(0x8100),vlan(vid=99,pcp=7),encap(/
39 s/$/)/' odp-base.txt
40
41  echo
42  echo '# Valid forms with QoS priority.'
43  sed 's/^/priority(1234),/' odp-base.txt
44
45  echo
46  echo '# Valid forms with tun_id and VLAN headers.'
47  sed 's/^/tun_id(0xfedcba9876543210),/
48 s/\(eth([[^)]]*)\),*/\1,eth_type(0x8100),vlan(vid=99,pcp=7),encap(/
49 s/$/)/' odp-base.txt
50
51  echo
52  echo '# Valid forms with QOS priority, tun_id, and VLAN headers.'
53  sed 's/^/priority(1234),tun_id(0xfedcba9876543210),/
54 s/\(eth([[^)]]*)\),*/\1,eth_type(0x8100),vlan(vid=99,pcp=7),encap(/
55 s/$/)/' odp-base.txt
56
57  echo
58  echo '# Valid forms with IP first fragment.'
59 sed -n 's/,frag=no),/,frag=first),/p' odp-base.txt
60
61  echo
62  echo '# Valid forms with IP later fragment.'
63 sed -n 's/,frag=no),.*/,frag=later)/p' odp-base.txt) > odp.txt
64 AT_CAPTURE_FILE([odp.txt])
65 AT_CHECK_UNQUOTED([test-odp parse-keys < odp.txt], [0], [`cat odp.txt`
66 ])
67 AT_CLEANUP
68
69 AT_SETUP([OVS datapath actions parsing and formatting - valid forms])
70 AT_DATA([actions.txt], [dnl
71 1,2,3
72 userspace(pid=555666777)
73 userspace(pid=6633,sFlow(vid=9,pcp=7,output=10))
74 userspace(pid=9765,slow_path())
75 userspace(pid=9765,slow_path(cfm))
76 userspace(pid=9765,slow_path(cfm,match))
77 userspace(pid=9123,userdata=0x815309)
78 set(tun_id(0x7f10354))
79 set(in_port(2))
80 set(eth(src=00:01:02:03:04:05,dst=10:11:12:13:14:15))
81 set(eth_type(0x1234))
82 set(ipv4(src=35.8.2.41,dst=172.16.0.20,proto=5,tos=0x80,ttl=128,frag=no))
83 set(tcp(src=80,dst=8080))
84 set(udp(src=81,dst=6632))
85 set(icmp(type=1,code=2))
86 set(ipv6(src=::1,dst=::2,label=0,proto=10,tclass=0x70,hlimit=128,frag=no))
87 set(icmpv6(type=1,code=2))
88 push_vlan(vid=12,pcp=0)
89 push_vlan(vid=13,pcp=5,cfi=0)
90 push_vlan(tpid=0x9100,vid=13,pcp=5)
91 push_vlan(tpid=0x9100,vid=13,pcp=5,cfi=0)
92 pop_vlan
93 sample(sample=9.7%,actions(1,2,3,push_vlan(vid=1,pcp=2)))
94 ])
95 AT_CHECK_UNQUOTED([test-odp parse-actions < actions.txt], [0],
96   [`cat actions.txt`
97 ])
98 AT_CLEANUP