Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git] / tests / ovs-ofctl.at
1 AT_BANNER([ovs-ofctl])
2
3 AT_SETUP([ovs-ofctl parse-flows choice of protocol])
4 # This doesn't cover some potential vlan_tci test cases.
5 for test_case in \
6     'tun_id=0                                    NXM,OXM,OXM-OpenFlow14' \
7     'tun_id=0/0x1                                NXM,OXM,OXM-OpenFlow14' \
8     'tun_src=1.2.3.4                             NXM,OXM,OXM-OpenFlow14' \
9     'tun_src=1.2.3.4/0.0.0.1                     NXM,OXM,OXM-OpenFlow14' \
10     'tun_dst=1.2.3.4                             NXM,OXM,OXM-OpenFlow14' \
11     'tun_dst=1.2.3.4/0.0.0.1                     NXM,OXM,OXM-OpenFlow14' \
12     'tun_flags=0                                 none' \
13     'tun_flags=1/1                               none' \
14     'tun_tos=0                                   none' \
15     'tun_ttl=0                                   none' \
16     'metadata=0                                  NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
17     'metadata=1/1                                NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
18     'in_port=1                                   any,OXM-OpenFlow14' \
19     'skb_priority=0                              none' \
20     'pkt_mark=1                                  NXM,OXM,OXM-OpenFlow14' \
21     'pkt_mark=1/1                                NXM,OXM,OXM-OpenFlow14' \
22     'reg0=0                                      NXM,OXM,OXM-OpenFlow14' \
23     'reg0=0/1                                    NXM,OXM,OXM-OpenFlow14' \
24     'reg1=1                                      NXM,OXM,OXM-OpenFlow14' \
25     'reg1=1/1                                    NXM,OXM,OXM-OpenFlow14' \
26     'reg2=2                                      NXM,OXM,OXM-OpenFlow14' \
27     'reg2=2/1                                    NXM,OXM,OXM-OpenFlow14' \
28     'reg3=3                                      NXM,OXM,OXM-OpenFlow14' \
29     'reg3=3/1                                    NXM,OXM,OXM-OpenFlow14' \
30     'reg4=4                                      NXM,OXM,OXM-OpenFlow14' \
31     'reg4=4/1                                    NXM,OXM,OXM-OpenFlow14' \
32     'reg5=5                                      NXM,OXM,OXM-OpenFlow14' \
33     'reg5=5/1                                    NXM,OXM,OXM-OpenFlow14' \
34     'reg6=6                                      NXM,OXM,OXM-OpenFlow14' \
35     'reg6=6/1                                    NXM,OXM,OXM-OpenFlow14' \
36     'reg7=7                                      NXM,OXM,OXM-OpenFlow14' \
37     'reg7=7/1                                    NXM,OXM,OXM-OpenFlow14' \
38     'dl_src=00:11:22:33:44:55                    any,OXM-OpenFlow14' \
39     'dl_src=00:11:22:33:44:55/00:ff:ff:ff:ff:ff  NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
40     'dl_dst=00:11:22:33:44:55                    any,OXM-OpenFlow14' \
41     'dl_dst=00:11:22:33:44:55/00:ff:ff:ff:ff:ff  NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
42     'dl_type=0x1234                              any,OXM-OpenFlow14' \
43     'dl_type=0x0800                              any,OXM-OpenFlow14' \
44     'dl_type=0x0806                              any,OXM-OpenFlow14' \
45     'dl_type=0x86dd                              any,OXM-OpenFlow14' \
46     'vlan_tci=0                                  any,OXM-OpenFlow14' \
47     'vlan_tci=0x1009                             any,OXM-OpenFlow14' \
48     'vlan_tci=0x1009/0x1                         NXM,OXM,OXM-OpenFlow14' \
49     'dl_vlan=9                                   any,OXM-OpenFlow14' \
50     'vlan_vid=11                                 any,OXM-OpenFlow14' \
51     'vlan_vid=11/0x1                             NXM,OXM,OXM-OpenFlow14' \
52     'dl_vlan_pcp=6                               any,OXM-OpenFlow14' \
53     'vlan_pcp=5                                  any,OXM-OpenFlow14' \
54     'mpls,mpls_label=5                           NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
55     'mpls,mpls_tc=1                              NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
56     'mpls,mpls_bos=0                             NXM,OXM,OXM-OpenFlow14' \
57     'ip,ip_src=1.2.3.4                           any,OXM-OpenFlow14' \
58     'ip,ip_src=192.168.0.0/24                    any,OXM-OpenFlow14' \
59     'ip,ip_src=192.0.168.0/255.0.255.0           NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
60     'ip,ip_dst=1.2.3.4                           any,OXM-OpenFlow14' \
61     'ip,ip_dst=192.168.0.0/24                    any,OXM-OpenFlow14' \
62     'ip,ip_dst=192.0.168.0/255.0.255.0           NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
63     'ipv6,ipv6_src=::1                           NXM,OXM,OXM-OpenFlow14' \
64     'ipv6,ipv6_src=::1/::1                       NXM,OXM,OXM-OpenFlow14' \
65     'ipv6,ipv6_dst=::1                           NXM,OXM,OXM-OpenFlow14' \
66     'ipv6,ipv6_dst=::1/::1                       NXM,OXM,OXM-OpenFlow14' \
67     'ipv6,ipv6_label=5                           NXM,OXM,OXM-OpenFlow14' \
68     'ipv6,ipv6_label=5/1                         NXM,OXM,OXM-OpenFlow14' \
69     'ip,nw_proto=1                               any,OXM-OpenFlow14' \
70     'ipv6,nw_proto=1                             NXM,OXM,OXM-OpenFlow14' \
71     'ip,nw_tos=0xf0                              any,OXM-OpenFlow14' \
72     'ipv6,nw_tos=0xf0                            NXM,OXM,OXM-OpenFlow14' \
73     'ip,ip_dscp=0x3c                             any,OXM-OpenFlow14' \
74     'ipv6,ip_dscp=0x3c                           NXM,OXM,OXM-OpenFlow14' \
75     'ip,nw_ecn=1                                 NXM,OXM,OXM-OpenFlow14' \
76     'ipv6,nw_ecn=1                               NXM,OXM,OXM-OpenFlow14' \
77     'ip,nw_ttl=5                                 NXM,OXM,OXM-OpenFlow14' \
78     'ipv6,nw_ttl=5                               NXM,OXM,OXM-OpenFlow14' \
79     'ip,ip_frag=no                               NXM,OXM,OXM-OpenFlow14' \
80     'ipv6,ip_frag=no                             NXM,OXM,OXM-OpenFlow14' \
81     'arp,arp_op=0                                any,OXM-OpenFlow14' \
82     'arp,arp_spa=1.2.3.4                         any,OXM-OpenFlow14' \
83     'arp,arp_spa=1.2.3.4/0.0.0.1                 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
84     'arp,arp_tpa=1.2.3.4                         any,OXM-OpenFlow14' \
85     'arp,arp_tpa=1.2.3.4/0.0.0.1                 NXM,OXM,OpenFlow11,OXM-OpenFlow14' \
86     'arp,arp_sha=00:11:22:33:44:55               NXM,OXM,OXM-OpenFlow14' \
87     'arp,arp_sha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OXM-OpenFlow14' \
88     'arp,arp_tha=00:11:22:33:44:55               NXM,OXM,OXM-OpenFlow14' \
89     'arp,arp_tha=00:11:22:33:44:55/00:ff:ff:ff:ff:ff NXM,OXM,OXM-OpenFlow14' \
90     'tcp,tcp_src=80                              any,OXM-OpenFlow14' \
91     'tcp,tcp_src=0x1000/0x1000                   NXM,OXM,OXM-OpenFlow14' \
92     'tcp6,tcp_src=80                             NXM,OXM,OXM-OpenFlow14' \
93     'tcp6,tcp_src=0x1000/0x1000                  NXM,OXM,OXM-OpenFlow14' \
94     'tcp,tcp_dst=80                              any,OXM-OpenFlow14' \
95     'tcp,tcp_dst=0x1000/0x1000                   NXM,OXM,OXM-OpenFlow14' \
96     'tcp6,tcp_dst=80                             NXM,OXM,OXM-OpenFlow14' \
97     'tcp6,tcp_dst=0x1000/0x1000                  NXM,OXM,OXM-OpenFlow14' \
98     'udp,udp_src=80                              any,OXM-OpenFlow14' \
99     'udp,udp_src=0x1000/0x1000                   NXM,OXM,OXM-OpenFlow14' \
100     'udp6,udp_src=80                             NXM,OXM,OXM-OpenFlow14' \
101     'udp6,udp_src=0x1000/0x1000                  NXM,OXM,OXM-OpenFlow14' \
102     'udp,udp_dst=80                              any,OXM-OpenFlow14' \
103     'udp,udp_dst=0x1000/0x1000                   NXM,OXM,OXM-OpenFlow14' \
104     'udp6,udp_dst=80                             NXM,OXM,OXM-OpenFlow14' \
105     'udp6,udp_dst=0x1000/0x1000                  NXM,OXM,OXM-OpenFlow14' \
106     'icmp,icmp_type=1                            any,OXM-OpenFlow14' \
107     'icmp,icmp_code=2                            any,OXM-OpenFlow14' \
108     'icmp6,icmpv6_type=1                         NXM,OXM,OXM-OpenFlow14' \
109     'icmp6,icmpv6_code=2                         NXM,OXM,OXM-OpenFlow14'
110 do
111     set $test_case
112     echo
113     echo "### test case: '$1' should have usable protocols '$2'"
114     if test "$2" = none; then
115       AT_CHECK([ovs-ofctl parse-flow "$1,actions=drop"], [1],
116                [usable protocols: none
117 ],
118                [ovs-ofctl: no usable protocol
119 ])
120     else
121       AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "$1,actions=drop" | sed 1q], [0],
122                         [usable protocols: $2
123 ])
124     fi
125 done
126 AT_CLEANUP
127
128 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.0)])
129 AT_DATA([flows.txt], [[
130 # comment
131 tcp,tp_src=123,out_port=5,actions=flood
132 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
133 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
134 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
135 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
136 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
137 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
138 ip,actions=set_field:10.4.3.77->ip_src
139 sctp actions=drop
140 sctp actions=drop
141 in_port=0 actions=resubmit:0
142 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
143 ]])
144
145 AT_CHECK([ovs-ofctl parse-flows flows.txt
146 ], [0], [stdout])
147 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
148 [[usable protocols: any,OXM-OpenFlow14
149 chosen protocol: OpenFlow10-table_id
150 OFPT_FLOW_MOD: ADD tcp,tp_src=123 out_port:5 actions=FLOOD
151 OFPT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
152 OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
153 OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
154 OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
155 OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
156 OFPT_FLOW_MOD: ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
157 OFPT_FLOW_MOD: ADD ip actions=mod_nw_src:10.4.3.77
158 OFPT_FLOW_MOD: ADD sctp actions=drop
159 OFPT_FLOW_MOD: ADD sctp actions=drop
160 OFPT_FLOW_MOD: ADD in_port=0 actions=resubmit:0
161 OFPT_FLOW_MOD: ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
162 ]])
163 AT_CLEANUP
164
165 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.1)])
166 AT_DATA([flows.txt], [[
167 # comment
168 tcp,tp_src=123,out_port=5,actions=flood
169 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
170 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
171 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
172 udp,nw_src=192.168.0.3,tp_dst=53 actions=mod_nw_ecn:2,output:1
173 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
174 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
175 ip,actions=mod_nw_ttl:1,set_field:10.4.3.77->ip_src
176 sctp actions=drop
177 sctp actions=drop
178 in_port=0 actions=resubmit:0
179 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
180 ]])
181
182 AT_CHECK([ovs-ofctl --protocols OpenFlow11 parse-flows flows.txt
183 ], [0], [stdout])
184 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
185 [[usable protocols: any,OXM-OpenFlow14
186 chosen protocol: OpenFlow11
187 OFPT_FLOW_MOD (OF1.1): ADD tcp,tp_src=123 out_port:5 actions=FLOOD
188 OFPT_FLOW_MOD (OF1.1): ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
189 OFPT_FLOW_MOD (OF1.1): ADD udp,dl_vlan_pcp=7 idle:5 actions=pop_vlan,output:0
190 OFPT_FLOW_MOD (OF1.1): ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
191 OFPT_FLOW_MOD (OF1.1): ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=mod_nw_ecn:2,output:1
192 OFPT_FLOW_MOD (OF1.1): ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
193 OFPT_FLOW_MOD (OF1.1): ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
194 OFPT_FLOW_MOD (OF1.1): ADD ip actions=mod_nw_ttl:1,mod_nw_src:10.4.3.77
195 OFPT_FLOW_MOD (OF1.1): ADD sctp actions=drop
196 OFPT_FLOW_MOD (OF1.1): ADD sctp actions=drop
197 OFPT_FLOW_MOD (OF1.1): ADD in_port=0 actions=resubmit:0
198 OFPT_FLOW_MOD (OF1.1): ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
199 ]])
200 AT_CLEANUP
201
202 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.2)])
203 AT_DATA([flows.txt], [[
204 # comment
205 tcp,tp_src=123,actions=flood
206 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=mod_vlan_vid:7,mod_vlan_pcp:2
207 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
208 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
209 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
210 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
211 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
212 ipv6,actions=set_field:fe80:0123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
213 sctp actions=set_field:3334->sctp_src
214 sctp actions=set_field:4445->sctp_dst
215 tcp actions=mod_tp_dst:1234
216 udp actions=mod_tp_src:1111
217 ip actions=mod_nw_src:10.1.1.2,mod_nw_dst:192.168.10.1,mod_nw_ttl:1,mod_nw_tos:16,mod_nw_ecn:2
218 in_port=0 actions=mod_dl_src:11:22:33:44:55:66,mod_dl_dst:10:20:30:40:50:60
219 in_port=0 actions=resubmit:0
220 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
221 ]])
222
223 AT_CHECK([ovs-ofctl --protocols OpenFlow12 parse-flows flows.txt
224 ], [0], [stdout])
225 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
226 [[usable protocols: NXM,OXM,OXM-OpenFlow14
227 chosen protocol: OXM-OpenFlow12
228 OFPT_FLOW_MOD (OF1.2): ADD tcp,tp_src=123 actions=FLOOD
229 OFPT_FLOW_MOD (OF1.2): ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=set_field:4103->vlan_vid,set_field:2->vlan_pcp
230 OFPT_FLOW_MOD (OF1.2): ADD udp,dl_vlan_pcp=7 idle:5 actions=pop_vlan,output:0
231 OFPT_FLOW_MOD (OF1.2): ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
232 OFPT_FLOW_MOD (OF1.2): ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
233 OFPT_FLOW_MOD (OF1.2): ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
234 OFPT_FLOW_MOD (OF1.2): ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
235 OFPT_FLOW_MOD (OF1.2): ADD ipv6 actions=set_field:fe80:123:4567:890a:a6ba:dbff:fefe:59fa->ipv6_src
236 OFPT_FLOW_MOD (OF1.2): ADD sctp actions=set_field:3334->sctp_src
237 OFPT_FLOW_MOD (OF1.2): ADD sctp actions=set_field:4445->sctp_dst
238 OFPT_FLOW_MOD (OF1.2): ADD tcp actions=set_field:1234->tcp_dst
239 OFPT_FLOW_MOD (OF1.2): ADD udp actions=set_field:1111->udp_src
240 OFPT_FLOW_MOD (OF1.2): ADD ip actions=set_field:10.1.1.2->ip_src,set_field:192.168.10.1->ip_dst,mod_nw_ttl:1,set_field:4->ip_dscp,set_field:2->nw_ecn
241 OFPT_FLOW_MOD (OF1.2): ADD in_port=0 actions=set_field:11:22:33:44:55:66->eth_src,set_field:10:20:30:40:50:60->eth_dst
242 OFPT_FLOW_MOD (OF1.2): ADD in_port=0 actions=resubmit:0
243 OFPT_FLOW_MOD (OF1.2): ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
244 ]])
245 AT_CLEANUP
246
247 AT_SETUP([ovs-ofctl parse-flow with invalid mask])
248 for test_case in \
249     'tun_tos 1/1' \
250     'tun_ttl 1/1' \
251     'skb_priority 1/1' \
252     'eth_type 0x1234/0x1' \
253     'dl_vlan 9/0x1' \
254     'dl_vlan_pcp 6/0x1' \
255     'vlan_pcp 5/0x1' \
256     'mpls mpls_label 5/0x1' \
257     'mpls mpls_tc 1/0x1' \
258     'mpls mpls_bos 1/0x1' \
259     'ip nw_proto 1/1' \
260     'ipv6 nw_proto 1/1' \
261     'ip nw_tos 0xf0/0xf0' \
262     'ipv6 nw_tos 0xf0/0xf0' \
263     'ip ip_dscp 0x3c/0xf0' \
264     'ipv6 ip_dscp 0x3c/0xf0' \
265     'ip nw_ecn 1/1' \
266     'ipv6 nw_ecn 1/1' \
267     'ip nw_ttl 5/1' \
268     'ipv6 nw_ttl 5/1' \
269     'arp arp_op 0/1' \
270     'icmp icmp_type 1/1' \
271     'icmp icmp_code 2/1' \
272     'icmp6 icmpv6_code 2/1'
273 do
274     set $test_case
275     if test $# = 3; then
276         prereq=$1, field=$2 value=$3
277     else
278         prereq= field=$1 value=$2
279     fi
280     AT_CHECK_UNQUOTED([ovs-ofctl parse-flow "$prereq$field=$value,actions=drop"], [1], [],
281 [ovs-ofctl: $value: invalid mask for field $field
282 ])
283 done
284 AT_CLEANUP
285
286 AT_SETUP([ovs-ofctl action inconsistency (OpenFlow 1.1)])
287 AT_CHECK([ovs-ofctl --protocols OpenFlow11 add-flow br0 'ip actions=mod_tp_dst:1234'
288 ], [1], [stdout], [ovs-ofctl: none of the usable flow formats (OpenFlow10,NXM) is among the allowed flow formats (OpenFlow11)
289 ])
290 AT_CLEANUP
291
292 AT_SETUP([ovs-ofctl parse-flows (With Tunnel-Parameters)])
293 AT_DATA([flows.txt], [[
294 tun_id=0x1234000056780000/0xffff0000ffff0000,tun_src=1.1.1.1,tun_dst=2.2.2.2,tun_tos=0x3,tun_ttl=20,tun_flags=key|csum actions=drop
295 ]])
296
297 AT_CHECK([ovs-ofctl parse-flows flows.txt
298 ], [1], [usable protocols: none
299 ], [stderr])
300
301 AT_CLEANUP
302
303
304 AT_SETUP([ovs-ofctl parse-flows (skb_priority)])
305 AT_DATA([flows.txt], [[
306 skb_priority=0x12341234,tcp,tp_src=123,actions=flood
307 ]])
308
309 AT_CHECK([ovs-ofctl parse-flows flows.txt
310 ], [1], [usable protocols: none
311 ], [stderr])
312
313 AT_CLEANUP
314
315
316 AT_SETUP([ovs-ofctl parse-flows (NXM)])
317 AT_DATA([flows.txt], [[
318 # comment
319 tcp,tp_src=123,actions=flood
320 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
321 pkt_mark=0xbb,actions=set_field:0xaa->pkt_mark
322 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
323 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
324 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
325 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
326 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
327 tcp,tp_src=0x1230/0xfff0,tun_id=0x1234,cookie=0x5678,actions=flood
328 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel:0x123456789
329 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])
330 table=1,actions=drop
331 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
332 metadata=0x1234ffff5678ffff/0xffff0000ffff0000,actions=drop
333 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
334 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
335 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
336 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
337 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
338 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
339 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:[2,3])
340 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
341 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
342 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3)
343 send_flow_rem,actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
344 check_overlap,actions=output:1,exit,output:2
345 tcp,actions=fin_timeout(idle_timeout=5,hard_timeout=15)
346 actions=controller(max_len=123,reason=invalid_ttl,id=555)
347 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
348 ]])
349
350 AT_CHECK([ovs-ofctl parse-flows flows.txt
351 ], [0], [stdout])
352 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
353 [[usable protocols: OXM,NXM+table_id,OXM-OpenFlow14
354 chosen protocol: NXM+table_id
355 NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
356 NXT_FLOW_MOD: ADD table:255 in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
357 NXT_FLOW_MOD: ADD table:255 pkt_mark=0xbb actions=load:0xaa->NXM_NX_PKT_MARK[]
358 NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
359 NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
360 NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
361 NXT_FLOW_MOD: ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
362 NXT_FLOW_MOD: ADD table:255 actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
363 NXT_FLOW_MOD: ADD table:255 tcp,tun_id=0x1234,tp_src=0x1230/0xfff0 cookie:0x5678 actions=FLOOD
364 NXT_FLOW_MOD: ADD table:255 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
365 NXT_FLOW_MOD: ADD table:255 actions=multipath(eth_src,50,hrw,12,0,NXM_NX_REG0[0..3]),multipath(symmetric_l4,1024,iter_hash,5000,5050,NXM_NX_REG0[0..12])
366 NXT_FLOW_MOD: ADD table:1 actions=drop
367 NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
368 NXT_FLOW_MOD: ADD table:255 metadata=0x1234000056780000/0xffff0000ffff0000 actions=drop
369 NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
370 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
371 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
372 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
373 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
374 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
375 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
376 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
377 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
378 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3)
379 NXT_FLOW_MOD: ADD table:255 send_flow_rem actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
380 NXT_FLOW_MOD: ADD table:255 check_overlap actions=output:1,exit,output:2
381 NXT_FLOW_MOD: ADD table:255 tcp actions=fin_timeout(idle_timeout=5,hard_timeout=15)
382 NXT_FLOW_MOD: ADD table:255 actions=controller(reason=invalid_ttl,max_len=123,id=555)
383 NXT_FLOW_MOD: ADD table:255 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
384 ]])
385 AT_CLEANUP
386
387 AT_SETUP([ovs-ofctl -F nxm parse-flows])
388 AT_DATA([flows.txt], [
389 # comment
390 tcp,tp_src=123,actions=flood
391 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
392 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
393 ipv6,ipv6_label=0x12345 actions=2
394 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
395 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
396 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
397 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
398 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
399 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
400 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
401 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
402 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
403 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
404 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4F:0571/112 actions=drop
405 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
406 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
407 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE00:0000/96,nd_tll=00:0A:E4:25:6B:B1 actions=drop
408 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
409 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
410 tun_id=0x1234,cookie=0x5678,actions=flood
411 actions=drop
412 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
413 dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=drop
414 dl_dst=00:00:00:00:00:00/01:00:00:00:00:00,actions=drop
415 dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff,actions=drop
416 dl_dst=aa:bb:cc:dd:ee:ff/00:00:00:00:00:00,actions=drop
417 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
418 ])
419 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
420 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
421 usable protocols: NXM,OXM,OXM-OpenFlow14
422 chosen protocol: NXM-table_id
423 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
424 NXT_FLOW_MOD: ADD in_port=LOCAL,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
425 NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
426 NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
427 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
428 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
429 NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
430 NXT_FLOW_MOD: ADD tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
431 NXT_FLOW_MOD: ADD udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
432 NXT_FLOW_MOD: ADD icmp6,in_port=3,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
433 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
434 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
435 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
436 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571 actions=drop
437 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4f:0/112 actions=drop
438 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_sll=00:0a:e4:25:6b:b0 actions=drop
439 NXT_FLOW_MOD: ADD icmp6,icmp_type=136,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571,nd_tll=00:0a:e4:25:6b:b1 actions=drop
440 NXT_FLOW_MOD: ADD icmp6,icmp_type=136,nd_target=fec0:0:1234:f045:8fff:1111::/96,nd_tll=00:0a:e4:25:6b:b1 actions=drop
441 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
442 NXT_FLOW_MOD: ADD actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
443 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
444 NXT_FLOW_MOD: ADD actions=drop
445 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
446 NXT_FLOW_MOD: ADD dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=drop
447 NXT_FLOW_MOD: ADD dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=drop
448 NXT_FLOW_MOD: ADD dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff actions=drop
449 NXT_FLOW_MOD: ADD actions=drop
450 NXT_FLOW_MOD: ADD actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
451 ])
452 AT_CLEANUP
453
454 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
455 AT_DATA([flows.txt], [[
456 # comment
457 tcp,tp_src=123,actions=flood
458 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
459 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
460 ipv6,ipv6_label=0x12345 actions=2
461 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
462 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
463 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
464 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
465 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
466 sctp6,ipv6_src=2001:db8:3c4d:1::5,tp_dst=309 actions=drop
467 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
468 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
469 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
470 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
471 sctp,nw_src=192.168.0.3,tp_dst=309 actions=pop_queue,output:1
472 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
473 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
474 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
475 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
476 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
477 tun_id=0x1234,cookie=0x5678,actions=flood
478 actions=drop
479 reg0=123,actions=move:NXM_NX_REG0[0..5]->NXM_NX_REG1[26..31],load:55->NXM_NX_REG2[0..31],move:NXM_NX_REG0[0..31]->NXM_NX_TUN_ID[0..31],move:NXM_NX_REG0[0..15]->NXM_OF_VLAN_TCI[]
480 actions=move:OXM_OF_ETH_DST[]->OXM_OF_ETH_SRC[]
481 actions=push:NXM_NX_REG0[0..31],pop:NXM_NX_REG0[]
482 vlan_tci=0x1123/0x1fff,actions=drop
483 actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
484 ]])
485 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout], [stderr])
486 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
487 [[usable protocols: NXM,OXM,OXM-OpenFlow14
488 chosen protocol: NXM-table_id
489 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
490 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
491 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
492 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
493 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
494 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
495 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
496 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000001), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(0050) actions=drop
497 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000003), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(0035) actions=drop
498 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000005), NXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(0135) actions=drop
499 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(0003), NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000001), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(86) actions=drop
500 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_VLAN_TCI_W(f000/f000), NXM_OF_IP_PROTO(11) idle:5 actions=strip_vlan,output:0
501 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80003), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(0050) actions=set_queue:37,output:1
502 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80003), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(0035) actions=pop_queue,output:1
503 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80003), NXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(0135) actions=pop_queue,output:1
504 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(fec000001234f0458fff1111fe4e0571) actions=drop
505 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_SLL(000ae4256bb0) actions=drop
506 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(fec000001234f0458fff1111fe4e0571), NXM_NX_ND_TLL(000ae4256bb1) actions=drop
507 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
508 NXT_FLOW_MOD: ADD <any> actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
509 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
510 NXT_FLOW_MOD: ADD <any> actions=drop
511 NXT_FLOW_MOD: ADD NXM_NX_REG0(0000007b) actions=move:NXM_NX_REG0[0..5]->NXM_NX_REG1[26..31],load:0x37->NXM_NX_REG2[],move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],move:NXM_NX_REG0[0..15]->NXM_OF_VLAN_TCI[]
512 NXT_FLOW_MOD: ADD <any> actions=move:NXM_OF_ETH_DST[]->NXM_OF_ETH_SRC[]
513 NXT_FLOW_MOD: ADD <any> actions=push:NXM_NX_REG0[],pop:NXM_NX_REG0[]
514 NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop
515 NXT_FLOW_MOD: ADD <any> actions=sample(probability=12345,collector_set_id=23456,obs_domain_id=34567,obs_point_id=45678)
516 ]])
517 AT_CLEANUP
518
519 AT_SETUP([ovs-ofctl parse-nx-match])
520 AT_KEYWORDS([nx-match])
521 AT_DATA([nx-match.txt], [dnl
522 <any>
523
524 # in port
525 NXM_OF_IN_PORT(0000)
526 NXM_OF_IN_PORT(fffe)
527
528 # eth dst
529 NXM_OF_ETH_DST(0002e30f80a4)
530 NXM_OF_ETH_DST_W(010000000000/010000000000)
531 NXM_OF_ETH_DST_W(000000000000/010000000000)
532 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
533 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
534 NXM_OF_ETH_DST_W(60175619848f/000000000000)
535 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
536 NXM_OF_ETH_DST_W(60175619848f/5a5a5a5a5a5a)
537
538 # eth src
539 NXM_OF_ETH_SRC(020898456ddb)
540 NXM_OF_ETH_SRC_W(012345abcdef/ffffff555555)
541 NXM_OF_ETH_SRC_W(020898456ddb/ffffffffffff)
542 NXM_OF_ETH_SRC_W(020898456ddb/000000000000)
543
544 # eth type
545 NXM_OF_ETH_TYPE(0800)
546 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
547
548 # vlan tci
549 NXM_OF_VLAN_TCI(f009)
550 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
551 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
552 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
553 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
554 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
555 NXM_OF_VLAN_TCI_W(1123/ffff)    # Packets with VID=123, PCP=0
556 NXM_OF_VLAN_TCI_W(1123/0000)    # Packets with or without 802.1Q header
557 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
558 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
559
560 # IP TOS
561 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
562 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(41)
563 NXM_OF_IP_TOS(f0)
564
565 # IP ECN
566 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(03)
567 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(06)
568 NXM_NX_IP_ECN(03)
569
570 # IP protocol
571 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
572 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
573 NXM_OF_IP_PROTO(05)
574
575 # IP TTL
576 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_TTL(80)
577 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_TTL(ff)
578 NXM_NX_IP_TTL(80)
579
580 # IP source
581 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
582 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
583 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/5a5a5a5a)
584 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/ffffffff)
585 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/00000000)
586 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
587 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
588
589 # IP destination
590 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
591 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
592 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/5a5a5a5a)
593 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/ffffffff)
594 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/00000000)
595 NXM_OF_IP_DST(ac100014)
596 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
597
598 # TCP source port
599 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
600 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/F0F0)
601 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/ffff)
602 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/0000)
603 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
604
605 # TCP destination port
606 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
607 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/FFF0)
608 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/ffff)
609 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/0000)
610 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
611
612 # TCP flags
613 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS(0131)
614 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS_W(00F0/0FF0)
615 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS_W(01E2/ffff)
616 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_NX_TCP_FLAGS_W(00E1/0000)
617 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_NX_TCP_FLAGS(4321)
618
619 # UDP source port
620 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
621 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/01FF)
622 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/ffff)
623 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/0000)
624 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
625
626 # UDP destination port
627 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
628 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/F00F)
629 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/FFFF)
630 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/0000)
631 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
632
633 # ICMP type
634 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
635 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
636
637 # ICMP code
638 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
639 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
640 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
641 NXM_OF_ICMP_CODE(00)
642
643 # ARP opcode
644 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
645 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
646 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
647 NXM_OF_ARP_OP(0001)
648 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
649
650 # ARP source protocol address
651 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
652 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
653 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
654 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/ffffffff)
655 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/00000000)
656 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
657 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
658
659 # ARP destination protocol address
660 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
661 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
662 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/77777777)
663 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/ffffffff)
664 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/00000000)
665 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
666 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
667
668 # ARP source hardware address
669 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
670 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
671 NXM_NX_ARP_SHA(0002e30f80a4)
672
673 # ARP destination hardware address
674 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
675 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
676 NXM_NX_ARP_THA(0002e30f80a4)
677
678 # RARP opcode
679 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_OP(0003)
680 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_OP(1111)
681 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0003)
682 NXM_OF_ARP_OP(0003)
683 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_OP(0003) NXM_OF_ARP_OP(0003)
684
685 # RARP source protocol address
686 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA(ac100014)
687 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
688 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
689 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81234/ffffffff)
690 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_SPA_W(C0a81234/00000000)
691 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
692 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
693
694 # RARP destination protocol address
695 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA(ac100014)
696 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
697 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a81234/77777777)
698 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a81234/ffffffff)
699 NXM_OF_ETH_TYPE(8035) NXM_OF_ARP_TPA_W(C0a81234/00000000)
700 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
701 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
702
703 # RARP source hardware address
704 NXM_OF_ETH_TYPE(8035) NXM_NX_ARP_SHA(0002e30f80a4)
705 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
706 NXM_NX_ARP_SHA(0002e30f80a4)
707
708 # RARP destination hardware address
709 NXM_OF_ETH_TYPE(8035) NXM_NX_ARP_THA(0002e30f80a4)
710 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
711 NXM_NX_ARP_THA(0002e30f80a4)
712
713 # IPv6 source
714 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
715 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
716 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
717 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
718 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
719 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
720 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
721
722 # IPv6 destination
723 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
724 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
725 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/77777777777777777777777777777777)
726 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
727 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
728 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
729
730 # IPv6 Flow Label
731 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_LABEL(1000000f)
732 NXM_NX_IPV6_LABEL(0000000f)
733 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_LABEL(0000000f)
734
735 # ND target address
736 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
737 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
738 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/0123456789abcdeffedcba9876543210)
739 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/ffffffffffffffffffffffffffffffff)
740 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/00000000000000000000000000000000)
741 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/fedcba98765432100123456789abcdef)
742
743 # ND source hardware address
744 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
745 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
746 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3b) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
747 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_SLL(0002e30f80a4)
748
749 # ND destination hardware address
750 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
751 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
752 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3b) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
753 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005) NXM_NX_ND_TLL(0002e30f80a4)
754
755 # IPv4 fragments.
756 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(00)
757 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(01)
758 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(02)
759 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(03)
760 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/03)
761 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/fd)
762 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/02)
763 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(01/01)
764 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(02/02)
765 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/03)
766 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/ff)
767 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/00)
768 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(f3)
769
770 # IPv6 fragments.
771 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(00)
772 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(01)
773 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(02)
774 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(03)
775 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/03)
776 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/01)
777 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/02)
778 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(01/01)
779 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(02/02)
780 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/03)
781 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/00)
782 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/ff)
783 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(f3)
784
785 # Flow cookie.
786 NXM_NX_COOKIE(00000000abcdef01)
787 NXM_NX_COOKIE_W(84200000abcdef01/84200000FFFFFFFF)
788 NXM_NX_COOKIE_W(84200000abcdef01/ffffffffffffffff)
789 NXM_NX_COOKIE_W(84200000abcdef01/0000000000000000)
790
791 # Tunnel ID.
792 NXM_NX_TUN_ID(00000000abcdef01)
793 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
794 NXM_NX_TUN_ID_W(84200000abcdef01/FFFFFFFFFFFFFFFF)
795 NXM_NX_TUN_ID_W(84200000abcdef01/0000000000000000)
796
797 # Register 0.
798 NXM_NX_REG0(acebdf56)
799 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
800 NXM_NX_REG0_W(a0e0d050/ffffffff)
801 NXM_NX_REG0_W(a0e0d050/00000000)
802
803 # Invalid field number.
804 01020304(1111/2222)
805
806 # Unimplemented registers.
807 #
808 # This test assumes that at least two registers, but fewer than 16,
809 # registers are implemented.
810 00010004(12345678)
811 00010108(12345678/12345678)
812 00011e04(12345678)
813 00011f08(12345678/12345678)
814 ])
815 AT_CHECK([ovs-ofctl -vPATTERN:'console:%c|%p|%m' --strict parse-nx-match < nx-match.txt], [0], [dnl
816 <any>
817
818 # in port
819 NXM_OF_IN_PORT(0000)
820 NXM_OF_IN_PORT(fffe)
821
822 # eth dst
823 NXM_OF_ETH_DST(0002e30f80a4)
824 NXM_OF_ETH_DST_W(010000000000/010000000000)
825 NXM_OF_ETH_DST_W(000000000000/010000000000)
826 NXM_OF_ETH_DST_W(010000000000/010000000000)
827 NXM_OF_ETH_DST(0002e30f80a4)
828 <any>
829 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
830 NXM_OF_ETH_DST_W(40125218000a/5a5a5a5a5a5a)
831
832 # eth src
833 NXM_OF_ETH_SRC(020898456ddb)
834 NXM_OF_ETH_SRC_W(012345014545/ffffff555555)
835 NXM_OF_ETH_SRC(020898456ddb)
836 <any>
837
838 # eth type
839 NXM_OF_ETH_TYPE(0800)
840 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
841
842 # vlan tci
843 NXM_OF_VLAN_TCI(f009)
844 nx_pull_match() returned error OFPBMC_DUP_FIELD
845 NXM_OF_VLAN_TCI(0000)
846 NXM_OF_VLAN_TCI(3123)
847 NXM_OF_VLAN_TCI(0123)
848 NXM_OF_VLAN_TCI_W(1123/1fff)
849 NXM_OF_VLAN_TCI(1123)
850 <any>
851 NXM_OF_VLAN_TCI_W(f000/f000)
852 NXM_OF_VLAN_TCI_W(0000/e000)
853
854 # IP TOS
855 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
856 nx_pull_match() returned error OFPBMC_BAD_VALUE
857 nx_pull_match() returned error OFPBMC_BAD_PREREQ
858
859 # IP ECN
860 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
861 nx_pull_match() returned error OFPBMC_BAD_VALUE
862 nx_pull_match() returned error OFPBMC_BAD_PREREQ
863
864 # IP protocol
865 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
866 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
867 nx_pull_match() returned error OFPBMC_BAD_PREREQ
868
869 # IP TTL
870 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
871 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
872 nx_pull_match() returned error OFPBMC_BAD_PREREQ
873
874 # IP source
875 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
876 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
877 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(40080000/5a5a5a5a)
878 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(c0a80000)
879 NXM_OF_ETH_TYPE(0800)
880 nx_pull_match() returned error OFPBMC_BAD_PREREQ
881 nx_pull_match() returned error OFPBMC_BAD_PREREQ
882
883 # IP destination
884 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
885 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
886 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(40080000/5a5a5a5a)
887 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(c0a80000)
888 NXM_OF_ETH_TYPE(0800)
889 nx_pull_match() returned error OFPBMC_BAD_PREREQ
890 nx_pull_match() returned error OFPBMC_BAD_PREREQ
891
892 # TCP source port
893 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
894 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC_W(5050/f0f0)
895 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(5050)
896 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06)
897 nx_pull_match() returned error OFPBMC_BAD_PREREQ
898
899 # TCP destination port
900 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
901 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST_W(fde0/fff0)
902 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(fde0)
903 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06)
904 nx_pull_match() returned error OFPBMC_BAD_PREREQ
905
906 # TCP flags
907 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(0131)
908 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS_W(00f0/0ff0)
909 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_NX_TCP_FLAGS(01e2)
910 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06)
911 nx_pull_match() returned error OFPBMC_BAD_PREREQ
912
913 # UDP source port
914 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
915 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC_W(0132/01ff)
916 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(0132)
917 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11)
918 nx_pull_match() returned error OFPBMC_BAD_PREREQ
919
920 # UDP destination port
921 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
922 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST_W(5005/f00f)
923 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(5005)
924 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11)
925 nx_pull_match() returned error OFPBMC_BAD_PREREQ
926
927 # ICMP type
928 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
929 nx_pull_match() returned error OFPBMC_BAD_PREREQ
930
931 # ICMP code
932 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
933 nx_pull_match() returned error OFPBMC_BAD_PREREQ
934 nx_pull_match() returned error OFPBMC_BAD_PREREQ
935 nx_pull_match() returned error OFPBMC_BAD_PREREQ
936
937 # ARP opcode
938 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
939 nx_pull_match() returned error OFPBMC_BAD_VALUE
940 nx_pull_match() returned error OFPBMC_BAD_PREREQ
941 nx_pull_match() returned error OFPBMC_BAD_PREREQ
942 nx_pull_match() returned error OFPBMC_DUP_FIELD
943
944 # ARP source protocol address
945 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
946 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
947 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(80a80200/aaaaaa00)
948 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(c0a81234)
949 NXM_OF_ETH_TYPE(0806)
950 nx_pull_match() returned error OFPBMC_BAD_PREREQ
951 nx_pull_match() returned error OFPBMC_BAD_PREREQ
952
953 # ARP destination protocol address
954 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
955 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
956 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(40201234/77777777)
957 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(c0a81234)
958 NXM_OF_ETH_TYPE(0806)
959 nx_pull_match() returned error OFPBMC_BAD_PREREQ
960 nx_pull_match() returned error OFPBMC_BAD_PREREQ
961
962 # ARP source hardware address
963 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
964 nx_pull_match() returned error OFPBMC_BAD_PREREQ
965 nx_pull_match() returned error OFPBMC_BAD_PREREQ
966
967 # ARP destination hardware address
968 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
969 nx_pull_match() returned error OFPBMC_BAD_PREREQ
970 nx_pull_match() returned error OFPBMC_BAD_PREREQ
971
972 # RARP opcode
973 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_OP(0003)
974 nx_pull_match() returned error OFPBMC_BAD_VALUE
975 nx_pull_match() returned error OFPBMC_BAD_PREREQ
976 nx_pull_match() returned error OFPBMC_BAD_PREREQ
977 nx_pull_match() returned error OFPBMC_DUP_FIELD
978
979 # RARP source protocol address
980 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA(ac100014)
981 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
982 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA_W(80a80200/aaaaaa00)
983 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_SPA(c0a81234)
984 NXM_OF_ETH_TYPE(8035)
985 nx_pull_match() returned error OFPBMC_BAD_PREREQ
986 nx_pull_match() returned error OFPBMC_BAD_PREREQ
987
988 # RARP destination protocol address
989 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA(ac100014)
990 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
991 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA_W(40201234/77777777)
992 NXM_OF_ETH_TYPE(8035), NXM_OF_ARP_TPA(c0a81234)
993 NXM_OF_ETH_TYPE(8035)
994 nx_pull_match() returned error OFPBMC_BAD_PREREQ
995 nx_pull_match() returned error OFPBMC_BAD_PREREQ
996
997 # RARP source hardware address
998 NXM_OF_ETH_TYPE(8035), NXM_NX_ARP_SHA(0002e30f80a4)
999 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1000 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1001
1002 # RARP destination hardware address
1003 NXM_OF_ETH_TYPE(8035), NXM_NX_ARP_THA(0002e30f80a4)
1004 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1005 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1006
1007 # IPv6 source
1008 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
1009 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1010 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1011 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(00000818184800000000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
1012 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010000000000000000)
1013 NXM_OF_ETH_TYPE(86dd)
1014 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1015
1016 # IPv6 destination
1017 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
1018 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1019 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010530344500010000000000000000/77777777777777777777777777777777)
1020 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010000000000000000)
1021 NXM_OF_ETH_TYPE(86dd)
1022 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1023
1024 # IPv6 Flow Label
1025 nx_pull_match() returned error OFPBMC_BAD_VALUE
1026 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1027 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(0000000f)
1028
1029 # ND target address
1030 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
1031 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
1032 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET_W(00010520080900010000000000040000/0123456789abcdeffedcba9876543210)
1033 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
1034 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87)
1035 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET_W(20000898344400000002000300000005/fedcba98765432100123456789abcdef)
1036
1037 # ND source hardware address
1038 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005), NXM_NX_ND_SLL(0002e30f80a4)
1039 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1040 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1041 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1042
1043 # ND destination hardware address
1044 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005), NXM_NX_ND_TLL(0002e30f80a4)
1045 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1046 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1047 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1048
1049 # IPv4 fragments.
1050 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
1051 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(01)
1052 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(02)
1053 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
1054 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
1055 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/01)
1056 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
1057 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
1058 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
1059 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
1060 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
1061 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
1062 nx_pull_match() returned error OFPBMC_BAD_VALUE
1063
1064 # IPv6 fragments.
1065 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
1066 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(01)
1067 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(02)
1068 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
1069 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
1070 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/01)
1071 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
1072 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
1073 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
1074 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
1075 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
1076 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
1077 nx_pull_match() returned error OFPBMC_BAD_VALUE
1078
1079 # Flow cookie.
1080 NXM_NX_COOKIE(00000000abcdef01)
1081 NXM_NX_COOKIE_W(84200000abcdef01/84200000ffffffff)
1082 NXM_NX_COOKIE(84200000abcdef01)
1083 <any>
1084
1085 # Tunnel ID.
1086 NXM_NX_TUN_ID(00000000abcdef01)
1087 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
1088 NXM_NX_TUN_ID(84200000abcdef01)
1089 <any>
1090
1091 # Register 0.
1092 NXM_NX_REG0(acebdf56)
1093 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
1094 NXM_NX_REG0(a0e0d050)
1095 <any>
1096
1097 # Invalid field number.
1098 nx_pull_match() returned error OFPBMC_BAD_FIELD
1099
1100 # Unimplemented registers.
1101 #
1102 # This test assumes that at least two registers, but fewer than 16,
1103 # registers are implemented.
1104 NXM_NX_REG0(12345678)
1105 NXM_NX_REG0_W(12345678/12345678)
1106 nx_pull_match() returned error OFPBMC_BAD_FIELD
1107 nx_pull_match() returned error OFPBMC_BAD_FIELD
1108 ], [stderr])
1109
1110 # Check that at least the first warning made it.  (It's rate-limited
1111 # so a variable number could show up, especially under valgrind etc.)
1112 AT_CHECK([grep 'has 1-bits in value' stderr | sed 1q], [0], [dnl
1113 nx_match|WARN|NXM/OXM entry NXM_OF_ETH_DST_W(ffffffffffff/010000000000) has 1-bits in value for bits wildcarded by the mask.  (Future versions of OVS may report this as an OpenFlow error.)
1114 ])
1115
1116 # Check that there wasn't any other stderr output.
1117 AT_CHECK([grep -v 'has 1-bits in value' stderr], [1])
1118 AT_CLEANUP
1119
1120 AT_SETUP([ovs-ofctl parse-ofp10-match])
1121 AT_KEYWORDS([OF1.0])
1122 AT_DATA([test-data], [dnl
1123 # in_port=LOCAL
1124 003820fe fffe xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl
1125 xxxxxxxx xxxxxxxx xxxx xxxx
1126
1127 # dl_src=00:01:02:03:04:05
1128 003820fb xxxx 000102030405 xxxxxxxxxxxx xxxx xx xx xxxx xx xx xxxx dnl
1129 xxxxxxxx xxxxxxxx xxxx xxxx
1130
1131 # dl_dst=10:20:30:40:50:60
1132 003820f7 xxxx xxxxxxxxxxxx 102030405060 xxxx xx xx xxxx xx xx xxxx dnl
1133 xxxxxxxx xxxxxxxx xxxx xxxx
1134
1135 # dl_vlan=291
1136 003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx 0123 xx xx xxxx xx xx xxxx dnl
1137 xxxxxxxx xxxxxxxx xxxx xxxx
1138
1139 # dl_vlan_pcp=5
1140 002820ff xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx 05 xx xxxx xx xx xxxx dnl
1141 xxxxxxxx xxxxxxxx xxxx xxxx
1142
1143 # dl_vlan=291,dl_vlan_pcp=4
1144 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx 0123 04 xx xxxx xx xx xxxx dnl
1145 xxxxxxxx xxxxxxxx xxxx xxxx
1146
1147 # vlan_tci=0x0000
1148 003820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff xx xx xxxx xx xx xxxx dnl
1149 xxxxxxxx xxxxxxxx xxxx xxxx
1150
1151 dnl dl_vlan_pcp doesn't make sense when dl_vlan is "none", so
1152 dnl OVS ignores it and drops it on output.
1153 # vlan_tci=0x0000
1154 #  1: 28 -> 38
1155 # 20: 05 -> 00
1156 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx ffff 05 xx xxxx xx xx xxxx dnl
1157 xxxxxxxx xxxxxxxx xxxx xxxx
1158
1159 dnl Invalid VID and PCP discards out-of-range bits:
1160 # dl_vlan=256,dl_vlan_pcp=7
1161 # 18: f1 -> 01
1162 # 20: ff -> 07
1163 002820fd xxxx xxxxxxxxxxxx xxxxxxxxxxxx f100 ff xx xxxx xx xx xxxx dnl
1164 xxxxxxxx xxxxxxxx xxxx xxxx
1165
1166 # dl_type=0x1234
1167 003820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1168 xxxxxxxx xxxxxxxx xxxx xxxx
1169
1170 # ip,nw_proto=5
1171 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 05 xxxx dnl
1172 xxxxxxxx xxxxxxxx xxxx xxxx
1173
1174 dnl Ignore nw_proto if not IP or ARP:
1175 # dl_type=0x1234,nw_proto=5
1176 # normal:  3: cf -> ef
1177 # normal: 25: 05 -> 00
1178 & ofp_util|INFO|normalization changed ofp_match, details:
1179 & ofp_util|INFO| pre: dl_type=0x1234,nw_proto=5
1180 & ofp_util|INFO|post: dl_type=0x1234
1181 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx 05 xxxx dnl
1182 xxxxxxxx xxxxxxxx xxxx xxxx
1183
1184 # ip,nw_tos=252
1185 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 fc xx xxxx dnl
1186 xxxxxxxx xxxxxxxx xxxx xxxx
1187
1188 dnl Ignore nw_tos if not IP:
1189 # arp,nw_tos=4
1190 # 24: 05 -> 04
1191 # normal:  1: 18 -> 38
1192 # normal: 24: 04 -> 00
1193 & ofp_util|INFO|normalization changed ofp_match, details:
1194 & ofp_util|INFO| pre: arp,nw_tos=4
1195 & ofp_util|INFO|post: arp
1196 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 05 xx xxxx dnl
1197 xxxxxxxx xxxxxxxx xxxx xxxx
1198
1199 dnl Low 2 bits of invalid TOS are forced to 0:
1200 # ip,nw_tos=48
1201 # 24: 31 -> 30
1202 001820ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 31 xx xxxx dnl
1203 xxxxxxxx xxxxxxxx xxxx xxxx
1204
1205 # arp,arp_op=2
1206 003820cf xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx 02 xxxx dnl
1207 xxxxxxxx xxxxxxxx xxxx xxxx
1208
1209 # ip,nw_src=192.168.128.85
1210 003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1211 c0a88055 xxxxxxxx xxxx xxxx
1212
1213 # ip,nw_src=192.168.128.0/24
1214 # 31: 55 -> 00
1215 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1216 c0a88055 xxxxxxxx xxxx xxxx
1217
1218 # ip,nw_dst=192.168.128.85
1219 003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1220 xxxxxxxx c0a88055 xxxx xxxx
1221
1222 # ip,nw_dst=192.168.128.0/24
1223 # 35: 55 -> 00
1224 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx xx xxxx dnl
1225 xxxxxxxx c0a88055 xxxx xxxx
1226
1227 # arp,arp_spa=192.168.128.85
1228 003800ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1229 c0a88055 xxxxxxxx xxxx xxxx
1230
1231 # arp,arp_spa=192.168.128.0/24
1232 # 31: 55 -> 00
1233 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1234 c0a88055 xxxxxxxx xxxx xxxx
1235
1236 # arp,arp_tpa=192.168.128.85
1237 003020ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1238 xxxxxxxx c0a88055 xxxx xxxx
1239
1240 # arp,arp_tpa=192.168.128.0/24
1241 # 35: 55 -> 00
1242 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0806 xx xx xxxx dnl
1243 xxxxxxxx c0a88055 xxxx xxxx
1244
1245 dnl Ignore nw_src if not IP or ARP:
1246 # dl_type=0x1234,nw_src=192.168.128.0/24
1247 # 31: 55 -> 00
1248 # normal:  2: 08 -> 20
1249 # normal: 28: c0 -> 00
1250 # normal: 29: a8 -> 00
1251 # normal: 30: 80 -> 00
1252 & ofp_util|INFO|normalization changed ofp_match, details:
1253 & ofp_util|INFO| pre: dl_type=0x1234,nw_src=192.168.128.0/24
1254 & ofp_util|INFO|post: dl_type=0x1234
1255 003808ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1256 c0a88055 xxxxxxxx xxxx xxxx
1257
1258 dnl Ignore nw_dst if not IP or ARP:
1259 # dl_type=0x1234,nw_dst=192.168.128.0/24
1260 # 35: 55 -> 00
1261 # normal:  1: 32 -> 38
1262 # normal: 32: c0 -> 00
1263 # normal: 33: a8 -> 00
1264 # normal: 34: 80 -> 00
1265 & ofp_util|INFO|normalization changed ofp_match, details:
1266 & ofp_util|INFO| pre: dl_type=0x1234,nw_dst=192.168.128.0/24
1267 & ofp_util|INFO|post: dl_type=0x1234
1268 003220ef xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 1234 xx xx xxxx dnl
1269 xxxxxxxx c0a88055 xxxx xxxx
1270
1271 # tcp,tp_src=443
1272 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl
1273 xxxxxxxx xxxxxxxx 01bb xxxx
1274
1275 # tcp,tp_dst=443
1276 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 06 xxxx dnl
1277 xxxxxxxx xxxxxxxx xxxx 01bb
1278
1279 # udp,tp_src=443
1280 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl
1281 xxxxxxxx xxxxxxxx 01bb xxxx
1282
1283 # udp,tp_dst=443
1284 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 11 xxxx dnl
1285 xxxxxxxx xxxxxxxx xxxx 01bb
1286
1287 # sctp,tp_src=443
1288 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 84 xxxx dnl
1289 xxxxxxxx xxxxxxxx 01bb xxxx
1290
1291 # sctp,tp_dst=443
1292 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 84 xxxx dnl
1293 xxxxxxxx xxxxxxxx xxxx 01bb
1294
1295 # icmp,icmp_type=5
1296 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl
1297 xxxxxxxx xxxxxxxx 0005 xxxx
1298
1299 # icmp,icmp_code=8
1300 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 01 xxxx dnl
1301 xxxxxxxx xxxxxxxx xxxx 0008
1302
1303 dnl Ignore tp_src if not TCP/UDP/SCTP:
1304 # ip,nw_proto=21,tp_src=443
1305 # normal:  3: 8f -> cf
1306 # normal: 36: 01 -> 00
1307 # normal: 37: bb -> 00
1308 & ofp_util|INFO|normalization changed ofp_match, details:
1309 & ofp_util|INFO| pre: ip,nw_proto=21,tp_src=443
1310 & ofp_util|INFO|post: ip,nw_proto=21
1311 0038208f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl
1312 xxxxxxxx xxxxxxxx 01bb xxxx
1313
1314 dnl Ignore tp_dst if not TCP/UDP/SCTP:
1315 # ip,nw_proto=21,tp_dst=443
1316 # normal:  3: 4f -> cf
1317 # normal: 38: 01 -> 00
1318 # normal: 39: bb -> 00
1319 dnl The normalization details are suppressed here due to rate-limiting.
1320 0038204f xxxx xxxxxxxxxxxx xxxxxxxxxxxx xxxx xx xx 0800 xx 15 xxxx dnl
1321 xxxxxxxx xxxxxxxx xxxx 01bb
1322
1323 ])
1324 sed '/^[[#&]]/d' < test-data > input.txt
1325 sed -n 's/^# //p; /^$/p' < test-data > expout
1326 sed -n 's/^& //p' < test-data > experr
1327 AT_CAPTURE_FILE([input.txt])
1328 AT_CAPTURE_FILE([expout])
1329 AT_CAPTURE_FILE([experr])
1330 AT_CHECK(
1331   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp10-match < input.txt],
1332   [0], [expout], [experr])
1333 AT_CLEANUP
1334
1335 AT_SETUP([ovs-ofctl parse-ofp11-match])
1336 AT_KEYWORDS([OF1.1])
1337 AT_DATA([test-data], [dnl
1338 # in_port=LOCAL
1339 0000 0058 fffffffe 000003fe dnl
1340 000000000000ffffffffffff 000000000000ffffffffffff dnl
1341 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1342 00000000 00 000000 0000000000000000ffffffffffffffff
1343
1344 # bad ofp11_match: OFPBMC_BAD_VALUE
1345 & ofp_util|WARN|port 305419896 is outside the supported range 0 through 65279 or 0xffffff00 through 0xffffffff
1346 0000 0058 12345678 000003fe dnl
1347 000000000000ffffffffffff 000000000000ffffffffffff dnl
1348 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1349 00000000 00 000000 0000000000000000ffffffffffffffff
1350
1351 # dl_src=00:01:02:03:04:05
1352 0000 0058 00000000 000003ff dnl
1353 000102030405000000000000 000000000000ffffffffffff dnl
1354 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1355 00000000 00 000000 0000000000000000ffffffffffffffff
1356
1357 # dl_src=55:55:55:55:55:55/55:55:55:55:55:55
1358 0000 0058 00000000 000003ff dnl
1359 555555555555aaaaaaaaaaaa 000000000000ffffffffffff dnl
1360 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1361 00000000 00 000000 0000000000000000ffffffffffffffff
1362
1363 # dl_dst=00:01:02:03:04:05
1364 0000 0058 00000000 000003ff dnl
1365 000000000000ffffffffffff 000102030405000000000000 dnl
1366 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1367 00000000 00 000000 0000000000000000ffffffffffffffff
1368
1369 # dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
1370 0000 0058 00000000 000003ff dnl
1371 000000000000ffffffffffff 010000000000feffffffffff dnl
1372 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1373 00000000 00 000000 0000000000000000ffffffffffffffff
1374
1375 # dl_dst=00:01:02:03:04:05/fe:ff:ff:ff:ff:ff
1376 0000 0058 00000000 000003ff dnl
1377 000000000000ffffffffffff 000102030405010000000000 dnl
1378 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1379 00000000 00 000000 0000000000000000ffffffffffffffff
1380
1381 # dl_dst=55:55:55:55:55:55/55:55:55:55:55:55
1382 0000 0058 00000000 000003ff dnl
1383 000000000000ffffffffffff 555555555555aaaaaaaaaaaa dnl
1384 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1385 00000000 00 000000 0000000000000000ffffffffffffffff
1386
1387 dnl dl_vlan_pcp is ignored if dl_vlan is wildcarded, which causes the
1388 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1389 # in_port=1
1390 # 11: fa -> fe
1391 # 38: 03 -> 00
1392 0000 0058 00000001 000003fa dnl
1393 000000000000ffffffffffff 000000000000ffffffffffff dnl
1394 0000 03 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1395 00000000 00 000000 0000000000000000ffffffffffffffff
1396
1397 # dl_vlan=291
1398 0000 0058 00000000 000003fd dnl
1399 000000000000ffffffffffff 000000000000ffffffffffff dnl
1400 0123 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1401 00000000 00 000000 0000000000000000ffffffffffffffff
1402
1403 dnl OFPVID_NONE:
1404 # vlan_tci=0x0000
1405 0000 0058 00000000 000003fd dnl
1406 000000000000ffffffffffff 000000000000ffffffffffff dnl
1407 ffff 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1408 00000000 00 000000 0000000000000000ffffffffffffffff
1409
1410 dnl OFPVID_NONE ignores dl_vlan_pcp even if not wildcarded, which causes
1411 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
1412 # vlan_tci=0x0000
1413 # 11: f9 -> fd
1414 # 38: 05 -> 00
1415 0000 0058 00000000 000003f9 dnl
1416 000000000000ffffffffffff 000000000000ffffffffffff dnl
1417 ffff 05 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1418 00000000 00 000000 0000000000000000ffffffffffffffff
1419
1420 # vlan_tci=0x1000/0x1000
1421 0000 0058 00000000 000003fd dnl
1422 000000000000ffffffffffff 000000000000ffffffffffff dnl
1423 fffe 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1424 00000000 00 000000 0000000000000000ffffffffffffffff
1425
1426 dnl Try invalid VID:
1427 # bad ofp11_match: OFPBMC_BAD_VALUE
1428 0000 0058 00000000 000003fd dnl
1429 000000000000ffffffffffff 000000000000ffffffffffff dnl
1430 1234 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1431 00000000 00 000000 0000000000000000ffffffffffffffff
1432
1433 # dl_vlan_pcp=4
1434 0000 0058 00000000 000003f9 dnl
1435 000000000000ffffffffffff 000000000000ffffffffffff dnl
1436 fffe 04 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1437 00000000 00 000000 0000000000000000ffffffffffffffff
1438
1439 # dl_vlan=10,dl_vlan_pcp=6
1440 0000 0058 00000000 000003f9 dnl
1441 000000000000ffffffffffff 000000000000ffffffffffff dnl
1442 000a 06 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1443 00000000 00 000000 0000000000000000ffffffffffffffff
1444
1445 # dl_type=0x1234
1446 0000 0058 00000000 000003f7 dnl
1447 000000000000ffffffffffff 000000000000ffffffffffff dnl
1448 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1449 00000000 00 000000 0000000000000000ffffffffffffffff
1450
1451 # ip,nw_tos=252
1452 0000 0058 00000000 000003e7 dnl
1453 000000000000ffffffffffff 000000000000ffffffffffff dnl
1454 0000 00 00 0800 fc 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1455 00000000 00 000000 0000000000000000ffffffffffffffff
1456
1457 dnl Try invalid TOS:
1458 # bad ofp11_match: OFPBMC_BAD_VALUE
1459 0000 0058 00000000 000003e7 dnl
1460 000000000000ffffffffffff 000000000000ffffffffffff dnl
1461 0000 00 00 0800 01 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1462 00000000 00 000000 0000000000000000ffffffffffffffff
1463
1464 # ip,nw_proto=5
1465 0000 0058 00000000 000003d7 dnl
1466 000000000000ffffffffffff 000000000000ffffffffffff dnl
1467 0000 00 00 0800 00 05 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1468 00000000 00 000000 0000000000000000ffffffffffffffff
1469
1470 # arp,arp_op=2
1471 0000 0058 00000000 000003d7 dnl
1472 000000000000ffffffffffff 000000000000ffffffffffff dnl
1473 0000 00 00 0806 00 02 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1474 00000000 00 000000 0000000000000000ffffffffffffffff
1475
1476 # ip,nw_src=192.168.128.0/24
1477 0000 0058 00000000 000003f7 dnl
1478 000000000000ffffffffffff 000000000000ffffffffffff dnl
1479 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1480 00000000 00 000000 0000000000000000ffffffffffffffff
1481
1482 # ip,nw_src=128.160.128.0/165.165.165.165
1483 # 44: c0 -> 80
1484 # 45: a8 -> a0
1485 0000 0058 00000000 000003f7 dnl
1486 000000000000ffffffffffff 000000000000ffffffffffff dnl
1487 0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl
1488 00000000 00 000000 0000000000000000ffffffffffffffff
1489
1490 # ip,nw_dst=192.168.128.0/24
1491 0000 0058 00000000 000003f7 dnl
1492 000000000000ffffffffffff 000000000000ffffffffffff dnl
1493 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1494 00000000 00 000000 0000000000000000ffffffffffffffff
1495
1496 # ip,nw_dst=128.160.128.0/165.165.165.165
1497 # 52: c0 -> 80
1498 # 53: a8 -> a0
1499 0000 0058 00000000 000003f7 dnl
1500 000000000000ffffffffffff 000000000000ffffffffffff dnl
1501 0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
1502 00000000 00 000000 0000000000000000ffffffffffffffff
1503
1504 # arp,arp_spa=192.168.128.0/24
1505 0000 0058 00000000 000003f7 dnl
1506 000000000000ffffffffffff 000000000000ffffffffffff dnl
1507 0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
1508 00000000 00 000000 0000000000000000ffffffffffffffff
1509
1510 # arp,arp_tpa=192.168.128.0/24
1511 0000 0058 00000000 000003f7 dnl
1512 000000000000ffffffffffff 000000000000ffffffffffff dnl
1513 0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
1514 00000000 00 000000 0000000000000000ffffffffffffffff
1515
1516 # tcp,tp_src=443
1517 0000 0058 00000000 00000397 dnl
1518 000000000000ffffffffffff 000000000000ffffffffffff dnl
1519 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1520 00000000 00 000000 0000000000000000ffffffffffffffff
1521
1522 # tcp,tp_dst=443
1523 0000 0058 00000000 00000357 dnl
1524 000000000000ffffffffffff 000000000000ffffffffffff dnl
1525 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1526 00000000 00 000000 0000000000000000ffffffffffffffff
1527
1528 # udp,tp_src=443
1529 0000 0058 00000000 00000397 dnl
1530 000000000000ffffffffffff 000000000000ffffffffffff dnl
1531 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1532 00000000 00 000000 0000000000000000ffffffffffffffff
1533
1534 # icmp,icmp_type=5
1535 0000 0058 00000000 00000397 dnl
1536 000000000000ffffffffffff 000000000000ffffffffffff dnl
1537 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0005 0000 dnl
1538 00000000 00 000000 0000000000000000ffffffffffffffff
1539
1540 # icmp,icmp_code=8
1541 0000 0058 00000000 00000357 dnl
1542 000000000000ffffffffffff 000000000000ffffffffffff dnl
1543 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0000 0008 dnl
1544 00000000 00 000000 0000000000000000ffffffffffffffff
1545
1546 # udp,tp_src=443
1547 0000 0058 00000000 00000397 dnl
1548 000000000000ffffffffffff 000000000000ffffffffffff dnl
1549 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1550 00000000 00 000000 0000000000000000ffffffffffffffff
1551
1552 # udp,tp_dst=443
1553 0000 0058 00000000 00000357 dnl
1554 000000000000ffffffffffff 000000000000ffffffffffff dnl
1555 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1556 00000000 00 000000 0000000000000000ffffffffffffffff
1557
1558 # sctp
1559 0000 0058 00000000 000003d7 dnl
1560 000000000000ffffffffffff 000000000000ffffffffffff dnl
1561 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1562 00000000 00 000000 0000000000000000ffffffffffffffff
1563
1564 # sctp,tp_src=443
1565 0000 0058 00000000 00000397 dnl
1566 000000000000ffffffffffff 000000000000ffffffffffff dnl
1567 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1568 00000000 00 000000 0000000000000000ffffffffffffffff
1569
1570 # sctp,tp_dst=443
1571 0000 0058 00000000 00000357 dnl
1572 000000000000ffffffffffff 000000000000ffffffffffff dnl
1573 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1574 00000000 00 000000 0000000000000000ffffffffffffffff
1575
1576 dnl Ignore tp_src if not TCP/UDP/SCTP:
1577 # ip,nw_proto=21
1578 # 11: 97 -> d7
1579 # 60: 01 -> 00
1580 # 61: bb -> 00
1581 0000 0058 00000000 00000397 dnl
1582 000000000000ffffffffffff 000000000000ffffffffffff dnl
1583 0000 00 00 0800 00 15 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
1584 00000000 00 000000 0000000000000000ffffffffffffffff
1585
1586 dnl Ignore tp_dst if not TCP/UDP/SCTP:
1587 # ip,nw_proto=22
1588 # 11: 57 -> d7
1589 # 62: 01 -> 00
1590 # 63: bb -> 00
1591 0000 0058 00000000 00000357 dnl
1592 000000000000ffffffffffff 000000000000ffffffffffff dnl
1593 0000 00 00 0800 00 16 00000000ffffffff 00000000ffffffff 0000 01bb dnl
1594 00000000 00 000000 0000000000000000ffffffffffffffff
1595
1596 # mpls,mpls_label=284280
1597 # 64: 12 -> 00
1598 # 65: 34 -> 04
1599 0000 0058 00000000 000002f7 dnl
1600 000000000000ffffffffffff 000000000000ffffffffffff dnl
1601 0000 00 00 8847 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1602 12345678 00 000000 0000000000000000ffffffffffffffff
1603
1604 # mplsm,mpls_tc=2
1605 # 68: 5a -> 02
1606 0000 0058 00000000 000001f7 dnl
1607 000000000000ffffffffffff 000000000000ffffffffffff dnl
1608 0000 00 00 8848 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1609 00000000 5a 000000 0000000000000000ffffffffffffffff
1610
1611 dnl mpls_label and mpls_tc must be ignored if dl_type is not MPLS:
1612 # dl_type=0x1234
1613 # 10: 00 -> 03
1614 # 64: 12 -> 00
1615 # 65: 34 -> 00
1616 # 66: 56 -> 00
1617 # 67: 78 -> 00
1618 # 68: 5a -> 00
1619 0000 0058 00000000 000000f7 dnl
1620 000000000000ffffffffffff 000000000000ffffffffffff dnl
1621 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1622 12345678 5a 000000 0000000000000000ffffffffffffffff
1623
1624 dnl metadata match:
1625 # metadata=0x1234567890abcdef
1626 0000 0058 00000000 000003ff dnl
1627 000000000000ffffffffffff 000000000000ffffffffffff dnl
1628 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1629 00000000 00 000000 1234567890abcdef0000000000000000
1630
1631 dnl metadata match:
1632 # metadata=0x5555555555555555/0x5555555555555555
1633 0000 0058 00000000 000003ff dnl
1634 000000000000ffffffffffff 000000000000ffffffffffff dnl
1635 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1636 00000000 00 000000 5555555555555555aaaaaaaaaaaaaaaa
1637
1638 dnl metadata match:
1639 # metadata=0x1234000090ab0000/0xffff0000ffff0000
1640 # 74: 56 -> 00
1641 # 75: 78 -> 00
1642 # 78: cd -> 00
1643 # 79: ef -> 00
1644 0000 0058 00000000 000003ff dnl
1645 000000000000ffffffffffff 000000000000ffffffffffff dnl
1646 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
1647 00000000 00 000000 1234567890abcdef0000ffff0000ffff
1648
1649 ])
1650 sed '/^[[#&]]/d' < test-data > input.txt
1651 sed -n 's/^# //p; /^$/p' < test-data > expout
1652 sed -n 's/^& //p' < test-data > experr
1653 AT_CAPTURE_FILE([input.txt])
1654 AT_CAPTURE_FILE([expout])
1655 AT_CAPTURE_FILE([experr])
1656 AT_CHECK(
1657   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-match < input.txt],
1658   [0], [expout], [experr])
1659 AT_CLEANUP
1660
1661 AT_SETUP([ovs-ofctl parse-nx-match loose])
1662 AT_KEYWORDS([nx-match])
1663 AT_DATA([nx-match.txt], [dnl
1664 NXM_OF_IN_PORT(0001), 01020304(1111/2222), NXM_OF_ETH_TYPE(0800)
1665 ])
1666
1667 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
1668 nx_pull_match() returned error OFPBMC_BAD_FIELD
1669 ])
1670
1671 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
1672 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
1673 ])
1674 AT_CLEANUP
1675
1676 AT_SETUP([ovs-ofctl parse-oxm])
1677 AT_KEYWORDS([oxm])
1678 AT_DATA([oxm.txt], [dnl
1679 <any>
1680
1681 # in port
1682 OXM_OF_IN_PORT(00000000)
1683 OXM_OF_IN_PORT(fffffffe)
1684
1685 # metadata
1686 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1687 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1688 OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000)
1689 OXM_OF_METADATA_W(1234567890abcdef/ffffffffffffffff)
1690 OXM_OF_METADATA_W(1234567890abcdef/0000000000000000)
1691
1692 # eth dst
1693 OXM_OF_ETH_DST(0002e30f80a4)
1694 OXM_OF_ETH_DST_W(010000000000/010000000000)
1695 OXM_OF_ETH_DST_W(000000000000/010000000000)
1696 OXM_OF_ETH_DST_W(ffffffffffff/010000000000)
1697 OXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
1698 OXM_OF_ETH_DST_W(0002e30f80a4/000000000000)
1699 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1700
1701 # eth src
1702 OXM_OF_ETH_SRC(020898456ddb)
1703
1704 # eth type
1705 OXM_OF_ETH_TYPE(0800)
1706 OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
1707
1708 # vlan
1709 OXM_OF_VLAN_VID(1009) OXM_OF_VLAN_VID(1009) # Duplicate Field
1710 OXM_OF_VLAN_VID(f009)           # Bad Value
1711 OXM_OF_VLAN_PCP(00)             # Bad Pre-Requisite
1712 OXM_OF_VLAN_VID(0000)           # Packets without 802.1Q header or with VID=0
1713 OXM_OF_VLAN_VID(1123)           # Packets with VID=123, any PCP
1714 OXM_OF_VLAN_VID(1123) OXM_OF_VLAN_PCP(01) # Packets with VID=123, PCP=1.
1715 OXM_OF_VLAN_VID(0123)           # Does not make sense (but supported anyway)
1716 OXM_OF_VLAN_VID_W(0123/0123)      # Does not make sense (but supported anyway)
1717 OXM_OF_VLAN_VID_W(1123/0123)      # Does not make sense (but supported anyway)
1718 OXM_OF_VLAN_VID_W(0123/1123)      # Does not make sense (but supported anyway)
1719 OXM_OF_VLAN_VID(0123) OXM_OF_VLAN_PCP(01)  #Bad Pre-Requisite
1720 OXM_OF_VLAN_VID_W(1123/1fff)    # Packets with VID=123, any PCP.
1721 OXM_OF_VLAN_VID_W(1123/ffff)    # Packets with VID=123, any PCP.
1722 OXM_OF_VLAN_VID_W(1123/0000)    # Packets with or without 802.1Q header
1723 OXM_OF_VLAN_VID_W(1123/1f0f),   # Packets with # VID=123 (masked)
1724 OXM_OF_VLAN_VID_W(1123/1f0f), OXM_OF_VLAN_PCP(01)  # Packets with VID=123 (masked), any PCP.
1725 OXM_OF_VLAN_VID_W(1000/1000)    # Packets with any VID, any PCP
1726 OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01)  # Packets with any VID, PCP=1.
1727
1728 # IP TOS
1729 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(f0)
1730 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(41)
1731 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_DSCP(3f)
1732 OXM_OF_IP_DSCP(f0)
1733
1734 # IP ECN
1735 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
1736 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06)
1737 OXM_OF_IP_ECN(03)
1738
1739 # IP protocol
1740 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01)
1741 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(05)
1742 OXM_OF_IP_PROTO(05)
1743
1744 # IP source
1745 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC(ac100014)
1746 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFF0000)
1747 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFFFFFF)
1748 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/00000000)
1749 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_SRC(ac100014)
1750 OXM_OF_IPV4_SRC_W(C0D80000/FFFF0000)
1751
1752 # IP destination
1753 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST(ac100014)
1754 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFF0000)
1755 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFFFFFF)
1756 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/00000000)
1757 OXM_OF_IPV4_DST(ac100014)
1758 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_DST_W(C0D80000/FFFF0000)
1759
1760 # TCP source port
1761 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC(4231)
1762 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/F0F0)
1763 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/FFFF)
1764 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/0000)
1765 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_SRC(4231)
1766
1767 # TCP destination port
1768 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST(4231)
1769 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFF0)
1770 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFFF)
1771 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/0000)
1772 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_DST(4231)
1773
1774 # UDP source port
1775 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC(8732)
1776 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/01FF)
1777 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/FFFF)
1778 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/0000)
1779 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_UDP_SRC(7823)
1780
1781 # UDP destination port
1782 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST(1782)
1783 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/F00F)
1784 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/FFFF)
1785 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/0000)
1786 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_UDP_DST(1293)
1787
1788 # SCTP source port
1789 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC(8732)
1790 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/01FF)
1791 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/FFFF)
1792 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_SRC_W(0132/0000)
1793 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_SCTP_SRC(7823)
1794
1795 # SCTP destination port
1796 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST(1782)
1797 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/F00F)
1798 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/FFFF)
1799 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(84) OXM_OF_SCTP_DST_W(5005/0000)
1800 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_SCTP_DST(1293)
1801
1802 # ICMP type
1803 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_TYPE(12)
1804 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_TYPE(10)
1805
1806 # ICMP code
1807 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_CODE(12)
1808 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_CODE(10)
1809 OXM_OF_ETH_TYPE(0800) OXM_OF_ICMPV4_CODE(10)
1810 OXM_OF_ICMPV4_CODE(00)
1811
1812 # ARP opcode
1813 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001)
1814 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(1111)
1815 OXM_OF_ETH_TYPE(0000) OXM_OF_ARP_OP(0001)
1816 OXM_OF_ARP_OP(0001)
1817 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001) OXM_OF_ARP_OP(0001)
1818
1819 # ARP source protocol address
1820 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA(ac100014)
1821 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
1822 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFFFF)
1823 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/00000000)
1824 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SPA(ac100014)
1825 OXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
1826
1827 # ARP destination protocol address
1828 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA(ac100014)
1829 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
1830 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFFFF)
1831 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/00000000)
1832 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_TPA(ac100014)
1833 OXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
1834
1835 # ARP source hardware address
1836 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4)
1837 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4)
1838 OXM_OF_ARP_SHA(0002e30f80a4)
1839 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/ffffffffffff)
1840 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/000000000000)
1841 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA_W(0002e30f80a4/00000000000f)
1842
1843 # ARP destination hardware address
1844 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4)
1845 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4)
1846 OXM_OF_ARP_THA(0002e30f80a4)
1847 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/ffffffffffff)
1848 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/000000000000)
1849 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA_W(0002e30f80a4/00000000000f)
1850
1851 # IPv6 source
1852 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1853 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1854 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1855 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1856 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
1857 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1858
1859 # IPv6 destination
1860 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1861 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1862 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1863 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffffffffffffffffffff)
1864 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/00000000000000000000000000000000)
1865 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1866
1867 # IPv6 Flow Label
1868 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(1000000f)
1869 OXM_OF_IPV6_FLABEL(0000000f)
1870 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL(0000000f)
1871 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
1872 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000fffff)
1873 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/000ffff0)
1874 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/100fffff)
1875 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/ffffffff)
1876 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_FLABEL_W(0000000f/00000000)
1877
1878 # ND source hardware address
1879 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1880 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1881 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3b) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1882 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_SLL(0002e30f80a4)
1883
1884 # ND destination hardware address
1885 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1886 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1887 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3b) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1888 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
1889
1890 # Invalid field number.
1891 01020304(1111/2222)
1892 ])
1893 AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm < oxm.txt],
1894   [0], [dnl
1895 <any>
1896
1897 # in port
1898 OXM_OF_IN_PORT(00000000)
1899 OXM_OF_IN_PORT(fffffffe)
1900
1901 # metadata
1902 OXM_OF_METADATA(5a5a5a5a5a5a5a5a)
1903 OXM_OF_METADATA_W(0000000000000000/00000000ffffffff)
1904 OXM_OF_METADATA_W(1234000090ab0000/ffff0000ffff0000)
1905 OXM_OF_METADATA(1234567890abcdef)
1906 <any>
1907
1908 # eth dst
1909 OXM_OF_ETH_DST(0002e30f80a4)
1910 OXM_OF_ETH_DST_W(010000000000/010000000000)
1911 OXM_OF_ETH_DST_W(000000000000/010000000000)
1912 OXM_OF_ETH_DST_W(010000000000/010000000000)
1913 OXM_OF_ETH_DST(0002e30f80a4)
1914 <any>
1915 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1916
1917 # eth src
1918 OXM_OF_ETH_SRC(020898456ddb)
1919
1920 # eth type
1921 OXM_OF_ETH_TYPE(0800)
1922 OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
1923
1924 # vlan
1925 nx_pull_match() returned error OFPBMC_DUP_FIELD
1926 nx_pull_match() returned error OFPBMC_BAD_VALUE
1927 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1928 OXM_OF_VLAN_VID(0000)
1929 OXM_OF_VLAN_VID(1123)
1930 OXM_OF_VLAN_VID(1123), OXM_OF_VLAN_PCP(01)
1931 OXM_OF_VLAN_VID(0123)
1932 OXM_OF_VLAN_VID_W(0123/0123)
1933 OXM_OF_VLAN_VID_W(0123/0123)
1934 OXM_OF_VLAN_VID_W(0123/1123)
1935 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1936 OXM_OF_VLAN_VID(1123)
1937 OXM_OF_VLAN_VID(1123)
1938 <any>
1939 OXM_OF_VLAN_VID_W(1103/1f0f)
1940 OXM_OF_VLAN_VID_W(1103/1f0f), OXM_OF_VLAN_PCP(01)
1941 OXM_OF_VLAN_VID_W(1000/1000)
1942 OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01)
1943
1944 # IP TOS
1945 nx_pull_match() returned error OFPBMC_BAD_VALUE
1946 nx_pull_match() returned error OFPBMC_BAD_VALUE
1947 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_DSCP(3f)
1948 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1949
1950 # IP ECN
1951 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
1952 nx_pull_match() returned error OFPBMC_BAD_VALUE
1953 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1954
1955 # IP protocol
1956 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01)
1957 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(05)
1958 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1959
1960 # IP source
1961 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(ac100014)
1962 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC_W(c0a80000/ffff0000)
1963 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(c0a80000)
1964 OXM_OF_ETH_TYPE(0800)
1965 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1966 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1967
1968 # IP destination
1969 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(ac100014)
1970 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST_W(c0a80000/ffff0000)
1971 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(c0a88012)
1972 OXM_OF_ETH_TYPE(0800)
1973 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1974 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1975
1976 # TCP source port
1977 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(4231)
1978 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC_W(5050/f0f0)
1979 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(5050)
1980 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
1981 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1982
1983 # TCP destination port
1984 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(4231)
1985 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST_W(fde0/fff0)
1986 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(fde0)
1987 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06)
1988 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1989
1990 # UDP source port
1991 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(8732)
1992 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC_W(0132/01ff)
1993 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(0132)
1994 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
1995 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1996
1997 # UDP destination port
1998 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(1782)
1999 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST_W(5005/f00f)
2000 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(5005)
2001 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11)
2002 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2003
2004 # SCTP source port
2005 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC(8732)
2006 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC_W(0132/01ff)
2007 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_SRC(0132)
2008 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84)
2009 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2010
2011 # SCTP destination port
2012 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(1782)
2013 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST_W(5005/f00f)
2014 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84), OXM_OF_SCTP_DST(5005)
2015 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(84)
2016 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2017
2018 # ICMP type
2019 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_TYPE(12)
2020 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2021
2022 # ICMP code
2023 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_CODE(12)
2024 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2025 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2026 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2027
2028 # ARP opcode
2029 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_OP(0001)
2030 nx_pull_match() returned error OFPBMC_BAD_VALUE
2031 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2032 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2033 nx_pull_match() returned error OFPBMC_DUP_FIELD
2034
2035 # ARP source protocol address
2036 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(ac100014)
2037 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA_W(c0a81200/ffffff00)
2038 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(c0a81234)
2039 OXM_OF_ETH_TYPE(0806)
2040 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2041 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2042
2043 # ARP destination protocol address
2044 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(ac100014)
2045 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA_W(c0a81200/ffffff00)
2046 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(c0a812fe)
2047 OXM_OF_ETH_TYPE(0806)
2048 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2049 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2050
2051 # ARP source hardware address
2052 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
2053 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2054 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2055 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
2056 OXM_OF_ETH_TYPE(0806)
2057 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA_W(000000000004/00000000000f)
2058
2059 # ARP destination hardware address
2060 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
2061 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2062 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2063 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
2064 OXM_OF_ETH_TYPE(0806)
2065 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA_W(000000000004/00000000000f)
2066
2067 # IPv6 source
2068 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
2069 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2070 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
2071 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010000000000000000)
2072 OXM_OF_ETH_TYPE(86dd)
2073 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2074
2075 # IPv6 destination
2076 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
2077 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2078 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
2079 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010000000000000000)
2080 OXM_OF_ETH_TYPE(86dd)
2081 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2082
2083 # IPv6 Flow Label
2084 nx_pull_match() returned error OFPBMC_BAD_VALUE
2085 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2086 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2087 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(0000000f/0000000f)
2088 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2089 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL_W(00000000/000ffff0)
2090 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2091 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_FLABEL(0000000f)
2092 OXM_OF_ETH_TYPE(86dd)
2093
2094 # ND source hardware address
2095 OXM_OF_ETH_TYPE(86dd), OXM_OF_IP_PROTO(3a), OXM_OF_ICMPV6_TYPE(87), OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005), OXM_OF_IPV6_ND_SLL(0002e30f80a4)
2096 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2097 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2098 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2099
2100 # ND destination hardware address
2101 OXM_OF_ETH_TYPE(86dd), OXM_OF_IP_PROTO(3a), OXM_OF_ICMPV6_TYPE(88), OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005), OXM_OF_IPV6_ND_TLL(0002e30f80a4)
2102 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2103 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2104 nx_pull_match() returned error OFPBMC_BAD_PREREQ
2105
2106 # Invalid field number.
2107 nx_pull_match() returned error OFPBMC_BAD_FIELD
2108 ], [stderr])
2109
2110 # Check that at least the first warning made it.  (It's rate-limited
2111 # so a variable number could show up, especially under valgrind etc.)
2112 AT_CHECK([grep 'has 1-bits in value' stderr | sed 1q], [0], [dnl
2113 nx_match|WARN|NXM/OXM entry OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000) has 1-bits in value for bits wildcarded by the mask.  (Future versions of OVS may report this as an OpenFlow error.)
2114 ])
2115
2116 # Check that there wasn't any other stderr output.
2117 AT_CHECK([grep -v 'has 1-bits in value' stderr], [1])
2118 AT_CLEANUP
2119
2120 AT_SETUP([ovs-ofctl parse-oxm loose])
2121 AT_KEYWORDS([oxm])
2122 AT_DATA([oxm.txt], [dnl
2123 OXM_OF_IN_PORT(00000001), 01020304(1111/2222), OXM_OF_ETH_TYPE(0800)
2124 ])
2125
2126 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
2127 nx_pull_match() returned error OFPBMC_BAD_FIELD
2128 ])
2129
2130 AT_CHECK([ovs-ofctl parse-oxm < oxm.txt], [0], [dnl
2131 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
2132 ])
2133 AT_CLEANUP
2134
2135 dnl Check all of the patterns mentioned in the "VLAN Matching" section
2136 dnl in the DESIGN file at top level.
2137 AT_SETUP([ovs-ofctl check-vlan])
2138 AT_KEYWORDS([VLAN])
2139
2140 dnl [1]
2141 AT_CHECK([ovs-ofctl check-vlan 0000 0000], [0], [dnl
2142  -> 0000/0000
2143 NXM: <any> -> 0000/0000
2144 OXM: <any> -> 0000/0000,--
2145 OF1.0: 0000/1,00/1 -> 0000/0000
2146 OF1.1: 0000/1,00/1 -> 0000/0000
2147 ])
2148
2149 dnl [2]
2150 AT_CHECK([ovs-ofctl check-vlan 0000 ffff], [0], [dnl
2151 vlan_tci=0x0000 -> 0000/ffff
2152 NXM: NXM_OF_VLAN_TCI(0000) -> 0000/ffff
2153 OXM: OXM_OF_VLAN_VID(0000) -> 0000/1fff,--
2154 OF1.0: ffff/0,00/1 -> 0000/ffff
2155 OF1.1: ffff/0,00/1 -> 0000/ffff
2156 ])
2157
2158 dnl [3]
2159 AT_CHECK([ovs-ofctl check-vlan 1abc 1fff], [0], [dnl
2160 dl_vlan=2748 -> 1abc/1fff
2161 NXM: NXM_OF_VLAN_TCI_W(1abc/1fff) -> 1abc/1fff
2162 OXM: OXM_OF_VLAN_VID(1abc) -> 1abc/1fff,--
2163 OF1.0: 0abc/0,00/1 -> 1abc/1fff
2164 OF1.1: 0abc/0,00/1 -> 1abc/1fff
2165 ])
2166
2167 dnl [4]
2168 AT_CHECK([ovs-ofctl check-vlan b000 f000], [0], [dnl
2169 dl_vlan_pcp=5 -> b000/f000
2170 NXM: NXM_OF_VLAN_TCI_W(b000/f000) -> b000/f000
2171 OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(05) -> 1000/1000,05
2172 OF1.0: 0000/1,05/0 -> b000/f000
2173 OF1.1: fffe/0,05/0 -> b000/f000
2174 ])
2175
2176 dnl [5]
2177 AT_CHECK([ovs-ofctl check-vlan babc ffff], [0], [dnl
2178 dl_vlan=2748,dl_vlan_pcp=5 -> babc/ffff
2179 NXM: NXM_OF_VLAN_TCI(babc) -> babc/ffff
2180 OXM: OXM_OF_VLAN_VID(1abc), OXM_OF_VLAN_PCP(05) -> 1abc/1fff,05
2181 OF1.0: 0abc/0,05/0 -> babc/ffff
2182 OF1.1: 0abc/0,05/0 -> babc/ffff
2183 ])
2184
2185 dnl [6]
2186 AT_CHECK([ovs-ofctl check-vlan 0000 0fff], [0], [dnl
2187 vlan_tci=0x0000/0x0fff -> 0000/0fff
2188 NXM: NXM_OF_VLAN_TCI_W(0000/0fff) -> 0000/0fff
2189 OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
2190 OF1.0: 0000/0,00/1 -> 1000/1fff
2191 OF1.1: 0000/0,00/1 -> 1000/1fff
2192 ])
2193
2194 dnl [7]
2195 AT_CHECK([ovs-ofctl check-vlan 0000 f000], [0], [dnl
2196 vlan_tci=0x0000/0xf000 -> 0000/f000
2197 NXM: NXM_OF_VLAN_TCI_W(0000/f000) -> 0000/f000
2198 OXM: OXM_OF_VLAN_VID_W(0000/1000) -> 0000/1000,--
2199 OF1.0: ffff/0,00/1 -> 0000/ffff
2200 OF1.1: ffff/0,00/1 -> 0000/ffff
2201 ])
2202
2203 dnl [8]
2204 AT_CHECK([ovs-ofctl check-vlan 0000 efff], [0], [dnl
2205 vlan_tci=0x0000/0xefff -> 0000/efff
2206 NXM: NXM_OF_VLAN_TCI_W(0000/efff) -> 0000/efff
2207 OXM: OXM_OF_VLAN_VID_W(0000/0fff) -> 0000/0fff,--
2208 OF1.0: 0000/0,00/0 -> 1000/ffff
2209 OF1.1: 0000/0,00/0 -> 1000/ffff
2210 ])
2211
2212 dnl [9]
2213 AT_CHECK([ovs-ofctl check-vlan 1001 1001], [0], [dnl
2214 vlan_tci=0x1001/0x1001 -> 1001/1001
2215 NXM: NXM_OF_VLAN_TCI_W(1001/1001) -> 1001/1001
2216 OXM: OXM_OF_VLAN_VID_W(1001/1001) -> 1001/1001,--
2217 OF1.0: 0001/0,00/1 -> 1001/1fff
2218 OF1.1: 0001/0,00/1 -> 1001/1fff
2219 ])
2220
2221 dnl [10]
2222 AT_CHECK([ovs-ofctl check-vlan 3000 3000], [0], [dnl
2223 vlan_tci=0x3000/0x3000 -> 3000/3000
2224 NXM: NXM_OF_VLAN_TCI_W(3000/3000) -> 3000/3000
2225 OXM: OXM_OF_VLAN_VID_W(1000/1000), OXM_OF_VLAN_PCP(01) -> 1000/1000,01
2226 OF1.0: 0000/1,01/0 -> 3000/f000
2227 OF1.1: fffe/0,01/0 -> 3000/f000
2228 ])
2229 AT_CHECK
2230 AT_CLEANUP
2231
2232 dnl Check that "-F openflow10" rejects a flow_mod with unsupported features,
2233 dnl such as tunnels and metadata.
2234 AT_SETUP([ovs-ofctl -F option and NXM features])
2235 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
2236   [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM,OXM-OpenFlow14) is among the allowed flow formats (OpenFlow10)
2237 ])
2238 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy metadata=123,actions=drop],
2239   [1], [], [ovs-ofctl: none of the usable flow formats (NXM,OXM,OpenFlow11,OXM-OpenFlow14) is among the allowed flow formats (OpenFlow10)
2240 ])
2241 AT_CLEANUP
2242
2243 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
2244 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
2245 dnl additionally show up as the top 32 bits of the cookie.)  This checks
2246 dnl for regression against bug #4566.
2247 AT_SETUP([ovs-ofctl -F option with flow_mods])
2248 OVS_VSWITCHD_START
2249 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
2250 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
2251 NXST_FLOW reply:
2252  tun_id=0x12345678 actions=drop
2253 ])
2254 OVS_VSWITCHD_STOP
2255 AT_CLEANUP
2256
2257 dnl Check that "-F openflow10" is really honored on dump-flows.
2258 dnl (If it isn't, then dump-flows will show the register match.)
2259 AT_SETUP([ovs-ofctl dump-flows honors -F option])
2260 OVS_VSWITCHD_START
2261 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
2262 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
2263 OFPST_FLOW reply:
2264  actions=drop
2265 ])
2266 OVS_VSWITCHD_STOP
2267 AT_CLEANUP
2268
2269 dnl Check that "-F openflow10" fails on dump-flows if the requested match
2270 dnl can't be represented in OpenFlow 1.0.
2271 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
2272 OVS_VSWITCHD_START
2273 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
2274   [ovs-ofctl: none of the usable flow formats (NXM,OXM,OXM-OpenFlow14) is among the allowed flow formats (OpenFlow10)
2275 ])
2276 OVS_VSWITCHD_STOP
2277 AT_CLEANUP
2278
2279 dnl Check that add-flow reports non-normalized flows (feature #5029).
2280 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
2281 OVS_VSWITCHD_START
2282 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
2283   [0], [], [dnl
2284 ofp_util|INFO|normalization changed ofp_match, details:
2285 ofp_util|INFO| pre: nw_src=1.2.3.4
2286 ofp_util|INFO|post: @&t@
2287 ])
2288 OVS_VSWITCHD_STOP
2289 AT_CLEANUP
2290
2291 dnl Check that --sort and --rsort works with dump-flows
2292 dnl Default field is 'priority'. Flow entries are displayed based
2293 dnl on field to sort.
2294 AT_SETUP([ovs-ofctl dump-flows with sorting])
2295 OVS_VSWITCHD_START
2296 AT_KEYWORDS([sort])
2297 AT_DATA([allflows.txt], [[
2298 priority=4,in_port=23213 actions=output:42
2299 priority=5,in_port=1029 actions=output:43
2300 priority=7,in_port=1029 actions=output:43
2301 priority=3,in_port=1028 actions=output:44
2302 priority=1,in_port=1026 actions=output:45
2303 priority=6,in_port=1027 actions=output:64
2304 priority=2,in_port=1025 actions=output:47
2305 priority=8,tcp,tp_src=5 actions=drop
2306 priority=9,tcp,tp_src=6 actions=drop
2307 ]])
2308
2309 AT_CHECK([ovs-ofctl add-flows br0 allflows.txt
2310 ], [0], [ignore])
2311 AT_CHECK([ovs-ofctl --sort dump-flows br0 | ofctl_strip], [0], [dnl
2312  priority=1,in_port=1026 actions=output:45
2313  priority=2,in_port=1025 actions=output:47
2314  priority=3,in_port=1028 actions=output:44
2315  priority=4,in_port=23213 actions=output:42
2316  priority=5,in_port=1029 actions=output:43
2317  priority=6,in_port=1027 actions=output:64
2318  priority=7,in_port=1029 actions=output:43
2319  priority=8,tcp,tp_src=5 actions=drop
2320  priority=9,tcp,tp_src=6 actions=drop
2321 ])
2322 AT_CHECK([ovs-ofctl --rsort dump-flows br0 | ofctl_strip], [0], [dnl
2323  priority=9,tcp,tp_src=6 actions=drop
2324  priority=8,tcp,tp_src=5 actions=drop
2325  priority=7,in_port=1029 actions=output:43
2326  priority=6,in_port=1027 actions=output:64
2327  priority=5,in_port=1029 actions=output:43
2328  priority=4,in_port=23213 actions=output:42
2329  priority=3,in_port=1028 actions=output:44
2330  priority=2,in_port=1025 actions=output:47
2331  priority=1,in_port=1026 actions=output:45
2332 ])
2333 AT_CHECK([ovs-ofctl --sort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
2334  priority=2,in_port=1025 actions=output:47
2335  priority=1,in_port=1026 actions=output:45
2336  priority=6,in_port=1027 actions=output:64
2337  priority=3,in_port=1028 actions=output:44
2338  priority=7,in_port=1029 actions=output:43
2339  priority=5,in_port=1029 actions=output:43
2340  priority=4,in_port=23213 actions=output:42
2341  priority=9,tcp,tp_src=6 actions=drop
2342  priority=8,tcp,tp_src=5 actions=drop
2343 ])
2344 AT_CHECK([ovs-ofctl --rsort=in_port dump-flows br0 | ofctl_strip], [0], [dnl
2345  priority=4,in_port=23213 actions=output:42
2346  priority=7,in_port=1029 actions=output:43
2347  priority=5,in_port=1029 actions=output:43
2348  priority=3,in_port=1028 actions=output:44
2349  priority=6,in_port=1027 actions=output:64
2350  priority=1,in_port=1026 actions=output:45
2351  priority=2,in_port=1025 actions=output:47
2352  priority=9,tcp,tp_src=6 actions=drop
2353  priority=8,tcp,tp_src=5 actions=drop
2354 ])
2355 AT_CHECK([ovs-ofctl --sort=tcp_src dump-flows br0 | ofctl_strip], [0], [dnl
2356  priority=8,tcp,tp_src=5 actions=drop
2357  priority=9,tcp,tp_src=6 actions=drop
2358  priority=7,in_port=1029 actions=output:43
2359  priority=6,in_port=1027 actions=output:64
2360  priority=5,in_port=1029 actions=output:43
2361  priority=4,in_port=23213 actions=output:42
2362  priority=3,in_port=1028 actions=output:44
2363  priority=2,in_port=1025 actions=output:47
2364  priority=1,in_port=1026 actions=output:45
2365 ])
2366 AT_CHECK(
2367   [ovs-ofctl --sort=in_port --sort=tcp_src dump-flows br0 | ofctl_strip], [0],
2368   [ priority=2,in_port=1025 actions=output:47
2369  priority=1,in_port=1026 actions=output:45
2370  priority=6,in_port=1027 actions=output:64
2371  priority=3,in_port=1028 actions=output:44
2372  priority=7,in_port=1029 actions=output:43
2373  priority=5,in_port=1029 actions=output:43
2374  priority=4,in_port=23213 actions=output:42
2375  priority=8,tcp,tp_src=5 actions=drop
2376  priority=9,tcp,tp_src=6 actions=drop
2377 ])
2378 OVS_VSWITCHD_STOP
2379 AT_CLEANUP
2380
2381 AT_SETUP([ovs-ofctl diff-flows])
2382 OVS_VSWITCHD_START
2383
2384 # Add tons of flows to br0.
2385 for i in `seq 0 1023`; do echo "dl_vlan=$i,actions=drop"; done > add-flows.txt
2386 AT_CHECK([ovs-ofctl add-flows br0 add-flows.txt])
2387
2388 # Dump them and compare against what we expect by hand, then with diff-flows.
2389 for i in `seq 0 1023`; do echo " dl_vlan=$i actions=drop"; done | sort > expout
2390 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip | sed '/NXST_FLOW/d' | sort],
2391   [0], [expout])
2392 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt])
2393
2394 # Remove even-numbered flows, compare again.
2395 for i in `seq 0 1023 2`; do echo "dl_vlan=$i"; done > del-flows.txt
2396 AT_CHECK([ovs-ofctl del-flows br0 - < del-flows.txt])
2397 for i in `seq 0 1023 2`; do echo "+dl_vlan=$i actions=drop"; done | sort > expout
2398 AT_CHECK([ovs-ofctl diff-flows br0 add-flows.txt | sort], [0], [expout])
2399 for i in `seq 0 1023 2`; do echo "-dl_vlan=$i actions=drop"; done | sort > expout
2400 AT_CHECK([ovs-ofctl diff-flows add-flows.txt br0 | sort], [0], [expout])
2401
2402 OVS_VSWITCHD_STOP
2403 AT_CLEANUP
2404
2405 dnl ofpacts that differ bytewise don't necessarily differ when
2406 dnl converted to another representation, such as OpenFlow 1.0
2407 dnl or to a string.  "resubmit(,1)" is an example of an action
2408 dnl of this type: "ofpact_resubmit"s can differ in their "compat"
2409 dnl values even though this doesn't affect the string format.
2410 dnl
2411 dnl This test checks that "ovs-ofctl diff-flows" doesn't report
2412 dnl false ofpacts differences.
2413 AT_SETUP([ovs-ofctl diff-flows - suppress false differences])
2414 OVS_VSWITCHD_START
2415 AT_DATA([flows.txt], [actions=resubmit(,1)
2416 ])
2417 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2418 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt])
2419 AT_CHECK([ovs-ofctl add-flow br0 idle_timeout=60,dl_vlan=9,actions=output:1])
2420 AT_CHECK([ovs-ofctl diff-flows br0 flows.txt], [2], [dnl
2421 -dl_vlan=9 idle_timeout=60 actions=output:1
2422 ])
2423 AT_CHECK([ovs-ofctl add-flow br0 hard_timeout=120,cookie=1234,dl_vlan=9,actions=output:1])
2424 AT_CHECK([ovs-ofctl diff-flows flows.txt br0], [2], [dnl
2425 +dl_vlan=9 cookie=0x4d2 hard_timeout=120 actions=output:1
2426 ])
2427 OVS_VSWITCHD_STOP
2428 AT_CLEANUP
2429
2430 AT_SETUP([ovs-ofctl -F and -O interaction])
2431 AT_CHECK([ovs-ofctl -F oxm -O openflow10], [1], [],
2432   [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.)
2433 ])
2434 AT_CHECK([ovs-ofctl -F oxm -O openflow11], [1], [],
2435   [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.)
2436 ])
2437 AT_CHECK([ovs-ofctl -F oxm -O openflow10,openflow11], [1], [],
2438   [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.)
2439 ])
2440 AT_CHECK([ovs-ofctl -F oxm -O openflow10,openflow12], [1], [],
2441  [ovs-ofctl: missing command name; use --help for help
2442 ])
2443 AT_CHECK([ovs-ofctl -F oxm -O openflow12], [1], [],
2444   [ovs-ofctl: missing command name; use --help for help
2445 ])
2446 AT_CHECK([ovs-ofctl -F oxm -O openflow13], [1], [],
2447   [ovs-ofctl: missing command name; use --help for help
2448 ])
2449 AT_CLEANUP
2450
2451 AT_SETUP([ovs-ofctl ofp-parse])
2452 # Test the echo request/reply messages (0 payload).
2453 AT_CHECK([printf '\1\2\0\10\0\0\0\0\1\3\0\10\0\0\0\0' > binary_ofp_msg])
2454 AT_CHECK([ovs-ofctl ofp-parse binary_ofp_msg], [0], [dnl
2455 OFPT_ECHO_REQUEST (xid=0x0): 0 bytes of payload
2456 OFPT_ECHO_REPLY (xid=0x0): 0 bytes of payload
2457 ])
2458
2459 # Test the hello (xid:1 3-byte payload).
2460 AT_CHECK([printf '\1\0\0\13\0\0\0\1\101\102\103' > binary_ofp_msg])
2461 AT_CHECK([ovs-ofctl ofp-parse - < binary_ofp_msg], [0], [dnl
2462 OFPT_HELLO (xid=0x1):
2463  version bitmap: 0x01
2464  unknown data in hello:
2465 00000000  01 00 00 0b 00 00 00 01-41 42 43                |........ABC     |
2466 ])
2467 AT_CLEANUP
2468
2469 AT_SETUP([tcp flags - filtering])
2470 OVS_VSWITCHD_START([add-port br0 p1 -- set Interface p1 type=dummy ofport_request=1 \
2471                     -- add-port br0 p2 -- set Interface p2 type=dummy ofport_request=2])
2472 AT_DATA([flows.txt], [dnl
2473         in_port=1,tcp,tp_dst=80,tcp_flags=+syn-rst-ack-fin,action=2  # Allow outbound web traffic bare-SYN
2474         in_port=1,tcp,tp_dst=80,tcp_flags=+ack,action=2  # Allow outbound web traffic with ACK bit
2475         in_port=1,tcp,tp_dst=80,tcp_flags=+rst,action=2  # Allow outbound web traffic with RST bit
2476         in_port=2,tcp,tp_src=80,tcp_flags=+ack,action=1  # Allow inbound web traffic with ACK bit
2477         in_port=2,tcp,tp_src=80,tcp_flags=+rst,action=1  # Allow inbound web traffic with RST bit
2478         priority=0,in_port=1,action=drop  # Default drop outbound
2479         priority=0,in_port=2,action=drop  # Default drop inbound
2480 ])
2481
2482 AT_CHECK([ovs-ofctl add-flows br0 flows.txt])
2483
2484 AT_CHECK([ovs-ofctl add-flow br0 "tcp,tcp_flags=+ack-ack,action="], [1], [],
2485   [ovs-ofctl: ack: Each TCP flag can be specified only once
2486 ])
2487
2488 AT_CHECK([ovs-appctl dpif/show | tail -n +4], [0], [dnl
2489                 p1 1/1: (dummy)
2490                 p2 2/2: (dummy)
2491 ])
2492
2493 dnl Outbound web traffic with bare-SYN
2494 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x002)'], [0], [stdout])
2495 AT_CHECK([tail -1 stdout], [0],
2496   [Datapath actions: 2
2497 ])
2498
2499 dnl Outbopund web traffic with ACK bit
2500 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x110)'], [0], [stdout])
2501 AT_CHECK([tail -1 stdout], [0],
2502   [Datapath actions: 2
2503 ])
2504
2505 dnl Outbound web traffic with RST bit
2506 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=50:54:00:00:00:05,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=6,tos=0,ttl=64,frag=no),tcp(src=8,dst=80),tcp_flags(0x104)'], [0], [stdout])
2507 AT_CHECK([tail -1 stdout], [0],
2508   [Datapath actions: 2
2509 ])
2510
2511 dnl Inbound web traffic with ACK bit
2512 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0x010)'], [0], [stdout])
2513 AT_CHECK([tail -1 stdout], [0],
2514   [Datapath actions: 1
2515 ])
2516
2517 dnl Inbound web traffic with RST bit
2518 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0x014)'], [0], [stdout])
2519 AT_CHECK([tail -1 stdout], [0],
2520   [Datapath actions: 1
2521 ])
2522
2523 dnl Inbound web traffic with SYN bit without ACK or RST bits
2524 AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(2),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:05),eth_type(0x0800),ipv4(src=192.168.0.2,dst=192.168.0.1,proto=6,tos=0,ttl=64,frag=no),tcp(src=80,dst=8),tcp_flags(0xfeb)'], [0], [stdout])
2525 AT_CHECK([tail -1 stdout], [0],
2526   [Datapath actions: drop
2527 ])
2528
2529 OVS_VSWITCHD_STOP
2530 AT_CLEANUP