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