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