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