flow: Factor out flag parsing and formatting routines.
[cascardo/ovs.git] / tests / ovs-ofctl.at
1 AT_BANNER([ovs-ofctl])
2
3 AT_SETUP([ovs-ofctl parse-flows choice of protocol])
4 # This doesn't cover some potential vlan_tci test cases.
5 for test_case in \
6     'tun_id=0                                    NXM,OXM' \
7     'tun_id=0/0x1                                NXM,OXM' \
8     'tun_src=1.2.3.4                             NXM,OXM' \
9     'tun_src=1.2.3.4/0.0.0.1                     NXM,OXM' \
10     'tun_dst=1.2.3.4                             NXM,OXM' \
11     'tun_dst=1.2.3.4/0.0.0.1                     NXM,OXM' \
12     'tun_flags=0                                 none' \
13     'tun_tos=0                                   none' \
14     'tun_ttl=0                                   none' \
15     'tun_gbp_id=0                                NXM,OXM' \
16     'tun_gbp_id=0/0x1                            NXM,OXM' \
17     'tun_gbp_flags=0                             NXM,OXM' \
18     'tun_gbp_flags=0/0x1                         NXM,OXM' \
19     'tun_metadata0=0                             NXM,OXM' \
20     'tun_metadata0=0/0x1                         NXM,OXM' \
21     'metadata=0                                  NXM,OXM,OpenFlow11' \
22     'metadata=1/1                                NXM,OXM,OpenFlow11' \
23     'in_port=1                                   any' \
24     'skb_priority=0                              none' \
25     'pkt_mark=1                                  NXM,OXM' \
26     'pkt_mark=1/1                                NXM,OXM' \
27     'reg0=0                                      NXM,OXM' \
28     'reg0=0/1                                    NXM,OXM' \
29     'reg1=1                                      NXM,OXM' \
30     'reg1=1/1                                    NXM,OXM' \
31     'reg2=2                                      NXM,OXM' \
32     'reg2=2/1                                    NXM,OXM' \
33     'reg3=3                                      NXM,OXM' \
34     'reg3=3/1                                    NXM,OXM' \
35     'reg4=4                                      NXM,OXM' \
36     'reg4=4/1                                    NXM,OXM' \
37     'reg5=5                                      NXM,OXM' \
38     'reg5=5/1                                    NXM,OXM' \
39     'reg6=6                                      NXM,OXM' \
40     'reg6=6/1                                    NXM,OXM' \
41     'reg7=7                                      NXM,OXM' \
42     'reg7=7/1                                    NXM,OXM' \
43     'xreg0=0                                     NXM,OXM' \
44     'xreg0=0/1                                   NXM,OXM' \
45     'xreg1=1                                     NXM,OXM' \
46     'xreg1=1/1                                   NXM,OXM' \
47     'xreg2=2                                     NXM,OXM' \
48     'xreg2=2/3                                   NXM,OXM' \
49     'xreg3=3                                     NXM,OXM' \
50     'xreg3=3/5                                   NXM,OXM' \
51     'dl_src=00:11:22:33:44:55                    any' \
52     'dl_src=00:11:22:33:44:55/00:ff:ff:ff:ff:ff  NXM,OXM,OpenFlow11' \
53     'dl_dst=00:11:22:33:44:55                    any' \
54     'dl_dst=00:11:22:33:44:55/00:ff:ff:ff:ff:ff  NXM,OXM,OpenFlow11' \
55     'dl_type=0x1234                              any' \
56     'dl_type=0x0800                              any' \
57     'dl_type=0x0806                              any' \
58     'dl_type=0x86dd                              any' \
59     'vlan_tci=0                                  any' \
60     'vlan_tci=0x1009                             any' \
61     'vlan_tci=0x1009/0x1                         NXM,OXM' \
62     'dl_vlan=9                                   any' \
63     'vlan_vid=11                                 any' \
64     'vlan_vid=11/0x1                             NXM,OXM' \
65     'dl_vlan_pcp=6                               any' \
66     'vlan_pcp=5                                  any' \
67     'mpls,mpls_label=5                           NXM,OXM,OpenFlow11' \
68     'mpls,mpls_tc=1                              NXM,OXM,OpenFlow11' \
69     'mpls,mpls_bos=0                             NXM,OXM' \
70     'ip,ip_src=1.2.3.4                           any' \
71     'ip,ip_src=192.168.0.0/24                    any' \
72     'ip,ip_src=192.0.168.0/255.0.255.0           NXM,OXM,OpenFlow11' \
73     'ip,ip_dst=1.2.3.4                           any' \
74     'ip,ip_dst=192.168.0.0/24                    any' \
75     'ip,ip_dst=192.0.168.0/255.0.255.0           NXM,OXM,OpenFlow11' \
76     'ipv6,ipv6_src=::1                           NXM,OXM' \
77     'ipv6,ipv6_src=0:0:0:0:0:0:0:1/::1           NXM,OXM' \
78     'ipv6,ipv6_dst=::1                           NXM,OXM' \
79     'ipv6,ipv6_dst=0:0:0:0:0:0:0:1/::1           NXM,OXM' \
80     'ipv6,ipv6_label=5                           NXM,OXM' \
81     'ipv6,ipv6_label=5/1                         NXM,OXM' \
82     'ip,nw_proto=1                               any' \
83     'ipv6,nw_proto=1                             NXM,OXM' \
84     'ip,nw_tos=0xf0                              any' \
85     'ipv6,nw_tos=0xf0                            NXM,OXM' \
86     'ip,ip_dscp=0x3c                             any' \
87     'ipv6,ip_dscp=0x3c                           NXM,OXM' \
88     'ip,nw_ecn=1                                 NXM,OXM' \
89     'ipv6,nw_ecn=1                               NXM,OXM' \
90     'ip,nw_ttl=5                                 NXM,OXM' \
91     'ipv6,nw_ttl=5                               NXM,OXM' \
92     'ip,ip_frag=no                               NXM,OXM' \
93     'ipv6,ip_frag=no                             NXM,OXM' \
94     'arp,arp_op=0                                any' \
95     'arp,arp_spa=1.2.3.4                         any' \
96     'arp,arp_spa=1.2.3.4/0.0.0.1                 NXM,OXM,OpenFlow11' \
97     'arp,arp_tpa=1.2.3.4                         any' \
98     'arp,arp_tpa=1.2.3.4/0.0.0.1                 NXM,OXM,OpenFlow11' \
99     'arp,arp_sha=00:11:22:33:44:55               NXM,OXM' \
100     'arp,arp_sha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM' \
101     'arp,arp_tha=00:11:22:33:44:55               NXM,OXM' \
102     'arp,arp_tha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM' \
103     'tcp,tcp_src=80                              any' \
104     'tcp,tcp_src=0x1000/0x1000                   NXM,OXM' \
105     'tcp6,tcp_src=80                             NXM,OXM' \
106     'tcp6,tcp_src=0x1000/0x1000                  NXM,OXM' \
107     'tcp,tcp_dst=80                              any' \
108     'tcp,tcp_dst=0x1000/0x1000                   NXM,OXM' \
109     'tcp6,tcp_dst=80                             NXM,OXM' \
110     'tcp6,tcp_dst=0x1000/0x1000                  NXM,OXM' \
111     'udp,udp_src=80                              any' \
112     'udp,udp_src=0x1000/0x1000                   NXM,OXM' \
113     'udp6,udp_src=80                             NXM,OXM' \
114     'udp6,udp_src=0x1000/0x1000                  NXM,OXM' \
115     'udp,udp_dst=80                              any' \
116     'udp,udp_dst=0x1000/0x1000                   NXM,OXM' \
117     'udp6,udp_dst=80                             NXM,OXM' \
118     'udp6,udp_dst=0x1000/0x1000                  NXM,OXM' \
119     'icmp,icmp_type=1                            any' \
120     'icmp,icmp_code=2                            any' \
121     'icmp6,icmpv6_type=1                         NXM,OXM' \
122     'icmp6,icmpv6_code=2                         NXM,OXM'
123 do
124     set $test_case
125     echo
126     echo "### test case: '$1' should have usable protocols '$2'"
127     if test "$2" = none; then
128       AT_CHECK([ovs-ofctl parse-flow "$1,actions=drop"], [1],
129                [usable protocols: none
130 ],
131                [ovs-ofctl: no usable protocol
132 ])
133     else
134       AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "$1,actions=drop" | sed 1q], [0],
135                         [usable protocols: $2
136 ])
137     fi
138 done
139 AT_CLEANUP
140
141 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.0)])
142 AT_DATA([flows.txt], [[
143 # comment
144 tcp,tp_src=123,actions=flood
145 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
146 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
147 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
148 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
149 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
150 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
151 ip,actions=set_field:10.4.3.77->ip_src
152 sctp actions=drop
153 sctp actions=drop
154 in_port=0 actions=resubmit:0
155 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
156 ]])
157
158 AT_CHECK([ovs-ofctl parse-flows flows.txt
159 ], [0], [stdout])
160 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
161 [[usable protocols: any
162 chosen protocol: OpenFlow10-table_id
163 OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
164 OFPT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
165 OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
166 OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
167 OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
168 OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
169 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
170 OFPT_FLOW_MOD: ADD ip actions=mod_nw_src:10.4.3.77
171 OFPT_FLOW_MOD: ADD sctp actions=drop
172 OFPT_FLOW_MOD: ADD sctp actions=drop
173 OFPT_FLOW_MOD: ADD in_port=0 actions=resubmit:0
174 OFPT_FLOW_MOD: ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
175 ]])
176 AT_CLEANUP
177
178 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.1)])
179 AT_DATA([flows.txt], [[
180 # comment
181 tcp,tp_src=123,actions=flood
182 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
183 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
184 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
185 udp,nw_src=192.168.0.3,tp_dst=53 actions=mod_nw_ecn:2,output:1
186 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
187 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
188 ip,actions=mod_nw_ttl:1,set_field:10.4.3.77->ip_src
189 sctp actions=drop
190 sctp actions=drop
191 in_port=0 actions=resubmit:0
192 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
193 ]])
194
195 AT_CHECK([ovs-ofctl --protocols OpenFlow11 parse-flows flows.txt
196 ], [0], [stdout])
197 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
198 [[usable protocols: any
199 chosen protocol: OpenFlow11
200 OFPT_FLOW_MOD (OF1.1): ADD tcp,tp_src=123 actions=FLOOD
201 OFPT_FLOW_MOD (OF1.1): ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
202 OFPT_FLOW_MOD (OF1.1): ADD udp,dl_vlan_pcp=7 idle:5 actions=pop_vlan,output:0
203 OFPT_FLOW_MOD (OF1.1): ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
204 OFPT_FLOW_MOD (OF1.1): ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=mod_nw_ecn:2,output:1
205 OFPT_FLOW_MOD (OF1.1): ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
206 OFPT_FLOW_MOD (OF1.1): 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
207 OFPT_FLOW_MOD (OF1.1): ADD ip actions=mod_nw_ttl:1,mod_nw_src:10.4.3.77
208 OFPT_FLOW_MOD (OF1.1): ADD sctp actions=drop
209 OFPT_FLOW_MOD (OF1.1): ADD sctp actions=drop
210 OFPT_FLOW_MOD (OF1.1): ADD in_port=0 actions=resubmit:0
211 OFPT_FLOW_MOD (OF1.1): ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
212 ]])
213 AT_CLEANUP
214
215 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.2)])
216 AT_DATA([flows.txt], [[
217 # comment
218 tcp,tp_src=123,actions=flood
219 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=mod_vlan_vid:7,mod_vlan_pcp:2
220 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
221 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
222 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
223 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
224 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
225 ipv6,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
226 sctp actions=set_field:3334->sctp_src
227 sctp actions=set_field:4445->sctp_dst
228 tcp actions=mod_tp_dst:1234
229 udp actions=mod_tp_src:1111
230 ip actions=mod_nw_src:10.1.1.2,mod_nw_dst:192.168.10.1,mod_nw_ttl:1,mod_nw_tos:16,mod_nw_ecn:2
231 in_port=0 actions=mod_dl_src:11:22:33:44:55:66,mod_dl_dst:10:20:30:40:50:60
232 in_port=0 actions=resubmit:0
233 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
234 ]])
235
236 AT_CHECK([ovs-ofctl --protocols OpenFlow12 parse-flows flows.txt
237 ], [0], [stdout])
238 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
239 [[usable protocols: NXM,OXM
240 chosen protocol: OXM-OpenFlow12
241 OFPT_FLOW_MOD (OF1.2): ADD tcp,tp_src=123 actions=FLOOD
242 OFPT_FLOW_MOD (OF1.2): ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=set_field:4103->vlan_vid,set_field:2->vlan_pcp
243 OFPT_FLOW_MOD (OF1.2): ADD udp,dl_vlan_pcp=7 idle:5 actions=pop_vlan,output:0
244 OFPT_FLOW_MOD (OF1.2): ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
245 OFPT_FLOW_MOD (OF1.2): ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
246 OFPT_FLOW_MOD (OF1.2): ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
247 OFPT_FLOW_MOD (OF1.2): 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
248 OFPT_FLOW_MOD (OF1.2): ADD ipv6 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
249 OFPT_FLOW_MOD (OF1.2): ADD sctp actions=set_field:3334->sctp_src
250 OFPT_FLOW_MOD (OF1.2): ADD sctp actions=set_field:4445->sctp_dst
251 OFPT_FLOW_MOD (OF1.2): ADD tcp actions=set_field:1234->tcp_dst
252 OFPT_FLOW_MOD (OF1.2): ADD udp actions=set_field:1111->udp_src
253 OFPT_FLOW_MOD (OF1.2): ADD ip actions=set_field:10.1.1.2->ip_src,set_field:192.168.10.1->ip_dst,mod_nw_ttl:1,set_field:4->ip_dscp,set_field:2->nw_ecn
254 OFPT_FLOW_MOD (OF1.2): ADD in_port=0 actions=set_field:11:22:33:44:55:66->eth_src,set_field:10:20:30:40:50:60->eth_dst
255 OFPT_FLOW_MOD (OF1.2): ADD in_port=0 actions=resubmit:0
256 OFPT_FLOW_MOD (OF1.2): ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
257 ]])
258 AT_CLEANUP
259
260 AT_SETUP([ovs-ofctl parse-flow with invalid mask])
261 for test_case in \
262     'tun_tos 1/1' \
263     'tun_ttl 1/1' \
264     'skb_priority 1/1' \
265     'eth_type 0x1234/0x1' \
266     'dl_vlan 9/0x1' \
267     'dl_vlan_pcp 6/0x1' \
268     'vlan_pcp 5/0x1' \
269     'mpls mpls_label 5/0x1' \
270     'mpls mpls_tc 1/0x1' \
271     'mpls mpls_bos 1/0x1' \
272     'ip nw_proto 1/1' \
273     'ipv6 nw_proto 1/1' \
274     'ip nw_tos 0xf0/0xf0' \
275     'ipv6 nw_tos 0xf0/0xf0' \
276     'ip ip_dscp 0x3c/0xf0' \
277     'ipv6 ip_dscp 0x3c/0xf0' \
278     'ip nw_ecn 1/1' \
279     'ipv6 nw_ecn 1/1' \
280     'ip nw_ttl 5/1' \
281     'ipv6 nw_ttl 5/1' \
282     'arp arp_op 0/1' \
283     'icmp icmp_type 1/1' \
284     'icmp icmp_code 2/1' \
285     'icmp6 icmpv6_code 2/1'
286 do
287     set $test_case
288     if test $# = 3; then
289         prereq=$1, field=$2 value=$3
290     else
291         prereq= field=$1 value=$2
292     fi
293     AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "$prereq$field=$value,actions=drop"], [1], [],
294 [ovs-ofctl: $value: invalid mask for field $field
295 ])
296 done
297 AT_CLEANUP
298
299 AT_SETUP([ovs-ofctl action inconsistency (OpenFlow 1.1)])
300 AT_CHECK([ovs-ofctl --protocols OpenFlow11 add-flow br0 'ip actions=mod_tp_dst:1234'
301 ], [1], [stdout], [ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
302 ])
303 AT_CLEANUP
304
305 AT_SETUP([ovs-ofctl parse-flows (With Tunnel-Parameters)])
306 AT_DATA([flows.txt], [[
307 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
308 ]])
309
310 AT_CHECK([ovs-ofctl parse-flows flows.txt
311 ], [1], [usable protocols: none
312 ], [stderr])
313
314 AT_CLEANUP
315
316
317 AT_SETUP([ovs-ofctl parse-flows (skb_priority)])
318 AT_DATA([flows.txt], [[
319 skb_priority=0x12341234,tcp,tp_src=123,actions=flood
320 ]])
321
322 AT_CHECK([ovs-ofctl parse-flows flows.txt
323 ], [1], [usable protocols: none
324 ], [stderr])
325
326 AT_CLEANUP
327
328
329 AT_SETUP([ovs-ofctl parse-flows (NXM)])
330 AT_DATA([flows.txt], [[
331 # comment
332 tcp,tp_src=123,actions=flood
333 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
334 pkt_mark=0xbb,actions=set_field:0xaa->pkt_mark
335 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
336 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
337 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
338 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
339 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
340 tcp,tp_src=0x1230/0xfff0,tun_id=0x1234,cookie=0x5678,actions=flood
341 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel:0x123456789
342 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])
343 table=1,actions=drop
344 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
345 metadata=0x1234ffff5678ffff/0xffff0000ffff0000,actions=drop
346 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
347 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
348 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
349 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
350 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
351 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
352 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:[2,3])
353 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
354 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
355 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3)
356 send_flow_rem,actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
357 check_overlap,actions=output:1,exit,output:2
358 tcp,actions=fin_timeout(idle_timeout=5,hard_timeout=15)
359 actions=controller(max_len=123,reason=invalid_ttl,id=555)
360 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
361 ]])
362
363 AT_CHECK([ovs-ofctl parse-flows flows.txt
364 ], [0], [stdout])
365 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
366 [[usable protocols: OXM,NXM+table_id
367 chosen protocol: NXM+table_id
368 NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
369 NXT_FLOW_MOD: ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
370 NXT_FLOW_MOD: ADD table:255 pkt_mark=0xbb actions=load:0xaa->NXM_NX_PKT_MARK[]
371 NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
372 NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
373 NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
374 NXT_FLOW_MOD: ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
375 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
376 NXT_FLOW_MOD: ADD table:255 tcp,tun_id=0x1234,tp_src=0x1230/0xfff0 cookie:0x5678 actions=FLOOD
377 NXT_FLOW_MOD: ADD table:255 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
378 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])
379 NXT_FLOW_MOD: ADD table:1 actions=drop
380 NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
381 NXT_FLOW_MOD: ADD table:255 metadata=0x1234000056780000/0xffff0000ffff0000 actions=drop
382 NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
383 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
384 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
385 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
386 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
387 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
388 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
389 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
390 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
391 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3)
392 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
393 NXT_FLOW_MOD: ADD table:255 check_overlap actions=output:1,exit,output:2
394 NXT_FLOW_MOD: ADD table:255 tcp actions=fin_timeout(idle_timeout=5,hard_timeout=15)
395 NXT_FLOW_MOD: ADD table:255 actions=controller(reason=invalid_ttl,max_len=123,id=555)
396 NXT_FLOW_MOD: ADD table:255 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
397 ]])
398 AT_CLEANUP
399
400 AT_SETUP([ovs-ofctl -F nxm parse-flows])
401 AT_DATA([flows.txt], [
402 # comment
403 tcp,tp_src=123,actions=flood
404 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
405 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
406 ipv6,ipv6_label=0x12345 actions=2
407 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
408 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
409 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
410 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
411 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
412 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
413 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
414 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
415 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
416 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
417 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4F:0571/112 actions=drop
418 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
419 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
420 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE00:0000/96,nd_tll=00:0A:E4:25:6B:B1 actions=drop
421 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
422 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
423 tun_id=0x1234,cookie=0x5678,actions=flood
424 actions=drop
425 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
426 dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=drop
427 dl_dst=00:00:00:00:00:00/01:00:00:00:00:00,actions=drop
428 dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff,actions=drop
429 dl_dst=aa:bb:cc:dd:ee:ff/00:00:00:00:00:00,actions=drop
430 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
431 ])
432 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
433 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
434 usable protocols: NXM,OXM
435 chosen protocol: NXM-table_id
436 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
437 NXT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
438 NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
439 NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
440 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
441 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
442 NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
443 NXT_FLOW_MOD: ADD tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
444 NXT_FLOW_MOD: ADD udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
445 NXT_FLOW_MOD: ADD icmp6,in_port=3,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
446 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
447 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
448 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
449 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571 actions=drop
450 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4f:0/112 actions=drop
451 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_sll=00:0a:e4:25:6b:b0 actions=drop
452 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
453 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
454 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
455 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
456 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
457 NXT_FLOW_MOD: ADD actions=drop
458 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
459 NXT_FLOW_MOD: ADD dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=drop
460 NXT_FLOW_MOD: ADD dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=drop
461 NXT_FLOW_MOD: ADD dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff actions=drop
462 NXT_FLOW_MOD: ADD actions=drop
463 NXT_FLOW_MOD: ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
464 ])
465 AT_CLEANUP
466
467 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
468 AT_DATA([flows.txt], [[
469 # comment
470 tcp,tp_src=123,actions=flood
471 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
472 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
473 ipv6,ipv6_label=0x12345 actions=2
474 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
475 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
476 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
477 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
478 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
479 sctp6,ipv6_src=2001:db8:3c4d:1::5,tp_dst=309 actions=drop
480 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
481 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
482 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
483 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
484 sctp,nw_src=192.168.0.3,tp_dst=309 actions=pop_queue,output:1
485 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
486 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
487 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
488 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
489 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
490 tun_id=0x1234,cookie=0x5678,actions=flood
491 actions=drop
492 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[]
493 actions=move:OXM_OF_ETH_DST[]->OXM_OF_ETH_SRC[]
494 actions=push:NXM_NX_REG0[0..31],pop:NXM_NX_REG0[]
495 vlan_tci=0x1123/0x1fff,actions=drop
496 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
497 ]])
498 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout], [stderr])
499 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
500 [[usable protocols: NXM,OXM
501 chosen protocol: NXM-table_id
502 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
503 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
504 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
505 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
506 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
507 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
508 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
509 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
510 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
511 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000005), NXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(0135) actions=drop
512 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
513 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
514 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
515 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
516 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80003), NXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(0135) actions=pop_queue,output:1
517 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
518 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
519 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
520 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
521 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
522 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
523 NXT_FLOW_MOD: ADD <any> actions=drop
524 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[]
525 NXT_FLOW_MOD: ADD <any> actions=move:NXM_OF_ETH_DST[]->NXM_OF_ETH_SRC[]
526 NXT_FLOW_MOD: ADD <any> actions=push:NXM_NX_REG0[],pop:NXM_NX_REG0[]
527 NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop
528 NXT_FLOW_MOD: ADD <any> actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
529 ]])
530 AT_CLEANUP
531
532 AT_SETUP([ovs-ofctl parse-nx-match])
533 AT_KEYWORDS([nx-match])
534 AT_DATA([nx-match.txt], [dnl
535 <any>
536
537 # in port
538 NXM_OF_IN_PORT(0000)
539 NXM_OF_IN_PORT(fffe)
540
541 # eth dst
542 NXM_OF_ETH_DST(0002e30f80a4)
543 NXM_OF_ETH_DST_W(010000000000/010000000000)
544 NXM_OF_ETH_DST_W(000000000000/010000000000)
545 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
546 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
547 NXM_OF_ETH_DST_W(60175619848f/000000000000)
548 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
549 NXM_OF_ETH_DST_W(60175619848f/5a5a5a5a5a5a)
550
551 # eth src
552 NXM_OF_ETH_SRC(020898456ddb)
553 NXM_OF_ETH_SRC_W(012345abcdef/ffffff555555)
554 NXM_OF_ETH_SRC_W(020898456ddb/ffffffffffff)
555 NXM_OF_ETH_SRC_W(020898456ddb/000000000000)
556
557 # eth type
558 NXM_OF_ETH_TYPE(0800)
559 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
560
561 # vlan tci
562 NXM_OF_VLAN_TCI(f009)
563 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
564 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
565 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
566 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
567 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
568 NXM_OF_VLAN_TCI_W(1123/ffff)    # Packets with VID=123, PCP=0
569 NXM_OF_VLAN_TCI_W(1123/0000)    # Packets with or without 802.1Q header
570 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
571 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
572
573 # IP TOS
574 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
575 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(41)
576 NXM_OF_IP_TOS(f0)
577
578 # IP ECN
579 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(03)
580 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(06)
581 NXM_NX_IP_ECN(03)
582
583 # IP protocol
584 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
585 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
586 NXM_OF_IP_PROTO(05)
587
588 # IP TTL
589 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_TTL(80)
590 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_TTL(ff)
591 NXM_NX_IP_TTL(80)
592
593 # IP source
594 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
595 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
596 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/5a5a5a5a)
597 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/ffffffff)
598 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
599 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
600
601 # IP destination
602 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
603 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
604 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/5a5a5a5a)
605 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/ffffffff)
606 NXM_OF_IP_DST(ac100014)
607 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
608
609 # TCP source port
610 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
611 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/F0F0)
612 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/ffff)
613 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
614
615 # TCP destination port
616 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
617 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/FFF0)
618 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/ffff)
619 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
620
621 # TCP flags
622 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS(0131)
623 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS_W(00F0/0FF0)
624 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS_W(01E2/ffff)
625 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_NX_TCP_FLAGS(0fff)
626
627 # UDP source port
628 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
629 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/01FF)
630 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/ffff)
631 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
632
633 # UDP destination port
634 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
635 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/F00F)
636 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/FFFF)
637 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
638
639 # ICMP type
640 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
641 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
642
643 # ICMP code
644 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
645 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
646 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
647 NXM_OF_ICMP_CODE(00)
648
649 # ARP opcode
650 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
651 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
652 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
653 NXM_OF_ARP_OP(0001)
654 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
655
656 # ARP source protocol address
657 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
658 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
659 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
660 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/ffffffff)
661 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
662 NXM_OF_ARP_SPA_W(C0D80000/FFFF0000)
663
664 # ARP destination protocol address
665 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
666 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
667 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/77777777)
668 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/ffffffff)
669 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
670 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
671
672 # ARP source hardware address
673 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
674 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
675 NXM_NX_ARP_SHA(0002e30f80a4)
676
677 # ARP destination hardware address
678 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
679 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
680 NXM_NX_ARP_THA(0002e30f80a4)
681
682 # RARP opcode
683 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_OP(0003)
684 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_OP(1111)
685 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0003)
686 NXM_OF_ARP_OP(0003)
687 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_OP(0003) NXM_OF_ARP_OP(0003)
688
689 # RARP source protocol address
690 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA(ac100014)
691 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81200/FFFFFF00)
692 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
693 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81234/ffffffff)
694 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
695 NXM_OF_ARP_SPA_W(C0D80000/FFFF0000)
696
697 # RARP destination protocol address
698 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA(ac100014)
699 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a81200/FFFFFF00)
700 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a81234/77777777)
701 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a81234/ffffffff)
702 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
703 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
704
705 # RARP source hardware address
706 NXM_OF_ETH_TYPE(8035) NXM_NX_ARP_SHA(0002e30f80a4)
707 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
708 NXM_NX_ARP_SHA(0002e30f80a4)
709
710 # RARP destination hardware address
711 NXM_OF_ETH_TYPE(8035) NXM_NX_ARP_THA(0002e30f80a4)
712 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
713 NXM_NX_ARP_THA(0002e30f80a4)
714
715 # IPv6 source
716 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
717 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
718 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
719 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
720 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
721 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
722 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffff000000000000)
723
724 # IPv6 destination
725 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
726 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
727 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/77777777777777777777777777777777)
728 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
729 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(00000000000000000000000000000000/00000000000000000000000000000000)
730 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
731
732 # IPv6 Flow Label
733 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_LABEL(1000000f)
734 NXM_NX_IPV6_LABEL(0000000f)
735 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_LABEL(0000000f)
736
737 # ND target address
738 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
739 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
740 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/0123456789abcdeffedcba9876543210)
741 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/ffffffffffffffffffffffffffffffff)
742 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(00000000000000000000000000000000/00000000000000000000000000000000)
743 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/fedcba98765432100123456789abcdef)
744
745 # ND source hardware address
746 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)
747 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)
748 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)
749 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)
750
751 # ND destination hardware address
752 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)
753 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)
754 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)
755 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)
756
757 # IPv4 fragments.
758 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(00)
759 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(01)
760 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(02)
761 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(03)
762 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/03)
763 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/fd)
764 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/02)
765 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(01/01)
766 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(02/02)
767 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/03)
768 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/ff)
769 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/00)
770 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(f3)
771
772 # IPv6 fragments.
773 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(00)
774 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(01)
775 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(02)
776 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(03)
777 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/03)
778 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/01)
779 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/02)
780 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(01/01)
781 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(02/02)
782 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/03)
783 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/00)
784 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/ff)
785 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(f3)
786
787 # Flow cookie.
788 NXM_NX_COOKIE(00000000abcdef01)
789 NXM_NX_COOKIE_W(84200000abcdef01/84200000FFFFFFFF)
790 NXM_NX_COOKIE_W(84200000abcdef01/ffffffffffffffff)
791 NXM_NX_COOKIE_W(0000000000000000/0000000000000000)
792
793 # Tunnel ID.
794 NXM_NX_TUN_ID(00000000abcdef01)
795 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
796 NXM_NX_TUN_ID_W(84200000abcdef01/FFFFFFFFFFFFFFFF)
797 NXM_NX_TUN_ID_W(0000000000000000/0000000000000000)
798
799 # Register 0.
800 NXM_NX_REG0(acebdf56)
801 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
802 NXM_NX_REG0_W(a0e0d050/ffffffff)
803 NXM_NX_REG0_W(00000000/00000000)
804
805 # dp_hash (testing experimenter OXM).
806 NXM_NX_DP_HASH(01234567)
807 NXOXM_ET_DP_HASH(01234567)
808
809 # Invalid field number.
810 01020304(1111/3333)
811
812 # Invalid field numbers (experimenter OXM).
813 ffff020800002320(11112222)
814 ffff030800002320(1111/3333)
815
816 # Unimplemented registers.
817 #
818 # This test assumes that at least two registers, but fewer than 16,
819 # registers are implemented.
820 00010004(12345678)
821 00010108(12345678/12345678)
822 00011e04(12345678)
823 00011f08(12345678/12345678)
824 ])
825 AT_CHECK([ovs-ofctl -vPATTERN:'console:%c|%p|%m' --strict parse-nx-match < nx-match.txt], [0], [dnl
826 <any>
827
828 # in port
829 NXM_OF_IN_PORT(0000)
830 NXM_OF_IN_PORT(fffe)
831
832 # eth dst
833 NXM_OF_ETH_DST(0002e30f80a4)
834 NXM_OF_ETH_DST_W(010000000000/010000000000)
835 NXM_OF_ETH_DST_W(000000000000/010000000000)
836 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
837 NXM_OF_ETH_DST(0002e30f80a4)
838 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
839 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
840 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
841
842 # eth src
843 NXM_OF_ETH_SRC(020898456ddb)
844 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
845 NXM_OF_ETH_SRC(020898456ddb)
846 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
847
848 # eth type
849 NXM_OF_ETH_TYPE(0800)
850 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
851
852 # vlan tci
853 NXM_OF_VLAN_TCI(f009)
854 nx_pull_match() returned error OFPBMC_DUP_FIELD
855 NXM_OF_VLAN_TCI(0000)
856 NXM_OF_VLAN_TCI(3123)
857 NXM_OF_VLAN_TCI(0123)
858 NXM_OF_VLAN_TCI_W(1123/1fff)
859 NXM_OF_VLAN_TCI(1123)
860 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
861 NXM_OF_VLAN_TCI_W(f000/f000)
862 NXM_OF_VLAN_TCI_W(0000/e000)
863
864 # IP TOS
865 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
866 nx_pull_match() returned error OFPBMC_BAD_VALUE
867 nx_pull_match() returned error OFPBMC_BAD_PREREQ
868
869 # IP ECN
870 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
871 nx_pull_match() returned error OFPBMC_BAD_VALUE
872 nx_pull_match() returned error OFPBMC_BAD_PREREQ
873
874 # IP protocol
875 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
876 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
877 nx_pull_match() returned error OFPBMC_BAD_PREREQ
878
879 # IP TTL
880 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
881 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
882 nx_pull_match() returned error OFPBMC_BAD_PREREQ
883
884 # IP source
885 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
886 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
887 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
888 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80000)
889 nx_pull_match() returned error OFPBMC_BAD_PREREQ
890 nx_pull_match() returned error OFPBMC_BAD_PREREQ
891
892 # IP destination
893 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
894 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
895 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
896 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(c0a80000)
897 nx_pull_match() returned error OFPBMC_BAD_PREREQ
898 nx_pull_match() returned error OFPBMC_BAD_PREREQ
899
900 # TCP source port
901 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
902 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC_W(5050/f0f0)
903 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(5050)
904 nx_pull_match() returned error OFPBMC_BAD_PREREQ
905
906 # TCP destination port
907 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
908 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST_W(fde0/fff0)
909 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(fde0)
910 nx_pull_match() returned error OFPBMC_BAD_PREREQ
911
912 # TCP flags
913 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0131)
914 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS_W(00f0/0ff0)
915 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(01e2)
916 nx_pull_match() returned error OFPBMC_BAD_PREREQ
917
918 # UDP source port
919 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
920 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC_W(0132/01ff)
921 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(0132)
922 nx_pull_match() returned error OFPBMC_BAD_PREREQ
923
924 # UDP destination port
925 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
926 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST_W(5005/f00f)
927 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(5005)
928 nx_pull_match() returned error OFPBMC_BAD_PREREQ
929
930 # ICMP type
931 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
932 nx_pull_match() returned error OFPBMC_BAD_PREREQ
933
934 # ICMP code
935 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
936 nx_pull_match() returned error OFPBMC_BAD_PREREQ
937 nx_pull_match() returned error OFPBMC_BAD_PREREQ
938 nx_pull_match() returned error OFPBMC_BAD_PREREQ
939
940 # ARP opcode
941 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
942 nx_pull_match() returned error OFPBMC_BAD_VALUE
943 nx_pull_match() returned error OFPBMC_BAD_PREREQ
944 nx_pull_match() returned error OFPBMC_BAD_PREREQ
945 nx_pull_match() returned error OFPBMC_DUP_FIELD
946
947 # ARP source protocol address
948 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
949 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
950 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
951 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(c0a81234)
952 nx_pull_match() returned error OFPBMC_BAD_PREREQ
953 nx_pull_match() returned error OFPBMC_BAD_PREREQ
954
955 # ARP destination protocol address
956 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
957 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
958 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
959 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(c0a81234)
960 nx_pull_match() returned error OFPBMC_BAD_PREREQ
961 nx_pull_match() returned error OFPBMC_BAD_PREREQ
962
963 # ARP source hardware address
964 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
965 nx_pull_match() returned error OFPBMC_BAD_PREREQ
966 nx_pull_match() returned error OFPBMC_BAD_PREREQ
967
968 # ARP destination hardware address
969 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
970 nx_pull_match() returned error OFPBMC_BAD_PREREQ
971 nx_pull_match() returned error OFPBMC_BAD_PREREQ
972
973 # RARP opcode
974 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_OP(0003)
975 nx_pull_match() returned error OFPBMC_BAD_VALUE
976 nx_pull_match() returned error OFPBMC_BAD_PREREQ
977 nx_pull_match() returned error OFPBMC_BAD_PREREQ
978 nx_pull_match() returned error OFPBMC_DUP_FIELD
979
980 # RARP source protocol address
981 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA(ac100014)
982 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
983 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
984 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA(c0a81234)
985 nx_pull_match() returned error OFPBMC_BAD_PREREQ
986 nx_pull_match() returned error OFPBMC_BAD_PREREQ
987
988 # RARP destination protocol address
989 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA(ac100014)
990 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
991 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
992 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA(c0a81234)
993 nx_pull_match() returned error OFPBMC_BAD_PREREQ
994 nx_pull_match() returned error OFPBMC_BAD_PREREQ
995
996 # RARP source hardware address
997 NXM_OF_ETH_TYPE(8035), NXM_NX_ARP_SHA(0002e30f80a4)
998 nx_pull_match() returned error OFPBMC_BAD_PREREQ
999 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1000
1001 # RARP destination hardware address
1002 NXM_OF_ETH_TYPE(8035), NXM_NX_ARP_THA(0002e30f80a4)
1003 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1004 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1005
1006 # IPv6 source
1007 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
1008 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1009 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1010 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1011 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000000)
1012 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1013 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1014
1015 # IPv6 destination
1016 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
1017 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1018 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1019 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010000000000000000)
1020 NXM_OF_ETH_TYPE(86dd)
1021 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1022
1023 # IPv6 Flow Label
1024 nx_pull_match() returned error OFPBMC_BAD_VALUE
1025 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1026 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(0000000f)
1027
1028 # ND target address
1029 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
1030 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
1031 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1032 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
1033 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87)
1034 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1035
1036 # ND source hardware address
1037 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)
1038 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1039 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1040 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1041
1042 # ND destination hardware address
1043 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)
1044 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1045 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1046 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1047
1048 # IPv4 fragments.
1049 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
1050 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(01)
1051 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(02)
1052 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
1053 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
1054 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/01)
1055 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
1056 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
1057 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
1058 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
1059 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
1060 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1061 nx_pull_match() returned error OFPBMC_BAD_VALUE
1062
1063 # IPv6 fragments.
1064 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
1065 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(01)
1066 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(02)
1067 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
1068 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
1069 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/01)
1070 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
1071 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
1072 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
1073 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
1074 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1075 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
1076 nx_pull_match() returned error OFPBMC_BAD_VALUE
1077
1078 # Flow cookie.
1079 NXM_NX_COOKIE(00000000abcdef01)
1080 NXM_NX_COOKIE_W(84200000abcdef01/84200000ffffffff)
1081 NXM_NX_COOKIE(84200000abcdef01)
1082 <any>
1083
1084 # Tunnel ID.
1085 NXM_NX_TUN_ID(00000000abcdef01)
1086 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
1087 NXM_NX_TUN_ID(84200000abcdef01)
1088 <any>
1089
1090 # Register 0.
1091 NXM_NX_REG0(acebdf56)
1092 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
1093 NXM_NX_REG0(a0e0d050)
1094 <any>
1095
1096 # dp_hash (testing experimenter OXM).
1097 NXM_NX_DP_HASH(01234567)
1098 NXM_NX_DP_HASH(01234567)
1099
1100 # Invalid field number.
1101 nx_pull_match() returned error OFPBMC_BAD_FIELD
1102
1103 # Invalid field numbers (experimenter OXM).
1104 nx_pull_match() returned error OFPBMC_BAD_FIELD
1105 nx_pull_match() returned error OFPBMC_BAD_FIELD
1106
1107 # Unimplemented registers.
1108 #
1109 # This test assumes that at least two registers, but fewer than 16,
1110 # registers are implemented.
1111 NXM_NX_REG0(12345678)
1112 NXM_NX_REG0_W(12345678/12345678)
1113 nx_pull_match() returned error OFPBMC_BAD_FIELD
1114 nx_pull_match() returned error OFPBMC_BAD_FIELD
1115 ], [stderr])
1116
1117 # Check that at least the first warning made it.  (It's rate-limited
1118 # so a variable number could show up, especially under valgrind etc.)
1119 AT_CHECK([grep '1-bits in value' stderr | sed 1q], [0], [dnl
1120 nx_match|WARN|Rejecting NXM/OXM entry 0:0:1:1:12 with 1-bits in value for bits wildcarded by the mask.
1121 ])
1122
1123 # Check that there wasn't any other stderr output.
1124 AT_CHECK([grep -v '1-bits in value' stderr], [1])
1125 AT_CLEANUP
1126
1127 AT_SETUP([ovs-ofctl parse-ofp10-match])
1128 AT_KEYWORDS([OF1.0])
1129 AT_DATA([test-data], [dnl
1130 # in_port=LOCAL
1131 003820fe fffe xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl
1132 xxxxxxxx xxxxxxxx xxxx xxxx
1133
1134 # dl_src=00:01:02:03:04:05
1135 003820fb xxxx 000102030405 xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl
1136 xxxxxxxx xxxxxxxx xxxx xxxx
1137
1138 # dl_dst=10:20:30:40:50:60
1139 003820f7 xxxx xxxxxxxxxxxx 102030405060 xxxx xx xx xxxx xx xx xxxx dnl
1140 xxxxxxxx xxxxxxxx xxxx xxxx
1141
1142 # dl_vlan=291
1143 003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx 0123 xx xx xxxx xx xx xxxx dnl
1144 xxxxxxxx xxxxxxxx xxxx xxxx
1145
1146 # dl_vlan_pcp=5
1147 002820ff xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx 05 xx xxxx xx xx xxxx dnl
1148 xxxxxxxx xxxxxxxx xxxx xxxx
1149
1150 # dl_vlan=291,dl_vlan_pcp=4
1151 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx 0123 04 xx xxxx xx xx xxxx dnl
1152 xxxxxxxx xxxxxxxx xxxx xxxx
1153
1154 # vlan_tci=0x0000
1155 003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff xx xx xxxx xx xx xxxx dnl
1156 xxxxxxxx xxxxxxxx xxxx xxxx
1157
1158 dnl dl_vlan_pcp doesn't make sense when dl_vlan is "none", so
1159 dnl OVS ignores it and drops it on output.
1160 # vlan_tci=0x0000
1161 #  1: 28 -> 38
1162 # 20: 05 -> 00
1163 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff 05 xx xxxx xx xx xxxx dnl
1164 xxxxxxxx xxxxxxxx xxxx xxxx
1165
1166 dnl Invalid VID and PCP discards out-of-range bits:
1167 # dl_vlan=256,dl_vlan_pcp=7
1168 # 18: f1 -> 01
1169 # 20: ff -> 07
1170 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx f100 ff xx xxxx xx xx xxxx dnl
1171 xxxxxxxx xxxxxxxx xxxx xxxx
1172
1173 # dl_type=0x1234
1174 003820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1175 xxxxxxxx xxxxxxxx xxxx xxxx
1176
1177 # ip,nw_proto=5
1178 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 05 xxxx dnl
1179 xxxxxxxx xxxxxxxx xxxx xxxx
1180
1181 dnl Ignore nw_proto if not IP or ARP:
1182 # dl_type=0x1234,nw_proto=5
1183 # normal:  3: cf -> ef
1184 # normal: 25: 05 -> 00
1185 & ofp_util|INFO|normalization changed ofp_match, details:
1186 & ofp_util|INFO| pre: dl_type=0x1234,nw_proto=5
1187 & ofp_util|INFO|post: dl_type=0x1234
1188 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx 05 xxxx dnl
1189 xxxxxxxx xxxxxxxx xxxx xxxx
1190
1191 # ip,nw_tos=252
1192 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 fc xx xxxx dnl
1193 xxxxxxxx xxxxxxxx xxxx xxxx
1194
1195 dnl Ignore nw_tos if not IP:
1196 # arp,nw_tos=4
1197 # 24: 05 -> 04
1198 # normal:  1: 18 -> 38
1199 # normal: 24: 04 -> 00
1200 & ofp_util|INFO|normalization changed ofp_match, details:
1201 & ofp_util|INFO| pre: arp,nw_tos=4
1202 & ofp_util|INFO|post: arp
1203 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 05 xx xxxx dnl
1204 xxxxxxxx xxxxxxxx xxxx xxxx
1205
1206 dnl Low 2 bits of invalid TOS are forced to 0:
1207 # ip,nw_tos=48
1208 # 24: 31 -> 30
1209 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 31 xx xxxx dnl
1210 xxxxxxxx xxxxxxxx xxxx xxxx
1211
1212 # arp,arp_op=2
1213 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx 02 xxxx dnl
1214 xxxxxxxx xxxxxxxx xxxx xxxx
1215
1216 # ip,nw_src=192.168.128.85
1217 003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1218 c0a88055 xxxxxxxx xxxx xxxx
1219
1220 # ip,nw_src=192.168.128.0/24
1221 # 31: 55 -> 00
1222 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1223 c0a88055 xxxxxxxx xxxx xxxx
1224
1225 # ip,nw_dst=192.168.128.85
1226 003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1227 xxxxxxxx c0a88055 xxxx xxxx
1228
1229 # ip,nw_dst=192.168.128.0/24
1230 # 35: 55 -> 00
1231 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1232 xxxxxxxx c0a88055 xxxx xxxx
1233
1234 # arp,arp_spa=192.168.128.85
1235 003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1236 c0a88055 xxxxxxxx xxxx xxxx
1237
1238 # arp,arp_spa=192.168.128.0/24
1239 # 31: 55 -> 00
1240 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1241 c0a88055 xxxxxxxx xxxx xxxx
1242
1243 # arp,arp_tpa=192.168.128.85
1244 003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1245 xxxxxxxx c0a88055 xxxx xxxx
1246
1247 # arp,arp_tpa=192.168.128.0/24
1248 # 35: 55 -> 00
1249 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1250 xxxxxxxx c0a88055 xxxx xxxx
1251
1252 dnl Ignore nw_src if not IP or ARP:
1253 # dl_type=0x1234,nw_src=192.168.128.0/24
1254 # 31: 55 -> 00
1255 # normal:  2: 08 -> 20
1256 # normal: 28: c0 -> 00
1257 # normal: 29: a8 -> 00
1258 # normal: 30: 80 -> 00
1259 & ofp_util|INFO|normalization changed ofp_match, details:
1260 & ofp_util|INFO| pre: dl_type=0x1234,nw_src=192.168.128.0/24
1261 & ofp_util|INFO|post: dl_type=0x1234
1262 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1263 c0a88055 xxxxxxxx xxxx xxxx
1264
1265 dnl Ignore nw_dst if not IP or ARP:
1266 # dl_type=0x1234,nw_dst=192.168.128.0/24
1267 # 35: 55 -> 00
1268 # normal:  1: 32 -> 38
1269 # normal: 32: c0 -> 00
1270 # normal: 33: a8 -> 00
1271 # normal: 34: 80 -> 00
1272 & ofp_util|INFO|normalization changed ofp_match, details:
1273 & ofp_util|INFO| pre: dl_type=0x1234,nw_dst=192.168.128.0/24
1274 & ofp_util|INFO|post: dl_type=0x1234
1275 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1276 xxxxxxxx c0a88055 xxxx xxxx
1277
1278 # tcp,tp_src=443
1279 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl
1280 xxxxxxxx xxxxxxxx 01bb xxxx
1281
1282 # tcp,tp_dst=443
1283 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl
1284 xxxxxxxx xxxxxxxx xxxx 01bb
1285
1286 # udp,tp_src=443
1287 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl
1288 xxxxxxxx xxxxxxxx 01bb xxxx
1289
1290 # udp,tp_dst=443
1291 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl
1292 xxxxxxxx xxxxxxxx xxxx 01bb
1293
1294 # sctp,tp_src=443
1295 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 84 xxxx dnl
1296 xxxxxxxx xxxxxxxx 01bb xxxx
1297
1298 # sctp,tp_dst=443
1299 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 84 xxxx dnl
1300 xxxxxxxx xxxxxxxx xxxx 01bb
1301
1302 # icmp,icmp_type=5
1303 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl
1304 xxxxxxxx xxxxxxxx 0005 xxxx
1305
1306 # icmp,icmp_code=8
1307 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl
1308 xxxxxxxx xxxxxxxx xxxx 0008
1309
1310 dnl Ignore tp_src if not TCP/UDP/SCTP:
1311 # ip,nw_proto=21,tp_src=443
1312 # normal:  3: 8f -> cf
1313 # normal: 36: 01 -> 00
1314 # normal: 37: bb -> 00
1315 & ofp_util|INFO|normalization changed ofp_match, details:
1316 & ofp_util|INFO| pre: ip,nw_proto=21,tp_src=443
1317 & ofp_util|INFO|post: ip,nw_proto=21
1318 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl
1319 xxxxxxxx xxxxxxxx 01bb xxxx
1320
1321 dnl Ignore tp_dst if not TCP/UDP/SCTP:
1322 # ip,nw_proto=21,tp_dst=443
1323 # normal:  3: 4f -> cf
1324 # normal: 38: 01 -> 00
1325 # normal: 39: bb -> 00
1326 dnl The normalization details are suppressed here due to rate-limiting.
1327 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl
1328 xxxxxxxx xxxxxxxx xxxx 01bb
1329
1330 ])
1331 sed '/^[[#&]]/d' < test-data > input.txt
1332 sed -n 's/^# //p; /^$/p' < test-data > expout
1333 sed -n 's/^& //p' < test-data > experr
1334 AT_CAPTURE_FILE([input.txt])
1335 AT_CAPTURE_FILE([expout])
1336 AT_CAPTURE_FILE([experr])
1337 AT_CHECK(
1338   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-match < input.txt],
1339   [0], [expout], [experr])
1340 AT_CLEANUP
1341
1342 AT_SETUP([ovs-ofctl parse-ofp11-match])
1343 AT_KEYWORDS([OF1.1])
1344 AT_DATA([test-data], [dnl
1345 # in_port=LOCAL
1346 0000 0058 fffffffe 000003fe dnl
1347 000000000000ffffffffffff 000000000000ffffffffffff dnl
1348 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1349 00000000 00 000000 0000000000000000ffffffffffffffff
1350
1351 # bad ofp11_match: OFPBMC_BAD_VALUE
1352 & ofp_util|WARN|port 305419896 is outside the supported range 0 through 65279 or 0xffffff00 through 0xffffffff
1353 0000 0058 12345678 000003fe dnl
1354 000000000000ffffffffffff 000000000000ffffffffffff dnl
1355 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1356 00000000 00 000000 0000000000000000ffffffffffffffff
1357
1358 # dl_src=00:01:02:03:04:05
1359 0000 0058 00000000 000003ff dnl
1360 000102030405000000000000 000000000000ffffffffffff dnl
1361 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1362 00000000 00 000000 0000000000000000ffffffffffffffff
1363
1364 # dl_src=55:55:55:55:55:55/55:55:55:55:55:55
1365 0000 0058 00000000 000003ff dnl
1366 555555555555aaaaaaaaaaaa 000000000000ffffffffffff dnl
1367 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1368 00000000 00 000000 0000000000000000ffffffffffffffff
1369
1370 # dl_dst=00:01:02:03:04:05
1371 0000 0058 00000000 000003ff dnl
1372 000000000000ffffffffffff 000102030405000000000000 dnl
1373 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1374 00000000 00 000000 0000000000000000ffffffffffffffff
1375
1376 # dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
1377 0000 0058 00000000 000003ff dnl
1378 000000000000ffffffffffff 010000000000feffffffffff dnl
1379 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1380 00000000 00 000000 0000000000000000ffffffffffffffff
1381
1382 # dl_dst=00:01:02:03:04:05/fe:ff:ff:ff:ff:ff
1383 0000 0058 00000000 000003ff dnl
1384 000000000000ffffffffffff 000102030405010000000000 dnl
1385 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1386 00000000 00 000000 0000000000000000ffffffffffffffff
1387
1388 # dl_dst=55:55:55:55:55:55/55:55:55:55:55:55
1389 0000 0058 00000000 000003ff dnl
1390 000000000000ffffffffffff 555555555555aaaaaaaaaaaa dnl
1391 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1392 00000000 00 000000 0000000000000000ffffffffffffffff
1393
1394 dnl dl_vlan_pcp is ignored if dl_vlan is wildcarded, which causes the
1395 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1396 # in_port=1
1397 # 11: fa -> fe
1398 # 38: 03 -> 00
1399 0000 0058 00000001 000003fa dnl
1400 000000000000ffffffffffff 000000000000ffffffffffff dnl
1401 0000 03 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1402 00000000 00 000000 0000000000000000ffffffffffffffff
1403
1404 # dl_vlan=291
1405 0000 0058 00000000 000003fd dnl
1406 000000000000ffffffffffff 000000000000ffffffffffff dnl
1407 0123 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1408 00000000 00 000000 0000000000000000ffffffffffffffff
1409
1410 dnl OFPVID_NONE:
1411 # vlan_tci=0x0000
1412 0000 0058 00000000 000003fd dnl
1413 000000000000ffffffffffff 000000000000ffffffffffff dnl
1414 ffff 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1415 00000000 00 000000 0000000000000000ffffffffffffffff
1416
1417 dnl OFPVID_NONE ignores dl_vlan_pcp even if not wildcarded, which causes
1418 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1419 # vlan_tci=0x0000
1420 # 11: f9 -> fd
1421 # 38: 05 -> 00
1422 0000 0058 00000000 000003f9 dnl
1423 000000000000ffffffffffff 000000000000ffffffffffff dnl
1424 ffff 05 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1425 00000000 00 000000 0000000000000000ffffffffffffffff
1426
1427 # vlan_tci=0x1000/0x1000
1428 0000 0058 00000000 000003fd dnl
1429 000000000000ffffffffffff 000000000000ffffffffffff dnl
1430 fffe 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1431 00000000 00 000000 0000000000000000ffffffffffffffff
1432
1433 dnl Try invalid VID:
1434 # bad ofp11_match: OFPBMC_BAD_VALUE
1435 0000 0058 00000000 000003fd dnl
1436 000000000000ffffffffffff 000000000000ffffffffffff dnl
1437 1234 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1438 00000000 00 000000 0000000000000000ffffffffffffffff
1439
1440 # dl_vlan_pcp=4
1441 0000 0058 00000000 000003f9 dnl
1442 000000000000ffffffffffff 000000000000ffffffffffff dnl
1443 fffe 04 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1444 00000000 00 000000 0000000000000000ffffffffffffffff
1445
1446 # dl_vlan=10,dl_vlan_pcp=6
1447 0000 0058 00000000 000003f9 dnl
1448 000000000000ffffffffffff 000000000000ffffffffffff dnl
1449 000a 06 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1450 00000000 00 000000 0000000000000000ffffffffffffffff
1451
1452 # dl_type=0x1234
1453 0000 0058 00000000 000003f7 dnl
1454 000000000000ffffffffffff 000000000000ffffffffffff dnl
1455 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1456 00000000 00 000000 0000000000000000ffffffffffffffff
1457
1458 # ip,nw_tos=252
1459 0000 0058 00000000 000003e7 dnl
1460 000000000000ffffffffffff 000000000000ffffffffffff dnl
1461 0000 00 00 0800 fc 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1462 00000000 00 000000 0000000000000000ffffffffffffffff
1463
1464 dnl Try invalid TOS:
1465 # bad ofp11_match: OFPBMC_BAD_VALUE
1466 0000 0058 00000000 000003e7 dnl
1467 000000000000ffffffffffff 000000000000ffffffffffff dnl
1468 0000 00 00 0800 01 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1469 00000000 00 000000 0000000000000000ffffffffffffffff
1470
1471 # ip,nw_proto=5
1472 0000 0058 00000000 000003d7 dnl
1473 000000000000ffffffffffff 000000000000ffffffffffff dnl
1474 0000 00 00 0800 00 05 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1475 00000000 00 000000 0000000000000000ffffffffffffffff
1476
1477 # arp,arp_op=2
1478 0000 0058 00000000 000003d7 dnl
1479 000000000000ffffffffffff 000000000000ffffffffffff dnl
1480 0000 00 00 0806 00 02 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1481 00000000 00 000000 0000000000000000ffffffffffffffff
1482
1483 # ip,nw_src=192.168.128.0/24
1484 0000 0058 00000000 000003f7 dnl
1485 000000000000ffffffffffff 000000000000ffffffffffff dnl
1486 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1487 00000000 00 000000 0000000000000000ffffffffffffffff
1488
1489 # ip,nw_src=128.160.128.0/165.165.165.165
1490 # 44: c0 -> 80
1491 # 45: a8 -> a0
1492 0000 0058 00000000 000003f7 dnl
1493 000000000000ffffffffffff 000000000000ffffffffffff dnl
1494 0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl
1495 00000000 00 000000 0000000000000000ffffffffffffffff
1496
1497 # ip,nw_dst=192.168.128.0/24
1498 0000 0058 00000000 000003f7 dnl
1499 000000000000ffffffffffff 000000000000ffffffffffff dnl
1500 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1501 00000000 00 000000 0000000000000000ffffffffffffffff
1502
1503 # ip,nw_dst=128.160.128.0/165.165.165.165
1504 # 52: c0 -> 80
1505 # 53: a8 -> a0
1506 0000 0058 00000000 000003f7 dnl
1507 000000000000ffffffffffff 000000000000ffffffffffff dnl
1508 0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
1509 00000000 00 000000 0000000000000000ffffffffffffffff
1510
1511 # arp,arp_spa=192.168.128.0/24
1512 0000 0058 00000000 000003f7 dnl
1513 000000000000ffffffffffff 000000000000ffffffffffff dnl
1514 0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1515 00000000 00 000000 0000000000000000ffffffffffffffff
1516
1517 # arp,arp_tpa=192.168.128.0/24
1518 0000 0058 00000000 000003f7 dnl
1519 000000000000ffffffffffff 000000000000ffffffffffff dnl
1520 0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1521 00000000 00 000000 0000000000000000ffffffffffffffff
1522
1523 # tcp,tp_src=443
1524 0000 0058 00000000 00000397 dnl
1525 000000000000ffffffffffff 000000000000ffffffffffff dnl
1526 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1527 00000000 00 000000 0000000000000000ffffffffffffffff
1528
1529 # tcp,tp_dst=443
1530 0000 0058 00000000 00000357 dnl
1531 000000000000ffffffffffff 000000000000ffffffffffff dnl
1532 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1533 00000000 00 000000 0000000000000000ffffffffffffffff
1534
1535 # udp,tp_src=443
1536 0000 0058 00000000 00000397 dnl
1537 000000000000ffffffffffff 000000000000ffffffffffff dnl
1538 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1539 00000000 00 000000 0000000000000000ffffffffffffffff
1540
1541 # icmp,icmp_type=5
1542 0000 0058 00000000 00000397 dnl
1543 000000000000ffffffffffff 000000000000ffffffffffff dnl
1544 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0005 0000 dnl
1545 00000000 00 000000 0000000000000000ffffffffffffffff
1546
1547 # icmp,icmp_code=8
1548 0000 0058 00000000 00000357 dnl
1549 000000000000ffffffffffff 000000000000ffffffffffff dnl
1550 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0000 0008 dnl
1551 00000000 00 000000 0000000000000000ffffffffffffffff
1552
1553 # udp,tp_src=443
1554 0000 0058 00000000 00000397 dnl
1555 000000000000ffffffffffff 000000000000ffffffffffff dnl
1556 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1557 00000000 00 000000 0000000000000000ffffffffffffffff
1558
1559 # udp,tp_dst=443
1560 0000 0058 00000000 00000357 dnl
1561 000000000000ffffffffffff 000000000000ffffffffffff dnl
1562 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1563 00000000 00 000000 0000000000000000ffffffffffffffff
1564
1565 # sctp
1566 0000 0058 00000000 000003d7 dnl
1567 000000000000ffffffffffff 000000000000ffffffffffff dnl
1568 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1569 00000000 00 000000 0000000000000000ffffffffffffffff
1570
1571 # sctp,tp_src=443
1572 0000 0058 00000000 00000397 dnl
1573 000000000000ffffffffffff 000000000000ffffffffffff dnl
1574 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1575 00000000 00 000000 0000000000000000ffffffffffffffff
1576
1577 # sctp,tp_dst=443
1578 0000 0058 00000000 00000357 dnl
1579 000000000000ffffffffffff 000000000000ffffffffffff dnl
1580 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1581 00000000 00 000000 0000000000000000ffffffffffffffff
1582
1583 dnl Ignore tp_src if not TCP/UDP/SCTP:
1584 # ip,nw_proto=21
1585 # 11: 97 -> d7
1586 # 60: 01 -> 00
1587 # 61: bb -> 00
1588 0000 0058 00000000 00000397 dnl
1589 000000000000ffffffffffff 000000000000ffffffffffff dnl
1590 0000 00 00 0800 00 15 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1591 00000000 00 000000 0000000000000000ffffffffffffffff
1592
1593 dnl Ignore tp_dst if not TCP/UDP/SCTP:
1594 # ip,nw_proto=22
1595 # 11: 57 -> d7
1596 # 62: 01 -> 00
1597 # 63: bb -> 00
1598 0000 0058 00000000 00000357 dnl
1599 000000000000ffffffffffff 000000000000ffffffffffff dnl
1600 0000 00 00 0800 00 16 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1601 00000000 00 000000 0000000000000000ffffffffffffffff
1602
1603 # mpls,mpls_label=284280
1604 # 64: 12 -> 00
1605 # 65: 34 -> 04
1606 0000 0058 00000000 000002f7 dnl
1607 000000000000ffffffffffff 000000000000ffffffffffff dnl
1608 0000 00 00 8847 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1609 12345678 00 000000 0000000000000000ffffffffffffffff
1610
1611 # mplsm,mpls_tc=2
1612 # 68: 5a -> 02
1613 0000 0058 00000000 000001f7 dnl
1614 000000000000ffffffffffff 000000000000ffffffffffff dnl
1615 0000 00 00 8848 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1616 00000000 5a 000000 0000000000000000ffffffffffffffff
1617
1618 dnl mpls_label and mpls_tc must be ignored if dl_type is not MPLS:
1619 # dl_type=0x1234
1620 # 10: 00 -> 03
1621 # 64: 12 -> 00
1622 # 65: 34 -> 00
1623 # 66: 56 -> 00
1624 # 67: 78 -> 00
1625 # 68: 5a -> 00
1626 0000 0058 00000000 000000f7 dnl
1627 000000000000ffffffffffff 000000000000ffffffffffff dnl
1628 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1629 12345678 5a 000000 0000000000000000ffffffffffffffff
1630
1631 dnl metadata match:
1632 # metadata=0x1234567890abcdef
1633 0000 0058 00000000 000003ff dnl
1634 000000000000ffffffffffff 000000000000ffffffffffff dnl
1635 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1636 00000000 00 000000 1234567890abcdef0000000000000000
1637
1638 dnl metadata match:
1639 # metadata=0x5555555555555555/0x5555555555555555
1640 0000 0058 00000000 000003ff dnl
1641 000000000000ffffffffffff 000000000000ffffffffffff dnl
1642 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1643 00000000 00 000000 5555555555555555aaaaaaaaaaaaaaaa
1644
1645 dnl metadata match:
1646 # metadata=0x1234000090ab0000/0xffff0000ffff0000
1647 # 74: 56 -> 00
1648 # 75: 78 -> 00
1649 # 78: cd -> 00
1650 # 79: ef -> 00
1651 0000 0058 00000000 000003ff dnl
1652 000000000000ffffffffffff 000000000000ffffffffffff dnl
1653 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1654 00000000 00 000000 1234567890abcdef0000ffff0000ffff
1655
1656 ])
1657 sed '/^[[#&]]/d' < test-data > input.txt
1658 sed -n 's/^# //p; /^$/p' < test-data > expout
1659 sed -n 's/^& //p' < test-data > experr
1660 AT_CAPTURE_FILE([input.txt])
1661 AT_CAPTURE_FILE([expout])
1662 AT_CAPTURE_FILE([experr])
1663 AT_CHECK(
1664   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-match < input.txt],
1665   [0], [expout], [experr])
1666 AT_CLEANUP
1667
1668 AT_SETUP([ovs-ofctl parse-nx-match loose])
1669 AT_KEYWORDS([nx-match])
1670 AT_DATA([nx-match.txt], [dnl
1671 NXM_OF_IN_PORT(0001), 01020304(1111/3333), NXM_OF_ETH_TYPE(0800)
1672 NXM_OF_IN_PORT(0001), ffff020800002320(11112222), NXM_OF_ETH_TYPE(0800)
1673 NXM_OF_IN_PORT(0001), ffff030800002320(1111/3333), NXM_OF_ETH_TYPE(0800)
1674 ])
1675
1676 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
1677 nx_pull_match() returned error OFPBMC_BAD_FIELD
1678 nx_pull_match() returned error OFPBMC_BAD_FIELD
1679 nx_pull_match() returned error OFPBMC_BAD_FIELD
1680 ])
1681
1682 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
1683 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1684 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1685 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1686 ])
1687 AT_CLEANUP
1688
1689 AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.2)])
1690 AT_KEYWORDS([oxm])
1691 AT_DATA([oxm.txt], [dnl
1692 <any>
1693
1694 # in port
1695 OXM_OF_IN_PORT(00000000)
1696 OXM_OF_IN_PORT(fffffffe)
1697
1698 # metadata
1699 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1700 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1701 OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000)
1702 OXM_OF_METADATA_W(1234567890abcdef/ffffffffffffffff)
1703 OXM_OF_METADATA_W(1234567890abcdef/0000000000000000)
1704
1705 # eth dst
1706 OXM_OF_ETH_DST(0002e30f80a4)
1707 OXM_OF_ETH_DST_W(010000000000/010000000000)
1708 OXM_OF_ETH_DST_W(000000000000/010000000000)
1709 OXM_OF_ETH_DST_W(ffffffffffff/010000000000)
1710 OXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
1711 OXM_OF_ETH_DST_W(0002e30f80a4/000000000000)
1712 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1713
1714 # eth src
1715 OXM_OF_ETH_SRC(020898456ddb)
1716
1717 # eth type
1718 OXM_OF_ETH_TYPE(0800)
1719 OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
1720
1721 # vlan
1722 OXM_OF_VLAN_VID(1009) OXM_OF_VLAN_VID(1009) # Duplicate Field
1723 OXM_OF_VLAN_VID(f009)           # Bad Value
1724 OXM_OF_VLAN_PCP(00)             # Bad Pre-Requisite
1725 OXM_OF_VLAN_VID(0000)           # Packets without 802.1Q header or with VID=0
1726 OXM_OF_VLAN_VID(1123)           # Packets with VID=123, any PCP
1727 OXM_OF_VLAN_VID(1123) OXM_OF_VLAN_PCP(01) # Packets with VID=123, PCP=1.
1728 OXM_OF_VLAN_VID(0123)           # Does not make sense (but supported anyway)
1729 OXM_OF_VLAN_VID_W(0123/0123)      # Does not make sense (but supported anyway)
1730 OXM_OF_VLAN_VID_W(1123/0123)      # Does not make sense (but supported anyway)
1731 OXM_OF_VLAN_VID_W(0123/1123)      # Does not make sense (but supported anyway)
1732 OXM_OF_VLAN_VID(0123) OXM_OF_VLAN_PCP(01)  #Bad Pre-Requisite
1733 OXM_OF_VLAN_VID_W(1123/1fff)    # Packets with VID=123, any PCP.
1734 OXM_OF_VLAN_VID_W(1123/ffff)    # Packets with VID=123, any PCP.
1735 OXM_OF_VLAN_VID_W(0000/0000)    # Packets with or without 802.1Q header
1736 OXM_OF_VLAN_VID_W(1103/1f0f),   # Packets with # VID=123 (masked)
1737 OXM_OF_VLAN_VID_W(1103/1f0f), OXM_OF_VLAN_PCP(01)  # Packets with VID=123 (masked), any PCP.
1738 OXM_OF_VLAN_VID_W(1000/1000)    # Packets with any VID, any PCP
1739 OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01)  # Packets with any VID, PCP=1.
1740
1741 # IP TOS
1742 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(f0)
1743 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(41)
1744 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(3f)
1745 OXM_OF_IP_DSCP(3f)
1746
1747 # IP ECN
1748 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
1749 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06)
1750 OXM_OF_IP_ECN(03)
1751
1752 # IP protocol
1753 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01)
1754 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(05)
1755 OXM_OF_IP_PROTO(05)
1756
1757 # IP source
1758 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC(ac100014)
1759 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFF0000)
1760 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFFFFFF)
1761 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(00000000/00000000)
1762 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_SRC(ac100014)
1763 OXM_OF_IPV4_SRC_W(C0D80000/FFFF0000)
1764
1765 # IP destination
1766 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST(ac100014)
1767 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a80000/FFFF0000)
1768 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFFFFFF)
1769 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(00000000/00000000)
1770 OXM_OF_IPV4_DST(ac100014)
1771 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_DST_W(C0D80000/FFFF0000)
1772
1773 # TCP source port
1774 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC(4231)
1775 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/F0F0)
1776 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/FFFF)
1777 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(0000/0000)
1778 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_SRC(4231)
1779
1780 # TCP destination port
1781 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST(4231)
1782 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFF0)
1783 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFFF)
1784 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(0000/0000)
1785 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_DST(4231)
1786
1787 # UDP source port
1788 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC(8732)
1789 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/01FF)
1790 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/FFFF)
1791 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0000/0000)
1792 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_UDP_SRC(7823)
1793
1794 # UDP destination port
1795 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST(1782)
1796 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/F00F)
1797 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/FFFF)
1798 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(0000/0000)
1799 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_UDP_DST(1293)
1800
1801 # SCTP source port
1802 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC(8732)
1803 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/01FF)
1804 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/FFFF)
1805 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0000/0000)
1806 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_SCTP_SRC(7823)
1807
1808 # SCTP destination port
1809 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST(1782)
1810 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/F00F)
1811 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/FFFF)
1812 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(0000/0000)
1813 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_SCTP_DST(1293)
1814
1815 # ICMP type
1816 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_TYPE(12)
1817 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_TYPE(10)
1818
1819 # ICMP code
1820 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_CODE(12)
1821 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_CODE(10)
1822 OXM_OF_ETH_TYPE(0800) OXM_OF_ICMPV4_CODE(10)
1823 OXM_OF_ICMPV4_CODE(00)
1824
1825 # ARP opcode
1826 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001)
1827 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(1111)
1828 OXM_OF_ETH_TYPE(0000) OXM_OF_ARP_OP(0001)
1829 OXM_OF_ARP_OP(0001)
1830 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001) OXM_OF_ARP_OP(0001)
1831
1832 # ARP source protocol address
1833 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA(ac100014)
1834 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81200/FFFFFF00)
1835 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFFFF)
1836 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(00000000/00000000)
1837 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SPA(ac100014)
1838 OXM_OF_ARP_SPA_W(C0D80000/FFFF0000)
1839
1840 # ARP destination protocol address
1841 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA(ac100014)
1842 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a81200/FFFFFF00)
1843 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFFFF)
1844 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(00000000/00000000)
1845 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_TPA(ac100014)
1846 OXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
1847
1848 # ARP source hardware address
1849 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4)
1850 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4)
1851 OXM_OF_ARP_SHA(0002e30f80a4)
1852 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/ffffffffffff)
1853 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(000000000000/000000000000)
1854 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(000000000004/00000000000f)
1855
1856 # ARP destination hardware address
1857 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4)
1858 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4)
1859 OXM_OF_ARP_THA(0002e30f80a4)
1860 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/ffffffffffff)
1861 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(000000000000/000000000000)
1862 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(000000000004/00000000000f)
1863
1864 # IPv6 source
1865 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1866 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1867 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1868 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1869 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(00000000000000000000000000000000/00000000000000000000000000000000)
1870 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1871
1872 # IPv6 destination
1873 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1874 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1875 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1876 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1877 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(00000000000000000000000000000000/00000000000000000000000000000000)
1878 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1879
1880 # IPv6 Flow Label
1881 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(1000000f)
1882 OXM_OF_IPV6_FLABEL(0000000f)
1883 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(0000000f)
1884 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
1885 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000fffff)
1886 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(00000000/000ffff0)
1887 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/100fffff)
1888 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/ffffffff)
1889 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(00000000/00000000)
1890
1891 # ND source hardware address
1892 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)
1893 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)
1894 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)
1895 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)
1896
1897 # ND destination hardware address
1898 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)
1899 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)
1900 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)
1901 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)
1902
1903 # Registers 0, 1, and 2.
1904 NXM_NX_REG0(acebdf56)
1905 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
1906 NXM_NX_REG0(a0e0d050)
1907 NXM_NX_REG1(acebdf56)
1908 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
1909 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
1910 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
1911 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
1912
1913 # Extended registers 0, 1, and 2.
1914 # (For OpenFlow 1.2, OVS transforms these into its extension registers.)
1915 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
1916 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
1917 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
1918 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
1919 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
1920 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
1921 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
1922 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
1923
1924 # Invalid field number.
1925 01020304(1111/3333)
1926
1927 # Invalid field numbers (experimenter OXM).
1928 ffff020800002320(11112222)
1929 ffff030800002320(1111/3333)
1930 ])
1931 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow12 < oxm.txt],
1932   [0], [dnl
1933 <any>
1934
1935 # in port
1936 OXM_OF_IN_PORT(00000000)
1937 OXM_OF_IN_PORT(fffffffe)
1938
1939 # metadata
1940 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1941 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1942 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1943 OXM_OF_METADATA(1234567890abcdef)
1944 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1945
1946 # eth dst
1947 OXM_OF_ETH_DST(0002e30f80a4)
1948 OXM_OF_ETH_DST_W(010000000000/010000000000)
1949 OXM_OF_ETH_DST_W(000000000000/010000000000)
1950 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1951 OXM_OF_ETH_DST(0002e30f80a4)
1952 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1953 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1954
1955 # eth src
1956 OXM_OF_ETH_SRC(020898456ddb)
1957
1958 # eth type
1959 OXM_OF_ETH_TYPE(0800)
1960 OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
1961
1962 # vlan
1963 nx_pull_match() returned error OFPBMC_DUP_FIELD
1964 nx_pull_match() returned error OFPBMC_BAD_VALUE
1965 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1966 OXM_OF_VLAN_VID(0000)
1967 OXM_OF_VLAN_VID(1123)
1968 OXM_OF_VLAN_VID(1123), OXM_OF_VLAN_PCP(01)
1969 OXM_OF_VLAN_VID(0123)
1970 OXM_OF_VLAN_VID_W(0123/0123)
1971 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1972 OXM_OF_VLAN_VID_W(0123/1123)
1973 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1974 OXM_OF_VLAN_VID(1123)
1975 OXM_OF_VLAN_VID(1123)
1976 <any>
1977 OXM_OF_VLAN_VID_W(1103/1f0f)
1978 OXM_OF_VLAN_VID_W(1103/1f0f), OXM_OF_VLAN_PCP(01)
1979 OXM_OF_VLAN_VID_W(1000/1000)
1980 OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01)
1981
1982 # IP TOS
1983 nx_pull_match() returned error OFPBMC_BAD_VALUE
1984 nx_pull_match() returned error OFPBMC_BAD_VALUE
1985 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_DSCP(3f)
1986 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1987
1988 # IP ECN
1989 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
1990 nx_pull_match() returned error OFPBMC_BAD_VALUE
1991 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1992
1993 # IP protocol
1994 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01)
1995 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(05)
1996 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1997
1998 # IP source
1999 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(ac100014)
2000 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC_W(c0a80000/ffff0000)
2001 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(c0a80000)
2002 OXM_OF_ETH_TYPE(0800)
2003 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2004 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2005
2006 # IP destination
2007 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(ac100014)
2008 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST_W(c0a80000/ffff0000)
2009 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(c0a88012)
2010 OXM_OF_ETH_TYPE(0800)
2011 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2012 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2013
2014 # TCP source port
2015 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(4231)
2016 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC_W(5050/f0f0)
2017 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(5050)
2018 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
2019 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2020
2021 # TCP destination port
2022 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(4231)
2023 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST_W(fde0/fff0)
2024 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(fde0)
2025 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
2026 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2027
2028 # UDP source port
2029 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(8732)
2030 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC_W(0132/01ff)
2031 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(0132)
2032 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
2033 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2034
2035 # UDP destination port
2036 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(1782)
2037 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST_W(5005/f00f)
2038 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(5005)
2039 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
2040 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2041
2042 # SCTP source port
2043 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC(8732)
2044 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC_W(0132/01ff)
2045 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC(0132)
2046 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84)
2047 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2048
2049 # SCTP destination port
2050 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(1782)
2051 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST_W(5005/f00f)
2052 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(5005)
2053 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84)
2054 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2055
2056 # ICMP type
2057 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_TYPE(12)
2058 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2059
2060 # ICMP code
2061 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_CODE(12)
2062 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2063 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2064 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2065
2066 # ARP opcode
2067 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_OP(0001)
2068 nx_pull_match() returned error OFPBMC_BAD_VALUE
2069 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2070 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2071 nx_pull_match() returned error OFPBMC_DUP_FIELD
2072
2073 # ARP source protocol address
2074 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(ac100014)
2075 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA_W(c0a81200/ffffff00)
2076 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(c0a81234)
2077 OXM_OF_ETH_TYPE(0806)
2078 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2079 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2080
2081 # ARP destination protocol address
2082 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(ac100014)
2083 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA_W(c0a81200/ffffff00)
2084 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(c0a812fe)
2085 OXM_OF_ETH_TYPE(0806)
2086 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2087 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2088
2089 # ARP source hardware address
2090 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
2091 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2092 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2093 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
2094 OXM_OF_ETH_TYPE(0806)
2095 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA_W(000000000004/00000000000f)
2096
2097 # ARP destination hardware address
2098 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
2099 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2100 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2101 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
2102 OXM_OF_ETH_TYPE(0806)
2103 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA_W(000000000004/00000000000f)
2104
2105 # IPv6 source
2106 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
2107 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2108 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
2109 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010000000000000000)
2110 OXM_OF_ETH_TYPE(86dd)
2111 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2112
2113 # IPv6 destination
2114 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
2115 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2116 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
2117 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010000000000000000)
2118 OXM_OF_ETH_TYPE(86dd)
2119 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2120
2121 # IPv6 Flow Label
2122 nx_pull_match() returned error OFPBMC_BAD_VALUE
2123 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2124 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2125 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
2126 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2127 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(00000000/000ffff0)
2128 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2129 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2130 OXM_OF_ETH_TYPE(86dd)
2131
2132 # ND source hardware address
2133 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)
2134 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2135 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2136 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2137
2138 # ND destination hardware address
2139 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)
2140 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2141 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2142 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2143
2144 # Registers 0, 1, and 2.
2145 NXM_NX_REG0(acebdf56)
2146 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
2147 NXM_NX_REG0(a0e0d050)
2148 NXM_NX_REG1(acebdf56)
2149 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
2150 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
2151 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
2152 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
2153
2154 # Extended registers 0, 1, and 2.
2155 # (For OpenFlow 1.2, OVS transforms these into its extension registers.)
2156 NXM_NX_REG0(acebdf56)
2157 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
2158 NXM_NX_REG0(a0e0d050)
2159 NXM_NX_REG1(acebdf56)
2160 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
2161 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
2162 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
2163 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
2164
2165 # Invalid field number.
2166 nx_pull_match() returned error OFPBMC_BAD_FIELD
2167
2168 # Invalid field numbers (experimenter OXM).
2169 nx_pull_match() returned error OFPBMC_BAD_FIELD
2170 nx_pull_match() returned error OFPBMC_BAD_FIELD
2171 ], [stderr])
2172
2173 # Check that at least the first warning made it.  (It's rate-limited
2174 # so a variable number could show up, especially under valgrind etc.)
2175 AT_CHECK([grep '1-bits in value' stderr | sed 1q], [0], [dnl
2176 nx_match|WARN|Rejecting NXM/OXM entry 0:32768:2:1:16 with 1-bits in value for bits wildcarded by the mask.
2177 ])
2178
2179 # Check that there wasn't any other stderr output.
2180 AT_CHECK([grep -v '1-bits in value' stderr], [1])
2181 AT_CLEANUP
2182
2183 AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.3)])
2184 AT_KEYWORDS([oxm])
2185 AT_DATA([oxm.txt], [dnl
2186 # actset_output
2187 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2188 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2189 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2190 OXM_OF_ACTSET_OUTPUT(00000000)
2191 OXM_OF_ACTSET_OUTPUT(fffffffe)
2192 OXM_OF_ACTSET_OUTPUT(fffffff7)
2193 ])
2194 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow13 < oxm.txt],
2195   [0], [dnl
2196 # actset_output
2197 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2198 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2199 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2200 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2201 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2202 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2203 ], [])
2204 AT_CLEANUP
2205
2206 AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.5)])
2207 AT_KEYWORDS([oxm])
2208 AT_DATA([oxm.txt], [dnl
2209 # Extended registers 0 and 1.
2210 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
2211 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
2212 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
2213 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
2214 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
2215 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
2216 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
2217 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
2218
2219 # Registers 0, 1, and 2.
2220 # (OpenFlow 1.5 transforms these into the standard "xregs".)
2221 NXM_NX_REG0(acebdf56)
2222 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
2223 NXM_NX_REG0(a0e0d050)
2224 NXM_NX_REG1(acebdf56)
2225 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
2226 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
2227 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
2228 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
2229
2230 # actset_output
2231 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2232 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2233 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2234 OXM_OF_ACTSET_OUTPUT(00000000)
2235 OXM_OF_ACTSET_OUTPUT(fffffffe)
2236 OXM_OF_ACTSET_OUTPUT(fffffff7)
2237 ])
2238 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow15 < oxm.txt],
2239   [0], [dnl
2240 # Extended registers 0 and 1.
2241 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
2242 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
2243 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
2244 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
2245 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
2246 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
2247 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
2248 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
2249
2250 # Registers 0, 1, and 2.
2251 # (OpenFlow 1.5 transforms these into the standard "xregs".)
2252 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
2253 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
2254 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
2255 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
2256 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
2257 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
2258 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
2259 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
2260
2261 # actset_output
2262 OXM_OF_ACTSET_OUTPUT(00000000)
2263 OXM_OF_ACTSET_OUTPUT(fffffffe)
2264 OXM_OF_ACTSET_OUTPUT(fffffff7)
2265 OXM_OF_ACTSET_OUTPUT(00000000)
2266 OXM_OF_ACTSET_OUTPUT(fffffffe)
2267 OXM_OF_ACTSET_OUTPUT(fffffff7)
2268 ], [])
2269 AT_CLEANUP
2270
2271 AT_SETUP([ovs-ofctl parse-oxm loose])
2272 AT_KEYWORDS([oxm])
2273 AT_DATA([oxm.txt], [dnl
2274 OXM_OF_IN_PORT(00000001), 01020304(1111/3333), OXM_OF_ETH_TYPE(0800)
2275 OXM_OF_IN_PORT(00000001), ffff020800002320(11112222), OXM_OF_ETH_TYPE(0800)
2276 OXM_OF_IN_PORT(00000001), ffff030800002320(1111/3333), OXM_OF_ETH_TYPE(0800)
2277 ])
2278
2279 AT_CHECK([ovs-ofctl --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
2280 nx_pull_match() returned error OFPBMC_BAD_FIELD
2281 nx_pull_match() returned error OFPBMC_BAD_FIELD
2282 nx_pull_match() returned error OFPBMC_BAD_FIELD
2283 ])
2284
2285 AT_CHECK([ovs-ofctl parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
2286 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2287 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2288 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2289 ])
2290 AT_CLEANUP
2291
2292 AT_SETUP([experimenter OXM encoding])
2293 AT_DATA([oxm.txt], [dnl
2294 NXM_NX_DP_HASH(01234567)
2295 NXOXM_ET_DP_HASH(01234567)
2296
2297 NXM_NX_DP_HASH_W(01234567/0fffffff)
2298 NXOXM_ET_DP_HASH_W(01234567/0fffffff)
2299 ])
2300
2301 # To allow for testing experimenter OXM, which doesn't really have many
2302 # examples in the wild, we've defined a variant of NXM_NX_DP_HASH that uses
2303 # the experimenter OXM mechanism, called NXOXM_ET_DP_HASH.  We've defined
2304 # it as if it were introduced with OpenFlow 1.5, which gives us the
2305 # opportunity to see that both forms are accepted in all OpenFlow versions
2306 # but the experimenter form is used for encoding in OF1.5+.
2307 #
2308 # First verify that both forms are accepted and NXOXM_ET_DP_HASH is encoded
2309 # in OF1.5.
2310 AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow15 < oxm.txt], [0], [dnl
2311 NXOXM_ET_DP_HASH(01234567)
2312 00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@
2313 NXOXM_ET_DP_HASH(01234567)
2314 00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@
2315
2316 NXOXM_ET_DP_HASH_W(01234567/0fffffff)
2317 00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@
2318 00000010  0f ff ff ff 00 00 00 00-
2319 NXOXM_ET_DP_HASH_W(01234567/0fffffff)
2320 00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@
2321 00000010  0f ff ff ff 00 00 00 00-
2322 ])
2323
2324 # Then verify that both forms are accepted and NXM_NX_DP_HASH is encoded
2325 # in OF1.2.
2326 AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
2327 NXM_NX_DP_HASH(01234567)
2328 00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@
2329 NXM_NX_DP_HASH(01234567)
2330 00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@
2331
2332 NXM_NX_DP_HASH_W(01234567/0fffffff)
2333 00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@
2334 NXM_NX_DP_HASH_W(01234567/0fffffff)
2335 00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@
2336 ])
2337 AT_CLEANUP
2338
2339 AT_SETUP([check TCP flags expression in OXM and NXM])
2340 # NXM/OXM input for matching on TCP flags.
2341 tcp_flags='OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_FLAGS(0fff)'
2342
2343 # Check that marshaling into NXM gives all NXM headers.
2344 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-nxm], [0],
2345   [NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0fff)
2346 ])
2347
2348 # Check that marshaling in OXM for OF1.2 gives OXM headers except for
2349 # TCP flags, which didn't have an OXM definition.
2350 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow12], [0],
2351     [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0fff)
2352 ])
2353
2354 # Check that marshaling in OXM for OF1.3 and OF1.4 gives OXM headers,
2355 # including the ONF extension for TCP flags introduced in OF1.3.
2356 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow13], [0],
2357     [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), ONFOXM_ET_TCP_FLAGS(0fff)
2358 ])
2359 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow14], [0],
2360     [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), ONFOXM_ET_TCP_FLAGS(0fff)
2361 ])
2362
2363 # OpenFlow 1.5 added an OXM header for TCP flags:
2364 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow15], [0],
2365   [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_FLAGS(0fff)
2366 ])
2367 AT_CLEANUP
2368
2369 dnl Check all of the patterns mentioned in the "VLAN Matching" section
2370 dnl in the DESIGN file at top level.
2371 AT_SETUP([ovs-ofctl check-vlan])
2372 AT_KEYWORDS([VLAN])
2373
2374 dnl [1]
2375 AT_CHECK([ovs-ofctl check-vlan 0000 0000], [0], [dnl
2376  -> 0000/0000
2377 NXM: <any> -> 0000/0000
2378 OXM: <any> -> 0000/0000,--
2379 OF1.0: 0000/1,00/1 -> 0000/0000
2380 OF1.1: 0000/1,00/1 -> 0000/0000
2381 ])
2382
2383 dnl [2]
2384 AT_CHECK([ovs-ofctl check-vlan 0000 ffff], [0], [dnl
2385 vlan_tci=0x0000 -> 0000/ffff
2386 NXM: NXM_OF_VLAN_TCI(0000) -> 0000/ffff
2387 OXM: OXM_OF_VLAN_VID(0000) -> 0000/1fff,--
2388 OF1.0: ffff/0,00/1 -> 0000/ffff
2389 OF1.1: ffff/0,00/1 -> 0000/ffff
2390 ])
2391
2392 dnl [3]
2393 AT_CHECK([ovs-ofctl check-vlan 1abc 1fff], [0], [dnl
2394 dl_vlan=2748 -> 1abc/1fff
2395 NXM: NXM_OF_VLAN_TCI_W(1abc/1fff) -> 1abc/1fff
2396 OXM: OXM_OF_VLAN_VID(1abc) -> 1abc/1fff,--
2397 OF1.0: 0abc/0,00/1 -> 1abc/1fff
2398 OF1.1: 0abc/0,00/1 -> 1abc/1fff
2399 ])
2400
2401 dnl [4]
2402 AT_CHECK([ovs-ofctl check-vlan b000 f000], [0], [dnl
2403 dl_vlan_pcp=5 -> b000/f000
2404 NXM: NXM_OF_VLAN_TCI_W(b000/f000) -> b000/f000
2405 OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(05) -> 1000/1000,05
2406 OF1.0: 0000/1,05/0 -> b000/f000
2407 OF1.1: fffe/0,05/0 -> b000/f000
2408 ])
2409
2410 dnl [5]
2411 AT_CHECK([ovs-ofctl check-vlan babc ffff], [0], [dnl
2412 dl_vlan=2748,dl_vlan_pcp=5 -> babc/ffff
2413 NXM: NXM_OF_VLAN_TCI(babc) -> babc/ffff
2414 OXM: OXM_OF_VLAN_VID(1abc), OXM_OF_VLAN_PCP(05) -> 1abc/1fff,05
2415 OF1.0: 0abc/0,05/0 -> babc/ffff
2416 OF1.1: 0abc/0,05/0 -> babc/ffff
2417 ])
2418
2419 dnl [6]
2420 AT_CHECK([ovs-ofctl check-vlan 0000 0fff], [0], [dnl
2421 vlan_tci=0x0000/0x0fff -> 0000/0fff
2422 NXM: NXM_OF_VLAN_TCI_W(0000/0fff) -> 0000/0fff
2423 OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
2424 OF1.0: 0000/0,00/1 -> 1000/1fff
2425 OF1.1: 0000/0,00/1 -> 1000/1fff
2426 ])
2427
2428 dnl [7]
2429 AT_CHECK([ovs-ofctl check-vlan 0000 f000], [0], [dnl
2430 vlan_tci=0x0000/0xf000 -> 0000/f000
2431 NXM: NXM_OF_VLAN_TCI_W(0000/f000) -> 0000/f000
2432 OXM: OXM_OF_VLAN_VID_W(0000/1000) -> 0000/1000,--
2433 OF1.0: ffff/0,00/1 -> 0000/ffff
2434 OF1.1: ffff/0,00/1 -> 0000/ffff
2435 ])
2436
2437 dnl [8]
2438 AT_CHECK([ovs-ofctl check-vlan 0000 efff], [0], [dnl
2439 vlan_tci=0x0000/0xefff -> 0000/efff
2440 NXM: NXM_OF_VLAN_TCI_W(0000/efff) -> 0000/efff
2441 OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
2442 OF1.0: 0000/0,00/0 -> 1000/ffff
2443 OF1.1: 0000/0,00/0 -> 1000/ffff
2444 ])
2445
2446 dnl [9]
2447 AT_CHECK([ovs-ofctl check-vlan 1001 1001], [0], [dnl
2448 vlan_tci=0x1001/0x1001 -> 1001/1001
2449 NXM: NXM_OF_VLAN_TCI_W(1001/1001) -> 1001/1001
2450 OXM: OXM_OF_VLAN_VID_W(1001/1001) -> 1001/1001,--
2451 OF1.0: 0001/0,00/1 -> 1001/1fff
2452 OF1.1: 0001/0,00/1 -> 1001/1fff
2453 ])
2454
2455 dnl [10]
2456 AT_CHECK([ovs-ofctl check-vlan 3000 3000], [0], [dnl
2457 vlan_tci=0x3000/0x3000 -> 3000/3000
2458 NXM: NXM_OF_VLAN_TCI_W(3000/3000) -> 3000/3000
2459 OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) -> 1000/1000,01
2460 OF1.0: 0000/1,01/0 -> 3000/f000
2461 OF1.1: fffe/0,01/0 -> 3000/f000
2462 ])
2463 AT_CHECK
2464 AT_CLEANUP
2465
2466 dnl Check that "-F openflow10" rejects a flow_mod with unsupported features,
2467 dnl such as tunnels and metadata.
2468 AT_SETUP([ovs-ofctl -F option and NXM features])
2469 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
2470   [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
2471 ])
2472 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop],
2473   [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10)
2474 ])
2475 AT_CLEANUP
2476
2477 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
2478 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
2479 dnl additionally show up as the top 32 bits of the cookie.)  This checks
2480 dnl for regression against bug #4566.
2481 AT_SETUP([ovs-ofctl -F option with flow_mods])
2482 OVS_VSWITCHD_START
2483 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
2484 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
2485 NXST_FLOW reply:
2486  tun_id=0x12345678 actions=drop
2487 ])
2488 OVS_VSWITCHD_STOP
2489 AT_CLEANUP
2490
2491 dnl Check that "-F openflow10" is really honored on dump-flows.
2492 dnl (If it isn't, then dump-flows will show the register match.)
2493 AT_SETUP([ovs-ofctl dump-flows honors -F option])
2494 OVS_VSWITCHD_START
2495 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
2496 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
2497 OFPST_FLOW reply:
2498  actions=drop
2499 ])
2500 OVS_VSWITCHD_STOP
2501 AT_CLEANUP
2502
2503 dnl Check that "-F openflow10" fails on dump-flows if the requested match
2504 dnl can't be represented in OpenFlow 1.0.
2505 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
2506 OVS_VSWITCHD_START
2507 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
2508   [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
2509 ])
2510 OVS_VSWITCHD_STOP
2511 AT_CLEANUP
2512
2513 dnl Check that add-flow reports non-normalized flows (feature #5029).
2514 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
2515 OVS_VSWITCHD_START
2516 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
2517   [0], [], [dnl
2518 ofp_util|INFO|normalization changed ofp_match, details:
2519 ofp_util|INFO| pre: nw_src=1.2.3.4
2520 ofp_util|INFO|post: @&t@
2521 ])
2522 OVS_VSWITCHD_STOP
2523 AT_CLEANUP
2524
2525 dnl Check that --sort and --rsort works with dump-flows
2526 dnl Default field is 'priority'. Flow entries are displayed based
2527 dnl on field to sort.
2528 AT_SETUP([ovs-ofctl dump-flows with sorting])
2529 OVS_VSWITCHD_START
2530 AT_KEYWORDS([sort])
2531 AT_DATA([allflows.txt], [[
2532 priority=4,in_port=23213 actions=output:42
2533 priority=5,in_port=1029 actions=output:43
2534 priority=7,in_port=1029 actions=output:43
2535 priority=3,in_port=1028 actions=output:44
2536 priority=1,in_port=1026 actions=output:45
2537 priority=6,in_port=1027 actions=output:64
2538 priority=2,in_port=1025 actions=output:47
2539 priority=8,tcp,tp_src=5 actions=drop
2540 priority=9,tcp,tp_src=6 actions=drop
2541 ]])
2542
2543 AT_CHECK([ovs-ofctl add-flows br0 allflows.txt
2544 ], [0], [ignore])
2545 AT_CHECK([ovs-ofctl --sort dump-flows br0 | ofctl_strip], [0], [dnl
2546  priority=1,in_port=1026 actions=output:45
2547  priority=2,in_port=1025 actions=output:47
2548  priority=3,in_port=1028 actions=output:44
2549  priority=4,in_port=23213 actions=output:42
2550  priority=5,in_port=1029 actions=output:43
2551  priority=6,in_port=1027 actions=output:64
2552  priority=7,in_port=1029 actions=output:43
2553  priority=8,tcp,tp_src=5 actions=drop
2554  priority=9,tcp,tp_src=6 actions=drop
2555 ])
2556 AT_CHECK([ovs-ofctl --rsort dump-flows br0 | ofctl_strip], [0], [dnl
2557  priority=9,tcp,tp_src=6 actions=drop
2558  priority=8,tcp,tp_src=5 actions=drop
2559  priority=7,in_port=1029 actions=output:43
2560  priority=6,in_port=1027 actions=output:64
2561  priority=5,in_port=1029 actions=output:43
2562  priority=4,in_port=23213 actions=output:42
2563  priority=3,in_port=1028 actions=output:44
2564  priority=2,in_port=1025 actions=output:47
2565  priority=1,in_port=1026 actions=output:45
2566 ])
2567 AT_CHECK([ovs-ofctl --sort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
2568  priority=2,in_port=1025 actions=output:47
2569  priority=1,in_port=1026 actions=output:45
2570  priority=6,in_port=1027 actions=output:64
2571  priority=3,in_port=1028 actions=output:44
2572  priority=7,in_port=1029 actions=output:43
2573  priority=5,in_port=1029 actions=output:43
2574  priority=4,in_port=23213 actions=output:42
2575  priority=9,tcp,tp_src=6 actions=drop
2576  priority=8,tcp,tp_src=5 actions=drop
2577 ])
2578 AT_CHECK([ovs-ofctl --rsort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
2579  priority=4,in_port=23213 actions=output:42
2580  priority=7,in_port=1029 actions=output:43
2581  priority=5,in_port=1029 actions=output:43
2582  priority=3,in_port=1028 actions=output:44
2583  priority=6,in_port=1027 actions=output:64
2584  priority=1,in_port=1026 actions=output:45
2585  priority=2,in_port=1025 actions=output:47
2586  priority=9,tcp,tp_src=6 actions=drop
2587  priority=8,tcp,tp_src=5 actions=drop
2588 ])
2589 AT_CHECK([ovs-ofctl --sort=tcp_src dump-flows br0 | ofctl_strip], [0], [dnl
2590  priority=8,tcp,tp_src=5 actions=drop
2591  priority=9,tcp,tp_src=6 actions=drop
2592  priority=7,in_port=1029 actions=output:43
2593  priority=6,in_port=1027 actions=output:64
2594  priority=5,in_port=1029 actions=output:43
2595  priority=4,in_port=23213 actions=output:42
2596  priority=3,in_port=1028 actions=output:44
2597  priority=2,in_port=1025 actions=output:47
2598  priority=1,in_port=1026 actions=output:45
2599 ])
2600 AT_CHECK(
2601   [ovs-ofctl --sort=in_port --sort=tcp_src dump-flows br0 | ofctl_strip], [0],
2602   [ priority=2,in_port=1025 actions=output:47
2603  priority=1,in_port=1026 actions=output:45
2604  priority=6,in_port=1027 actions=output:64
2605  priority=3,in_port=1028 actions=output:44
2606  priority=7,in_port=1029 actions=output:43
2607  priority=5,in_port=1029 actions=output:43
2608  priority=4,in_port=23213 actions=output:42
2609  priority=8,tcp,tp_src=5 actions=drop
2610  priority=9,tcp,tp_src=6 actions=drop
2611 ])
2612 OVS_VSWITCHD_STOP
2613 AT_CLEANUP
2614
2615 AT_SETUP([ovs-ofctl diff-flows])
2616 OVS_VSWITCHD_START
2617
2618 # Add tons of flows to br0.
2619 for i in `seq 0 1023`; do echo "dl_vlan=$i,actions=drop"; done > add-flows.txt
2620 AT_CHECK([ovs-ofctl add-flows br0 add-flows.txt])
2621
2622 # Dump them and compare against what we expect by hand, then with diff-flows.
2623 for i in `seq 0 1023`; do echo " dl_vlan=$i actions=drop"; done | sort > expout
2624 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed '/NXST_FLOW/d' | sort],
2625   [0], [expout])
2626 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt])
2627
2628 # Remove even-numbered flows, compare again.
2629 for i in `seq 0 1023 2`; do echo "dl_vlan=$i"; done > del-flows.txt
2630 AT_CHECK([ovs-ofctl del-flows br0 - < del-flows.txt])
2631 for i in `seq 0 1023 2`; do echo "+dl_vlan=$i actions=drop"; done | sort > expout
2632 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt | sort], [0], [expout])
2633 for i in `seq 0 1023 2`; do echo "-dl_vlan=$i actions=drop"; done | sort > expout
2634 AT_CHECK([ovs-ofctl diff-flows add-flows.txt br0 | sort], [0], [expout])
2635
2636 OVS_VSWITCHD_STOP
2637 AT_CLEANUP
2638
2639 dnl ofpacts that differ bytewise don't necessarily differ when
2640 dnl converted to another representation, such as OpenFlow 1.0
2641 dnl or to a string.  "resubmit(,1)" is an example of an action
2642 dnl of this type: "ofpact_resubmit"s can differ in their "compat"
2643 dnl values even though this doesn't affect the string format.
2644 dnl
2645 dnl This test checks that "ovs-ofctl diff-flows" doesn't report
2646 dnl false ofpacts differences.
2647 AT_SETUP([ovs-ofctl diff-flows - suppress false differences])
2648 OVS_VSWITCHD_START
2649 AT_DATA([flows.txt], [actions=resubmit(,1)
2650 ])
2651 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2652 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2653 AT_CHECK([ovs-ofctl add-flow br0 idle_timeout=60,dl_vlan=9,actions=output:1])
2654 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt], [2], [dnl
2655 -dl_vlan=9 idle_timeout=60 actions=output:1
2656 ])
2657 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=120,cookie=1234,dl_vlan=9,actions=output:1])
2658 AT_CHECK([ovs-ofctl diff-flows flows.txt br0], [2], [dnl
2659 +dl_vlan=9 cookie=0x4d2 hard_timeout=120 actions=output:1
2660 ])
2661 OVS_VSWITCHD_STOP
2662 AT_CLEANUP
2663
2664 AT_SETUP([ovs-ofctl -F and -O interaction])
2665 AT_CHECK([ovs-ofctl -F oxm -O openflow10], [1], [],
2666   [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.)
2667 ])
2668 AT_CHECK([ovs-ofctl -F oxm -O openflow11], [1], [],
2669   [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.)
2670 ])
2671 AT_CHECK([ovs-ofctl -F oxm -O openflow10,openflow11], [1], [],
2672   [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.)
2673 ])
2674 AT_CHECK([ovs-ofctl -F oxm -O openflow10,openflow12], [1], [],
2675  [ovs-ofctl: missing command name; use --help for help
2676 ])
2677 AT_CHECK([ovs-ofctl -F oxm -O openflow12], [1], [],
2678   [ovs-ofctl: missing command name; use --help for help
2679 ])
2680 AT_CHECK([ovs-ofctl -F oxm -O openflow13], [1], [],
2681   [ovs-ofctl: missing command name; use --help for help
2682 ])
2683 AT_CLEANUP
2684
2685 AT_SETUP([ovs-ofctl ofp-parse])
2686 # Test the echo request/reply messages (0 payload).
2687 AT_CHECK([printf '\1\2\0\10\0\0\0\0\1\3\0\10\0\0\0\0' > binary_ofp_msg])
2688 AT_CHECK([ovs-ofctl ofp-parse binary_ofp_msg], [0], [dnl
2689 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
2690 OFPT_ECHO_REPLY (xid=0x0): 0 bytes of payload
2691 ])
2692
2693 # Test the hello (xid:1 3-byte payload).
2694 AT_CHECK([printf '\1\0\0\13\0\0\0\1\101\102\103' > binary_ofp_msg])
2695 AT_CHECK([ovs-ofctl ofp-parse - < binary_ofp_msg], [0], [dnl
2696 OFPT_HELLO (xid=0x1):
2697  version bitmap: 0x01
2698  unknown data in hello:
2699 00000000  01 00 00 0b 00 00 00 01-41 42 43                |........ABC     |
2700 ])
2701 AT_CLEANUP
2702
2703 AT_SETUP([tcp flags - filtering])
2704 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 \
2705                     -- add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])
2706 AT_DATA([flows.txt], [dnl
2707         in_port=1,tcp,tp_dst=80,tcp_flags=+syn-rst-ack-fin,action=2  # Allow outbound web traffic bare-SYN
2708         in_port=1,tcp,tp_dst=80,tcp_flags=+ack,action=2  # Allow outbound web traffic with ACK bit
2709         in_port=1,tcp,tp_dst=80,tcp_flags=+rst,action=2  # Allow outbound web traffic with RST bit
2710         in_port=2,tcp,tp_src=80,tcp_flags=+ack,action=1  # Allow inbound web traffic with ACK bit
2711         in_port=2,tcp,tp_src=80,tcp_flags=+rst,action=1  # Allow inbound web traffic with RST bit
2712         priority=0,in_port=1,action=drop  # Default drop outbound
2713         priority=0,in_port=2,action=drop  # Default drop inbound
2714 ])
2715
2716 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2717
2718 AT_CHECK([ovs-ofctl add-flow br0 "tcp,tcp_flags=+ack-ack,action="], [1], [],
2719   [ovs-ofctl: ack: Each TCP flag can be specified only once
2720 ])
2721
2722 AT_CHECK([ovs-appctl dpif/show | tail -n +4], [0], [dnl
2723                 p1 1/1: (dummy)
2724                 p2 2/2: (dummy)
2725 ])
2726
2727 dnl Outbound web traffic with bare-SYN
2728 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x002)'], [0], [stdout])
2729 AT_CHECK([tail -1 stdout], [0],
2730   [Datapath actions: 2
2731 ])
2732
2733 dnl Outbopund web traffic with ACK bit
2734 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x110)'], [0], [stdout])
2735 AT_CHECK([tail -1 stdout], [0],
2736   [Datapath actions: 2
2737 ])
2738
2739 dnl Outbound web traffic with RST bit
2740 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x104)'], [0], [stdout])
2741 AT_CHECK([tail -1 stdout], [0],
2742   [Datapath actions: 2
2743 ])
2744
2745 dnl Inbound web traffic with ACK bit
2746 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0x010)'], [0], [stdout])
2747 AT_CHECK([tail -1 stdout], [0],
2748   [Datapath actions: 1
2749 ])
2750
2751 dnl Inbound web traffic with RST bit
2752 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0x014)'], [0], [stdout])
2753 AT_CHECK([tail -1 stdout], [0],
2754   [Datapath actions: 1
2755 ])
2756
2757 dnl Inbound web traffic with SYN bit without ACK or RST bits
2758 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0xfeb)'], [0], [stdout])
2759 AT_CHECK([tail -1 stdout], [0],
2760   [Datapath actions: drop
2761 ])
2762
2763 OVS_VSWITCHD_STOP
2764 AT_CLEANUP
2765
2766 dnl Check importance parameter added in OF1.4.
2767 dnl It validates whether importance set via add-flow via OpenFlow1.4+ gets
2768 dnl set or not by validating it againt the dump-flows output via OpenFlow1.4+
2769 dnl If add-flow or dump-flows is used with later version of OpenFlow prior to 1.4+
2770 dnl then the importance will be considered zero whether provided as an argument.
2771
2772 AT_SETUP([ovs-ofctl rule with importance])
2773 OVS_VSWITCHD_START
2774 dnl Flow with importance parameter added via OF1.4+ and later version
2775 AT_CHECK([ovs-ofctl -O OpenFlow14 add-flow br0 priority=21,importance=21,actions=normal])
2776 AT_CHECK([ovs-ofctl add-flow br0 priority=22,importance=22,actions=normal])
2777
2778 dnl Importance parameter will only be visible of flows that are added via OF1.4+ if dumped via OF1.4+
2779 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/ST_FLOW reply/d' | sort], [0], [dnl
2780  importance=21, priority=21 actions=NORMAL
2781  priority=22 actions=NORMAL
2782 ])
2783
2784 dnl Importance parameter will not be visible if flow is dumped with previous version prior to OF1.4+ whether added via OF1.4+
2785 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed '/ST_FLOW reply/d' | sort], [0], [dnl
2786  priority=21 actions=NORMAL
2787  priority=22 actions=NORMAL
2788 ])
2789
2790 OVS_VSWITCHD_STOP
2791 AT_CLEANUP
2792
2793
2794 dnl Importance parameter added in OF1.4.
2795 dnl This validates whether flows with importance
2796 dnl parameter are getting replaced with "replace-flows" or
2797 dnl not by validating dump-flows output after replace with the expected output.
2798
2799 AT_SETUP([ovs-ofctl replace-flows with importance])
2800 OVS_VSWITCHD_START
2801
2802 dnl Add flows to br0 with importance via OF1.4+. For more details refer "ovs-ofctl rule with importance" test case.
2803 for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; done > add-flows.txt
2804 AT_CHECK([ovs-ofctl -O OpenFlow14 add-flows br0 add-flows.txt])
2805
2806 dnl Replace some flows in the bridge.
2807 for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; done > replace-flows.txt
2808 AT_CHECK([ovs-ofctl -O OpenFlow14 replace-flows br0 replace-flows.txt])
2809
2810 dnl Dump them and compare the dump flows output against the expected output.
2811 for i in 1 2 3 4 5 6 7 8; do if [[ `expr $i % 2` -eq 1 ]]; then importance=`expr $i + 10`; else importance=$i; fi; echo " importance=$importance, dl_vlan=$i actions=drop"; done | sort > expout
2812 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLOW/d' | sort],
2813   [0], [expout])
2814
2815 OVS_VSWITCHD_STOP
2816 AT_CLEANUP
2817
2818 AT_SETUP([ovs-ofctl replace-flows with --bundle])
2819 OVS_VSWITCHD_START
2820
2821 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
2822
2823 dnl Add flows to br0 with importance via OF1.4+, using an OF1.4+ bundle. For more details refer "ovs-ofctl rule with importance" test case.
2824 for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; done > add-flows.txt
2825 AT_CHECK([ovs-ofctl --bundle add-flows br0 add-flows.txt])
2826
2827 dnl Replace some flows in the bridge.
2828 for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; done > replace-flows.txt
2829 AT_CHECK([ovs-ofctl --bundle replace-flows br0 replace-flows.txt])
2830
2831 dnl Dump them and compare the dump flows output against the expected output.
2832 for i in 1 2 3 4 5 6 7 8; do if [[ `expr $i % 2` -eq 1 ]]; then importance=`expr $i + 10`; else importance=$i; fi; echo " importance=$importance, dl_vlan=$i actions=drop"; done | sort > expout
2833 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLOW/d' | sort],
2834   [0], [expout])
2835
2836 dnl Check logs for OpenFlow trace
2837 # Prevent race.
2838 OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_windows_sub | test `grep -- "|vconn|DBG|unix: sent (Success): OFPST_FLOW reply" | wc -l` -ge 2])
2839 # AT_CHECK([sed -n "s/^.*\(|vconn|DBG|.*xid=.*:\).*$/\1/p" ovs-vswitchd.log], [0], [dnl
2840 AT_CHECK([print_vconn_debug | vconn_windows_sub | ofctl_strip], [0], [dnl
2841 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
2842  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
2843 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
2844  version bitmap: 0x01, 0x05
2845 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05)
2846 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2847  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
2848 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2849  bundle_id=0 type=OPEN_REPLY flags=0
2850 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2851  bundle_id=0 flags=atomic ordered
2852 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=1 importance:1 actions=drop
2853 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2854  bundle_id=0 flags=atomic ordered
2855 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=2 importance:2 actions=drop
2856 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2857  bundle_id=0 flags=atomic ordered
2858 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=3 importance:3 actions=drop
2859 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2860  bundle_id=0 flags=atomic ordered
2861 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=4 importance:4 actions=drop
2862 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2863  bundle_id=0 flags=atomic ordered
2864 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=5 importance:5 actions=drop
2865 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2866  bundle_id=0 flags=atomic ordered
2867 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=6 importance:6 actions=drop
2868 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2869  bundle_id=0 flags=atomic ordered
2870 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=7 importance:7 actions=drop
2871 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2872  bundle_id=0 flags=atomic ordered
2873 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=8 importance:8 actions=drop
2874 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2875  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2876 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2877  bundle_id=0 type=COMMIT_REPLY flags=0
2878 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
2879  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
2880 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
2881  version bitmap: 0x01, 0x05
2882 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05)
2883 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
2884 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
2885 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2886  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
2887 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2888  bundle_id=0 type=OPEN_REPLY flags=0
2889 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2890  bundle_id=0 flags=atomic ordered
2891 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=1 importance:11 actions=drop
2892 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2893  bundle_id=0 flags=atomic ordered
2894 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=3 importance:13 actions=drop
2895 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2896  bundle_id=0 flags=atomic ordered
2897 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=5 importance:15 actions=drop
2898 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2899  bundle_id=0 flags=atomic ordered
2900 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=7 importance:17 actions=drop
2901 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2902  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2903 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2904  bundle_id=0 type=COMMIT_REPLY flags=0
2905 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
2906  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
2907 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
2908  version bitmap: 0x05
2909 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
2910 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
2911 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
2912  importance=2, dl_vlan=2 actions=drop
2913  importance=4, dl_vlan=4 actions=drop
2914  importance=6, dl_vlan=6 actions=drop
2915  importance=8, dl_vlan=8 actions=drop
2916  importance=11, dl_vlan=1 actions=drop
2917  importance=13, dl_vlan=3 actions=drop
2918  importance=15, dl_vlan=5 actions=drop
2919  importance=17, dl_vlan=7 actions=drop
2920 ])
2921
2922 OVS_VSWITCHD_STOP
2923 AT_CLEANUP