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