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