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