c1e9ec45ed47676bb930dfbaba41a87bedc037bc
[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 # vlan_tci=0x0000
1144 003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff xx xx xxxx xx xx xxxx dnl
1145 xxxxxxxx xxxxxxxx xxxx xxxx
1146
1147 dnl dl_vlan_pcp doesn't make sense when dl_vlan is "none", so
1148 dnl OVS ignores it and drops it on output.
1149 # vlan_tci=0x0000
1150 #  1: 28 -> 38
1151 # 20: 05 -> 00
1152 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff 05 xx xxxx xx xx xxxx dnl
1153 xxxxxxxx xxxxxxxx xxxx xxxx
1154
1155 dnl Invalid VID and PCP discards out-of-range bits:
1156 # dl_vlan=256,dl_vlan_pcp=7
1157 # 18: f1 -> 01
1158 # 20: ff -> 07
1159 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx f100 ff xx xxxx xx xx xxxx dnl
1160 xxxxxxxx xxxxxxxx xxxx xxxx
1161
1162 # dl_type=0x1234
1163 003820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1164 xxxxxxxx xxxxxxxx xxxx xxxx
1165
1166 # ip,nw_proto=5
1167 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 05 xxxx dnl
1168 xxxxxxxx xxxxxxxx xxxx xxxx
1169
1170 dnl Ignore nw_proto if not IP or ARP:
1171 # dl_type=0x1234,nw_proto=5
1172 # normal:  3: cf -> ef
1173 # normal: 25: 05 -> 00
1174 & ofp_util|INFO|normalization changed ofp_match, details:
1175 & ofp_util|INFO| pre: dl_type=0x1234,nw_proto=5
1176 & ofp_util|INFO|post: dl_type=0x1234
1177 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx 05 xxxx dnl
1178 xxxxxxxx xxxxxxxx xxxx xxxx
1179
1180 # ip,nw_tos=252
1181 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 fc xx xxxx dnl
1182 xxxxxxxx xxxxxxxx xxxx xxxx
1183
1184 dnl Ignore nw_tos if not IP:
1185 # arp,nw_tos=4
1186 # 24: 05 -> 04
1187 # normal:  1: 18 -> 38
1188 # normal: 24: 04 -> 00
1189 & ofp_util|INFO|normalization changed ofp_match, details:
1190 & ofp_util|INFO| pre: arp,nw_tos=4
1191 & ofp_util|INFO|post: arp
1192 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 05 xx xxxx dnl
1193 xxxxxxxx xxxxxxxx xxxx xxxx
1194
1195 dnl Low 2 bits of invalid TOS are forced to 0:
1196 # ip,nw_tos=48
1197 # 24: 31 -> 30
1198 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 31 xx xxxx dnl
1199 xxxxxxxx xxxxxxxx xxxx xxxx
1200
1201 # arp,arp_op=2
1202 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx 02 xxxx dnl
1203 xxxxxxxx xxxxxxxx xxxx xxxx
1204
1205 # ip,nw_src=192.168.128.85
1206 003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1207 c0a88055 xxxxxxxx xxxx xxxx
1208
1209 # ip,nw_src=192.168.128.0/24
1210 # 31: 55 -> 00
1211 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1212 c0a88055 xxxxxxxx xxxx xxxx
1213
1214 # ip,nw_dst=192.168.128.85
1215 003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1216 xxxxxxxx c0a88055 xxxx xxxx
1217
1218 # ip,nw_dst=192.168.128.0/24
1219 # 35: 55 -> 00
1220 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1221 xxxxxxxx c0a88055 xxxx xxxx
1222
1223 # arp,arp_spa=192.168.128.85
1224 003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1225 c0a88055 xxxxxxxx xxxx xxxx
1226
1227 # arp,arp_spa=192.168.128.0/24
1228 # 31: 55 -> 00
1229 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1230 c0a88055 xxxxxxxx xxxx xxxx
1231
1232 # arp,arp_tpa=192.168.128.85
1233 003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1234 xxxxxxxx c0a88055 xxxx xxxx
1235
1236 # arp,arp_tpa=192.168.128.0/24
1237 # 35: 55 -> 00
1238 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1239 xxxxxxxx c0a88055 xxxx xxxx
1240
1241 dnl Ignore nw_src if not IP or ARP:
1242 # dl_type=0x1234,nw_src=192.168.128.0/24
1243 # 31: 55 -> 00
1244 # normal:  2: 08 -> 20
1245 # normal: 28: c0 -> 00
1246 # normal: 29: a8 -> 00
1247 # normal: 30: 80 -> 00
1248 & ofp_util|INFO|normalization changed ofp_match, details:
1249 & ofp_util|INFO| pre: dl_type=0x1234,nw_src=192.168.128.0/24
1250 & ofp_util|INFO|post: dl_type=0x1234
1251 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1252 c0a88055 xxxxxxxx xxxx xxxx
1253
1254 dnl Ignore nw_dst if not IP or ARP:
1255 # dl_type=0x1234,nw_dst=192.168.128.0/24
1256 # 35: 55 -> 00
1257 # normal:  1: 32 -> 38
1258 # normal: 32: c0 -> 00
1259 # normal: 33: a8 -> 00
1260 # normal: 34: 80 -> 00
1261 & ofp_util|INFO|normalization changed ofp_match, details:
1262 & ofp_util|INFO| pre: dl_type=0x1234,nw_dst=192.168.128.0/24
1263 & ofp_util|INFO|post: dl_type=0x1234
1264 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1265 xxxxxxxx c0a88055 xxxx xxxx
1266
1267 # tcp,tp_src=443
1268 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl
1269 xxxxxxxx xxxxxxxx 01bb xxxx
1270
1271 # tcp,tp_dst=443
1272 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl
1273 xxxxxxxx xxxxxxxx xxxx 01bb
1274
1275 # udp,tp_src=443
1276 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl
1277 xxxxxxxx xxxxxxxx 01bb xxxx
1278
1279 # udp,tp_dst=443
1280 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl
1281 xxxxxxxx xxxxxxxx xxxx 01bb
1282
1283 # sctp,tp_src=443
1284 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 84 xxxx dnl
1285 xxxxxxxx xxxxxxxx 01bb xxxx
1286
1287 # sctp,tp_dst=443
1288 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 84 xxxx dnl
1289 xxxxxxxx xxxxxxxx xxxx 01bb
1290
1291 # icmp,icmp_type=5
1292 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl
1293 xxxxxxxx xxxxxxxx 0005 xxxx
1294
1295 # icmp,icmp_code=8
1296 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl
1297 xxxxxxxx xxxxxxxx xxxx 0008
1298
1299 dnl Ignore tp_src if not TCP/UDP/SCTP:
1300 # ip,nw_proto=21,tp_src=443
1301 # normal:  3: 8f -> cf
1302 # normal: 36: 01 -> 00
1303 # normal: 37: bb -> 00
1304 & ofp_util|INFO|normalization changed ofp_match, details:
1305 & ofp_util|INFO| pre: ip,nw_proto=21,tp_src=443
1306 & ofp_util|INFO|post: ip,nw_proto=21
1307 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl
1308 xxxxxxxx xxxxxxxx 01bb xxxx
1309
1310 dnl Ignore tp_dst if not TCP/UDP/SCTP:
1311 # ip,nw_proto=21,tp_dst=443
1312 # normal:  3: 4f -> cf
1313 # normal: 38: 01 -> 00
1314 # normal: 39: bb -> 00
1315 dnl The normalization details are suppressed here due to rate-limiting.
1316 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl
1317 xxxxxxxx xxxxxxxx xxxx 01bb
1318
1319 ])
1320 sed '/^[[#&]]/d' < test-data > input.txt
1321 sed -n 's/^# //p; /^$/p' < test-data > expout
1322 sed -n 's/^& //p' < test-data > experr
1323 AT_CAPTURE_FILE([input.txt])
1324 AT_CAPTURE_FILE([expout])
1325 AT_CAPTURE_FILE([experr])
1326 AT_CHECK(
1327   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-match < input.txt],
1328   [0], [expout], [experr])
1329 AT_CLEANUP
1330
1331 AT_SETUP([ovs-ofctl parse-ofp11-match])
1332 AT_KEYWORDS([OF1.1])
1333 AT_DATA([test-data], [dnl
1334 # in_port=LOCAL
1335 0000 0058 fffffffe 000003fe dnl
1336 000000000000ffffffffffff 000000000000ffffffffffff dnl
1337 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1338 00000000 00 000000 0000000000000000ffffffffffffffff
1339
1340 # bad ofp11_match: OFPBMC_BAD_VALUE
1341 & ofp_util|WARN|port 305419896 is outside the supported range 0 through 65279 or 0xffffff00 through 0xffffffff
1342 0000 0058 12345678 000003fe dnl
1343 000000000000ffffffffffff 000000000000ffffffffffff dnl
1344 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1345 00000000 00 000000 0000000000000000ffffffffffffffff
1346
1347 # dl_src=00:01:02:03:04:05
1348 0000 0058 00000000 000003ff dnl
1349 000102030405000000000000 000000000000ffffffffffff dnl
1350 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1351 00000000 00 000000 0000000000000000ffffffffffffffff
1352
1353 # dl_src=55:55:55:55:55:55/55:55:55:55:55:55
1354 0000 0058 00000000 000003ff dnl
1355 555555555555aaaaaaaaaaaa 000000000000ffffffffffff dnl
1356 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1357 00000000 00 000000 0000000000000000ffffffffffffffff
1358
1359 # dl_dst=00:01:02:03:04:05
1360 0000 0058 00000000 000003ff dnl
1361 000000000000ffffffffffff 000102030405000000000000 dnl
1362 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1363 00000000 00 000000 0000000000000000ffffffffffffffff
1364
1365 # dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
1366 0000 0058 00000000 000003ff dnl
1367 000000000000ffffffffffff 010000000000feffffffffff dnl
1368 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1369 00000000 00 000000 0000000000000000ffffffffffffffff
1370
1371 # dl_dst=00:01:02:03:04:05/fe:ff:ff:ff:ff:ff
1372 0000 0058 00000000 000003ff dnl
1373 000000000000ffffffffffff 000102030405010000000000 dnl
1374 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1375 00000000 00 000000 0000000000000000ffffffffffffffff
1376
1377 # dl_dst=55:55:55:55:55:55/55:55:55:55:55:55
1378 0000 0058 00000000 000003ff dnl
1379 000000000000ffffffffffff 555555555555aaaaaaaaaaaa dnl
1380 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1381 00000000 00 000000 0000000000000000ffffffffffffffff
1382
1383 dnl dl_vlan_pcp is ignored if dl_vlan is wildcarded, which causes the
1384 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1385 # in_port=1
1386 # 11: fa -> fe
1387 # 38: 03 -> 00
1388 0000 0058 00000001 000003fa dnl
1389 000000000000ffffffffffff 000000000000ffffffffffff dnl
1390 0000 03 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1391 00000000 00 000000 0000000000000000ffffffffffffffff
1392
1393 # dl_vlan=291
1394 0000 0058 00000000 000003fd dnl
1395 000000000000ffffffffffff 000000000000ffffffffffff dnl
1396 0123 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1397 00000000 00 000000 0000000000000000ffffffffffffffff
1398
1399 dnl OFPVID_NONE:
1400 # vlan_tci=0x0000
1401 0000 0058 00000000 000003fd dnl
1402 000000000000ffffffffffff 000000000000ffffffffffff dnl
1403 ffff 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1404 00000000 00 000000 0000000000000000ffffffffffffffff
1405
1406 dnl OFPVID_NONE ignores dl_vlan_pcp even if not wildcarded, which causes
1407 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1408 # vlan_tci=0x0000
1409 # 11: f9 -> fd
1410 # 38: 05 -> 00
1411 0000 0058 00000000 000003f9 dnl
1412 000000000000ffffffffffff 000000000000ffffffffffff dnl
1413 ffff 05 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1414 00000000 00 000000 0000000000000000ffffffffffffffff
1415
1416 # vlan_tci=0x1000/0x1000
1417 0000 0058 00000000 000003fd dnl
1418 000000000000ffffffffffff 000000000000ffffffffffff dnl
1419 fffe 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1420 00000000 00 000000 0000000000000000ffffffffffffffff
1421
1422 dnl Try invalid VID:
1423 # bad ofp11_match: OFPBMC_BAD_VALUE
1424 0000 0058 00000000 000003fd dnl
1425 000000000000ffffffffffff 000000000000ffffffffffff dnl
1426 1234 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1427 00000000 00 000000 0000000000000000ffffffffffffffff
1428
1429 # dl_vlan_pcp=4
1430 0000 0058 00000000 000003f9 dnl
1431 000000000000ffffffffffff 000000000000ffffffffffff dnl
1432 fffe 04 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1433 00000000 00 000000 0000000000000000ffffffffffffffff
1434
1435 # dl_vlan=10,dl_vlan_pcp=6
1436 0000 0058 00000000 000003f9 dnl
1437 000000000000ffffffffffff 000000000000ffffffffffff dnl
1438 000a 06 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1439 00000000 00 000000 0000000000000000ffffffffffffffff
1440
1441 # dl_type=0x1234
1442 0000 0058 00000000 000003f7 dnl
1443 000000000000ffffffffffff 000000000000ffffffffffff dnl
1444 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1445 00000000 00 000000 0000000000000000ffffffffffffffff
1446
1447 # ip,nw_tos=252
1448 0000 0058 00000000 000003e7 dnl
1449 000000000000ffffffffffff 000000000000ffffffffffff dnl
1450 0000 00 00 0800 fc 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1451 00000000 00 000000 0000000000000000ffffffffffffffff
1452
1453 dnl Try invalid TOS:
1454 # bad ofp11_match: OFPBMC_BAD_VALUE
1455 0000 0058 00000000 000003e7 dnl
1456 000000000000ffffffffffff 000000000000ffffffffffff dnl
1457 0000 00 00 0800 01 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1458 00000000 00 000000 0000000000000000ffffffffffffffff
1459
1460 # ip,nw_proto=5
1461 0000 0058 00000000 000003d7 dnl
1462 000000000000ffffffffffff 000000000000ffffffffffff dnl
1463 0000 00 00 0800 00 05 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1464 00000000 00 000000 0000000000000000ffffffffffffffff
1465
1466 # arp,arp_op=2
1467 0000 0058 00000000 000003d7 dnl
1468 000000000000ffffffffffff 000000000000ffffffffffff dnl
1469 0000 00 00 0806 00 02 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1470 00000000 00 000000 0000000000000000ffffffffffffffff
1471
1472 # ip,nw_src=192.168.128.0/24
1473 0000 0058 00000000 000003f7 dnl
1474 000000000000ffffffffffff 000000000000ffffffffffff dnl
1475 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1476 00000000 00 000000 0000000000000000ffffffffffffffff
1477
1478 # ip,nw_src=128.160.128.0/165.165.165.165
1479 # 44: c0 -> 80
1480 # 45: a8 -> a0
1481 0000 0058 00000000 000003f7 dnl
1482 000000000000ffffffffffff 000000000000ffffffffffff dnl
1483 0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl
1484 00000000 00 000000 0000000000000000ffffffffffffffff
1485
1486 # ip,nw_dst=192.168.128.0/24
1487 0000 0058 00000000 000003f7 dnl
1488 000000000000ffffffffffff 000000000000ffffffffffff dnl
1489 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1490 00000000 00 000000 0000000000000000ffffffffffffffff
1491
1492 # ip,nw_dst=128.160.128.0/165.165.165.165
1493 # 52: c0 -> 80
1494 # 53: a8 -> a0
1495 0000 0058 00000000 000003f7 dnl
1496 000000000000ffffffffffff 000000000000ffffffffffff dnl
1497 0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
1498 00000000 00 000000 0000000000000000ffffffffffffffff
1499
1500 # arp,arp_spa=192.168.128.0/24
1501 0000 0058 00000000 000003f7 dnl
1502 000000000000ffffffffffff 000000000000ffffffffffff dnl
1503 0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1504 00000000 00 000000 0000000000000000ffffffffffffffff
1505
1506 # arp,arp_tpa=192.168.128.0/24
1507 0000 0058 00000000 000003f7 dnl
1508 000000000000ffffffffffff 000000000000ffffffffffff dnl
1509 0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1510 00000000 00 000000 0000000000000000ffffffffffffffff
1511
1512 # tcp,tp_src=443
1513 0000 0058 00000000 00000397 dnl
1514 000000000000ffffffffffff 000000000000ffffffffffff dnl
1515 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1516 00000000 00 000000 0000000000000000ffffffffffffffff
1517
1518 # tcp,tp_dst=443
1519 0000 0058 00000000 00000357 dnl
1520 000000000000ffffffffffff 000000000000ffffffffffff dnl
1521 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1522 00000000 00 000000 0000000000000000ffffffffffffffff
1523
1524 # udp,tp_src=443
1525 0000 0058 00000000 00000397 dnl
1526 000000000000ffffffffffff 000000000000ffffffffffff dnl
1527 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1528 00000000 00 000000 0000000000000000ffffffffffffffff
1529
1530 # icmp,icmp_type=5
1531 0000 0058 00000000 00000397 dnl
1532 000000000000ffffffffffff 000000000000ffffffffffff dnl
1533 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0005 0000 dnl
1534 00000000 00 000000 0000000000000000ffffffffffffffff
1535
1536 # icmp,icmp_code=8
1537 0000 0058 00000000 00000357 dnl
1538 000000000000ffffffffffff 000000000000ffffffffffff dnl
1539 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0000 0008 dnl
1540 00000000 00 000000 0000000000000000ffffffffffffffff
1541
1542 # udp,tp_src=443
1543 0000 0058 00000000 00000397 dnl
1544 000000000000ffffffffffff 000000000000ffffffffffff dnl
1545 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1546 00000000 00 000000 0000000000000000ffffffffffffffff
1547
1548 # udp,tp_dst=443
1549 0000 0058 00000000 00000357 dnl
1550 000000000000ffffffffffff 000000000000ffffffffffff dnl
1551 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1552 00000000 00 000000 0000000000000000ffffffffffffffff
1553
1554 # sctp
1555 0000 0058 00000000 000003d7 dnl
1556 000000000000ffffffffffff 000000000000ffffffffffff dnl
1557 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1558 00000000 00 000000 0000000000000000ffffffffffffffff
1559
1560 # sctp,tp_src=443
1561 0000 0058 00000000 00000397 dnl
1562 000000000000ffffffffffff 000000000000ffffffffffff dnl
1563 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1564 00000000 00 000000 0000000000000000ffffffffffffffff
1565
1566 # sctp,tp_dst=443
1567 0000 0058 00000000 00000357 dnl
1568 000000000000ffffffffffff 000000000000ffffffffffff dnl
1569 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1570 00000000 00 000000 0000000000000000ffffffffffffffff
1571
1572 dnl Ignore tp_src if not TCP/UDP/SCTP:
1573 # ip,nw_proto=21
1574 # 11: 97 -> d7
1575 # 60: 01 -> 00
1576 # 61: bb -> 00
1577 0000 0058 00000000 00000397 dnl
1578 000000000000ffffffffffff 000000000000ffffffffffff dnl
1579 0000 00 00 0800 00 15 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1580 00000000 00 000000 0000000000000000ffffffffffffffff
1581
1582 dnl Ignore tp_dst if not TCP/UDP/SCTP:
1583 # ip,nw_proto=22
1584 # 11: 57 -> d7
1585 # 62: 01 -> 00
1586 # 63: bb -> 00
1587 0000 0058 00000000 00000357 dnl
1588 000000000000ffffffffffff 000000000000ffffffffffff dnl
1589 0000 00 00 0800 00 16 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1590 00000000 00 000000 0000000000000000ffffffffffffffff
1591
1592 # mpls,mpls_label=284280
1593 # 64: 12 -> 00
1594 # 65: 34 -> 04
1595 0000 0058 00000000 000002f7 dnl
1596 000000000000ffffffffffff 000000000000ffffffffffff dnl
1597 0000 00 00 8847 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1598 12345678 00 000000 0000000000000000ffffffffffffffff
1599
1600 # mplsm,mpls_tc=2
1601 # 68: 5a -> 02
1602 0000 0058 00000000 000001f7 dnl
1603 000000000000ffffffffffff 000000000000ffffffffffff dnl
1604 0000 00 00 8848 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1605 00000000 5a 000000 0000000000000000ffffffffffffffff
1606
1607 dnl mpls_label and mpls_tc must be ignored if dl_type is not MPLS:
1608 # dl_type=0x1234
1609 # 10: 00 -> 03
1610 # 64: 12 -> 00
1611 # 65: 34 -> 00
1612 # 66: 56 -> 00
1613 # 67: 78 -> 00
1614 # 68: 5a -> 00
1615 0000 0058 00000000 000000f7 dnl
1616 000000000000ffffffffffff 000000000000ffffffffffff dnl
1617 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1618 12345678 5a 000000 0000000000000000ffffffffffffffff
1619
1620 dnl metadata match:
1621 # metadata=0x1234567890abcdef
1622 0000 0058 00000000 000003ff dnl
1623 000000000000ffffffffffff 000000000000ffffffffffff dnl
1624 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1625 00000000 00 000000 1234567890abcdef0000000000000000
1626
1627 dnl metadata match:
1628 # metadata=0x5555555555555555/0x5555555555555555
1629 0000 0058 00000000 000003ff dnl
1630 000000000000ffffffffffff 000000000000ffffffffffff dnl
1631 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1632 00000000 00 000000 5555555555555555aaaaaaaaaaaaaaaa
1633
1634 dnl metadata match:
1635 # metadata=0x1234000090ab0000/0xffff0000ffff0000
1636 # 74: 56 -> 00
1637 # 75: 78 -> 00
1638 # 78: cd -> 00
1639 # 79: ef -> 00
1640 0000 0058 00000000 000003ff dnl
1641 000000000000ffffffffffff 000000000000ffffffffffff dnl
1642 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1643 00000000 00 000000 1234567890abcdef0000ffff0000ffff
1644
1645 ])
1646 sed '/^[[#&]]/d' < test-data > input.txt
1647 sed -n 's/^# //p; /^$/p' < test-data > expout
1648 sed -n 's/^& //p' < test-data > experr
1649 AT_CAPTURE_FILE([input.txt])
1650 AT_CAPTURE_FILE([expout])
1651 AT_CAPTURE_FILE([experr])
1652 AT_CHECK(
1653   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-match < input.txt],
1654   [0], [expout], [experr])
1655 AT_CLEANUP
1656
1657 AT_SETUP([ovs-ofctl parse-nx-match loose])
1658 AT_KEYWORDS([nx-match])
1659 AT_DATA([nx-match.txt], [dnl
1660 NXM_OF_IN_PORT(0001), 01020304(1111/3333), NXM_OF_ETH_TYPE(0800)
1661 NXM_OF_IN_PORT(0001), ffff020800002320(11112222), NXM_OF_ETH_TYPE(0800)
1662 NXM_OF_IN_PORT(0001), ffff030800002320(1111/3333), NXM_OF_ETH_TYPE(0800)
1663 ])
1664
1665 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
1666 nx_pull_match() returned error OFPBMC_BAD_FIELD
1667 nx_pull_match() returned error OFPBMC_BAD_FIELD
1668 nx_pull_match() returned error OFPBMC_BAD_FIELD
1669 ])
1670
1671 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
1672 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1673 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1674 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1675 ])
1676 AT_CLEANUP
1677
1678 AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.2)])
1679 AT_KEYWORDS([oxm])
1680 AT_DATA([oxm.txt], [dnl
1681 <any>
1682
1683 # in port
1684 OXM_OF_IN_PORT(00000000)
1685 OXM_OF_IN_PORT(fffffffe)
1686
1687 # metadata
1688 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1689 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1690 OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000)
1691 OXM_OF_METADATA_W(1234567890abcdef/ffffffffffffffff)
1692 OXM_OF_METADATA_W(1234567890abcdef/0000000000000000)
1693
1694 # eth dst
1695 OXM_OF_ETH_DST(0002e30f80a4)
1696 OXM_OF_ETH_DST_W(010000000000/010000000000)
1697 OXM_OF_ETH_DST_W(000000000000/010000000000)
1698 OXM_OF_ETH_DST_W(ffffffffffff/010000000000)
1699 OXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
1700 OXM_OF_ETH_DST_W(0002e30f80a4/000000000000)
1701 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1702
1703 # eth src
1704 OXM_OF_ETH_SRC(020898456ddb)
1705
1706 # eth type
1707 OXM_OF_ETH_TYPE(0800)
1708 OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
1709
1710 # vlan
1711 OXM_OF_VLAN_VID(1009) OXM_OF_VLAN_VID(1009) # Duplicate Field
1712 OXM_OF_VLAN_VID(f009)           # Bad Value
1713 OXM_OF_VLAN_PCP(00)             # Bad Pre-Requisite
1714 OXM_OF_VLAN_VID(0000)           # Packets without 802.1Q header or with VID=0
1715 OXM_OF_VLAN_VID(1123)           # Packets with VID=123, any PCP
1716 OXM_OF_VLAN_VID(1123) OXM_OF_VLAN_PCP(01) # Packets with VID=123, PCP=1.
1717 OXM_OF_VLAN_VID(0123)           # Does not make sense (but supported anyway)
1718 OXM_OF_VLAN_VID_W(0123/0123)      # Does not make sense (but supported anyway)
1719 OXM_OF_VLAN_VID_W(1123/0123)      # Does not make sense (but supported anyway)
1720 OXM_OF_VLAN_VID_W(0123/1123)      # Does not make sense (but supported anyway)
1721 OXM_OF_VLAN_VID(0123) OXM_OF_VLAN_PCP(01)  #Bad Pre-Requisite
1722 OXM_OF_VLAN_VID_W(1123/1fff)    # Packets with VID=123, any PCP.
1723 OXM_OF_VLAN_VID_W(1123/ffff)    # Packets with VID=123, any PCP.
1724 OXM_OF_VLAN_VID_W(0000/0000)    # Packets with or without 802.1Q header
1725 OXM_OF_VLAN_VID_W(1103/1f0f),   # Packets with # VID=123 (masked)
1726 OXM_OF_VLAN_VID_W(1103/1f0f), OXM_OF_VLAN_PCP(01)  # Packets with VID=123 (masked), any PCP.
1727 OXM_OF_VLAN_VID_W(1000/1000)    # Packets with any VID, any PCP
1728 OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01)  # Packets with any VID, PCP=1.
1729
1730 # IP TOS
1731 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(f0)
1732 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(41)
1733 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(3f)
1734 OXM_OF_IP_DSCP(3f)
1735
1736 # IP ECN
1737 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
1738 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06)
1739 OXM_OF_IP_ECN(03)
1740
1741 # IP protocol
1742 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01)
1743 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(05)
1744 OXM_OF_IP_PROTO(05)
1745
1746 # IP source
1747 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC(ac100014)
1748 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFF0000)
1749 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFFFFFF)
1750 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(00000000/00000000)
1751 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_SRC(ac100014)
1752 OXM_OF_IPV4_SRC_W(C0D80000/FFFF0000)
1753
1754 # IP destination
1755 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST(ac100014)
1756 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a80000/FFFF0000)
1757 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFFFFFF)
1758 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(00000000/00000000)
1759 OXM_OF_IPV4_DST(ac100014)
1760 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_DST_W(C0D80000/FFFF0000)
1761
1762 # TCP source port
1763 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC(4231)
1764 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/F0F0)
1765 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/FFFF)
1766 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(0000/0000)
1767 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_SRC(4231)
1768
1769 # TCP destination port
1770 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST(4231)
1771 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFF0)
1772 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFFF)
1773 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(0000/0000)
1774 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_DST(4231)
1775
1776 # UDP source port
1777 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC(8732)
1778 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/01FF)
1779 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/FFFF)
1780 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0000/0000)
1781 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_UDP_SRC(7823)
1782
1783 # UDP destination port
1784 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST(1782)
1785 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/F00F)
1786 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/FFFF)
1787 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(0000/0000)
1788 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_UDP_DST(1293)
1789
1790 # SCTP source port
1791 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC(8732)
1792 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/01FF)
1793 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/FFFF)
1794 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0000/0000)
1795 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_SCTP_SRC(7823)
1796
1797 # SCTP destination port
1798 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST(1782)
1799 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/F00F)
1800 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/FFFF)
1801 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(0000/0000)
1802 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_SCTP_DST(1293)
1803
1804 # ICMP type
1805 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_TYPE(12)
1806 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_TYPE(10)
1807
1808 # ICMP code
1809 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_CODE(12)
1810 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_CODE(10)
1811 OXM_OF_ETH_TYPE(0800) OXM_OF_ICMPV4_CODE(10)
1812 OXM_OF_ICMPV4_CODE(00)
1813
1814 # ARP opcode
1815 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001)
1816 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(1111)
1817 OXM_OF_ETH_TYPE(0000) OXM_OF_ARP_OP(0001)
1818 OXM_OF_ARP_OP(0001)
1819 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001) OXM_OF_ARP_OP(0001)
1820
1821 # ARP source protocol address
1822 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA(ac100014)
1823 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81200/FFFFFF00)
1824 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFFFF)
1825 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(00000000/00000000)
1826 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SPA(ac100014)
1827 OXM_OF_ARP_SPA_W(C0D80000/FFFF0000)
1828
1829 # ARP destination protocol address
1830 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA(ac100014)
1831 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a81200/FFFFFF00)
1832 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFFFF)
1833 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(00000000/00000000)
1834 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_TPA(ac100014)
1835 OXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
1836
1837 # ARP source hardware address
1838 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4)
1839 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4)
1840 OXM_OF_ARP_SHA(0002e30f80a4)
1841 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/ffffffffffff)
1842 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(000000000000/000000000000)
1843 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(000000000004/00000000000f)
1844
1845 # ARP destination hardware address
1846 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4)
1847 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4)
1848 OXM_OF_ARP_THA(0002e30f80a4)
1849 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/ffffffffffff)
1850 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(000000000000/000000000000)
1851 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(000000000004/00000000000f)
1852
1853 # IPv6 source
1854 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1855 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1856 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1857 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1858 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(00000000000000000000000000000000/00000000000000000000000000000000)
1859 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1860
1861 # IPv6 destination
1862 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1863 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1864 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1865 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1866 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(00000000000000000000000000000000/00000000000000000000000000000000)
1867 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1868
1869 # IPv6 Flow Label
1870 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(1000000f)
1871 OXM_OF_IPV6_FLABEL(0000000f)
1872 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(0000000f)
1873 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
1874 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000fffff)
1875 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(00000000/000ffff0)
1876 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/100fffff)
1877 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/ffffffff)
1878 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(00000000/00000000)
1879
1880 # ND source hardware address
1881 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)
1882 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)
1883 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)
1884 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)
1885
1886 # ND destination hardware address
1887 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)
1888 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)
1889 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3b) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1890 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)
1891
1892 # Registers 0, 1, and 2.
1893 NXM_NX_REG0(acebdf56)
1894 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
1895 NXM_NX_REG0(a0e0d050)
1896 NXM_NX_REG1(acebdf56)
1897 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
1898 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
1899 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
1900 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
1901
1902 # Extended registers 0, 1, and 2.
1903 # (For OpenFlow 1.2, OVS transforms these into its extension registers.)
1904 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
1905 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
1906 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
1907 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
1908 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
1909 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
1910 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
1911 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
1912
1913 # Invalid field number.
1914 01020304(1111/3333)
1915
1916 # Invalid field numbers (experimenter OXM).
1917 ffff020800002320(11112222)
1918 ffff030800002320(1111/3333)
1919 ])
1920 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow12 < oxm.txt],
1921   [0], [dnl
1922 <any>
1923
1924 # in port
1925 OXM_OF_IN_PORT(00000000)
1926 OXM_OF_IN_PORT(fffffffe)
1927
1928 # metadata
1929 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1930 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1931 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1932 OXM_OF_METADATA(1234567890abcdef)
1933 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1934
1935 # eth dst
1936 OXM_OF_ETH_DST(0002e30f80a4)
1937 OXM_OF_ETH_DST_W(010000000000/010000000000)
1938 OXM_OF_ETH_DST_W(000000000000/010000000000)
1939 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1940 OXM_OF_ETH_DST(0002e30f80a4)
1941 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1942 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1943
1944 # eth src
1945 OXM_OF_ETH_SRC(020898456ddb)
1946
1947 # eth type
1948 OXM_OF_ETH_TYPE(0800)
1949 OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
1950
1951 # vlan
1952 nx_pull_match() returned error OFPBMC_DUP_FIELD
1953 nx_pull_match() returned error OFPBMC_BAD_VALUE
1954 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1955 OXM_OF_VLAN_VID(0000)
1956 OXM_OF_VLAN_VID(1123)
1957 OXM_OF_VLAN_VID(1123), OXM_OF_VLAN_PCP(01)
1958 OXM_OF_VLAN_VID(0123)
1959 OXM_OF_VLAN_VID_W(0123/0123)
1960 nx_pull_match() returned error OFPBMC_BAD_WILDCARDS
1961 OXM_OF_VLAN_VID_W(0123/1123)
1962 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1963 OXM_OF_VLAN_VID(1123)
1964 OXM_OF_VLAN_VID(1123)
1965 <any>
1966 OXM_OF_VLAN_VID_W(1103/1f0f)
1967 OXM_OF_VLAN_VID_W(1103/1f0f), OXM_OF_VLAN_PCP(01)
1968 OXM_OF_VLAN_VID_W(1000/1000)
1969 OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01)
1970
1971 # IP TOS
1972 nx_pull_match() returned error OFPBMC_BAD_VALUE
1973 nx_pull_match() returned error OFPBMC_BAD_VALUE
1974 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_DSCP(3f)
1975 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1976
1977 # IP ECN
1978 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
1979 nx_pull_match() returned error OFPBMC_BAD_VALUE
1980 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1981
1982 # IP protocol
1983 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01)
1984 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(05)
1985 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1986
1987 # IP source
1988 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(ac100014)
1989 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC_W(c0a80000/ffff0000)
1990 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(c0a80000)
1991 OXM_OF_ETH_TYPE(0800)
1992 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1993 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1994
1995 # IP destination
1996 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(ac100014)
1997 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST_W(c0a80000/ffff0000)
1998 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(c0a88012)
1999 OXM_OF_ETH_TYPE(0800)
2000 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2001 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2002
2003 # TCP source port
2004 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(4231)
2005 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC_W(5050/f0f0)
2006 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(5050)
2007 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
2008 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2009
2010 # TCP destination port
2011 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(4231)
2012 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST_W(fde0/fff0)
2013 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(fde0)
2014 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
2015 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2016
2017 # UDP source port
2018 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(8732)
2019 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC_W(0132/01ff)
2020 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(0132)
2021 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
2022 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2023
2024 # UDP destination port
2025 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(1782)
2026 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST_W(5005/f00f)
2027 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(5005)
2028 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
2029 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2030
2031 # SCTP source port
2032 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC(8732)
2033 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC_W(0132/01ff)
2034 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC(0132)
2035 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84)
2036 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2037
2038 # SCTP destination port
2039 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(1782)
2040 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST_W(5005/f00f)
2041 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(5005)
2042 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84)
2043 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2044
2045 # ICMP type
2046 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_TYPE(12)
2047 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2048
2049 # ICMP code
2050 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_CODE(12)
2051 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2052 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2053 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2054
2055 # ARP opcode
2056 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_OP(0001)
2057 nx_pull_match() returned error OFPBMC_BAD_VALUE
2058 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2059 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2060 nx_pull_match() returned error OFPBMC_DUP_FIELD
2061
2062 # ARP source protocol address
2063 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(ac100014)
2064 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA_W(c0a81200/ffffff00)
2065 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(c0a81234)
2066 OXM_OF_ETH_TYPE(0806)
2067 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2068 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2069
2070 # ARP destination protocol address
2071 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(ac100014)
2072 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA_W(c0a81200/ffffff00)
2073 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(c0a812fe)
2074 OXM_OF_ETH_TYPE(0806)
2075 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2076 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2077
2078 # ARP source hardware address
2079 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
2080 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2081 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2082 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
2083 OXM_OF_ETH_TYPE(0806)
2084 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA_W(000000000004/00000000000f)
2085
2086 # ARP destination hardware address
2087 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
2088 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2089 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2090 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
2091 OXM_OF_ETH_TYPE(0806)
2092 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA_W(000000000004/00000000000f)
2093
2094 # IPv6 source
2095 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
2096 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2097 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
2098 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010000000000000000)
2099 OXM_OF_ETH_TYPE(86dd)
2100 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2101
2102 # IPv6 destination
2103 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
2104 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2105 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
2106 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010000000000000000)
2107 OXM_OF_ETH_TYPE(86dd)
2108 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2109
2110 # IPv6 Flow Label
2111 nx_pull_match() returned error OFPBMC_BAD_VALUE
2112 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2113 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2114 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
2115 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2116 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(00000000/000ffff0)
2117 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2118 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2119 OXM_OF_ETH_TYPE(86dd)
2120
2121 # ND source hardware address
2122 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)
2123 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2124 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2125 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2126
2127 # ND destination hardware address
2128 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)
2129 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2130 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2131 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2132
2133 # Registers 0, 1, and 2.
2134 NXM_NX_REG0(acebdf56)
2135 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
2136 NXM_NX_REG0(a0e0d050)
2137 NXM_NX_REG1(acebdf56)
2138 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
2139 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
2140 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
2141 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
2142
2143 # Extended registers 0, 1, and 2.
2144 # (For OpenFlow 1.2, OVS transforms these into its extension registers.)
2145 NXM_NX_REG0(acebdf56)
2146 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
2147 NXM_NX_REG0(a0e0d050)
2148 NXM_NX_REG1(acebdf56)
2149 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
2150 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
2151 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
2152 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
2153
2154 # Invalid field number.
2155 nx_pull_match() returned error OFPBMC_BAD_FIELD
2156
2157 # Invalid field numbers (experimenter OXM).
2158 nx_pull_match() returned error OFPBMC_BAD_FIELD
2159 nx_pull_match() returned error OFPBMC_BAD_FIELD
2160 ], [stderr])
2161
2162 # Check that at least the first warning made it.  (It's rate-limited
2163 # so a variable number could show up, especially under valgrind etc.)
2164 AT_CHECK([grep '1-bits in value' stderr | sed 1q], [0], [dnl
2165 nx_match|WARN|Rejecting NXM/OXM entry 0:32768:2:1:16 with 1-bits in value for bits wildcarded by the mask.
2166 ])
2167
2168 # Check that there wasn't any other stderr output.
2169 AT_CHECK([grep -v '1-bits in value' stderr], [1])
2170 AT_CLEANUP
2171
2172 AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.3)])
2173 AT_KEYWORDS([oxm])
2174 AT_DATA([oxm.txt], [dnl
2175 # actset_output
2176 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2177 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2178 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2179 OXM_OF_ACTSET_OUTPUT(00000000)
2180 OXM_OF_ACTSET_OUTPUT(fffffffe)
2181 OXM_OF_ACTSET_OUTPUT(fffffff7)
2182 ])
2183 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow13 < oxm.txt],
2184   [0], [dnl
2185 # actset_output
2186 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2187 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2188 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2189 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2190 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2191 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2192 ], [])
2193 AT_CLEANUP
2194
2195 AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.5)])
2196 AT_KEYWORDS([oxm])
2197 AT_DATA([oxm.txt], [dnl
2198 # Extended registers 0 and 1.
2199 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
2200 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
2201 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
2202 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
2203 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
2204 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
2205 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
2206 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
2207
2208 # Registers 0, 1, and 2.
2209 # (OpenFlow 1.5 transforms these into the standard "xregs".)
2210 NXM_NX_REG0(acebdf56)
2211 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
2212 NXM_NX_REG0(a0e0d050)
2213 NXM_NX_REG1(acebdf56)
2214 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
2215 NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
2216 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
2217 NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
2218
2219 # actset_output
2220 ONFOXM_ET_ACTSET_OUTPUT(00000000)
2221 ONFOXM_ET_ACTSET_OUTPUT(fffffffe)
2222 ONFOXM_ET_ACTSET_OUTPUT(fffffff7)
2223 OXM_OF_ACTSET_OUTPUT(00000000)
2224 OXM_OF_ACTSET_OUTPUT(fffffffe)
2225 OXM_OF_ACTSET_OUTPUT(fffffff7)
2226 ])
2227 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow15 < oxm.txt],
2228   [0], [dnl
2229 # Extended registers 0 and 1.
2230 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
2231 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
2232 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
2233 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
2234 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
2235 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
2236 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
2237 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
2238
2239 # Registers 0, 1, and 2.
2240 # (OpenFlow 1.5 transforms these into the standard "xregs".)
2241 OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
2242 OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
2243 OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
2244 OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
2245 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
2246 OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
2247 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
2248 OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
2249
2250 # actset_output
2251 OXM_OF_ACTSET_OUTPUT(00000000)
2252 OXM_OF_ACTSET_OUTPUT(fffffffe)
2253 OXM_OF_ACTSET_OUTPUT(fffffff7)
2254 OXM_OF_ACTSET_OUTPUT(00000000)
2255 OXM_OF_ACTSET_OUTPUT(fffffffe)
2256 OXM_OF_ACTSET_OUTPUT(fffffff7)
2257 ], [])
2258 AT_CLEANUP
2259
2260 AT_SETUP([ovs-ofctl parse-oxm loose])
2261 AT_KEYWORDS([oxm])
2262 AT_DATA([oxm.txt], [dnl
2263 OXM_OF_IN_PORT(00000001), 01020304(1111/3333), OXM_OF_ETH_TYPE(0800)
2264 OXM_OF_IN_PORT(00000001), ffff020800002320(11112222), OXM_OF_ETH_TYPE(0800)
2265 OXM_OF_IN_PORT(00000001), ffff030800002320(1111/3333), OXM_OF_ETH_TYPE(0800)
2266 ])
2267
2268 AT_CHECK([ovs-ofctl --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
2269 nx_pull_match() returned error OFPBMC_BAD_FIELD
2270 nx_pull_match() returned error OFPBMC_BAD_FIELD
2271 nx_pull_match() returned error OFPBMC_BAD_FIELD
2272 ])
2273
2274 AT_CHECK([ovs-ofctl parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
2275 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2276 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2277 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2278 ])
2279 AT_CLEANUP
2280
2281 AT_SETUP([experimenter OXM encoding])
2282 AT_DATA([oxm.txt], [dnl
2283 NXM_NX_DP_HASH(01234567)
2284 NXOXM_ET_DP_HASH(01234567)
2285
2286 NXM_NX_DP_HASH_W(01234567/0fffffff)
2287 NXOXM_ET_DP_HASH_W(01234567/0fffffff)
2288 ])
2289
2290 # To allow for testing experimenter OXM, which doesn't really have many
2291 # examples in the wild, we've defined a variant of NXM_NX_DP_HASH that uses
2292 # the experimenter OXM mechanism, called NXOXM_ET_DP_HASH.  We've defined
2293 # it as if it were introduced with OpenFlow 1.5, which gives us the
2294 # opportunity to see that both forms are accepted in all OpenFlow versions
2295 # but the experimenter form is used for encoding in OF1.5+.
2296 #
2297 # First verify that both forms are accepted and NXOXM_ET_DP_HASH is encoded
2298 # in OF1.5.
2299 AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow15 < oxm.txt], [0], [dnl
2300 NXOXM_ET_DP_HASH(01234567)
2301 00000000  00 01 00 10 ff ff 00 08-00 00 23 20 01 23 45 67 @&t@
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
2305 NXOXM_ET_DP_HASH_W(01234567/0fffffff)
2306 00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@
2307 00000010  0f ff ff ff 00 00 00 00-
2308 NXOXM_ET_DP_HASH_W(01234567/0fffffff)
2309 00000000  00 01 00 14 ff ff 01 0c-00 00 23 20 01 23 45 67 @&t@
2310 00000010  0f ff ff ff 00 00 00 00-
2311 ])
2312
2313 # Then verify that both forms are accepted and NXM_NX_DP_HASH is encoded
2314 # in OF1.2.
2315 AT_CHECK([ovs-ofctl -m --strict parse-oxm OpenFlow12 < oxm.txt], [0], [dnl
2316 NXM_NX_DP_HASH(01234567)
2317 00000000  00 01 00 0c 00 01 46 04-01 23 45 67 00 00 00 00 @&t@
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
2321 NXM_NX_DP_HASH_W(01234567/0fffffff)
2322 00000000  00 01 00 10 00 01 47 08-01 23 45 67 0f ff ff ff @&t@
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 ])
2326 AT_CLEANUP
2327
2328 AT_SETUP([check TCP flags expression in OXM and NXM])
2329 # NXM/OXM input for matching on TCP flags.
2330 tcp_flags='OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_FLAGS(0fff)'
2331
2332 # Check that marshaling into NXM gives all NXM headers.
2333 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-nxm], [0],
2334   [NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0fff)
2335 ])
2336
2337 # Check that marshaling in OXM for OF1.2 gives OXM headers except for
2338 # TCP flags, which didn't have an OXM definition.
2339 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow12], [0],
2340     [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0fff)
2341 ])
2342
2343 # Check that marshaling in OXM for OF1.3 and OF1.4 gives OXM headers,
2344 # including the ONF extension for TCP flags introduced in OF1.3.
2345 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow13], [0],
2346     [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), ONFOXM_ET_TCP_FLAGS(0fff)
2347 ])
2348 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow14], [0],
2349     [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), ONFOXM_ET_TCP_FLAGS(0fff)
2350 ])
2351
2352 # OpenFlow 1.5 added an OXM header for TCP flags:
2353 AT_CHECK([echo "$tcp_flags" | ovs-ofctl parse-oxm OpenFlow15], [0],
2354   [OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_FLAGS(0fff)
2355 ])
2356 AT_CLEANUP
2357
2358 dnl Check all of the patterns mentioned in the "VLAN Matching" section
2359 dnl in the DESIGN file at top level.
2360 AT_SETUP([ovs-ofctl check-vlan])
2361 AT_KEYWORDS([VLAN])
2362
2363 dnl [1]
2364 AT_CHECK([ovs-ofctl check-vlan 0000 0000], [0], [dnl
2365  -> 0000/0000
2366 NXM: <any> -> 0000/0000
2367 OXM: <any> -> 0000/0000,--
2368 OF1.0: 0000/1,00/1 -> 0000/0000
2369 OF1.1: 0000/1,00/1 -> 0000/0000
2370 ])
2371
2372 dnl [2]
2373 AT_CHECK([ovs-ofctl check-vlan 0000 ffff], [0], [dnl
2374 vlan_tci=0x0000 -> 0000/ffff
2375 NXM: NXM_OF_VLAN_TCI(0000) -> 0000/ffff
2376 OXM: OXM_OF_VLAN_VID(0000) -> 0000/1fff,--
2377 OF1.0: ffff/0,00/1 -> 0000/ffff
2378 OF1.1: ffff/0,00/1 -> 0000/ffff
2379 ])
2380
2381 dnl [3]
2382 AT_CHECK([ovs-ofctl check-vlan 1abc 1fff], [0], [dnl
2383 dl_vlan=2748 -> 1abc/1fff
2384 NXM: NXM_OF_VLAN_TCI_W(1abc/1fff) -> 1abc/1fff
2385 OXM: OXM_OF_VLAN_VID(1abc) -> 1abc/1fff,--
2386 OF1.0: 0abc/0,00/1 -> 1abc/1fff
2387 OF1.1: 0abc/0,00/1 -> 1abc/1fff
2388 ])
2389
2390 dnl [4]
2391 AT_CHECK([ovs-ofctl check-vlan b000 f000], [0], [dnl
2392 dl_vlan_pcp=5 -> b000/f000
2393 NXM: NXM_OF_VLAN_TCI_W(b000/f000) -> b000/f000
2394 OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(05) -> 1000/1000,05
2395 OF1.0: 0000/1,05/0 -> b000/f000
2396 OF1.1: fffe/0,05/0 -> b000/f000
2397 ])
2398
2399 dnl [5]
2400 AT_CHECK([ovs-ofctl check-vlan babc ffff], [0], [dnl
2401 dl_vlan=2748,dl_vlan_pcp=5 -> babc/ffff
2402 NXM: NXM_OF_VLAN_TCI(babc) -> babc/ffff
2403 OXM: OXM_OF_VLAN_VID(1abc), OXM_OF_VLAN_PCP(05) -> 1abc/1fff,05
2404 OF1.0: 0abc/0,05/0 -> babc/ffff
2405 OF1.1: 0abc/0,05/0 -> babc/ffff
2406 ])
2407
2408 dnl [6]
2409 AT_CHECK([ovs-ofctl check-vlan 0000 0fff], [0], [dnl
2410 vlan_tci=0x0000/0x0fff -> 0000/0fff
2411 NXM: NXM_OF_VLAN_TCI_W(0000/0fff) -> 0000/0fff
2412 OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
2413 OF1.0: 0000/0,00/1 -> 1000/1fff
2414 OF1.1: 0000/0,00/1 -> 1000/1fff
2415 ])
2416
2417 dnl [7]
2418 AT_CHECK([ovs-ofctl check-vlan 0000 f000], [0], [dnl
2419 vlan_tci=0x0000/0xf000 -> 0000/f000
2420 NXM: NXM_OF_VLAN_TCI_W(0000/f000) -> 0000/f000
2421 OXM: OXM_OF_VLAN_VID_W(0000/1000) -> 0000/1000,--
2422 OF1.0: ffff/0,00/1 -> 0000/ffff
2423 OF1.1: ffff/0,00/1 -> 0000/ffff
2424 ])
2425
2426 dnl [8]
2427 AT_CHECK([ovs-ofctl check-vlan 0000 efff], [0], [dnl
2428 vlan_tci=0x0000/0xefff -> 0000/efff
2429 NXM: NXM_OF_VLAN_TCI_W(0000/efff) -> 0000/efff
2430 OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
2431 OF1.0: 0000/0,00/0 -> 1000/ffff
2432 OF1.1: 0000/0,00/0 -> 1000/ffff
2433 ])
2434
2435 dnl [9]
2436 AT_CHECK([ovs-ofctl check-vlan 1001 1001], [0], [dnl
2437 vlan_tci=0x1001/0x1001 -> 1001/1001
2438 NXM: NXM_OF_VLAN_TCI_W(1001/1001) -> 1001/1001
2439 OXM: OXM_OF_VLAN_VID_W(1001/1001) -> 1001/1001,--
2440 OF1.0: 0001/0,00/1 -> 1001/1fff
2441 OF1.1: 0001/0,00/1 -> 1001/1fff
2442 ])
2443
2444 dnl [10]
2445 AT_CHECK([ovs-ofctl check-vlan 3000 3000], [0], [dnl
2446 vlan_tci=0x3000/0x3000 -> 3000/3000
2447 NXM: NXM_OF_VLAN_TCI_W(3000/3000) -> 3000/3000
2448 OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) -> 1000/1000,01
2449 OF1.0: 0000/1,01/0 -> 3000/f000
2450 OF1.1: fffe/0,01/0 -> 3000/f000
2451 ])
2452 AT_CHECK
2453 AT_CLEANUP
2454
2455 dnl Check that "-F openflow10" rejects a flow_mod with unsupported features,
2456 dnl such as tunnels and metadata.
2457 AT_SETUP([ovs-ofctl -F option and NXM features])
2458 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
2459   [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
2460 ])
2461 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop],
2462   [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM,OpenFlow11) is among the allowed flow formats (OpenFlow10)
2463 ])
2464 AT_CLEANUP
2465
2466 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
2467 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
2468 dnl additionally show up as the top 32 bits of the cookie.)  This checks
2469 dnl for regression against bug #4566.
2470 AT_SETUP([ovs-ofctl -F option with flow_mods])
2471 OVS_VSWITCHD_START
2472 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
2473 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
2474 NXST_FLOW reply:
2475  tun_id=0x12345678 actions=drop
2476 ])
2477 OVS_VSWITCHD_STOP
2478 AT_CLEANUP
2479
2480 dnl Check that "-F openflow10" is really honored on dump-flows.
2481 dnl (If it isn't, then dump-flows will show the register match.)
2482 AT_SETUP([ovs-ofctl dump-flows honors -F option])
2483 OVS_VSWITCHD_START
2484 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
2485 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
2486 OFPST_FLOW reply:
2487  actions=drop
2488 ])
2489 OVS_VSWITCHD_STOP
2490 AT_CLEANUP
2491
2492 dnl Check that "-F openflow10" fails on dump-flows if the requested match
2493 dnl can't be represented in OpenFlow 1.0.
2494 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
2495 OVS_VSWITCHD_START
2496 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
2497   [ovs-ofctl: none of the usable flow formats (NXM,OXM) is among the allowed flow formats (OpenFlow10)
2498 ])
2499 OVS_VSWITCHD_STOP
2500 AT_CLEANUP
2501
2502 dnl Check that add-flow reports non-normalized flows (feature #5029).
2503 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
2504 OVS_VSWITCHD_START
2505 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
2506   [0], [], [dnl
2507 ofp_util|INFO|normalization changed ofp_match, details:
2508 ofp_util|INFO| pre: nw_src=1.2.3.4
2509 ofp_util|INFO|post: @&t@
2510 ])
2511 OVS_VSWITCHD_STOP
2512 AT_CLEANUP
2513
2514 dnl Check that --sort and --rsort works with dump-flows
2515 dnl Default field is 'priority'. Flow entries are displayed based
2516 dnl on field to sort.
2517 AT_SETUP([ovs-ofctl dump-flows with sorting])
2518 OVS_VSWITCHD_START
2519 AT_KEYWORDS([sort])
2520 AT_DATA([allflows.txt], [[
2521 priority=4,in_port=23213 actions=output:42
2522 priority=5,in_port=1029 actions=output:43
2523 priority=7,in_port=1029 actions=output:43
2524 priority=3,in_port=1028 actions=output:44
2525 priority=1,in_port=1026 actions=output:45
2526 priority=6,in_port=1027 actions=output:64
2527 priority=2,in_port=1025 actions=output:47
2528 priority=8,tcp,tp_src=5 actions=drop
2529 priority=9,tcp,tp_src=6 actions=drop
2530 ]])
2531
2532 AT_CHECK([ovs-ofctl add-flows br0 allflows.txt
2533 ], [0], [ignore])
2534 AT_CHECK([ovs-ofctl --sort dump-flows br0 | ofctl_strip], [0], [dnl
2535  priority=1,in_port=1026 actions=output:45
2536  priority=2,in_port=1025 actions=output:47
2537  priority=3,in_port=1028 actions=output:44
2538  priority=4,in_port=23213 actions=output:42
2539  priority=5,in_port=1029 actions=output:43
2540  priority=6,in_port=1027 actions=output:64
2541  priority=7,in_port=1029 actions=output:43
2542  priority=8,tcp,tp_src=5 actions=drop
2543  priority=9,tcp,tp_src=6 actions=drop
2544 ])
2545 AT_CHECK([ovs-ofctl --rsort dump-flows br0 | ofctl_strip], [0], [dnl
2546  priority=9,tcp,tp_src=6 actions=drop
2547  priority=8,tcp,tp_src=5 actions=drop
2548  priority=7,in_port=1029 actions=output:43
2549  priority=6,in_port=1027 actions=output:64
2550  priority=5,in_port=1029 actions=output:43
2551  priority=4,in_port=23213 actions=output:42
2552  priority=3,in_port=1028 actions=output:44
2553  priority=2,in_port=1025 actions=output:47
2554  priority=1,in_port=1026 actions=output:45
2555 ])
2556 AT_CHECK([ovs-ofctl --sort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
2557  priority=2,in_port=1025 actions=output:47
2558  priority=1,in_port=1026 actions=output:45
2559  priority=6,in_port=1027 actions=output:64
2560  priority=3,in_port=1028 actions=output:44
2561  priority=7,in_port=1029 actions=output:43
2562  priority=5,in_port=1029 actions=output:43
2563  priority=4,in_port=23213 actions=output:42
2564  priority=9,tcp,tp_src=6 actions=drop
2565  priority=8,tcp,tp_src=5 actions=drop
2566 ])
2567 AT_CHECK([ovs-ofctl --rsort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
2568  priority=4,in_port=23213 actions=output:42
2569  priority=7,in_port=1029 actions=output:43
2570  priority=5,in_port=1029 actions=output:43
2571  priority=3,in_port=1028 actions=output:44
2572  priority=6,in_port=1027 actions=output:64
2573  priority=1,in_port=1026 actions=output:45
2574  priority=2,in_port=1025 actions=output:47
2575  priority=9,tcp,tp_src=6 actions=drop
2576  priority=8,tcp,tp_src=5 actions=drop
2577 ])
2578 AT_CHECK([ovs-ofctl --sort=tcp_src dump-flows br0 | ofctl_strip], [0], [dnl
2579  priority=8,tcp,tp_src=5 actions=drop
2580  priority=9,tcp,tp_src=6 actions=drop
2581  priority=7,in_port=1029 actions=output:43
2582  priority=6,in_port=1027 actions=output:64
2583  priority=5,in_port=1029 actions=output:43
2584  priority=4,in_port=23213 actions=output:42
2585  priority=3,in_port=1028 actions=output:44
2586  priority=2,in_port=1025 actions=output:47
2587  priority=1,in_port=1026 actions=output:45
2588 ])
2589 AT_CHECK(
2590   [ovs-ofctl --sort=in_port --sort=tcp_src dump-flows br0 | ofctl_strip], [0],
2591   [ priority=2,in_port=1025 actions=output:47
2592  priority=1,in_port=1026 actions=output:45
2593  priority=6,in_port=1027 actions=output:64
2594  priority=3,in_port=1028 actions=output:44
2595  priority=7,in_port=1029 actions=output:43
2596  priority=5,in_port=1029 actions=output:43
2597  priority=4,in_port=23213 actions=output:42
2598  priority=8,tcp,tp_src=5 actions=drop
2599  priority=9,tcp,tp_src=6 actions=drop
2600 ])
2601 OVS_VSWITCHD_STOP
2602 AT_CLEANUP
2603
2604 AT_SETUP([ovs-ofctl diff-flows])
2605 OVS_VSWITCHD_START
2606
2607 # Add tons of flows to br0.
2608 for i in `seq 0 1023`; do echo "dl_vlan=$i,actions=drop"; done > add-flows.txt
2609 AT_CHECK([ovs-ofctl add-flows br0 add-flows.txt])
2610
2611 # Dump them and compare against what we expect by hand, then with diff-flows.
2612 for i in `seq 0 1023`; do echo " dl_vlan=$i actions=drop"; done | sort > expout
2613 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed '/NXST_FLOW/d' | sort],
2614   [0], [expout])
2615 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt])
2616
2617 # Remove even-numbered flows, compare again.
2618 for i in `seq 0 1023 2`; do echo "dl_vlan=$i"; done > del-flows.txt
2619 AT_CHECK([ovs-ofctl del-flows br0 - < del-flows.txt])
2620 for i in `seq 0 1023 2`; do echo "+dl_vlan=$i actions=drop"; done | sort > expout
2621 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt | sort], [0], [expout])
2622 for i in `seq 0 1023 2`; do echo "-dl_vlan=$i actions=drop"; done | sort > expout
2623 AT_CHECK([ovs-ofctl diff-flows add-flows.txt br0 | sort], [0], [expout])
2624
2625 OVS_VSWITCHD_STOP
2626 AT_CLEANUP
2627
2628 dnl ofpacts that differ bytewise don't necessarily differ when
2629 dnl converted to another representation, such as OpenFlow 1.0
2630 dnl or to a string.  "resubmit(,1)" is an example of an action
2631 dnl of this type: "ofpact_resubmit"s can differ in their "compat"
2632 dnl values even though this doesn't affect the string format.
2633 dnl
2634 dnl This test checks that "ovs-ofctl diff-flows" doesn't report
2635 dnl false ofpacts differences.
2636 AT_SETUP([ovs-ofctl diff-flows - suppress false differences])
2637 OVS_VSWITCHD_START
2638 AT_DATA([flows.txt], [actions=resubmit(,1)
2639 ])
2640 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2641 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2642 AT_CHECK([ovs-ofctl add-flow br0 idle_timeout=60,dl_vlan=9,actions=output:1])
2643 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt], [2], [dnl
2644 -dl_vlan=9 idle_timeout=60 actions=output:1
2645 ])
2646 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=120,cookie=1234,dl_vlan=9,actions=output:1])
2647 AT_CHECK([ovs-ofctl diff-flows flows.txt br0], [2], [dnl
2648 +dl_vlan=9 cookie=0x4d2 hard_timeout=120 actions=output:1
2649 ])
2650 OVS_VSWITCHD_STOP
2651 AT_CLEANUP
2652
2653 AT_SETUP([ovs-ofctl -F and -O interaction])
2654 AT_CHECK([ovs-ofctl -F oxm -O openflow10], [1], [],
2655   [ovs-ofctl: None of the enabled OpenFlow versions (OpenFlow10) supports any of the enabled flow formats (OXM).  (Use -O to enable additional OpenFlow versions or -F to enable additional flow formats.)
2656 ])
2657 AT_CHECK([ovs-ofctl -F oxm -O openflow11], [1], [],
2658   [ovs-ofctl: None of the enabled OpenFlow versions (OpenFlow11) supports any of the enabled flow formats (OXM).  (Use -O to enable additional OpenFlow versions or -F to enable additional flow formats.)
2659 ])
2660 AT_CHECK([ovs-ofctl -F oxm -O openflow10,openflow11], [1], [],
2661   [ovs-ofctl: None of the enabled OpenFlow versions (OpenFlow10, OpenFlow11) supports any of the enabled flow formats (OXM).  (Use -O to enable additional OpenFlow versions or -F to enable additional flow formats.)
2662 ])
2663 AT_CHECK([ovs-ofctl -F oxm -O openflow10,openflow12], [1], [],
2664  [ovs-ofctl: missing command name; use --help for help
2665 ])
2666 AT_CHECK([ovs-ofctl -F oxm -O openflow12], [1], [],
2667   [ovs-ofctl: missing command name; use --help for help
2668 ])
2669 AT_CHECK([ovs-ofctl -F oxm -O openflow13], [1], [],
2670   [ovs-ofctl: missing command name; use --help for help
2671 ])
2672 AT_CLEANUP
2673
2674 AT_SETUP([ovs-ofctl ofp-parse])
2675 # Test the echo request/reply messages (0 payload).
2676 AT_CHECK([printf '\1\2\0\10\0\0\0\0\1\3\0\10\0\0\0\0' > binary_ofp_msg])
2677 AT_CHECK([ovs-ofctl ofp-parse binary_ofp_msg], [0], [dnl
2678 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
2679 OFPT_ECHO_REPLY (xid=0x0): 0 bytes of payload
2680 ])
2681
2682 # Test the hello (xid:1 3-byte payload).
2683 AT_CHECK([printf '\1\0\0\13\0\0\0\1\101\102\103' > binary_ofp_msg])
2684 AT_CHECK([ovs-ofctl ofp-parse - < binary_ofp_msg], [0], [dnl
2685 OFPT_HELLO (xid=0x1):
2686  version bitmap: 0x01
2687  unknown data in hello:
2688 00000000  01 00 00 0b 00 00 00 01-41 42 43                |........ABC     |
2689 ])
2690 AT_CLEANUP
2691
2692 AT_SETUP([tcp flags - filtering])
2693 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 \
2694                     -- add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])
2695 AT_DATA([flows.txt], [dnl
2696         in_port=1,tcp,tp_dst=80,tcp_flags=+syn-rst-ack-fin,action=2  # Allow outbound web traffic bare-SYN
2697         in_port=1,tcp,tp_dst=80,tcp_flags=+ack,action=2  # Allow outbound web traffic with ACK bit
2698         in_port=1,tcp,tp_dst=80,tcp_flags=+rst,action=2  # Allow outbound web traffic with RST bit
2699         in_port=2,tcp,tp_src=80,tcp_flags=+ack,action=1  # Allow inbound web traffic with ACK bit
2700         in_port=2,tcp,tp_src=80,tcp_flags=+rst,action=1  # Allow inbound web traffic with RST bit
2701         priority=0,in_port=1,action=drop  # Default drop outbound
2702         priority=0,in_port=2,action=drop  # Default drop inbound
2703 ])
2704
2705 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2706
2707 AT_CHECK([ovs-ofctl add-flow br0 "tcp,tcp_flags=+ack-ack,action="], [1], [],
2708   [ovs-ofctl: ack: Each TCP flag can be specified only once
2709 ])
2710
2711 AT_CHECK([ovs-appctl dpif/show | tail -n +4], [0], [dnl
2712                 p1 1/1: (dummy)
2713                 p2 2/2: (dummy)
2714 ])
2715
2716 dnl Outbound web traffic with bare-SYN
2717 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x002)'], [0], [stdout])
2718 AT_CHECK([tail -1 stdout], [0],
2719   [Datapath actions: 2
2720 ])
2721
2722 dnl Outbopund web traffic with ACK bit
2723 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x110)'], [0], [stdout])
2724 AT_CHECK([tail -1 stdout], [0],
2725   [Datapath actions: 2
2726 ])
2727
2728 dnl Outbound web traffic with RST bit
2729 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x104)'], [0], [stdout])
2730 AT_CHECK([tail -1 stdout], [0],
2731   [Datapath actions: 2
2732 ])
2733
2734 dnl Inbound web traffic with ACK bit
2735 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0x010)'], [0], [stdout])
2736 AT_CHECK([tail -1 stdout], [0],
2737   [Datapath actions: 1
2738 ])
2739
2740 dnl Inbound web traffic with RST bit
2741 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0x014)'], [0], [stdout])
2742 AT_CHECK([tail -1 stdout], [0],
2743   [Datapath actions: 1
2744 ])
2745
2746 dnl Inbound web traffic with SYN bit without ACK or RST bits
2747 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0xfeb)'], [0], [stdout])
2748 AT_CHECK([tail -1 stdout], [0],
2749   [Datapath actions: drop
2750 ])
2751
2752 OVS_VSWITCHD_STOP
2753 AT_CLEANUP
2754
2755 dnl Check importance parameter added in OF1.4.
2756 dnl It validates whether importance set via add-flow via OpenFlow1.4+ gets
2757 dnl set or not by validating it againt the dump-flows output via OpenFlow1.4+
2758 dnl If add-flow or dump-flows is used with later version of OpenFlow prior to 1.4+
2759 dnl then the importance will be considered zero whether provided as an argument.
2760
2761 AT_SETUP([ovs-ofctl rule with importance])
2762 OVS_VSWITCHD_START
2763 dnl Flow with importance parameter added via OF1.4+ and later version
2764 AT_CHECK([ovs-ofctl -O OpenFlow14 add-flow br0 priority=21,importance=21,actions=normal])
2765 AT_CHECK([ovs-ofctl add-flow br0 priority=22,importance=22,actions=normal])
2766
2767 dnl Importance parameter will only be visible of flows that are added via OF1.4+ if dumped via OF1.4+
2768 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/ST_FLOW reply/d' | sort], [0], [dnl
2769  importance=21, priority=21 actions=NORMAL
2770  priority=22 actions=NORMAL
2771 ])
2772
2773 dnl Importance parameter will not be visible if flow is dumped with previous version prior to OF1.4+ whether added via OF1.4+
2774 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed '/ST_FLOW reply/d' | sort], [0], [dnl
2775  priority=21 actions=NORMAL
2776  priority=22 actions=NORMAL
2777 ])
2778
2779 OVS_VSWITCHD_STOP
2780 AT_CLEANUP
2781
2782
2783 dnl Importance parameter added in OF1.4.
2784 dnl This validates whether flows with importance
2785 dnl parameter are getting replaced with "replace-flows" or
2786 dnl not by validating dump-flows output after replace with the expected output.
2787
2788 AT_SETUP([ovs-ofctl replace-flows with importance])
2789 OVS_VSWITCHD_START
2790
2791 dnl Add flows to br0 with importance via OF1.4+. For more details refer "ovs-ofctl rule with importance" test case.
2792 for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; done > add-flows.txt
2793 AT_CHECK([ovs-ofctl -O OpenFlow14 add-flows br0 add-flows.txt])
2794
2795 dnl Replace some flows in the bridge.
2796 for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; done > replace-flows.txt
2797 AT_CHECK([ovs-ofctl -O OpenFlow14 replace-flows br0 replace-flows.txt])
2798
2799 dnl Dump them and compare the dump flows output against the expected output.
2800 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
2801 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLOW/d' | sort],
2802   [0], [expout])
2803
2804 OVS_VSWITCHD_STOP
2805 AT_CLEANUP
2806
2807 AT_SETUP([ovs-ofctl replace-flows with --bundle])
2808 OVS_VSWITCHD_START
2809
2810 AT_CHECK([ovs-appctl vlog/set vconn:dbg])
2811
2812 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.
2813 for i in 1 2 3 4 5 6 7 8; do echo "dl_vlan=$i,importance=$i,actions=drop"; done > add-flows.txt
2814 AT_CHECK([ovs-ofctl --bundle add-flows br0 add-flows.txt])
2815
2816 dnl Replace some flows in the bridge.
2817 for i in 1 3 5 7; do echo "dl_vlan=$i,importance=`expr $i + 10`,actions=drop"; done > replace-flows.txt
2818 AT_CHECK([ovs-ofctl --bundle replace-flows br0 replace-flows.txt])
2819
2820 dnl Dump them and compare the dump flows output against the expected output.
2821 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
2822 AT_CHECK([ovs-ofctl -O OpenFlow14 dump-flows br0 | ofctl_strip | sed '/OFPST_FLOW/d' | sort],
2823   [0], [expout])
2824
2825 dnl Check logs for OpenFlow trace
2826 # Prevent race.
2827 OVS_WAIT_UNTIL([cat ovs-vswitchd.log | vconn_windows_sub | test `grep -- "|vconn|DBG|unix: sent (Success): OFPST_FLOW reply" | wc -l` -ge 2])
2828 # AT_CHECK([sed -n "s/^.*\(|vconn|DBG|.*xid=.*:\).*$/\1/p" ovs-vswitchd.log], [0], [dnl
2829 AT_CHECK([print_vconn_debug | vconn_windows_sub | ofctl_strip], [0], [dnl
2830 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
2831  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
2832 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
2833  version bitmap: 0x01, 0x05
2834 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05)
2835 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2836  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
2837 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2838  bundle_id=0 type=OPEN_REPLY flags=0
2839 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2840  bundle_id=0 flags=atomic ordered
2841 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=1 importance:1 actions=drop
2842 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2843  bundle_id=0 flags=atomic ordered
2844 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=2 importance:2 actions=drop
2845 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2846  bundle_id=0 flags=atomic ordered
2847 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=3 importance:3 actions=drop
2848 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2849  bundle_id=0 flags=atomic ordered
2850 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=4 importance:4 actions=drop
2851 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2852  bundle_id=0 flags=atomic ordered
2853 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=5 importance:5 actions=drop
2854 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2855  bundle_id=0 flags=atomic ordered
2856 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=6 importance:6 actions=drop
2857 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2858  bundle_id=0 flags=atomic ordered
2859 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=7 importance:7 actions=drop
2860 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2861  bundle_id=0 flags=atomic ordered
2862 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=8 importance:8 actions=drop
2863 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2864  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2865 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2866  bundle_id=0 type=COMMIT_REPLY flags=0
2867 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
2868  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
2869 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
2870  version bitmap: 0x01, 0x05
2871 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports versions 0x01, 0x05)
2872 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
2873 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
2874 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2875  bundle_id=0 type=OPEN_REQUEST flags=atomic ordered
2876 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2877  bundle_id=0 type=OPEN_REPLY flags=0
2878 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2879  bundle_id=0 flags=atomic ordered
2880 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=1 importance:11 actions=drop
2881 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2882  bundle_id=0 flags=atomic ordered
2883 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=3 importance:13 actions=drop
2884 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2885  bundle_id=0 flags=atomic ordered
2886 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=5 importance:15 actions=drop
2887 vconn|DBG|unix: received: OFPT_BUNDLE_ADD_MESSAGE (OF1.4):
2888  bundle_id=0 flags=atomic ordered
2889 OFPT_FLOW_MOD (OF1.4): ADD dl_vlan=7 importance:17 actions=drop
2890 vconn|DBG|unix: received: OFPT_BUNDLE_CONTROL (OF1.4):
2891  bundle_id=0 type=COMMIT_REQUEST flags=atomic ordered
2892 vconn|DBG|unix: sent (Success): OFPT_BUNDLE_CONTROL (OF1.4):
2893  bundle_id=0 type=COMMIT_REPLY flags=0
2894 vconn|DBG|unix: sent (Success): OFPT_HELLO (OF1.5):
2895  version bitmap: 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
2896 vconn|DBG|unix: received: OFPT_HELLO (OF1.4):
2897  version bitmap: 0x05
2898 vconn|DBG|unix: negotiated OpenFlow version 0x05 (we support version 0x06 and earlier, peer supports version 0x05)
2899 vconn|DBG|unix: received: OFPST_FLOW request (OF1.4):
2900 vconn|DBG|unix: sent (Success): OFPST_FLOW reply (OF1.4):
2901  importance=2, dl_vlan=2 actions=drop
2902  importance=4, dl_vlan=4 actions=drop
2903  importance=6, dl_vlan=6 actions=drop
2904  importance=8, dl_vlan=8 actions=drop
2905  importance=11, dl_vlan=1 actions=drop
2906  importance=13, dl_vlan=3 actions=drop
2907  importance=15, dl_vlan=5 actions=drop
2908  importance=17, dl_vlan=7 actions=drop
2909 ])
2910
2911 OVS_VSWITCHD_STOP
2912 AT_CLEANUP