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