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