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