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