Allow general masking of IPv4 addresses rather than just CIDR masks.
[openvswitch] / tests / ovs-ofctl.at
1 AT_BANNER([ovs-ofctl])
2
3 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.0)])
4 AT_DATA([flows.txt], [[
5 # comment
6 tcp,tp_src=123,actions=flood
7 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
8 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
9 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
10 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
11 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
12 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
13 ]])
14
15 AT_CHECK([ovs-ofctl parse-flows flows.txt
16 ], [0], [stdout])
17 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
18 [[usable protocols: any
19 chosen protocol: OpenFlow10-table_id
20 OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
21 OFPT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
22 OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
23 OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
24 OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
25 OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
26 OFPT_FLOW_MOD: ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
27 ]])
28 AT_CLEANUP
29
30 AT_SETUP([ovs-ofctl parse-flows (NXM)])
31 AT_DATA([flows.txt], [[
32 # comment
33 tcp,tp_src=123,actions=flood
34 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
35 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
36 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
37 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
38 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
39 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
40 tcp,tp_src=0x1230/0xfff0,tun_id=0x1234,cookie=0x5678,actions=flood
41 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel:0x123456789
42 actions=multipath(eth_src, 50, hrw, 12, 0, NXM_NX_REG0[0..3]),multipath(symmetric_l4, 1024, iter_hash, 5000, 5050, NXM_NX_REG0[0..12])
43 table=1,actions=drop
44 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
45 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
46 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
47 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
48 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
49 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
50 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
51 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:[2,3])
52 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
53 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
54 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3)
55 send_flow_rem,actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
56 check_overlap,actions=output:1,exit,output:2
57 actions=fin_timeout(idle_timeout=5,hard_timeout=15)
58 actions=controller(max_len=123,reason=invalid_ttl,id=555)
59 ]])
60
61 AT_CHECK([ovs-ofctl parse-flows flows.txt
62 ], [0], [stdout])
63 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
64 [[usable protocols: NXM+table_id
65 chosen protocol: NXM+table_id
66 NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
67 NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
68 NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
69 NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
70 NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
71 NXT_FLOW_MOD: ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
72 NXT_FLOW_MOD: ADD table:255 actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
73 NXT_FLOW_MOD: ADD table:255 tcp,tun_id=0x1234,tp_src=0x1230/0xfff0 cookie:0x5678 actions=FLOOD
74 NXT_FLOW_MOD: ADD table:255 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
75 NXT_FLOW_MOD: ADD table:255 actions=multipath(eth_src,50,hrw,12,0,NXM_NX_REG0[0..3]),multipath(symmetric_l4,1024,iter_hash,5000,5050,NXM_NX_REG0[0..12])
76 NXT_FLOW_MOD: ADD table:1 actions=drop
77 NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
78 NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
79 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
80 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
81 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
82 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
83 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
84 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
85 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
86 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
87 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3)
88 NXT_FLOW_MOD: ADD table:255 send_flow_rem actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
89 NXT_FLOW_MOD: ADD table:255 check_overlap actions=output:1,exit,output:2
90 NXT_FLOW_MOD: ADD table:255 actions=fin_timeout(idle_timeout=5,hard_timeout=15)
91 NXT_FLOW_MOD: ADD table:255 actions=controller(reason=invalid_ttl,max_len=123,id=555)
92 ]])
93 AT_CLEANUP
94
95 AT_SETUP([ovs-ofctl -F nxm parse-flows])
96 AT_DATA([flows.txt], [
97 # comment
98 tcp,tp_src=123,actions=flood
99 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
100 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
101 ipv6,ipv6_label=0x12345 actions=2
102 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
103 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
104 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
105 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
106 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
107 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
108 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
109 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
110 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
111 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
112 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4F:0571/112 actions=drop
113 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
114 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
115 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE00:0000/96,nd_tll=00:0A:E4:25:6B:B1 actions=drop
116 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
117 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
118 tun_id=0x1234,cookie=0x5678,actions=flood
119 actions=drop
120 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
121 dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=drop
122 dl_dst=00:00:00:00:00:00/01:00:00:00:00:00,actions=drop
123 dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff,actions=drop
124 dl_dst=aa:bb:cc:dd:ee:ff/00:00:00:00:00:00,actions=drop
125 ])
126 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
127 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
128 usable protocols: NXM
129 chosen protocol: NXM-table_id
130 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
131 NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
132 NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
133 NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
134 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
135 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
136 NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
137 NXT_FLOW_MOD: ADD tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
138 NXT_FLOW_MOD: ADD udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
139 NXT_FLOW_MOD: ADD icmp6,in_port=3,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
140 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
141 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
142 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
143 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571 actions=drop
144 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4f:0/112 actions=drop
145 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_sll=00:0a:e4:25:6b:b0 actions=drop
146 NXT_FLOW_MOD: ADD icmp6,icmp_type=136,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571,nd_tll=00:0a:e4:25:6b:b1 actions=drop
147 NXT_FLOW_MOD: ADD icmp6,icmp_type=136,nd_target=fec0:0:1234:f045:8fff:1111::/96,nd_tll=00:0a:e4:25:6b:b1 actions=drop
148 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
149 NXT_FLOW_MOD: ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
150 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
151 NXT_FLOW_MOD: ADD actions=drop
152 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
153 NXT_FLOW_MOD: ADD dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=drop
154 NXT_FLOW_MOD: ADD dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=drop
155 NXT_FLOW_MOD: ADD dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff actions=drop
156 NXT_FLOW_MOD: ADD actions=drop
157 ])
158 AT_CLEANUP
159
160 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
161 AT_DATA([flows.txt], [[
162 # comment
163 tcp,tp_src=123,actions=flood
164 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
165 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
166 ipv6,ipv6_label=0x12345 actions=2
167 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
168 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
169 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
170 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
171 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
172 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
173 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
174 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
175 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
176 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
177 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
178 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
179 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
180 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
181 tun_id=0x1234,cookie=0x5678,actions=flood
182 actions=drop
183 reg0=123,actions=move:NXM_NX_REG0[0..5]->NXM_NX_REG1[26..31],load:55->NXM_NX_REG2[0..31],move:NXM_NX_REG0[0..31]->NXM_NX_TUN_ID[0..31],move:NXM_NX_REG0[0..15]->NXM_OF_VLAN_TCI[]
184 actions=autopath(5,NXM_NX_REG0[])
185 vlan_tci=0x1123/0x1fff,actions=drop
186 ]])
187 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout])
188 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
189 [[usable protocols: NXM
190 chosen protocol: NXM-table_id
191 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
192 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
193 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
194 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
195 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
196 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
197 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
198 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000001), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(0050) actions=drop
199 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000003), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(0035) actions=drop
200 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(0003), NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000001), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(86) actions=drop
201 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_VLAN_TCI_W(f000/f000), NXM_OF_IP_PROTO(11) idle:5 actions=strip_vlan,output:0
202 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80003), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(0050) actions=set_queue:37,output:1
203 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80003), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(0035) actions=pop_queue,output:1
204 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(fec000001234f0458fff1111fe4e0571) actions=drop
205 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_SLL(000ae4256bb0) actions=drop
206 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(fec000001234f0458fff1111fe4e0571), NXM_NX_ND_TLL(000ae4256bb1) actions=drop
207 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
208 NXT_FLOW_MOD: ADD <any> actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
209 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
210 NXT_FLOW_MOD: ADD <any> actions=drop
211 NXT_FLOW_MOD: ADD NXM_NX_REG0(0000007b) actions=move:NXM_NX_REG0[0..5]->NXM_NX_REG1[26..31],load:0x37->NXM_NX_REG2[],move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],move:NXM_NX_REG0[0..15]->NXM_OF_VLAN_TCI[]
212 NXT_FLOW_MOD: ADD <any> actions=autopath(5,NXM_NX_REG0[])
213 NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop
214 ]])
215 AT_CLEANUP
216
217 AT_SETUP([ovs-ofctl parse-nx-match])
218 AT_KEYWORDS([nx-match])
219 AT_DATA([nx-match.txt], [dnl
220 <any>
221
222 # in port
223 NXM_OF_IN_PORT(0000)
224 NXM_OF_IN_PORT(fffe)
225
226 # eth dst
227 NXM_OF_ETH_DST(0002e30f80a4)
228 NXM_OF_ETH_DST_W(010000000000/010000000000)
229 NXM_OF_ETH_DST_W(000000000000/010000000000)
230 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
231 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
232 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
233 NXM_OF_ETH_DST_W(60175619848f/5a5a5a5a5a5a)
234
235 # eth src
236 NXM_OF_ETH_SRC(020898456ddb)
237 NXM_OF_ETH_SRC_W(012345abcdef/ffffff555555)
238 NXM_OF_ETH_SRC_W(020898456ddb/ffffffffffff)
239
240 # eth type
241 NXM_OF_ETH_TYPE(0800)
242 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
243
244 # vlan tci
245 NXM_OF_VLAN_TCI(f009)
246 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
247 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
248 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
249 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
250 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
251 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
252 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
253
254 # IP TOS
255 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
256 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(41)
257 NXM_OF_IP_TOS(f0)
258
259 # IP ECN
260 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(03)
261 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(06)
262 NXM_NX_IP_ECN(03)
263
264 # IP protocol
265 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
266 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
267 NXM_OF_IP_PROTO(05)
268
269 # IP TTL
270 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_TTL(80)
271 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_TTL(ff)
272 NXM_NX_IP_TTL(80)
273
274 # IP source
275 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
276 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
277 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/5a5a5a5a)
278 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
279 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
280
281 # IP destination
282 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
283 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
284 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/5a5a5a5a)
285 NXM_OF_IP_DST(ac100014)
286 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
287
288 # TCP source port
289 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
290 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/F0F0)
291 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
292
293 # TCP destination port
294 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
295 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/FFF0)
296 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
297
298 # UDP source port
299 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
300 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/01FF)
301 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
302
303 # UDP destination port
304 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
305 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/F00F)
306 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
307
308 # ICMP type
309 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
310 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
311
312 # ICMP code
313 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
314 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
315 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
316 NXM_OF_ICMP_CODE(00)
317
318 # ARP opcode
319 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
320 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
321 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
322 NXM_OF_ARP_OP(0001)
323 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
324
325 # ARP source protocol address
326 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
327 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
328 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
329 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
330 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
331
332 # ARP destination protocol address
333 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
334 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
335 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/77777777)
336 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
337 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
338
339 # ARP source hardware address
340 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
341 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
342 NXM_NX_ARP_SHA(0002e30f80a4)
343
344 # ARP destination hardware address
345 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
346 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
347 NXM_NX_ARP_THA(0002e30f80a4)
348
349 # IPv6 source
350 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
351 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
352 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
353 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
354
355 # IPv6 destination
356 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
357 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
358 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
359 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
360
361 # ND source hardware address
362 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
363 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
364 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3b) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
365 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
366
367 # ND destination hardware address
368 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
369 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
370 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3b) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
371 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
372
373 # IPv4 fragments.
374 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(00)
375 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(01)
376 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(02)
377 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(03)
378 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/03)
379 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/fd)
380 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/02)
381 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(01/01)
382 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(02/02)
383 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/03)
384 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(f3)
385
386 # IPv6 fragments.
387 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(00)
388 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(01)
389 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(02)
390 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(03)
391 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/03)
392 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/01)
393 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/02)
394 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(01/01)
395 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(02/02)
396 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/03)
397 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(f3)
398
399 # Flow cookie.
400 NXM_NX_COOKIE(00000000abcdef01)
401 NXM_NX_COOKIE_W(84200000abcdef01/84200000FFFFFFFF)
402
403 # Tunnel ID.
404 NXM_NX_TUN_ID(00000000abcdef01)
405 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
406
407 # Register 0.
408 NXM_NX_REG0(acebdf56)
409 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
410
411 # Invalid field number.
412 01020304(1111/2222)
413
414 # Unimplemented registers.
415 #
416 # This test assumes that at least two registers, but fewer than 16,
417 # registers are implemented.
418 00010004(12345678)
419 00010108(12345678/12345678)
420 00011e04(12345678)
421 00011f08(12345678/12345678)
422 ])
423 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
424 <any>
425
426 # in port
427 NXM_OF_IN_PORT(0000)
428 NXM_OF_IN_PORT(fffe)
429
430 # eth dst
431 NXM_OF_ETH_DST(0002e30f80a4)
432 NXM_OF_ETH_DST_W(010000000000/010000000000)
433 NXM_OF_ETH_DST_W(000000000000/010000000000)
434 NXM_OF_ETH_DST_W(010000000000/010000000000)
435 NXM_OF_ETH_DST(0002e30f80a4)
436 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
437 NXM_OF_ETH_DST_W(40125218000a/5a5a5a5a5a5a)
438
439 # eth src
440 NXM_OF_ETH_SRC(020898456ddb)
441 NXM_OF_ETH_SRC_W(012345014545/ffffff555555)
442 NXM_OF_ETH_SRC(020898456ddb)
443
444 # eth type
445 NXM_OF_ETH_TYPE(0800)
446 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
447
448 # vlan tci
449 NXM_OF_VLAN_TCI(f009)
450 nx_pull_match() returned error OFPBMC_DUP_FIELD
451 NXM_OF_VLAN_TCI(0000)
452 NXM_OF_VLAN_TCI(3123)
453 NXM_OF_VLAN_TCI(0123)
454 NXM_OF_VLAN_TCI_W(1123/1fff)
455 NXM_OF_VLAN_TCI_W(f000/f000)
456 NXM_OF_VLAN_TCI_W(0000/e000)
457
458 # IP TOS
459 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
460 nx_pull_match() returned error OFPBMC_BAD_VALUE
461 nx_pull_match() returned error OFPBMC_BAD_PREREQ
462
463 # IP ECN
464 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
465 nx_pull_match() returned error OFPBMC_BAD_VALUE
466 nx_pull_match() returned error OFPBMC_BAD_PREREQ
467
468 # IP protocol
469 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
470 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
471 nx_pull_match() returned error OFPBMC_BAD_PREREQ
472
473 # IP TTL
474 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
475 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
476 nx_pull_match() returned error OFPBMC_BAD_PREREQ
477
478 # IP source
479 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
480 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
481 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(40080000/5a5a5a5a)
482 nx_pull_match() returned error OFPBMC_BAD_PREREQ
483 nx_pull_match() returned error OFPBMC_BAD_PREREQ
484
485 # IP destination
486 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
487 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
488 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(40080000/5a5a5a5a)
489 nx_pull_match() returned error OFPBMC_BAD_PREREQ
490 nx_pull_match() returned error OFPBMC_BAD_PREREQ
491
492 # TCP source port
493 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
494 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC_W(5050/f0f0)
495 nx_pull_match() returned error OFPBMC_BAD_PREREQ
496
497 # TCP destination port
498 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
499 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST_W(fde0/fff0)
500 nx_pull_match() returned error OFPBMC_BAD_PREREQ
501
502 # UDP source port
503 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
504 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC_W(0132/01ff)
505 nx_pull_match() returned error OFPBMC_BAD_PREREQ
506
507 # UDP destination port
508 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
509 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST_W(5005/f00f)
510 nx_pull_match() returned error OFPBMC_BAD_PREREQ
511
512 # ICMP type
513 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
514 nx_pull_match() returned error OFPBMC_BAD_PREREQ
515
516 # ICMP code
517 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
518 nx_pull_match() returned error OFPBMC_BAD_PREREQ
519 nx_pull_match() returned error OFPBMC_BAD_PREREQ
520 nx_pull_match() returned error OFPBMC_BAD_PREREQ
521
522 # ARP opcode
523 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
524 nx_pull_match() returned error OFPBMC_BAD_VALUE
525 nx_pull_match() returned error OFPBMC_BAD_PREREQ
526 nx_pull_match() returned error OFPBMC_BAD_PREREQ
527 nx_pull_match() returned error OFPBMC_DUP_FIELD
528
529 # ARP source protocol address
530 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
531 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
532 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(80a80200/aaaaaa00)
533 nx_pull_match() returned error OFPBMC_BAD_PREREQ
534 nx_pull_match() returned error OFPBMC_BAD_PREREQ
535
536 # ARP destination protocol address
537 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
538 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
539 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(40201234/77777777)
540 nx_pull_match() returned error OFPBMC_BAD_PREREQ
541 nx_pull_match() returned error OFPBMC_BAD_PREREQ
542
543 # ARP source hardware address
544 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
545 nx_pull_match() returned error OFPBMC_BAD_PREREQ
546 nx_pull_match() returned error OFPBMC_BAD_PREREQ
547
548 # ARP destination hardware address
549 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
550 nx_pull_match() returned error OFPBMC_BAD_PREREQ
551 nx_pull_match() returned error OFPBMC_BAD_PREREQ
552
553 # IPv6 source
554 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
555 nx_pull_match() returned error OFPBMC_BAD_PREREQ
556 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
557 nx_pull_match() returned error OFPBMC_BAD_PREREQ
558
559 # IPv6 destination
560 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
561 nx_pull_match() returned error OFPBMC_BAD_PREREQ
562 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
563 nx_pull_match() returned error OFPBMC_BAD_PREREQ
564
565 # ND source hardware address
566 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005), NXM_NX_ND_SLL(0002e30f80a4)
567 nx_pull_match() returned error OFPBMC_BAD_PREREQ
568 nx_pull_match() returned error OFPBMC_BAD_PREREQ
569 nx_pull_match() returned error OFPBMC_BAD_PREREQ
570
571 # ND destination hardware address
572 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005), NXM_NX_ND_TLL(0002e30f80a4)
573 nx_pull_match() returned error OFPBMC_BAD_PREREQ
574 nx_pull_match() returned error OFPBMC_BAD_PREREQ
575 nx_pull_match() returned error OFPBMC_BAD_PREREQ
576
577 # IPv4 fragments.
578 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
579 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(01)
580 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(02)
581 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
582 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
583 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/01)
584 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
585 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
586 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
587 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
588 nx_pull_match() returned error OFPBMC_BAD_VALUE
589
590 # IPv6 fragments.
591 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
592 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(01)
593 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(02)
594 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
595 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
596 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/01)
597 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
598 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
599 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
600 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
601 nx_pull_match() returned error OFPBMC_BAD_VALUE
602
603 # Flow cookie.
604 NXM_NX_COOKIE(00000000abcdef01)
605 NXM_NX_COOKIE_W(84200000abcdef01/84200000ffffffff)
606
607 # Tunnel ID.
608 NXM_NX_TUN_ID(00000000abcdef01)
609 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
610
611 # Register 0.
612 NXM_NX_REG0(acebdf56)
613 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
614
615 # Invalid field number.
616 nx_pull_match() returned error OFPBMC_BAD_FIELD
617
618 # Unimplemented registers.
619 #
620 # This test assumes that at least two registers, but fewer than 16,
621 # registers are implemented.
622 NXM_NX_REG0(12345678)
623 NXM_NX_REG0_W(12345678/12345678)
624 nx_pull_match() returned error OFPBMC_BAD_FIELD
625 nx_pull_match() returned error OFPBMC_BAD_FIELD
626 ])
627 AT_CLEANUP
628
629 AT_SETUP([ovs-ofctl parse-ofp11-match])
630 AT_KEYWORDS([OF1.1])
631 AT_DATA([test-data], [dnl
632 # in_port=65534
633 0000 0058 fffffffe 000003fe dnl
634 000000000000ffffffffffff 000000000000ffffffffffff dnl
635 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
636 00000000 00 000000 0000000000000000ffffffffffffffff
637
638 # bad ofp11_match: OFPBMC_BAD_VALUE
639 & ofp_util|WARN|port 305419896 is outside the supported range 0 through 65279 or 0xffffff00 through 0xffffffff
640 0000 0058 12345678 000003fe dnl
641 000000000000ffffffffffff 000000000000ffffffffffff dnl
642 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
643 00000000 00 000000 0000000000000000ffffffffffffffff
644
645 # dl_src=00:01:02:03:04:05
646 0000 0058 00000000 000003ff dnl
647 000102030405000000000000 000000000000ffffffffffff dnl
648 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
649 00000000 00 000000 0000000000000000ffffffffffffffff
650
651 # dl_src=55:55:55:55:55:55/55:55:55:55:55:55
652 0000 0058 00000000 000003ff dnl
653 555555555555aaaaaaaaaaaa 000000000000ffffffffffff dnl
654 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
655 00000000 00 000000 0000000000000000ffffffffffffffff
656
657 # dl_dst=00:01:02:03:04:05
658 0000 0058 00000000 000003ff dnl
659 000000000000ffffffffffff 000102030405000000000000 dnl
660 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
661 00000000 00 000000 0000000000000000ffffffffffffffff
662
663 # dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
664 0000 0058 00000000 000003ff dnl
665 000000000000ffffffffffff 010000000000feffffffffff dnl
666 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
667 00000000 00 000000 0000000000000000ffffffffffffffff
668
669 # dl_dst=00:01:02:03:04:05/fe:ff:ff:ff:ff:ff
670 0000 0058 00000000 000003ff dnl
671 000000000000ffffffffffff 000102030405010000000000 dnl
672 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
673 00000000 00 000000 0000000000000000ffffffffffffffff
674
675 # dl_dst=55:55:55:55:55:55/55:55:55:55:55:55
676 0000 0058 00000000 000003ff dnl
677 000000000000ffffffffffff 555555555555aaaaaaaaaaaa dnl
678 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
679 00000000 00 000000 0000000000000000ffffffffffffffff
680
681 dnl dl_vlan_pcp is ignored if dl_vlan is wildcarded, which causes the
682 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
683 # in_port=1
684 # 11: fa -> fe
685 # 38: 03 -> 00
686 0000 0058 00000001 000003fa dnl
687 000000000000ffffffffffff 000000000000ffffffffffff dnl
688 0000 03 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
689 00000000 00 000000 0000000000000000ffffffffffffffff
690
691 # dl_vlan=291
692 0000 0058 00000000 000003fd dnl
693 000000000000ffffffffffff 000000000000ffffffffffff dnl
694 0123 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
695 00000000 00 000000 0000000000000000ffffffffffffffff
696
697 dnl OFPVID_NONE:
698 # vlan_tci=0x0000
699 0000 0058 00000000 000003fd dnl
700 000000000000ffffffffffff 000000000000ffffffffffff dnl
701 ffff 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
702 00000000 00 000000 0000000000000000ffffffffffffffff
703
704 dnl OFPVID_NONE ignores dl_vlan_pcp even if not wildcarded, which causes
705 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
706 # vlan_tci=0x0000
707 # 11: f9 -> fd
708 # 38: 05 -> 00
709 0000 0058 00000000 000003f9 dnl
710 000000000000ffffffffffff 000000000000ffffffffffff dnl
711 ffff 05 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
712 00000000 00 000000 0000000000000000ffffffffffffffff
713
714 # vlan_tci=0x1000/0x1000
715 0000 0058 00000000 000003fd dnl
716 000000000000ffffffffffff 000000000000ffffffffffff dnl
717 fffe 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
718 00000000 00 000000 0000000000000000ffffffffffffffff
719
720 dnl Try invalid VID:
721 # bad ofp11_match: OFPBMC_BAD_VALUE
722 0000 0058 00000000 000003fd dnl
723 000000000000ffffffffffff 000000000000ffffffffffff dnl
724 1234 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
725 00000000 00 000000 0000000000000000ffffffffffffffff
726
727 # dl_vlan_pcp=4
728 0000 0058 00000000 000003f9 dnl
729 000000000000ffffffffffff 000000000000ffffffffffff dnl
730 fffe 04 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
731 00000000 00 000000 0000000000000000ffffffffffffffff
732
733 # dl_vlan=10,dl_vlan_pcp=6
734 0000 0058 00000000 000003f9 dnl
735 000000000000ffffffffffff 000000000000ffffffffffff dnl
736 000a 06 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
737 00000000 00 000000 0000000000000000ffffffffffffffff
738
739 # dl_type=0x1234
740 0000 0058 00000000 000003f7 dnl
741 000000000000ffffffffffff 000000000000ffffffffffff dnl
742 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
743 00000000 00 000000 0000000000000000ffffffffffffffff
744
745 # ip,nw_tos=252
746 0000 0058 00000000 000003e7 dnl
747 000000000000ffffffffffff 000000000000ffffffffffff dnl
748 0000 00 00 0800 fc 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
749 00000000 00 000000 0000000000000000ffffffffffffffff
750
751 dnl Try invalid TOS:
752 # bad ofp11_match: OFPBMC_BAD_VALUE
753 0000 0058 00000000 000003e7 dnl
754 000000000000ffffffffffff 000000000000ffffffffffff dnl
755 0000 00 00 0800 01 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
756 00000000 00 000000 0000000000000000ffffffffffffffff
757
758 # ip,nw_proto=5
759 0000 0058 00000000 000003d7 dnl
760 000000000000ffffffffffff 000000000000ffffffffffff dnl
761 0000 00 00 0800 00 05 00000000ffffffff 00000000ffffffff 0000 0000 dnl
762 00000000 00 000000 0000000000000000ffffffffffffffff
763
764 # arp,arp_op=2
765 0000 0058 00000000 000003d7 dnl
766 000000000000ffffffffffff 000000000000ffffffffffff dnl
767 0000 00 00 0806 00 02 00000000ffffffff 00000000ffffffff 0000 0000 dnl
768 00000000 00 000000 0000000000000000ffffffffffffffff
769
770 # ip,nw_src=192.168.128.0/24
771 0000 0058 00000000 000003f7 dnl
772 000000000000ffffffffffff 000000000000ffffffffffff dnl
773 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
774 00000000 00 000000 0000000000000000ffffffffffffffff
775
776 # ip,nw_src=128.160.128.0/165.165.165.165
777 # 44: c0 -> 80
778 # 45: a8 -> a0
779 0000 0058 00000000 000003f7 dnl
780 000000000000ffffffffffff 000000000000ffffffffffff dnl
781 0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl
782 00000000 00 000000 0000000000000000ffffffffffffffff
783
784 # ip,nw_dst=192.168.128.0/24
785 0000 0058 00000000 000003f7 dnl
786 000000000000ffffffffffff 000000000000ffffffffffff dnl
787 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
788 00000000 00 000000 0000000000000000ffffffffffffffff
789
790 # ip,nw_dst=128.160.128.0/165.165.165.165
791 # 52: c0 -> 80
792 # 53: a8 -> a0
793 0000 0058 00000000 000003f7 dnl
794 000000000000ffffffffffff 000000000000ffffffffffff dnl
795 0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
796 00000000 00 000000 0000000000000000ffffffffffffffff
797
798 # arp,nw_src=192.168.128.0/24
799 0000 0058 00000000 000003f7 dnl
800 000000000000ffffffffffff 000000000000ffffffffffff dnl
801 0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
802 00000000 00 000000 0000000000000000ffffffffffffffff
803
804 # arp,nw_dst=192.168.128.0/24
805 0000 0058 00000000 000003f7 dnl
806 000000000000ffffffffffff 000000000000ffffffffffff dnl
807 0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
808 00000000 00 000000 0000000000000000ffffffffffffffff
809
810 # tcp,tp_src=443
811 0000 0058 00000000 00000397 dnl
812 000000000000ffffffffffff 000000000000ffffffffffff dnl
813 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
814 00000000 00 000000 0000000000000000ffffffffffffffff
815
816 # tcp,tp_dst=443
817 0000 0058 00000000 00000357 dnl
818 000000000000ffffffffffff 000000000000ffffffffffff dnl
819 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 0000 01bb dnl
820 00000000 00 000000 0000000000000000ffffffffffffffff
821
822 # udp,tp_src=443
823 0000 0058 00000000 00000397 dnl
824 000000000000ffffffffffff 000000000000ffffffffffff dnl
825 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
826 00000000 00 000000 0000000000000000ffffffffffffffff
827
828 # icmp,icmp_type=5
829 0000 0058 00000000 00000397 dnl
830 000000000000ffffffffffff 000000000000ffffffffffff dnl
831 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0005 0000 dnl
832 00000000 00 000000 0000000000000000ffffffffffffffff
833
834 # icmp,icmp_code=8
835 0000 0058 00000000 00000357 dnl
836 000000000000ffffffffffff 000000000000ffffffffffff dnl
837 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0000 0008 dnl
838 00000000 00 000000 0000000000000000ffffffffffffffff
839
840 # udp,tp_src=443
841 0000 0058 00000000 00000397 dnl
842 000000000000ffffffffffff 000000000000ffffffffffff dnl
843 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
844 00000000 00 000000 0000000000000000ffffffffffffffff
845
846 # udp,tp_dst=443
847 0000 0058 00000000 00000357 dnl
848 000000000000ffffffffffff 000000000000ffffffffffff dnl
849 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 0000 01bb dnl
850 00000000 00 000000 0000000000000000ffffffffffffffff
851
852 dnl SCTP, no ports.
853 # ip,nw_proto=132
854 0000 0058 00000000 000003d7 dnl
855 000000000000ffffffffffff 000000000000ffffffffffff dnl
856 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 0000 dnl
857 00000000 00 000000 0000000000000000ffffffffffffffff
858
859 dnl SCTP tp_src matching not supported:
860 # bad ofp11_match: OFPBMC_BAD_FIELD
861 0000 0058 00000000 00000397 dnl
862 000000000000ffffffffffff 000000000000ffffffffffff dnl
863 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
864 00000000 00 000000 0000000000000000ffffffffffffffff
865
866 dnl SCTP tp_dst matching not supported:
867 # bad ofp11_match: OFPBMC_BAD_FIELD
868 0000 0058 00000000 00000357 dnl
869 000000000000ffffffffffff 000000000000ffffffffffff dnl
870 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 01bb dnl
871 00000000 00 000000 0000000000000000ffffffffffffffff
872
873 dnl Ignore tp_src if not TCP or UDP or SCTP:
874 # ip,nw_proto=21
875 # 11: 97 -> d7
876 # 60: 01 -> 00
877 # 61: bb -> 00
878 0000 0058 00000000 00000397 dnl
879 000000000000ffffffffffff 000000000000ffffffffffff dnl
880 0000 00 00 0800 00 15 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
881 00000000 00 000000 0000000000000000ffffffffffffffff
882
883 dnl Ignore tp_dst if not TCP or UDP or SCTP:
884 # ip,nw_proto=22
885 # 11: 57 -> d7
886 # 62: 01 -> 00
887 # 63: bb -> 00
888 0000 0058 00000000 00000357 dnl
889 000000000000ffffffffffff 000000000000ffffffffffff dnl
890 0000 00 00 0800 00 16 00000000ffffffff 00000000ffffffff 0000 01bb dnl
891 00000000 00 000000 0000000000000000ffffffffffffffff
892
893 dnl mpls_label not yet supported:
894 # bad ofp11_match: OFPBMC_BAD_TAG
895 0000 0058 00000000 000002f7 dnl
896 000000000000ffffffffffff 000000000000ffffffffffff dnl
897 0000 00 00 8847 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
898 12345678 00 000000 0000000000000000ffffffffffffffff
899
900 dnl mpls_tc not yet supported:
901 # bad ofp11_match: OFPBMC_BAD_TAG
902 0000 0058 00000000 000001f7 dnl
903 000000000000ffffffffffff 000000000000ffffffffffff dnl
904 0000 00 00 8848 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
905 00000000 5a 000000 0000000000000000ffffffffffffffff
906
907 dnl mpls_label and mpls_tc must be ignored if dl_type is not MPLS:
908 # dl_type=0x1234
909 # 10: 00 -> 03
910 # 64: 12 -> 00
911 # 65: 34 -> 00
912 # 66: 56 -> 00
913 # 67: 78 -> 00
914 # 68: 5a -> 00
915 0000 0058 00000000 000000f7 dnl
916 000000000000ffffffffffff 000000000000ffffffffffff dnl
917 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
918 12345678 5a 000000 0000000000000000ffffffffffffffff
919
920 dnl metadata match not yet supported:
921 # bad ofp11_match: OFPBMC_BAD_FIELD
922 0000 0058 00000000 000003ff dnl
923 000000000000ffffffffffff 000000000000ffffffffffff dnl
924 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
925 00000000 00 000000 0000000000000001fffffffffffffffe
926
927 ])
928 sed '/^[[#&]]/d' < test-data > input.txt
929 sed -n 's/^# //p; /^$/p' < test-data > expout
930 sed -n 's/^& //p' < test-data > experr
931 AT_CAPTURE_FILE([input.txt])
932 AT_CAPTURE_FILE([expout])
933 AT_CAPTURE_FILE([experr])
934 AT_CHECK(
935   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-match < input.txt],
936   [0], [expout], [experr])
937 AT_CLEANUP
938
939 AT_SETUP([ovs-ofctl parse-nx-match loose])
940 AT_KEYWORDS([nx-match])
941 AT_DATA([nx-match.txt], [dnl
942 NXM_OF_IN_PORT(0001), 01020304(1111/2222), NXM_OF_ETH_TYPE(0800)
943 ])
944
945 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
946 nx_pull_match() returned error OFPBMC_BAD_FIELD
947 ])
948
949 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
950 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
951 ])
952 AT_CLEANUP
953
954 AT_SETUP([ovs-ofctl parse-oxm])
955 AT_KEYWORDS([oxm])
956 AT_DATA([oxm.txt], [dnl
957 <any>
958
959 # in port
960 OXM_OF_IN_PORT(00000000)
961 OXM_OF_IN_PORT(fffffffe)
962
963 # eth dst
964 OXM_OF_ETH_DST(0002e30f80a4)
965 OXM_OF_ETH_DST_W(010000000000/010000000000)
966 OXM_OF_ETH_DST_W(000000000000/010000000000)
967 OXM_OF_ETH_DST_W(ffffffffffff/010000000000)
968 OXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
969 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
970
971 # eth src
972 OXM_OF_ETH_SRC(020898456ddb)
973
974 # eth type
975 OXM_OF_ETH_TYPE(0800)
976 OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
977
978 # IP ECN
979 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
980 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06)
981 OXM_OF_IP_ECN(03)
982
983 # IP protocol
984 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01)
985 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(05)
986 OXM_OF_IP_PROTO(05)
987
988 # IP source
989 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC(ac100014)
990 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFF0000)
991 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_SRC(ac100014)
992 OXM_OF_IPV4_SRC_W(C0D80000/FFFF0000)
993
994 # IP destination
995 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST(ac100014)
996 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFF0000)
997 OXM_OF_IPV4_DST(ac100014)
998 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_DST_W(C0D80000/FFFF0000)
999
1000 # TCP source port
1001 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC(4231)
1002 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/F0F0)
1003 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_SRC(4231)
1004
1005 # TCP destination port
1006 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST(4231)
1007 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFF0)
1008 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_DST(4231)
1009
1010 # UDP source port
1011 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC(8732)
1012 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/01FF)
1013 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_UDP_SRC(7823)
1014
1015 # UDP destination port
1016 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST(1782)
1017 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/F00F)
1018 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_UDP_DST(1293)
1019
1020 # ICMP type
1021 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_TYPE(12)
1022 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_TYPE(10)
1023
1024 # ICMP code
1025 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_CODE(12)
1026 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_CODE(10)
1027 OXM_OF_ETH_TYPE(0800) OXM_OF_ICMPV4_CODE(10)
1028 OXM_OF_ICMPV4_CODE(00)
1029
1030 # ARP opcode
1031 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001)
1032 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(1111)
1033 OXM_OF_ETH_TYPE(0000) OXM_OF_ARP_OP(0001)
1034 OXM_OF_ARP_OP(0001)
1035 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001) OXM_OF_ARP_OP(0001)
1036
1037 # ARP source protocol address
1038 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA(ac100014)
1039 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
1040 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SPA(ac100014)
1041 OXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
1042
1043 # ARP destination protocol address
1044 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA(ac100014)
1045 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
1046 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_TPA(ac100014)
1047 OXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
1048
1049 # ARP source hardware address
1050 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4)
1051 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4)
1052 OXM_OF_ARP_SHA(0002e30f80a4)
1053
1054 # ARP destination hardware address
1055 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4)
1056 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4)
1057 OXM_OF_ARP_THA(0002e30f80a4)
1058
1059 # IPv6 source
1060 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1061 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1062 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1063 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1064
1065 # IPv6 destination
1066 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1067 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1068 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1069 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1070
1071 # ND source hardware address
1072 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1073 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1074 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3b) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1075 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1076
1077 # ND destination hardware address
1078 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1079 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1080 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3b) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1081 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1082
1083 # Invalid field number.
1084 01020304(1111/2222)
1085 ])
1086 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
1087 <any>
1088
1089 # in port
1090 OXM_OF_IN_PORT(00000000)
1091 OXM_OF_IN_PORT(fffffffe)
1092
1093 # eth dst
1094 OXM_OF_ETH_DST(0002e30f80a4)
1095 OXM_OF_ETH_DST_W(010000000000/010000000000)
1096 OXM_OF_ETH_DST_W(000000000000/010000000000)
1097 OXM_OF_ETH_DST_W(010000000000/010000000000)
1098 OXM_OF_ETH_DST(0002e30f80a4)
1099 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1100
1101 # eth src
1102 OXM_OF_ETH_SRC(020898456ddb)
1103
1104 # eth type
1105 OXM_OF_ETH_TYPE(0800)
1106 OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
1107
1108 # IP ECN
1109 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
1110 nx_pull_match() returned error OFPBMC_BAD_VALUE
1111 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1112
1113 # IP protocol
1114 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01)
1115 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(05)
1116 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1117
1118 # IP source
1119 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(ac100014)
1120 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC_W(c0a80000/ffff0000)
1121 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1122 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1123
1124 # IP destination
1125 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(ac100014)
1126 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST_W(c0a80000/ffff0000)
1127 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1128 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1129
1130 # TCP source port
1131 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(4231)
1132 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC_W(5050/f0f0)
1133 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1134
1135 # TCP destination port
1136 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(4231)
1137 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST_W(fde0/fff0)
1138 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1139
1140 # UDP source port
1141 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(8732)
1142 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC_W(0132/01ff)
1143 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1144
1145 # UDP destination port
1146 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(1782)
1147 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST_W(5005/f00f)
1148 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1149
1150 # ICMP type
1151 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_TYPE(12)
1152 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1153
1154 # ICMP code
1155 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_CODE(12)
1156 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1157 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1158 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1159
1160 # ARP opcode
1161 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_OP(0001)
1162 nx_pull_match() returned error OFPBMC_BAD_VALUE
1163 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1164 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1165 nx_pull_match() returned error OFPBMC_DUP_FIELD
1166
1167 # ARP source protocol address
1168 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(ac100014)
1169 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA_W(c0a81200/ffffff00)
1170 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1171 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1172
1173 # ARP destination protocol address
1174 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(ac100014)
1175 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA_W(c0a81200/ffffff00)
1176 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1177 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1178
1179 # ARP source hardware address
1180 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
1181 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1182 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1183
1184 # ARP destination hardware address
1185 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
1186 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1187 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1188
1189 # IPv6 source
1190 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1191 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1192 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1193 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1194
1195 # IPv6 destination
1196 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1197 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1198 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1199 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1200
1201 # ND source hardware address
1202 OXM_OF_ETH_TYPE(86dd), OXM_OF_IP_PROTO(3a), OXM_OF_ICMPV6_TYPE(87), OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005), OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1203 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1204 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1205 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1206
1207 # ND destination hardware address
1208 OXM_OF_ETH_TYPE(86dd), OXM_OF_IP_PROTO(3a), OXM_OF_ICMPV6_TYPE(88), OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005), OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1209 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1210 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1211 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1212
1213 # Invalid field number.
1214 nx_pull_match() returned error OFPBMC_BAD_FIELD
1215 ])
1216 AT_CLEANUP
1217
1218 AT_SETUP([ovs-ofctl parse-oxm loose])
1219 AT_KEYWORDS([oxm])
1220 AT_DATA([oxm.txt], [dnl
1221 OXM_OF_IN_PORT(00000001), 01020304(1111/2222), OXM_OF_ETH_TYPE(0800)
1222 ])
1223
1224 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
1225 nx_pull_match() returned error OFPBMC_BAD_FIELD
1226 ])
1227
1228 AT_CHECK([ovs-ofctl parse-oxm < oxm.txt], [0], [dnl
1229 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
1230 ])
1231 AT_CLEANUP
1232
1233 dnl Check that "-F openflow10" rejects a flow_mod with a tun_id, since
1234 dnl OpenFlow 1.0 doesn't support tunnels.
1235 AT_SETUP([ovs-ofctl -F option and tun_id])
1236 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
1237   [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1238 ])
1239 AT_CLEANUP
1240
1241 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
1242 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
1243 dnl additionally show up as the top 32 bits of the cookie.)  This checks
1244 dnl for regression against bug #4566.
1245 AT_SETUP([ovs-ofctl -F option with flow_mods])
1246 OVS_VSWITCHD_START
1247 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
1248 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
1249 NXST_FLOW reply:
1250  tun_id=0x12345678 actions=drop
1251 ])
1252 OVS_VSWITCHD_STOP
1253 AT_CLEANUP
1254
1255 dnl Check that "-F openflow10" is really honored on dump-flows.
1256 dnl (If it isn't, then dump-flows will show the register match.)
1257 AT_SETUP([ovs-ofctl dump-flows honors -F option])
1258 OVS_VSWITCHD_START
1259 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
1260 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1261 OFPST_FLOW reply:
1262  actions=drop
1263 ])
1264 OVS_VSWITCHD_STOP
1265 AT_CLEANUP
1266
1267 dnl Check that "-F openflow10" fails on dump-flows if the requested match
1268 dnl can't be represented in OpenFlow 1.0.
1269 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
1270 OVS_VSWITCHD_START
1271 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
1272   [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1273 ])
1274 OVS_VSWITCHD_STOP
1275 AT_CLEANUP
1276
1277 dnl Check that add-flow reports non-normalized flows (feature #5029).
1278 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
1279 OVS_VSWITCHD_START
1280 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
1281   [0], [], [dnl
1282 ofp_util|INFO|normalization changed ofp_match, details:
1283 ofp_util|INFO| pre: nw_src=1.2.3.4
1284 ofp_util|INFO|post: @&t@
1285 ])
1286 OVS_VSWITCHD_STOP
1287 AT_CLEANUP
1288