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