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