OXM: Allow masking of IPv6 Flow Label
[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 metadata=0x1234ffff5678ffff/0xffff0000ffff0000,actions=drop
46 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
47 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
48 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
49 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
50 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
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..15],slaves:[2,3])
53 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
54 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
55 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3)
56 send_flow_rem,actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
57 check_overlap,actions=output:1,exit,output:2
58 actions=fin_timeout(idle_timeout=5,hard_timeout=15)
59 actions=controller(max_len=123,reason=invalid_ttl,id=555)
60 ]])
61
62 AT_CHECK([ovs-ofctl parse-flows flows.txt
63 ], [0], [stdout])
64 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
65 [[usable protocols: NXM+table_id
66 chosen protocol: NXM+table_id
67 NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
68 NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
69 NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
70 NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
71 NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
72 NXT_FLOW_MOD: ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
73 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
74 NXT_FLOW_MOD: ADD table:255 tcp,tun_id=0x1234,tp_src=0x1230/0xfff0 cookie:0x5678 actions=FLOOD
75 NXT_FLOW_MOD: ADD table:255 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
76 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])
77 NXT_FLOW_MOD: ADD table:1 actions=drop
78 NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
79 NXT_FLOW_MOD: ADD table:255 metadata=0x1234000056780000/0xffff0000ffff0000 actions=drop
80 NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
81 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
82 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
83 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
84 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
85 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
86 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
87 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
88 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
89 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3)
90 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
91 NXT_FLOW_MOD: ADD table:255 check_overlap actions=output:1,exit,output:2
92 NXT_FLOW_MOD: ADD table:255 actions=fin_timeout(idle_timeout=5,hard_timeout=15)
93 NXT_FLOW_MOD: ADD table:255 actions=controller(reason=invalid_ttl,max_len=123,id=555)
94 ]])
95 AT_CLEANUP
96
97 AT_SETUP([ovs-ofctl -F nxm parse-flows])
98 AT_DATA([flows.txt], [
99 # comment
100 tcp,tp_src=123,actions=flood
101 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
102 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
103 ipv6,ipv6_label=0x12345 actions=2
104 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
105 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
106 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
107 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
108 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
109 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
110 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
111 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
112 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
113 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
114 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4F:0571/112 actions=drop
115 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
116 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
117 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE00:0000/96,nd_tll=00:0A:E4:25:6B:B1 actions=drop
118 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
119 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
120 tun_id=0x1234,cookie=0x5678,actions=flood
121 actions=drop
122 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
123 dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=drop
124 dl_dst=00:00:00:00:00:00/01:00:00:00:00:00,actions=drop
125 dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff,actions=drop
126 dl_dst=aa:bb:cc:dd:ee:ff/00:00:00:00:00:00,actions=drop
127 ])
128 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
129 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
130 usable protocols: NXM
131 chosen protocol: NXM-table_id
132 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
133 NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
134 NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
135 NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
136 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
137 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
138 NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
139 NXT_FLOW_MOD: ADD tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
140 NXT_FLOW_MOD: ADD udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
141 NXT_FLOW_MOD: ADD icmp6,in_port=3,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
142 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
143 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
144 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
145 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571 actions=drop
146 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4f:0/112 actions=drop
147 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_sll=00:0a:e4:25:6b:b0 actions=drop
148 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
149 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
150 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
151 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
152 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
153 NXT_FLOW_MOD: ADD actions=drop
154 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
155 NXT_FLOW_MOD: ADD dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=drop
156 NXT_FLOW_MOD: ADD dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=drop
157 NXT_FLOW_MOD: ADD dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff actions=drop
158 NXT_FLOW_MOD: ADD actions=drop
159 ])
160 AT_CLEANUP
161
162 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
163 AT_DATA([flows.txt], [[
164 # comment
165 tcp,tp_src=123,actions=flood
166 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
167 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
168 ipv6,ipv6_label=0x12345 actions=2
169 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
170 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
171 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
172 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
173 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
174 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
175 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
176 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
177 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
178 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
179 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
180 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
181 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
182 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
183 tun_id=0x1234,cookie=0x5678,actions=flood
184 actions=drop
185 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[]
186 actions=move:OXM_OF_ETH_DST[]->OXM_OF_ETH_SRC[]
187 actions=autopath(5,NXM_NX_REG0[])
188 vlan_tci=0x1123/0x1fff,actions=drop
189 ]])
190 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout])
191 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
192 [[usable protocols: NXM
193 chosen protocol: NXM-table_id
194 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
195 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
196 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
197 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
198 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
199 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
200 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
201 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
202 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
203 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
204 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
205 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
206 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
207 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
208 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
209 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
210 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
211 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
212 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
213 NXT_FLOW_MOD: ADD <any> actions=drop
214 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[]
215 NXT_FLOW_MOD: ADD <any> actions=move:NXM_OF_ETH_DST[]->NXM_OF_ETH_SRC[]
216 NXT_FLOW_MOD: ADD <any> actions=autopath(5,NXM_NX_REG0[])
217 NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop
218 ]])
219 AT_CLEANUP
220
221 AT_SETUP([ovs-ofctl parse-nx-match])
222 AT_KEYWORDS([nx-match])
223 AT_DATA([nx-match.txt], [dnl
224 <any>
225
226 # in port
227 NXM_OF_IN_PORT(0000)
228 NXM_OF_IN_PORT(fffe)
229
230 # eth dst
231 NXM_OF_ETH_DST(0002e30f80a4)
232 NXM_OF_ETH_DST_W(010000000000/010000000000)
233 NXM_OF_ETH_DST_W(000000000000/010000000000)
234 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
235 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
236 NXM_OF_ETH_DST_W(60175619848f/000000000000)
237 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
238 NXM_OF_ETH_DST_W(60175619848f/5a5a5a5a5a5a)
239
240 # eth src
241 NXM_OF_ETH_SRC(020898456ddb)
242 NXM_OF_ETH_SRC_W(012345abcdef/ffffff555555)
243 NXM_OF_ETH_SRC_W(020898456ddb/ffffffffffff)
244 NXM_OF_ETH_SRC_W(020898456ddb/000000000000)
245
246 # eth type
247 NXM_OF_ETH_TYPE(0800)
248 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
249
250 # vlan tci
251 NXM_OF_VLAN_TCI(f009)
252 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
253 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
254 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
255 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
256 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
257 NXM_OF_VLAN_TCI_W(1123/ffff)    # Packets with VID=123, PCP=0
258 NXM_OF_VLAN_TCI_W(1123/0000)    # Packets with or without 802.1Q header
259 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
260 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
261
262 # IP TOS
263 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
264 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(41)
265 NXM_OF_IP_TOS(f0)
266
267 # IP ECN
268 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(03)
269 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(06)
270 NXM_NX_IP_ECN(03)
271
272 # IP protocol
273 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
274 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
275 NXM_OF_IP_PROTO(05)
276
277 # IP TTL
278 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_TTL(80)
279 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_TTL(ff)
280 NXM_NX_IP_TTL(80)
281
282 # IP source
283 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
284 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
285 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/5a5a5a5a)
286 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/ffffffff)
287 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/00000000)
288 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
289 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
290
291 # IP destination
292 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
293 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
294 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/5a5a5a5a)
295 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/ffffffff)
296 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/00000000)
297 NXM_OF_IP_DST(ac100014)
298 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
299
300 # TCP source port
301 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
302 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/F0F0)
303 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/ffff)
304 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/0000)
305 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
306
307 # TCP destination port
308 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
309 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/FFF0)
310 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/ffff)
311 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/0000)
312 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
313
314 # UDP source port
315 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
316 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/01FF)
317 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/ffff)
318 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/0000)
319 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
320
321 # UDP destination port
322 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
323 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/F00F)
324 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/FFFF)
325 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/0000)
326 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
327
328 # ICMP type
329 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
330 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
331
332 # ICMP code
333 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
334 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
335 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
336 NXM_OF_ICMP_CODE(00)
337
338 # ARP opcode
339 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
340 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
341 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
342 NXM_OF_ARP_OP(0001)
343 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
344
345 # ARP source protocol address
346 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
347 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
348 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
349 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/ffffffff)
350 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/00000000)
351 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
352 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
353
354 # ARP destination protocol address
355 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
356 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
357 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/77777777)
358 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/ffffffff)
359 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/00000000)
360 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
361 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
362
363 # ARP source hardware address
364 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
365 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
366 NXM_NX_ARP_SHA(0002e30f80a4)
367
368 # ARP destination hardware address
369 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
370 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
371 NXM_NX_ARP_THA(0002e30f80a4)
372
373 # IPv6 source
374 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
375 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
376 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
377 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
378 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
379 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
380 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
381
382 # IPv6 destination
383 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
384 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
385 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/77777777777777777777777777777777)
386 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
387 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
388 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
389
390 # IPv6 Flow Label
391 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_LABEL(1000000f)
392 NXM_NX_IPV6_LABEL(0000000f)
393 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_LABEL(0000000f)
394
395 # ND target address
396 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
397 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
398 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/0123456789abcdeffedcba9876543210)
399 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/ffffffffffffffffffffffffffffffff)
400 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/00000000000000000000000000000000)
401 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/fedcba98765432100123456789abcdef)
402
403 # ND source hardware address
404 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)
405 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)
406 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)
407 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)
408
409 # ND destination hardware address
410 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)
411 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)
412 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)
413 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)
414
415 # IPv4 fragments.
416 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(00)
417 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(01)
418 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(02)
419 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(03)
420 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/03)
421 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/fd)
422 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/02)
423 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(01/01)
424 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(02/02)
425 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/03)
426 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/ff)
427 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/00)
428 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(f3)
429
430 # IPv6 fragments.
431 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(00)
432 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(01)
433 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(02)
434 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(03)
435 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/03)
436 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/01)
437 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/02)
438 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(01/01)
439 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(02/02)
440 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/03)
441 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/00)
442 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/ff)
443 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(f3)
444
445 # Flow cookie.
446 NXM_NX_COOKIE(00000000abcdef01)
447 NXM_NX_COOKIE_W(84200000abcdef01/84200000FFFFFFFF)
448 NXM_NX_COOKIE_W(84200000abcdef01/ffffffffffffffff)
449 NXM_NX_COOKIE_W(84200000abcdef01/0000000000000000)
450
451 # Tunnel ID.
452 NXM_NX_TUN_ID(00000000abcdef01)
453 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
454 NXM_NX_TUN_ID_W(84200000abcdef01/FFFFFFFFFFFFFFFF)
455 NXM_NX_TUN_ID_W(84200000abcdef01/0000000000000000)
456
457 # Register 0.
458 NXM_NX_REG0(acebdf56)
459 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
460 NXM_NX_REG0_W(a0e0d050/ffffffff)
461 NXM_NX_REG0_W(a0e0d050/00000000)
462
463 # Invalid field number.
464 01020304(1111/2222)
465
466 # Unimplemented registers.
467 #
468 # This test assumes that at least two registers, but fewer than 16,
469 # registers are implemented.
470 00010004(12345678)
471 00010108(12345678/12345678)
472 00011e04(12345678)
473 00011f08(12345678/12345678)
474 ])
475 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
476 <any>
477
478 # in port
479 NXM_OF_IN_PORT(0000)
480 NXM_OF_IN_PORT(fffe)
481
482 # eth dst
483 NXM_OF_ETH_DST(0002e30f80a4)
484 NXM_OF_ETH_DST_W(010000000000/010000000000)
485 NXM_OF_ETH_DST_W(000000000000/010000000000)
486 NXM_OF_ETH_DST_W(010000000000/010000000000)
487 NXM_OF_ETH_DST(0002e30f80a4)
488 <any>
489 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
490 NXM_OF_ETH_DST_W(40125218000a/5a5a5a5a5a5a)
491
492 # eth src
493 NXM_OF_ETH_SRC(020898456ddb)
494 NXM_OF_ETH_SRC_W(012345014545/ffffff555555)
495 NXM_OF_ETH_SRC(020898456ddb)
496 <any>
497
498 # eth type
499 NXM_OF_ETH_TYPE(0800)
500 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
501
502 # vlan tci
503 NXM_OF_VLAN_TCI(f009)
504 nx_pull_match() returned error OFPBMC_DUP_FIELD
505 NXM_OF_VLAN_TCI(0000)
506 NXM_OF_VLAN_TCI(3123)
507 NXM_OF_VLAN_TCI(0123)
508 NXM_OF_VLAN_TCI_W(1123/1fff)
509 NXM_OF_VLAN_TCI(1123)
510 <any>
511 NXM_OF_VLAN_TCI_W(f000/f000)
512 NXM_OF_VLAN_TCI_W(0000/e000)
513
514 # IP TOS
515 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
516 nx_pull_match() returned error OFPBMC_BAD_VALUE
517 nx_pull_match() returned error OFPBMC_BAD_PREREQ
518
519 # IP ECN
520 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
521 nx_pull_match() returned error OFPBMC_BAD_VALUE
522 nx_pull_match() returned error OFPBMC_BAD_PREREQ
523
524 # IP protocol
525 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
526 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
527 nx_pull_match() returned error OFPBMC_BAD_PREREQ
528
529 # IP TTL
530 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
531 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
532 nx_pull_match() returned error OFPBMC_BAD_PREREQ
533
534 # IP source
535 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
536 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
537 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(40080000/5a5a5a5a)
538 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80000)
539 NXM_OF_ETH_TYPE(0800)
540 nx_pull_match() returned error OFPBMC_BAD_PREREQ
541 nx_pull_match() returned error OFPBMC_BAD_PREREQ
542
543 # IP destination
544 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
545 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
546 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(40080000/5a5a5a5a)
547 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(c0a80000)
548 NXM_OF_ETH_TYPE(0800)
549 nx_pull_match() returned error OFPBMC_BAD_PREREQ
550 nx_pull_match() returned error OFPBMC_BAD_PREREQ
551
552 # TCP source port
553 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
554 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC_W(5050/f0f0)
555 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(5050)
556 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06)
557 nx_pull_match() returned error OFPBMC_BAD_PREREQ
558
559 # TCP destination port
560 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
561 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST_W(fde0/fff0)
562 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(fde0)
563 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06)
564 nx_pull_match() returned error OFPBMC_BAD_PREREQ
565
566 # UDP source port
567 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
568 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC_W(0132/01ff)
569 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(0132)
570 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11)
571 nx_pull_match() returned error OFPBMC_BAD_PREREQ
572
573 # UDP destination port
574 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
575 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST_W(5005/f00f)
576 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(5005)
577 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11)
578 nx_pull_match() returned error OFPBMC_BAD_PREREQ
579
580 # ICMP type
581 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
582 nx_pull_match() returned error OFPBMC_BAD_PREREQ
583
584 # ICMP code
585 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
586 nx_pull_match() returned error OFPBMC_BAD_PREREQ
587 nx_pull_match() returned error OFPBMC_BAD_PREREQ
588 nx_pull_match() returned error OFPBMC_BAD_PREREQ
589
590 # ARP opcode
591 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
592 nx_pull_match() returned error OFPBMC_BAD_VALUE
593 nx_pull_match() returned error OFPBMC_BAD_PREREQ
594 nx_pull_match() returned error OFPBMC_BAD_PREREQ
595 nx_pull_match() returned error OFPBMC_DUP_FIELD
596
597 # ARP source protocol address
598 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
599 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
600 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(80a80200/aaaaaa00)
601 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(c0a81234)
602 NXM_OF_ETH_TYPE(0806)
603 nx_pull_match() returned error OFPBMC_BAD_PREREQ
604 nx_pull_match() returned error OFPBMC_BAD_PREREQ
605
606 # ARP destination protocol address
607 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
608 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
609 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(40201234/77777777)
610 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(c0a81234)
611 NXM_OF_ETH_TYPE(0806)
612 nx_pull_match() returned error OFPBMC_BAD_PREREQ
613 nx_pull_match() returned error OFPBMC_BAD_PREREQ
614
615 # ARP source hardware address
616 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
617 nx_pull_match() returned error OFPBMC_BAD_PREREQ
618 nx_pull_match() returned error OFPBMC_BAD_PREREQ
619
620 # ARP destination hardware address
621 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
622 nx_pull_match() returned error OFPBMC_BAD_PREREQ
623 nx_pull_match() returned error OFPBMC_BAD_PREREQ
624
625 # IPv6 source
626 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
627 nx_pull_match() returned error OFPBMC_BAD_PREREQ
628 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
629 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(00000818184800000000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
630 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000000)
631 NXM_OF_ETH_TYPE(86dd)
632 nx_pull_match() returned error OFPBMC_BAD_PREREQ
633
634 # IPv6 destination
635 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
636 nx_pull_match() returned error OFPBMC_BAD_PREREQ
637 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010530344500010000000000000000/77777777777777777777777777777777)
638 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010000000000000000)
639 NXM_OF_ETH_TYPE(86dd)
640 nx_pull_match() returned error OFPBMC_BAD_PREREQ
641
642 # IPv6 Flow Label
643 nx_pull_match() returned error OFPBMC_BAD_VALUE
644 nx_pull_match() returned error OFPBMC_BAD_PREREQ
645 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(0000000f)
646
647 # ND target address
648 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
649 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
650 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET_W(00010520080900010000000000040000/0123456789abcdeffedcba9876543210)
651 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
652 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87)
653 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET_W(20000898344400000002000300000005/fedcba98765432100123456789abcdef)
654
655 # ND source hardware address
656 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)
657 nx_pull_match() returned error OFPBMC_BAD_PREREQ
658 nx_pull_match() returned error OFPBMC_BAD_PREREQ
659 nx_pull_match() returned error OFPBMC_BAD_PREREQ
660
661 # ND destination hardware address
662 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)
663 nx_pull_match() returned error OFPBMC_BAD_PREREQ
664 nx_pull_match() returned error OFPBMC_BAD_PREREQ
665 nx_pull_match() returned error OFPBMC_BAD_PREREQ
666
667 # IPv4 fragments.
668 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
669 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(01)
670 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(02)
671 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
672 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
673 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/01)
674 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
675 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
676 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
677 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
678 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
679 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
680 nx_pull_match() returned error OFPBMC_BAD_VALUE
681
682 # IPv6 fragments.
683 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
684 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(01)
685 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(02)
686 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
687 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
688 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/01)
689 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
690 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
691 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
692 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
693 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
694 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
695 nx_pull_match() returned error OFPBMC_BAD_VALUE
696
697 # Flow cookie.
698 NXM_NX_COOKIE(00000000abcdef01)
699 NXM_NX_COOKIE_W(84200000abcdef01/84200000ffffffff)
700 NXM_NX_COOKIE(84200000abcdef01)
701 <any>
702
703 # Tunnel ID.
704 NXM_NX_TUN_ID(00000000abcdef01)
705 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
706 NXM_NX_TUN_ID(84200000abcdef01)
707 <any>
708
709 # Register 0.
710 NXM_NX_REG0(acebdf56)
711 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
712 NXM_NX_REG0(a0e0d050)
713 <any>
714
715 # Invalid field number.
716 nx_pull_match() returned error OFPBMC_BAD_FIELD
717
718 # Unimplemented registers.
719 #
720 # This test assumes that at least two registers, but fewer than 16,
721 # registers are implemented.
722 NXM_NX_REG0(12345678)
723 NXM_NX_REG0_W(12345678/12345678)
724 nx_pull_match() returned error OFPBMC_BAD_FIELD
725 nx_pull_match() returned error OFPBMC_BAD_FIELD
726 ])
727 AT_CLEANUP
728
729 AT_SETUP([ovs-ofctl parse-ofp10-match])
730 AT_KEYWORDS([OF1.0])
731 AT_DATA([test-data], [dnl
732 # in_port=65534
733 003820fe fffe 000000000000 000000000000 0000 00 00 0000 00 00 0000 dnl
734 00000000 00000000 0000 0000
735
736 # dl_src=00:01:02:03:04:05
737 003820fb 0000 000102030405 000000000000 0000 00 00 0000 00 00 0000 dnl
738 00000000 00000000 0000 0000
739
740 # dl_dst=10:20:30:40:50:60
741 003820f7 0000 000000000000 102030405060 0000 00 00 0000 00 00 0000 dnl
742 00000000 00000000 0000 0000
743
744 # dl_vlan=291
745 003820fd 0000 000000000000 000000000000 0123 00 00 0000 00 00 0000 dnl
746 00000000 00000000 0000 0000
747
748 # dl_vlan_pcp=5
749 002820ff 0000 000000000000 000000000000 0000 05 00 0000 00 00 0000 dnl
750 00000000 00000000 0000 0000
751
752 # dl_vlan=291,dl_vlan_pcp=4
753 002820fd 0000 000000000000 000000000000 0123 04 00 0000 00 00 0000 dnl
754 00000000 00000000 0000 0000
755
756 # vlan_tci=0x0000
757 003820fd 0000 000000000000 000000000000 ffff 00 00 0000 00 00 0000 dnl
758 00000000 00000000 0000 0000
759
760 dnl dl_vlan_pcp doesn't make sense when dl_vlan is "none", so
761 dnl OVS ignores it and drops it on output.
762 # vlan_tci=0x0000
763 #  1: 28 -> 38
764 # 20: 05 -> 00
765 002820fd 0000 000000000000 000000000000 ffff 05 00 0000 00 00 0000 dnl
766 00000000 00000000 0000 0000
767
768 dnl Invalid VID and PCP discards out-of-range bits:
769 # dl_vlan=256,dl_vlan_pcp=7
770 # 18: f1 -> 01
771 # 20: ff -> 07
772 002820fd 0000 000000000000 000000000000 f100 ff 00 0000 00 00 0000 dnl
773 00000000 00000000 0000 0000
774
775 # dl_type=0x1234
776 003820ef 0000 000000000000 000000000000 0000 00 00 1234 00 00 0000 dnl
777 00000000 00000000 0000 0000
778
779 # ip,nw_proto=5
780 003820cf 0000 000000000000 000000000000 0000 00 00 0800 00 05 0000 dnl
781 00000000 00000000 0000 0000
782
783 dnl Ignore nw_proto if not IP or ARP:
784 # dl_type=0x1234,nw_proto=5
785 # normal:  3: cf -> ef
786 # normal: 25: 05 -> 00
787 & ofp_util|INFO|normalization changed ofp_match, details:
788 & ofp_util|INFO| pre: dl_type=0x1234,nw_proto=5
789 & ofp_util|INFO|post: dl_type=0x1234
790 003820cf 0000 000000000000 000000000000 0000 00 00 1234 00 05 0000 dnl
791 00000000 00000000 0000 0000
792
793 # ip,nw_tos=252
794 001820ef 0000 000000000000 000000000000 0000 00 00 0800 fc 00 0000 dnl
795 00000000 00000000 0000 0000
796
797 dnl Ignore nw_tos if not IP:
798 # arp,nw_tos=4
799 # 24: 05 -> 04
800 # normal:  1: 18 -> 38
801 # normal: 24: 04 -> 00
802 & ofp_util|INFO|normalization changed ofp_match, details:
803 & ofp_util|INFO| pre: arp,nw_tos=4
804 & ofp_util|INFO|post: arp
805 001820ef 0000 000000000000 000000000000 0000 00 00 0806 05 00 0000 dnl
806 00000000 00000000 0000 0000
807
808 dnl Low 2 bits of invalid TOS are forced to 0:
809 # ip,nw_tos=48
810 # 24: 31 -> 30
811 001820ef 0000 000000000000 000000000000 0000 00 00 0800 31 00 0000 dnl
812 00000000 00000000 0000 0000
813
814 # arp,arp_op=2
815 003820cf 0000 000000000000 000000000000 0000 00 00 0806 00 02 0000 dnl
816 00000000 00000000 0000 0000
817
818 # ip,nw_src=192.168.128.85
819 003800ef 0000 000000000000 000000000000 0000 00 00 0800 00 00 0000 dnl
820 c0a88055 00000000 0000 0000
821
822 # ip,nw_src=192.168.128.0/24
823 # 31: 55 -> 00
824 003808ef 0000 000000000000 000000000000 0000 00 00 0800 00 00 0000 dnl
825 c0a88055 00000000 0000 0000
826
827 # ip,nw_dst=192.168.128.85
828 003020ef 0000 000000000000 000000000000 0000 00 00 0800 00 00 0000 dnl
829 00000000 c0a88055 0000 0000
830
831 # ip,nw_dst=192.168.128.0/24
832 # 35: 55 -> 00
833 003220ef 0000 000000000000 000000000000 0000 00 00 0800 00 00 0000 dnl
834 00000000 c0a88055 0000 0000
835
836 # arp,nw_src=192.168.128.85
837 003800ef 0000 000000000000 000000000000 0000 00 00 0806 00 00 0000 dnl
838 c0a88055 00000000 0000 0000
839
840 # arp,nw_src=192.168.128.0/24
841 # 31: 55 -> 00
842 003808ef 0000 000000000000 000000000000 0000 00 00 0806 00 00 0000 dnl
843 c0a88055 00000000 0000 0000
844
845 # arp,nw_dst=192.168.128.85
846 003020ef 0000 000000000000 000000000000 0000 00 00 0806 00 00 0000 dnl
847 00000000 c0a88055 0000 0000
848
849 # arp,nw_dst=192.168.128.0/24
850 # 35: 55 -> 00
851 003220ef 0000 000000000000 000000000000 0000 00 00 0806 00 00 0000 dnl
852 00000000 c0a88055 0000 0000
853
854 dnl Ignore nw_src if not IP or ARP:
855 # dl_type=0x1234,nw_src=192.168.128.0/24
856 # 31: 55 -> 00
857 # normal:  2: 08 -> 20
858 # normal: 28: c0 -> 00
859 # normal: 29: a8 -> 00
860 # normal: 30: 80 -> 00
861 & ofp_util|INFO|normalization changed ofp_match, details:
862 & ofp_util|INFO| pre: dl_type=0x1234,nw_src=192.168.128.0/24
863 & ofp_util|INFO|post: dl_type=0x1234
864 003808ef 0000 000000000000 000000000000 0000 00 00 1234 00 00 0000 dnl
865 c0a88055 00000000 0000 0000
866
867 dnl Ignore nw_dst if not IP or ARP:
868 # dl_type=0x1234,nw_dst=192.168.128.0/24
869 # 35: 55 -> 00
870 # normal:  1: 32 -> 38
871 # normal: 32: c0 -> 00
872 # normal: 33: a8 -> 00
873 # normal: 34: 80 -> 00
874 & ofp_util|INFO|normalization changed ofp_match, details:
875 & ofp_util|INFO| pre: dl_type=0x1234,nw_dst=192.168.128.0/24
876 & ofp_util|INFO|post: dl_type=0x1234
877 003220ef 0000 000000000000 000000000000 0000 00 00 1234 00 00 0000 dnl
878 00000000 c0a88055 0000 0000
879
880 # tcp,tp_src=443
881 0038208f 0000 000000000000 000000000000 0000 00 00 0800 00 06 0000 dnl
882 00000000 00000000 01bb 0000
883
884 # tcp,tp_dst=443
885 0038204f 0000 000000000000 000000000000 0000 00 00 0800 00 06 0000 dnl
886 00000000 00000000 0000 01bb
887
888 # udp,tp_src=443
889 0038208f 0000 000000000000 000000000000 0000 00 00 0800 00 11 0000 dnl
890 00000000 00000000 01bb 0000
891
892 # udp,tp_dst=443
893 0038204f 0000 000000000000 000000000000 0000 00 00 0800 00 11 0000 dnl
894 00000000 00000000 0000 01bb
895
896 # icmp,icmp_type=5
897 0038208f 0000 000000000000 000000000000 0000 00 00 0800 00 01 0000 dnl
898 00000000 00000000 0005 0000
899
900 # icmp,icmp_code=8
901 0038204f 0000 000000000000 000000000000 0000 00 00 0800 00 01 0000 dnl
902 00000000 00000000 0000 0008
903
904 dnl Ignore tp_src if not TCP or UDP:
905 # ip,nw_proto=21,tp_src=443
906 # normal:  3: 8f -> cf
907 # normal: 36: 01 -> 00
908 # normal: 37: bb -> 00
909 & ofp_util|INFO|normalization changed ofp_match, details:
910 & ofp_util|INFO| pre: ip,nw_proto=21,tp_src=443
911 & ofp_util|INFO|post: ip,nw_proto=21
912 0038208f 0000 000000000000 000000000000 0000 00 00 0800 00 15 0000 dnl
913 00000000 00000000 01bb 0000
914
915 dnl Ignore tp_dst if not TCP or UDP:
916 # ip,nw_proto=21,tp_dst=443
917 # normal:  3: 4f -> cf
918 # normal: 38: 01 -> 00
919 # normal: 39: bb -> 00
920 dnl The normalization details are suppressed here due to rate-limiting.
921 0038204f 0000 000000000000 000000000000 0000 00 00 0800 00 15 0000 dnl
922 00000000 00000000 0000 01bb
923
924 ])
925 sed '/^[[#&]]/d' < test-data > input.txt
926 sed -n 's/^# //p; /^$/p' < test-data > expout
927 sed -n 's/^& //p' < test-data > experr
928 AT_CAPTURE_FILE([input.txt])
929 AT_CAPTURE_FILE([expout])
930 AT_CAPTURE_FILE([experr])
931 AT_CHECK(
932   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-match < input.txt],
933   [0], [expout], [experr])
934 AT_CLEANUP
935
936 AT_SETUP([ovs-ofctl parse-ofp11-match])
937 AT_KEYWORDS([OF1.1])
938 AT_DATA([test-data], [dnl
939 # in_port=65534
940 0000 0058 fffffffe 000003fe dnl
941 000000000000ffffffffffff 000000000000ffffffffffff dnl
942 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
943 00000000 00 000000 0000000000000000ffffffffffffffff
944
945 # bad ofp11_match: OFPBMC_BAD_VALUE
946 & ofp_util|WARN|port 305419896 is outside the supported range 0 through 65279 or 0xffffff00 through 0xffffffff
947 0000 0058 12345678 000003fe dnl
948 000000000000ffffffffffff 000000000000ffffffffffff dnl
949 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
950 00000000 00 000000 0000000000000000ffffffffffffffff
951
952 # dl_src=00:01:02:03:04:05
953 0000 0058 00000000 000003ff dnl
954 000102030405000000000000 000000000000ffffffffffff dnl
955 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
956 00000000 00 000000 0000000000000000ffffffffffffffff
957
958 # dl_src=55:55:55:55:55:55/55:55:55:55:55:55
959 0000 0058 00000000 000003ff dnl
960 555555555555aaaaaaaaaaaa 000000000000ffffffffffff dnl
961 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
962 00000000 00 000000 0000000000000000ffffffffffffffff
963
964 # dl_dst=00:01:02:03:04:05
965 0000 0058 00000000 000003ff dnl
966 000000000000ffffffffffff 000102030405000000000000 dnl
967 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
968 00000000 00 000000 0000000000000000ffffffffffffffff
969
970 # dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
971 0000 0058 00000000 000003ff dnl
972 000000000000ffffffffffff 010000000000feffffffffff dnl
973 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
974 00000000 00 000000 0000000000000000ffffffffffffffff
975
976 # dl_dst=00:01:02:03:04:05/fe:ff:ff:ff:ff:ff
977 0000 0058 00000000 000003ff dnl
978 000000000000ffffffffffff 000102030405010000000000 dnl
979 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
980 00000000 00 000000 0000000000000000ffffffffffffffff
981
982 # dl_dst=55:55:55:55:55:55/55:55:55:55:55:55
983 0000 0058 00000000 000003ff dnl
984 000000000000ffffffffffff 555555555555aaaaaaaaaaaa dnl
985 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
986 00000000 00 000000 0000000000000000ffffffffffffffff
987
988 dnl dl_vlan_pcp is ignored if dl_vlan is wildcarded, which causes the
989 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
990 # in_port=1
991 # 11: fa -> fe
992 # 38: 03 -> 00
993 0000 0058 00000001 000003fa dnl
994 000000000000ffffffffffff 000000000000ffffffffffff dnl
995 0000 03 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
996 00000000 00 000000 0000000000000000ffffffffffffffff
997
998 # dl_vlan=291
999 0000 0058 00000000 000003fd dnl
1000 000000000000ffffffffffff 000000000000ffffffffffff dnl
1001 0123 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1002 00000000 00 000000 0000000000000000ffffffffffffffff
1003
1004 dnl OFPVID_NONE:
1005 # vlan_tci=0x0000
1006 0000 0058 00000000 000003fd dnl
1007 000000000000ffffffffffff 000000000000ffffffffffff dnl
1008 ffff 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1009 00000000 00 000000 0000000000000000ffffffffffffffff
1010
1011 dnl OFPVID_NONE ignores dl_vlan_pcp even if not wildcarded, which causes
1012 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1013 # vlan_tci=0x0000
1014 # 11: f9 -> fd
1015 # 38: 05 -> 00
1016 0000 0058 00000000 000003f9 dnl
1017 000000000000ffffffffffff 000000000000ffffffffffff dnl
1018 ffff 05 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1019 00000000 00 000000 0000000000000000ffffffffffffffff
1020
1021 # vlan_tci=0x1000/0x1000
1022 0000 0058 00000000 000003fd dnl
1023 000000000000ffffffffffff 000000000000ffffffffffff dnl
1024 fffe 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1025 00000000 00 000000 0000000000000000ffffffffffffffff
1026
1027 dnl Try invalid VID:
1028 # bad ofp11_match: OFPBMC_BAD_VALUE
1029 0000 0058 00000000 000003fd dnl
1030 000000000000ffffffffffff 000000000000ffffffffffff dnl
1031 1234 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1032 00000000 00 000000 0000000000000000ffffffffffffffff
1033
1034 # dl_vlan_pcp=4
1035 0000 0058 00000000 000003f9 dnl
1036 000000000000ffffffffffff 000000000000ffffffffffff dnl
1037 fffe 04 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1038 00000000 00 000000 0000000000000000ffffffffffffffff
1039
1040 # dl_vlan=10,dl_vlan_pcp=6
1041 0000 0058 00000000 000003f9 dnl
1042 000000000000ffffffffffff 000000000000ffffffffffff dnl
1043 000a 06 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1044 00000000 00 000000 0000000000000000ffffffffffffffff
1045
1046 # dl_type=0x1234
1047 0000 0058 00000000 000003f7 dnl
1048 000000000000ffffffffffff 000000000000ffffffffffff dnl
1049 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1050 00000000 00 000000 0000000000000000ffffffffffffffff
1051
1052 # ip,nw_tos=252
1053 0000 0058 00000000 000003e7 dnl
1054 000000000000ffffffffffff 000000000000ffffffffffff dnl
1055 0000 00 00 0800 fc 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1056 00000000 00 000000 0000000000000000ffffffffffffffff
1057
1058 dnl Try invalid TOS:
1059 # bad ofp11_match: OFPBMC_BAD_VALUE
1060 0000 0058 00000000 000003e7 dnl
1061 000000000000ffffffffffff 000000000000ffffffffffff dnl
1062 0000 00 00 0800 01 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1063 00000000 00 000000 0000000000000000ffffffffffffffff
1064
1065 # ip,nw_proto=5
1066 0000 0058 00000000 000003d7 dnl
1067 000000000000ffffffffffff 000000000000ffffffffffff dnl
1068 0000 00 00 0800 00 05 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1069 00000000 00 000000 0000000000000000ffffffffffffffff
1070
1071 # arp,arp_op=2
1072 0000 0058 00000000 000003d7 dnl
1073 000000000000ffffffffffff 000000000000ffffffffffff dnl
1074 0000 00 00 0806 00 02 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1075 00000000 00 000000 0000000000000000ffffffffffffffff
1076
1077 # ip,nw_src=192.168.128.0/24
1078 0000 0058 00000000 000003f7 dnl
1079 000000000000ffffffffffff 000000000000ffffffffffff dnl
1080 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1081 00000000 00 000000 0000000000000000ffffffffffffffff
1082
1083 # ip,nw_src=128.160.128.0/165.165.165.165
1084 # 44: c0 -> 80
1085 # 45: a8 -> a0
1086 0000 0058 00000000 000003f7 dnl
1087 000000000000ffffffffffff 000000000000ffffffffffff dnl
1088 0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl
1089 00000000 00 000000 0000000000000000ffffffffffffffff
1090
1091 # ip,nw_dst=192.168.128.0/24
1092 0000 0058 00000000 000003f7 dnl
1093 000000000000ffffffffffff 000000000000ffffffffffff dnl
1094 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1095 00000000 00 000000 0000000000000000ffffffffffffffff
1096
1097 # ip,nw_dst=128.160.128.0/165.165.165.165
1098 # 52: c0 -> 80
1099 # 53: a8 -> a0
1100 0000 0058 00000000 000003f7 dnl
1101 000000000000ffffffffffff 000000000000ffffffffffff dnl
1102 0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
1103 00000000 00 000000 0000000000000000ffffffffffffffff
1104
1105 # arp,nw_src=192.168.128.0/24
1106 0000 0058 00000000 000003f7 dnl
1107 000000000000ffffffffffff 000000000000ffffffffffff dnl
1108 0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1109 00000000 00 000000 0000000000000000ffffffffffffffff
1110
1111 # arp,nw_dst=192.168.128.0/24
1112 0000 0058 00000000 000003f7 dnl
1113 000000000000ffffffffffff 000000000000ffffffffffff dnl
1114 0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1115 00000000 00 000000 0000000000000000ffffffffffffffff
1116
1117 # tcp,tp_src=443
1118 0000 0058 00000000 00000397 dnl
1119 000000000000ffffffffffff 000000000000ffffffffffff dnl
1120 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1121 00000000 00 000000 0000000000000000ffffffffffffffff
1122
1123 # tcp,tp_dst=443
1124 0000 0058 00000000 00000357 dnl
1125 000000000000ffffffffffff 000000000000ffffffffffff dnl
1126 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1127 00000000 00 000000 0000000000000000ffffffffffffffff
1128
1129 # udp,tp_src=443
1130 0000 0058 00000000 00000397 dnl
1131 000000000000ffffffffffff 000000000000ffffffffffff dnl
1132 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1133 00000000 00 000000 0000000000000000ffffffffffffffff
1134
1135 # icmp,icmp_type=5
1136 0000 0058 00000000 00000397 dnl
1137 000000000000ffffffffffff 000000000000ffffffffffff dnl
1138 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0005 0000 dnl
1139 00000000 00 000000 0000000000000000ffffffffffffffff
1140
1141 # icmp,icmp_code=8
1142 0000 0058 00000000 00000357 dnl
1143 000000000000ffffffffffff 000000000000ffffffffffff dnl
1144 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0000 0008 dnl
1145 00000000 00 000000 0000000000000000ffffffffffffffff
1146
1147 # udp,tp_src=443
1148 0000 0058 00000000 00000397 dnl
1149 000000000000ffffffffffff 000000000000ffffffffffff dnl
1150 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1151 00000000 00 000000 0000000000000000ffffffffffffffff
1152
1153 # udp,tp_dst=443
1154 0000 0058 00000000 00000357 dnl
1155 000000000000ffffffffffff 000000000000ffffffffffff dnl
1156 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1157 00000000 00 000000 0000000000000000ffffffffffffffff
1158
1159 dnl SCTP, no ports.
1160 # ip,nw_proto=132
1161 0000 0058 00000000 000003d7 dnl
1162 000000000000ffffffffffff 000000000000ffffffffffff dnl
1163 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1164 00000000 00 000000 0000000000000000ffffffffffffffff
1165
1166 dnl SCTP tp_src matching not supported:
1167 # bad ofp11_match: OFPBMC_BAD_FIELD
1168 0000 0058 00000000 00000397 dnl
1169 000000000000ffffffffffff 000000000000ffffffffffff dnl
1170 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1171 00000000 00 000000 0000000000000000ffffffffffffffff
1172
1173 dnl SCTP tp_dst matching not supported:
1174 # bad ofp11_match: OFPBMC_BAD_FIELD
1175 0000 0058 00000000 00000357 dnl
1176 000000000000ffffffffffff 000000000000ffffffffffff dnl
1177 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1178 00000000 00 000000 0000000000000000ffffffffffffffff
1179
1180 dnl Ignore tp_src if not TCP or UDP or SCTP:
1181 # ip,nw_proto=21
1182 # 11: 97 -> d7
1183 # 60: 01 -> 00
1184 # 61: bb -> 00
1185 0000 0058 00000000 00000397 dnl
1186 000000000000ffffffffffff 000000000000ffffffffffff dnl
1187 0000 00 00 0800 00 15 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1188 00000000 00 000000 0000000000000000ffffffffffffffff
1189
1190 dnl Ignore tp_dst if not TCP or UDP or SCTP:
1191 # ip,nw_proto=22
1192 # 11: 57 -> d7
1193 # 62: 01 -> 00
1194 # 63: bb -> 00
1195 0000 0058 00000000 00000357 dnl
1196 000000000000ffffffffffff 000000000000ffffffffffff dnl
1197 0000 00 00 0800 00 16 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1198 00000000 00 000000 0000000000000000ffffffffffffffff
1199
1200 dnl mpls_label not yet supported:
1201 # bad ofp11_match: OFPBMC_BAD_TAG
1202 0000 0058 00000000 000002f7 dnl
1203 000000000000ffffffffffff 000000000000ffffffffffff dnl
1204 0000 00 00 8847 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1205 12345678 00 000000 0000000000000000ffffffffffffffff
1206
1207 dnl mpls_tc not yet supported:
1208 # bad ofp11_match: OFPBMC_BAD_TAG
1209 0000 0058 00000000 000001f7 dnl
1210 000000000000ffffffffffff 000000000000ffffffffffff dnl
1211 0000 00 00 8848 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1212 00000000 5a 000000 0000000000000000ffffffffffffffff
1213
1214 dnl mpls_label and mpls_tc must be ignored if dl_type is not MPLS:
1215 # dl_type=0x1234
1216 # 10: 00 -> 03
1217 # 64: 12 -> 00
1218 # 65: 34 -> 00
1219 # 66: 56 -> 00
1220 # 67: 78 -> 00
1221 # 68: 5a -> 00
1222 0000 0058 00000000 000000f7 dnl
1223 000000000000ffffffffffff 000000000000ffffffffffff dnl
1224 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1225 12345678 5a 000000 0000000000000000ffffffffffffffff
1226
1227 dnl metadata match:
1228 # metadata=0x1234567890abcdef
1229 0000 0058 00000000 000003ff dnl
1230 000000000000ffffffffffff 000000000000ffffffffffff dnl
1231 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1232 00000000 00 000000 1234567890abcdef0000000000000000
1233
1234 dnl metadata match:
1235 # metadata=0x5555555555555555/0x5555555555555555
1236 0000 0058 00000000 000003ff dnl
1237 000000000000ffffffffffff 000000000000ffffffffffff dnl
1238 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1239 00000000 00 000000 5555555555555555aaaaaaaaaaaaaaaa
1240
1241 dnl metadata match:
1242 # metadata=0x1234000090ab0000/0xffff0000ffff0000
1243 # 74: 56 -> 00
1244 # 75: 78 -> 00
1245 # 78: cd -> 00
1246 # 79: ef -> 00
1247 0000 0058 00000000 000003ff dnl
1248 000000000000ffffffffffff 000000000000ffffffffffff dnl
1249 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1250 00000000 00 000000 1234567890abcdef0000ffff0000ffff
1251
1252 ])
1253 sed '/^[[#&]]/d' < test-data > input.txt
1254 sed -n 's/^# //p; /^$/p' < test-data > expout
1255 sed -n 's/^& //p' < test-data > experr
1256 AT_CAPTURE_FILE([input.txt])
1257 AT_CAPTURE_FILE([expout])
1258 AT_CAPTURE_FILE([experr])
1259 AT_CHECK(
1260   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-match < input.txt],
1261   [0], [expout], [experr])
1262 AT_CLEANUP
1263
1264 AT_SETUP([ovs-ofctl parse-nx-match loose])
1265 AT_KEYWORDS([nx-match])
1266 AT_DATA([nx-match.txt], [dnl
1267 NXM_OF_IN_PORT(0001), 01020304(1111/2222), NXM_OF_ETH_TYPE(0800)
1268 ])
1269
1270 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
1271 nx_pull_match() returned error OFPBMC_BAD_FIELD
1272 ])
1273
1274 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
1275 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1276 ])
1277 AT_CLEANUP
1278
1279 AT_SETUP([ovs-ofctl parse-oxm])
1280 AT_KEYWORDS([oxm])
1281 AT_DATA([oxm.txt], [dnl
1282 <any>
1283
1284 # in port
1285 OXM_OF_IN_PORT(00000000)
1286 OXM_OF_IN_PORT(fffffffe)
1287
1288 # metadata
1289 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1290 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1291 OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000)
1292 OXM_OF_METADATA_W(1234567890abcdef/ffffffffffffffff)
1293 OXM_OF_METADATA_W(1234567890abcdef/0000000000000000)
1294
1295 # eth dst
1296 OXM_OF_ETH_DST(0002e30f80a4)
1297 OXM_OF_ETH_DST_W(010000000000/010000000000)
1298 OXM_OF_ETH_DST_W(000000000000/010000000000)
1299 OXM_OF_ETH_DST_W(ffffffffffff/010000000000)
1300 OXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
1301 OXM_OF_ETH_DST_W(0002e30f80a4/000000000000)
1302 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1303
1304 # eth src
1305 OXM_OF_ETH_SRC(020898456ddb)
1306
1307 # eth type
1308 OXM_OF_ETH_TYPE(0800)
1309 OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
1310
1311 # IP ECN
1312 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
1313 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06)
1314 OXM_OF_IP_ECN(03)
1315
1316 # IP protocol
1317 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01)
1318 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(05)
1319 OXM_OF_IP_PROTO(05)
1320
1321 # IP source
1322 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC(ac100014)
1323 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFF0000)
1324 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFFFFFF)
1325 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/00000000)
1326 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_SRC(ac100014)
1327 OXM_OF_IPV4_SRC_W(C0D80000/FFFF0000)
1328
1329 # IP destination
1330 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST(ac100014)
1331 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFF0000)
1332 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFFFFFF)
1333 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/00000000)
1334 OXM_OF_IPV4_DST(ac100014)
1335 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_DST_W(C0D80000/FFFF0000)
1336
1337 # TCP source port
1338 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC(4231)
1339 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/F0F0)
1340 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/FFFF)
1341 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/0000)
1342 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_SRC(4231)
1343
1344 # TCP destination port
1345 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST(4231)
1346 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFF0)
1347 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFFF)
1348 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/0000)
1349 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_DST(4231)
1350
1351 # UDP source port
1352 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC(8732)
1353 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/01FF)
1354 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/FFFF)
1355 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/0000)
1356 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_UDP_SRC(7823)
1357
1358 # UDP destination port
1359 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST(1782)
1360 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/F00F)
1361 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/FFFF)
1362 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/0000)
1363 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_UDP_DST(1293)
1364
1365 # ICMP type
1366 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_TYPE(12)
1367 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_TYPE(10)
1368
1369 # ICMP code
1370 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_CODE(12)
1371 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_CODE(10)
1372 OXM_OF_ETH_TYPE(0800) OXM_OF_ICMPV4_CODE(10)
1373 OXM_OF_ICMPV4_CODE(00)
1374
1375 # ARP opcode
1376 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001)
1377 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(1111)
1378 OXM_OF_ETH_TYPE(0000) OXM_OF_ARP_OP(0001)
1379 OXM_OF_ARP_OP(0001)
1380 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001) OXM_OF_ARP_OP(0001)
1381
1382 # ARP source protocol address
1383 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA(ac100014)
1384 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
1385 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFFFF)
1386 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/00000000)
1387 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SPA(ac100014)
1388 OXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
1389
1390 # ARP destination protocol address
1391 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA(ac100014)
1392 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
1393 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFFFF)
1394 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/00000000)
1395 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_TPA(ac100014)
1396 OXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
1397
1398 # ARP source hardware address
1399 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4)
1400 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4)
1401 OXM_OF_ARP_SHA(0002e30f80a4)
1402
1403 # ARP destination hardware address
1404 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4)
1405 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4)
1406 OXM_OF_ARP_THA(0002e30f80a4)
1407
1408 # IPv6 source
1409 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1410 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1411 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1412 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1413 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
1414 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1415
1416 # IPv6 destination
1417 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1418 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1419 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1420 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1421 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
1422 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1423
1424 # IPv6 Flow Label
1425 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(1000000f)
1426 OXM_OF_IPV6_FLABEL(0000000f)
1427 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(0000000f)
1428 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
1429 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000fffff)
1430 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000ffff0)
1431 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/100fffff)
1432 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/ffffffff)
1433 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/00000000)
1434
1435 # ND source hardware address
1436 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)
1437 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)
1438 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)
1439 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)
1440
1441 # ND destination hardware address
1442 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)
1443 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)
1444 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)
1445 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)
1446
1447 # Invalid field number.
1448 01020304(1111/2222)
1449 ])
1450 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
1451 <any>
1452
1453 # in port
1454 OXM_OF_IN_PORT(00000000)
1455 OXM_OF_IN_PORT(fffffffe)
1456
1457 # metadata
1458 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1459 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1460 OXM_OF_METADATA_W(1234000090ab0000/ffff0000ffff0000)
1461 OXM_OF_METADATA(1234567890abcdef)
1462 <any>
1463
1464 # eth dst
1465 OXM_OF_ETH_DST(0002e30f80a4)
1466 OXM_OF_ETH_DST_W(010000000000/010000000000)
1467 OXM_OF_ETH_DST_W(000000000000/010000000000)
1468 OXM_OF_ETH_DST_W(010000000000/010000000000)
1469 OXM_OF_ETH_DST(0002e30f80a4)
1470 <any>
1471 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1472
1473 # eth src
1474 OXM_OF_ETH_SRC(020898456ddb)
1475
1476 # eth type
1477 OXM_OF_ETH_TYPE(0800)
1478 OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
1479
1480 # IP ECN
1481 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
1482 nx_pull_match() returned error OFPBMC_BAD_VALUE
1483 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1484
1485 # IP protocol
1486 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01)
1487 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(05)
1488 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1489
1490 # IP source
1491 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(ac100014)
1492 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC_W(c0a80000/ffff0000)
1493 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(c0a80000)
1494 OXM_OF_ETH_TYPE(0800)
1495 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1496 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1497
1498 # IP destination
1499 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(ac100014)
1500 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST_W(c0a80000/ffff0000)
1501 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(c0a88012)
1502 OXM_OF_ETH_TYPE(0800)
1503 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1504 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1505
1506 # TCP source port
1507 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(4231)
1508 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC_W(5050/f0f0)
1509 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(5050)
1510 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
1511 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1512
1513 # TCP destination port
1514 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(4231)
1515 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST_W(fde0/fff0)
1516 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(fde0)
1517 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
1518 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1519
1520 # UDP source port
1521 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(8732)
1522 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC_W(0132/01ff)
1523 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(0132)
1524 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
1525 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1526
1527 # UDP destination port
1528 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(1782)
1529 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST_W(5005/f00f)
1530 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(5005)
1531 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
1532 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1533
1534 # ICMP type
1535 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_TYPE(12)
1536 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1537
1538 # ICMP code
1539 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_CODE(12)
1540 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1541 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1542 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1543
1544 # ARP opcode
1545 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_OP(0001)
1546 nx_pull_match() returned error OFPBMC_BAD_VALUE
1547 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1548 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1549 nx_pull_match() returned error OFPBMC_DUP_FIELD
1550
1551 # ARP source protocol address
1552 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(ac100014)
1553 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA_W(c0a81200/ffffff00)
1554 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(c0a81234)
1555 OXM_OF_ETH_TYPE(0806)
1556 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1557 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1558
1559 # ARP destination protocol address
1560 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(ac100014)
1561 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA_W(c0a81200/ffffff00)
1562 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(c0a812fe)
1563 OXM_OF_ETH_TYPE(0806)
1564 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1565 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1566
1567 # ARP source hardware address
1568 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
1569 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1570 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1571
1572 # ARP destination hardware address
1573 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
1574 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1575 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1576
1577 # IPv6 source
1578 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1579 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1580 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1581 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010000000000000000)
1582 OXM_OF_ETH_TYPE(86dd)
1583 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1584
1585 # IPv6 destination
1586 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1587 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1588 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1589 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010000000000000000)
1590 OXM_OF_ETH_TYPE(86dd)
1591 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1592
1593 # IPv6 Flow Label
1594 nx_pull_match() returned error OFPBMC_BAD_VALUE
1595 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1596 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
1597 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
1598 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
1599 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(00000000/000ffff0)
1600 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
1601 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
1602 OXM_OF_ETH_TYPE(86dd)
1603
1604 # ND source hardware address
1605 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)
1606 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1607 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1608 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1609
1610 # ND destination hardware address
1611 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)
1612 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1613 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1614 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1615
1616 # Invalid field number.
1617 nx_pull_match() returned error OFPBMC_BAD_FIELD
1618 ])
1619 AT_CLEANUP
1620
1621 AT_SETUP([ovs-ofctl parse-oxm loose])
1622 AT_KEYWORDS([oxm])
1623 AT_DATA([oxm.txt], [dnl
1624 OXM_OF_IN_PORT(00000001), 01020304(1111/2222), OXM_OF_ETH_TYPE(0800)
1625 ])
1626
1627 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
1628 nx_pull_match() returned error OFPBMC_BAD_FIELD
1629 ])
1630
1631 AT_CHECK([ovs-ofctl parse-oxm < oxm.txt], [0], [dnl
1632 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
1633 ])
1634 AT_CLEANUP
1635
1636 dnl Check that "-F openflow10" rejects a flow_mod with unsupported features,
1637 dnl such as tunnels and metadata.
1638 AT_SETUP([ovs-ofctl -F option and NXM features])
1639 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
1640   [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1641 ])
1642 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop],
1643   [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1644 ])
1645 AT_CLEANUP
1646
1647 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
1648 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
1649 dnl additionally show up as the top 32 bits of the cookie.)  This checks
1650 dnl for regression against bug #4566.
1651 AT_SETUP([ovs-ofctl -F option with flow_mods])
1652 OVS_VSWITCHD_START
1653 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
1654 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
1655 NXST_FLOW reply:
1656  tun_id=0x12345678 actions=drop
1657 ])
1658 OVS_VSWITCHD_STOP
1659 AT_CLEANUP
1660
1661 dnl Check that "-F openflow10" is really honored on dump-flows.
1662 dnl (If it isn't, then dump-flows will show the register match.)
1663 AT_SETUP([ovs-ofctl dump-flows honors -F option])
1664 OVS_VSWITCHD_START
1665 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
1666 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1667 OFPST_FLOW reply:
1668  actions=drop
1669 ])
1670 OVS_VSWITCHD_STOP
1671 AT_CLEANUP
1672
1673 dnl Check that "-F openflow10" fails on dump-flows if the requested match
1674 dnl can't be represented in OpenFlow 1.0.
1675 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
1676 OVS_VSWITCHD_START
1677 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
1678   [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1679 ])
1680 OVS_VSWITCHD_STOP
1681 AT_CLEANUP
1682
1683 dnl Check that add-flow reports non-normalized flows (feature #5029).
1684 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
1685 OVS_VSWITCHD_START
1686 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
1687   [0], [], [dnl
1688 ofp_util|INFO|normalization changed ofp_match, details:
1689 ofp_util|INFO| pre: nw_src=1.2.3.4
1690 ofp_util|INFO|post: @&t@
1691 ])
1692 OVS_VSWITCHD_STOP
1693 AT_CLEANUP
1694
1695 dnl Check that --sort and --rsort works with dump-flows
1696 dnl Default field is 'priority'. Flow entries are displayed based
1697 dnl on field to sort.
1698 AT_SETUP([ovs-ofctl dump-flows with sorting])
1699 OVS_VSWITCHD_START
1700 AT_KEYWORDS([sort])
1701 AT_DATA([allflows.txt], [[
1702 priority=4,in_port=23213 actions=output:42
1703 priority=5,in_port=1029 actions=output:43
1704 priority=7,in_port=1029 actions=output:43
1705 priority=3,in_port=1028 actions=output:44
1706 priority=1,in_port=1026 actions=output:45
1707 priority=6,in_port=1027 actions=output:64
1708 priority=2,in_port=1025 actions=output:47
1709 priority=8,tcp,tp_src=5 actions=drop
1710 priority=9,tcp,tp_src=6 actions=drop
1711 ]])
1712
1713 AT_CHECK([ovs-ofctl add-flows br0 allflows.txt
1714 ], [0], [ignore])
1715 AT_CHECK([ovs-ofctl --sort dump-flows br0 | ofctl_strip], [0], [dnl
1716  priority=1,in_port=1026 actions=output:45
1717  priority=2,in_port=1025 actions=output:47
1718  priority=3,in_port=1028 actions=output:44
1719  priority=4,in_port=23213 actions=output:42
1720  priority=5,in_port=1029 actions=output:43
1721  priority=6,in_port=1027 actions=output:64
1722  priority=7,in_port=1029 actions=output:43
1723  priority=8,tcp,tp_src=5 actions=drop
1724  priority=9,tcp,tp_src=6 actions=drop
1725 ])
1726 AT_CHECK([ovs-ofctl --rsort dump-flows br0 | ofctl_strip], [0], [dnl
1727  priority=9,tcp,tp_src=6 actions=drop
1728  priority=8,tcp,tp_src=5 actions=drop
1729  priority=7,in_port=1029 actions=output:43
1730  priority=6,in_port=1027 actions=output:64
1731  priority=5,in_port=1029 actions=output:43
1732  priority=4,in_port=23213 actions=output:42
1733  priority=3,in_port=1028 actions=output:44
1734  priority=2,in_port=1025 actions=output:47
1735  priority=1,in_port=1026 actions=output:45
1736 ])
1737 AT_CHECK([ovs-ofctl --sort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
1738  priority=2,in_port=1025 actions=output:47
1739  priority=1,in_port=1026 actions=output:45
1740  priority=6,in_port=1027 actions=output:64
1741  priority=3,in_port=1028 actions=output:44
1742  priority=7,in_port=1029 actions=output:43
1743  priority=5,in_port=1029 actions=output:43
1744  priority=4,in_port=23213 actions=output:42
1745  priority=9,tcp,tp_src=6 actions=drop
1746  priority=8,tcp,tp_src=5 actions=drop
1747 ])
1748 AT_CHECK([ovs-ofctl --rsort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
1749  priority=4,in_port=23213 actions=output:42
1750  priority=7,in_port=1029 actions=output:43
1751  priority=5,in_port=1029 actions=output:43
1752  priority=3,in_port=1028 actions=output:44
1753  priority=6,in_port=1027 actions=output:64
1754  priority=1,in_port=1026 actions=output:45
1755  priority=2,in_port=1025 actions=output:47
1756  priority=9,tcp,tp_src=6 actions=drop
1757  priority=8,tcp,tp_src=5 actions=drop
1758 ])
1759 AT_CHECK([ovs-ofctl --sort=tcp_src dump-flows br0 | ofctl_strip], [0], [dnl
1760  priority=8,tcp,tp_src=5 actions=drop
1761  priority=9,tcp,tp_src=6 actions=drop
1762  priority=7,in_port=1029 actions=output:43
1763  priority=6,in_port=1027 actions=output:64
1764  priority=5,in_port=1029 actions=output:43
1765  priority=4,in_port=23213 actions=output:42
1766  priority=3,in_port=1028 actions=output:44
1767  priority=2,in_port=1025 actions=output:47
1768  priority=1,in_port=1026 actions=output:45
1769 ])
1770 AT_CHECK(
1771   [ovs-ofctl --sort=in_port --sort=tcp_src dump-flows br0 | ofctl_strip], [0],
1772   [ priority=2,in_port=1025 actions=output:47
1773  priority=1,in_port=1026 actions=output:45
1774  priority=6,in_port=1027 actions=output:64
1775  priority=3,in_port=1028 actions=output:44
1776  priority=7,in_port=1029 actions=output:43
1777  priority=5,in_port=1029 actions=output:43
1778  priority=4,in_port=23213 actions=output:42
1779  priority=8,tcp,tp_src=5 actions=drop
1780  priority=9,tcp,tp_src=6 actions=drop
1781 ])
1782 OVS_VSWITCHD_STOP
1783 AT_CLEANUP
1784
1785 AT_SETUP([ovs-ofctl diff-flows])
1786 OVS_VSWITCHD_START
1787
1788 # Prints the integers from $1 to $2, increasing by $3 (default 1) on stdout.
1789 seq () {
1790     while test $1 -le $2; do
1791         echo $1
1792         set `expr $1 + ${3-1}` $2 $3
1793     done
1794 }
1795
1796 # Add tons of flows to br0.
1797 for i in `seq 0 1023`; do echo "dl_vlan=$i,actions=drop"; done > add-flows.txt
1798 AT_CHECK([ovs-ofctl add-flows br0 add-flows.txt])
1799
1800 # Dump them and compare against what we expect by hand, then with diff-flows.
1801 for i in `seq 0 1023`; do echo " dl_vlan=$i actions=drop"; done | sort > expout
1802 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed '/NXST_FLOW/d' | sort],
1803   [0], [expout])
1804 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt])
1805
1806 # Remove even-numbered flows, compare again.
1807 for i in `seq 0 1023 2`; do echo "dl_vlan=$i"; done > del-flows.txt
1808 AT_CHECK([ovs-ofctl del-flows br0 - < del-flows.txt])
1809 for i in `seq 0 1023 2`; do echo "+dl_vlan=$i actions=drop"; done | sort > expout
1810 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt | sort], [0], [expout])
1811 for i in `seq 0 1023 2`; do echo "-dl_vlan=$i actions=drop"; done | sort > expout
1812 AT_CHECK([ovs-ofctl diff-flows add-flows.txt br0 | sort], [0], [expout])
1813
1814 OVS_VSWITCHD_STOP
1815 AT_CLEANUP