meta-flow: Accept NXM and OXM field names, support NXM and OXM for output.
[openvswitch] / tests / ovs-ofctl.at
1 AT_BANNER([ovs-ofctl])
2
3 AT_SETUP([ovs-ofctl parse-flows (OpenFlow 1.0)])
4 AT_DATA([flows.txt], [[
5 # comment
6 tcp,tp_src=123,actions=flood
7 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
8 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
9 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
10 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
11 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
12 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
13 ]])
14
15 AT_CHECK([ovs-ofctl parse-flows flows.txt
16 ], [0], [stdout])
17 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
18 [[usable protocols: any
19 chosen protocol: OpenFlow10-table_id
20 OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
21 OFPT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
22 OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
23 OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
24 OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
25 OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
26 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
27 ]])
28 AT_CLEANUP
29
30 AT_SETUP([ovs-ofctl parse-flows (NXM)])
31 AT_DATA([flows.txt], [[
32 # comment
33 tcp,tp_src=123,actions=flood
34 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
35 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
36 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
37 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
38 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
39 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
40 tcp,tp_src=0x1230/0xfff0,tun_id=0x1234,cookie=0x5678,actions=flood
41 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel:0x123456789
42 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])
43 table=1,actions=drop
44 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
45 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
46 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
47 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
48 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
49 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
50 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
51 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:[2,3])
52 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
53 actions=output:1,bundle_load(eth_src,0,hrw,ofport,NXM_NX_REG0[16..31],slaves:1),output:2
54 actions=resubmit:1,resubmit(2),resubmit(,3),resubmit(2,3)
55 send_flow_rem,actions=output:1,output:NXM_NX_REG0[],output:2,output:NXM_NX_REG1[16..31],output:3
56 check_overlap,actions=output:1,exit,output:2
57 actions=fin_timeout(idle_timeout=5,hard_timeout=15)
58 actions=controller(max_len=123,reason=invalid_ttl,id=555)
59 ]])
60
61 AT_CHECK([ovs-ofctl parse-flows flows.txt
62 ], [0], [stdout])
63 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
64 [[usable protocols: NXM+table_id
65 chosen protocol: NXM+table_id
66 NXT_FLOW_MOD: ADD table:255 tcp,tp_src=123 actions=FLOOD
67 NXT_FLOW_MOD: ADD table:255 in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
68 NXT_FLOW_MOD: ADD table:255 udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
69 NXT_FLOW_MOD: ADD table:255 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
70 NXT_FLOW_MOD: ADD table:255 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
71 NXT_FLOW_MOD: ADD table:255 priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
72 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
73 NXT_FLOW_MOD: ADD table:255 tcp,tun_id=0x1234,tp_src=0x1230/0xfff0 cookie:0x5678 actions=FLOOD
74 NXT_FLOW_MOD: ADD table:255 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
75 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])
76 NXT_FLOW_MOD: ADD table:1 actions=drop
77 NXT_FLOW_MOD: ADD table:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
78 NXT_FLOW_MOD: ADD table:255 actions=bundle(eth_src,50,active_backup,ofport,slaves:1)
79 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:2,3)
80 NXT_FLOW_MOD: ADD table:255 actions=bundle(symmetric_l4,60,hrw,ofport,slaves:)
81 NXT_FLOW_MOD: ADD table:255 actions=output:1,bundle(eth_src,0,hrw,ofport,slaves:1),output:2
82 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(eth_src,50,active_backup,ofport,NXM_NX_REG0[],slaves:1)
83 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
84 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..15],slaves:2,3)
85 NXT_FLOW_MOD: ADD table:255 actions=bundle_load(symmetric_l4,60,hrw,ofport,NXM_NX_REG0[0..30],slaves:)
86 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
87 NXT_FLOW_MOD: ADD table:255 actions=resubmit:1,resubmit:2,resubmit(,3),resubmit(2,3)
88 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
89 NXT_FLOW_MOD: ADD table:255 check_overlap actions=output:1,exit,output:2
90 NXT_FLOW_MOD: ADD table:255 actions=fin_timeout(idle_timeout=5,hard_timeout=15)
91 NXT_FLOW_MOD: ADD table:255 actions=controller(reason=invalid_ttl,max_len=123,id=555)
92 ]])
93 AT_CLEANUP
94
95 AT_SETUP([ovs-ofctl -F nxm parse-flows])
96 AT_DATA([flows.txt], [
97 # comment
98 tcp,tp_src=123,actions=flood
99 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
100 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
101 ipv6,ipv6_label=0x12345 actions=2
102 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
103 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
104 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
105 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
106 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
107 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
108 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
109 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
110 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
111 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
112 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4F:0571/112 actions=drop
113 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
114 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
115 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE00:0000/96,nd_tll=00:0A:E4:25:6B:B1 actions=drop
116 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
117 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
118 tun_id=0x1234,cookie=0x5678,actions=flood
119 actions=drop
120 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
121 dl_dst=01:00:00:00:00:00/01:00:00:00:00:00,actions=drop
122 dl_dst=00:00:00:00:00:00/01:00:00:00:00:00,actions=drop
123 dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff,actions=drop
124 dl_dst=aa:bb:cc:dd:ee:ff/00:00:00:00:00:00,actions=drop
125 ])
126 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
127 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
128 usable protocols: NXM
129 chosen protocol: NXM-table_id
130 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
131 NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
132 NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
133 NXT_FLOW_MOD: ADD ipv6,ipv6_label=0x12345 actions=output:2
134 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
135 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
136 NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
137 NXT_FLOW_MOD: ADD tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
138 NXT_FLOW_MOD: ADD udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
139 NXT_FLOW_MOD: ADD icmp6,in_port=3,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
140 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
141 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
142 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
143 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571 actions=drop
144 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4f:0/112 actions=drop
145 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_sll=00:0a:e4:25:6b:b0 actions=drop
146 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
147 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
148 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
149 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
150 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
151 NXT_FLOW_MOD: ADD actions=drop
152 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
153 NXT_FLOW_MOD: ADD dl_dst=01:00:00:00:00:00/01:00:00:00:00:00 actions=drop
154 NXT_FLOW_MOD: ADD dl_dst=00:00:00:00:00:00/01:00:00:00:00:00 actions=drop
155 NXT_FLOW_MOD: ADD dl_dst=aa:bb:cc:dd:ee:ff/fe:ff:ff:ff:ff:ff actions=drop
156 NXT_FLOW_MOD: ADD actions=drop
157 ])
158 AT_CLEANUP
159
160 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
161 AT_DATA([flows.txt], [[
162 # comment
163 tcp,tp_src=123,actions=flood
164 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
165 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
166 ipv6,ipv6_label=0x12345 actions=2
167 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
168 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
169 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
170 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
171 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
172 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
173 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
174 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
175 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
176 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
177 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
178 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
179 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
180 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
181 tun_id=0x1234,cookie=0x5678,actions=flood
182 actions=drop
183 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[]
184 actions=move:OXM_OF_ETH_DST[]->OXM_OF_ETH_SRC[]
185 actions=autopath(5,NXM_NX_REG0[])
186 vlan_tci=0x1123/0x1fff,actions=drop
187 ]])
188 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout])
189 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
190 [[usable protocols: NXM
191 chosen protocol: NXM-table_id
192 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
193 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
194 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
195 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
196 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
197 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
198 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
199 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
200 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
201 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
202 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
203 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
204 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
205 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
206 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
207 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
208 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
209 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
210 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
211 NXT_FLOW_MOD: ADD <any> actions=drop
212 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[]
213 NXT_FLOW_MOD: ADD <any> actions=move:NXM_OF_ETH_DST[]->NXM_OF_ETH_SRC[]
214 NXT_FLOW_MOD: ADD <any> actions=autopath(5,NXM_NX_REG0[])
215 NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop
216 ]])
217 AT_CLEANUP
218
219 AT_SETUP([ovs-ofctl parse-nx-match])
220 AT_KEYWORDS([nx-match])
221 AT_DATA([nx-match.txt], [dnl
222 <any>
223
224 # in port
225 NXM_OF_IN_PORT(0000)
226 NXM_OF_IN_PORT(fffe)
227
228 # eth dst
229 NXM_OF_ETH_DST(0002e30f80a4)
230 NXM_OF_ETH_DST_W(010000000000/010000000000)
231 NXM_OF_ETH_DST_W(000000000000/010000000000)
232 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
233 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
234 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
235 NXM_OF_ETH_DST_W(60175619848f/5a5a5a5a5a5a)
236
237 # eth src
238 NXM_OF_ETH_SRC(020898456ddb)
239 NXM_OF_ETH_SRC_W(012345abcdef/ffffff555555)
240 NXM_OF_ETH_SRC_W(020898456ddb/ffffffffffff)
241
242 # eth type
243 NXM_OF_ETH_TYPE(0800)
244 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
245
246 # vlan tci
247 NXM_OF_VLAN_TCI(f009)
248 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
249 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
250 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
251 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
252 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
253 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
254 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
255
256 # IP TOS
257 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
258 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(41)
259 NXM_OF_IP_TOS(f0)
260
261 # IP ECN
262 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(03)
263 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(06)
264 NXM_NX_IP_ECN(03)
265
266 # IP protocol
267 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
268 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
269 NXM_OF_IP_PROTO(05)
270
271 # IP TTL
272 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_TTL(80)
273 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_TTL(ff)
274 NXM_NX_IP_TTL(80)
275
276 # IP source
277 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
278 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
279 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/5a5a5a5a)
280 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
281 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
282
283 # IP destination
284 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
285 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
286 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/5a5a5a5a)
287 NXM_OF_IP_DST(ac100014)
288 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
289
290 # TCP source port
291 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
292 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/F0F0)
293 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
294
295 # TCP destination port
296 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
297 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/FFF0)
298 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
299
300 # UDP source port
301 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
302 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/01FF)
303 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
304
305 # UDP destination port
306 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
307 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/F00F)
308 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
309
310 # ICMP type
311 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
312 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
313
314 # ICMP code
315 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
316 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
317 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
318 NXM_OF_ICMP_CODE(00)
319
320 # ARP opcode
321 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
322 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
323 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
324 NXM_OF_ARP_OP(0001)
325 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
326
327 # ARP source protocol address
328 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
329 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
330 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/aaaaaa00)
331 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
332 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
333
334 # ARP destination protocol address
335 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
336 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
337 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81234/77777777)
338 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
339 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
340
341 # ARP source hardware address
342 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
343 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
344 NXM_NX_ARP_SHA(0002e30f80a4)
345
346 # ARP destination hardware address
347 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
348 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
349 NXM_NX_ARP_THA(0002e30f80a4)
350
351 # IPv6 source
352 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
353 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
354 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
355 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
356 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
357
358 # IPv6 destination
359 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
360 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
361 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/77777777777777777777777777777777)
362 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
363
364 # ND target address
365 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
366 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
367 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(87) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/0123456789abcdeffedcba9876543210)
368 NXM_OF_ETH_TYPE(86dd) NXM_OF_IP_PROTO(3a) NXM_NX_ICMPV6_TYPE(88) NXM_NX_ND_TARGET_W(20010db83c4d00010002000300040005/fedcba98765432100123456789abcdef)
369
370 # ND source hardware address
371 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)
372 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)
373 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)
374 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)
375
376 # ND destination hardware address
377 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)
378 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)
379 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)
380 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)
381
382 # IPv4 fragments.
383 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(00)
384 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(01)
385 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(02)
386 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(03)
387 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/03)
388 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/fd)
389 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/02)
390 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(01/01)
391 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(02/02)
392 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/03)
393 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(f3)
394
395 # IPv6 fragments.
396 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(00)
397 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(01)
398 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(02)
399 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(03)
400 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/03)
401 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/01)
402 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/02)
403 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(01/01)
404 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(02/02)
405 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/03)
406 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(f3)
407
408 # Flow cookie.
409 NXM_NX_COOKIE(00000000abcdef01)
410 NXM_NX_COOKIE_W(84200000abcdef01/84200000FFFFFFFF)
411
412 # Tunnel ID.
413 NXM_NX_TUN_ID(00000000abcdef01)
414 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
415
416 # Register 0.
417 NXM_NX_REG0(acebdf56)
418 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
419
420 # Invalid field number.
421 01020304(1111/2222)
422
423 # Unimplemented registers.
424 #
425 # This test assumes that at least two registers, but fewer than 16,
426 # registers are implemented.
427 00010004(12345678)
428 00010108(12345678/12345678)
429 00011e04(12345678)
430 00011f08(12345678/12345678)
431 ])
432 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
433 <any>
434
435 # in port
436 NXM_OF_IN_PORT(0000)
437 NXM_OF_IN_PORT(fffe)
438
439 # eth dst
440 NXM_OF_ETH_DST(0002e30f80a4)
441 NXM_OF_ETH_DST_W(010000000000/010000000000)
442 NXM_OF_ETH_DST_W(000000000000/010000000000)
443 NXM_OF_ETH_DST_W(010000000000/010000000000)
444 NXM_OF_ETH_DST(0002e30f80a4)
445 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
446 NXM_OF_ETH_DST_W(40125218000a/5a5a5a5a5a5a)
447
448 # eth src
449 NXM_OF_ETH_SRC(020898456ddb)
450 NXM_OF_ETH_SRC_W(012345014545/ffffff555555)
451 NXM_OF_ETH_SRC(020898456ddb)
452
453 # eth type
454 NXM_OF_ETH_TYPE(0800)
455 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
456
457 # vlan tci
458 NXM_OF_VLAN_TCI(f009)
459 nx_pull_match() returned error OFPBMC_DUP_FIELD
460 NXM_OF_VLAN_TCI(0000)
461 NXM_OF_VLAN_TCI(3123)
462 NXM_OF_VLAN_TCI(0123)
463 NXM_OF_VLAN_TCI_W(1123/1fff)
464 NXM_OF_VLAN_TCI_W(f000/f000)
465 NXM_OF_VLAN_TCI_W(0000/e000)
466
467 # IP TOS
468 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
469 nx_pull_match() returned error OFPBMC_BAD_VALUE
470 nx_pull_match() returned error OFPBMC_BAD_PREREQ
471
472 # IP ECN
473 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
474 nx_pull_match() returned error OFPBMC_BAD_VALUE
475 nx_pull_match() returned error OFPBMC_BAD_PREREQ
476
477 # IP protocol
478 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
479 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
480 nx_pull_match() returned error OFPBMC_BAD_PREREQ
481
482 # IP TTL
483 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
484 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
485 nx_pull_match() returned error OFPBMC_BAD_PREREQ
486
487 # IP source
488 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
489 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
490 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(40080000/5a5a5a5a)
491 nx_pull_match() returned error OFPBMC_BAD_PREREQ
492 nx_pull_match() returned error OFPBMC_BAD_PREREQ
493
494 # IP destination
495 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
496 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
497 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(40080000/5a5a5a5a)
498 nx_pull_match() returned error OFPBMC_BAD_PREREQ
499 nx_pull_match() returned error OFPBMC_BAD_PREREQ
500
501 # TCP source port
502 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
503 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC_W(5050/f0f0)
504 nx_pull_match() returned error OFPBMC_BAD_PREREQ
505
506 # TCP destination port
507 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
508 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST_W(fde0/fff0)
509 nx_pull_match() returned error OFPBMC_BAD_PREREQ
510
511 # UDP source port
512 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
513 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC_W(0132/01ff)
514 nx_pull_match() returned error OFPBMC_BAD_PREREQ
515
516 # UDP destination port
517 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
518 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST_W(5005/f00f)
519 nx_pull_match() returned error OFPBMC_BAD_PREREQ
520
521 # ICMP type
522 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
523 nx_pull_match() returned error OFPBMC_BAD_PREREQ
524
525 # ICMP code
526 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
527 nx_pull_match() returned error OFPBMC_BAD_PREREQ
528 nx_pull_match() returned error OFPBMC_BAD_PREREQ
529 nx_pull_match() returned error OFPBMC_BAD_PREREQ
530
531 # ARP opcode
532 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
533 nx_pull_match() returned error OFPBMC_BAD_VALUE
534 nx_pull_match() returned error OFPBMC_BAD_PREREQ
535 nx_pull_match() returned error OFPBMC_BAD_PREREQ
536 nx_pull_match() returned error OFPBMC_DUP_FIELD
537
538 # ARP source protocol address
539 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
540 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
541 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(80a80200/aaaaaa00)
542 nx_pull_match() returned error OFPBMC_BAD_PREREQ
543 nx_pull_match() returned error OFPBMC_BAD_PREREQ
544
545 # ARP destination protocol address
546 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
547 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
548 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(40201234/77777777)
549 nx_pull_match() returned error OFPBMC_BAD_PREREQ
550 nx_pull_match() returned error OFPBMC_BAD_PREREQ
551
552 # ARP source hardware address
553 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
554 nx_pull_match() returned error OFPBMC_BAD_PREREQ
555 nx_pull_match() returned error OFPBMC_BAD_PREREQ
556
557 # ARP destination hardware address
558 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
559 nx_pull_match() returned error OFPBMC_BAD_PREREQ
560 nx_pull_match() returned error OFPBMC_BAD_PREREQ
561
562 # IPv6 source
563 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
564 nx_pull_match() returned error OFPBMC_BAD_PREREQ
565 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
566 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(00000818184800000000000000000000/5a5a5a5a5a5a5a5a0000000000000000)
567 nx_pull_match() returned error OFPBMC_BAD_PREREQ
568
569 # IPv6 destination
570 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
571 nx_pull_match() returned error OFPBMC_BAD_PREREQ
572 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010530344500010000000000000000/77777777777777777777777777777777)
573 nx_pull_match() returned error OFPBMC_BAD_PREREQ
574
575 # ND target address
576 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
577 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET(20010db83c4d00010002000300040005)
578 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(87), NXM_NX_ND_TARGET_W(00010520080900010000000000040000/0123456789abcdeffedcba9876543210)
579 NXM_OF_ETH_TYPE(86dd), NXM_OF_IP_PROTO(3a), NXM_NX_ICMPV6_TYPE(88), NXM_NX_ND_TARGET_W(20000898344400000002000300000005/fedcba98765432100123456789abcdef)
580
581 # ND source hardware address
582 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)
583 nx_pull_match() returned error OFPBMC_BAD_PREREQ
584 nx_pull_match() returned error OFPBMC_BAD_PREREQ
585 nx_pull_match() returned error OFPBMC_BAD_PREREQ
586
587 # ND destination hardware address
588 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)
589 nx_pull_match() returned error OFPBMC_BAD_PREREQ
590 nx_pull_match() returned error OFPBMC_BAD_PREREQ
591 nx_pull_match() returned error OFPBMC_BAD_PREREQ
592
593 # IPv4 fragments.
594 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
595 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(01)
596 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(02)
597 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
598 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
599 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/01)
600 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
601 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
602 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
603 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
604 nx_pull_match() returned error OFPBMC_BAD_VALUE
605
606 # IPv6 fragments.
607 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
608 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(01)
609 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(02)
610 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
611 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
612 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/01)
613 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
614 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
615 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
616 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
617 nx_pull_match() returned error OFPBMC_BAD_VALUE
618
619 # Flow cookie.
620 NXM_NX_COOKIE(00000000abcdef01)
621 NXM_NX_COOKIE_W(84200000abcdef01/84200000ffffffff)
622
623 # Tunnel ID.
624 NXM_NX_TUN_ID(00000000abcdef01)
625 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
626
627 # Register 0.
628 NXM_NX_REG0(acebdf56)
629 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
630
631 # Invalid field number.
632 nx_pull_match() returned error OFPBMC_BAD_FIELD
633
634 # Unimplemented registers.
635 #
636 # This test assumes that at least two registers, but fewer than 16,
637 # registers are implemented.
638 NXM_NX_REG0(12345678)
639 NXM_NX_REG0_W(12345678/12345678)
640 nx_pull_match() returned error OFPBMC_BAD_FIELD
641 nx_pull_match() returned error OFPBMC_BAD_FIELD
642 ])
643 AT_CLEANUP
644
645 AT_SETUP([ovs-ofctl parse-ofp11-match])
646 AT_KEYWORDS([OF1.1])
647 AT_DATA([test-data], [dnl
648 # in_port=65534
649 0000 0058 fffffffe 000003fe dnl
650 000000000000ffffffffffff 000000000000ffffffffffff dnl
651 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
652 00000000 00 000000 0000000000000000ffffffffffffffff
653
654 # bad ofp11_match: OFPBMC_BAD_VALUE
655 & ofp_util|WARN|port 305419896 is outside the supported range 0 through 65279 or 0xffffff00 through 0xffffffff
656 0000 0058 12345678 000003fe dnl
657 000000000000ffffffffffff 000000000000ffffffffffff dnl
658 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
659 00000000 00 000000 0000000000000000ffffffffffffffff
660
661 # dl_src=00:01:02:03:04:05
662 0000 0058 00000000 000003ff dnl
663 000102030405000000000000 000000000000ffffffffffff dnl
664 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
665 00000000 00 000000 0000000000000000ffffffffffffffff
666
667 # dl_src=55:55:55:55:55:55/55:55:55:55:55:55
668 0000 0058 00000000 000003ff dnl
669 555555555555aaaaaaaaaaaa 000000000000ffffffffffff dnl
670 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
671 00000000 00 000000 0000000000000000ffffffffffffffff
672
673 # dl_dst=00:01:02:03:04:05
674 0000 0058 00000000 000003ff dnl
675 000000000000ffffffffffff 000102030405000000000000 dnl
676 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
677 00000000 00 000000 0000000000000000ffffffffffffffff
678
679 # dl_dst=01:00:00:00:00:00/01:00:00:00:00:00
680 0000 0058 00000000 000003ff dnl
681 000000000000ffffffffffff 010000000000feffffffffff dnl
682 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
683 00000000 00 000000 0000000000000000ffffffffffffffff
684
685 # dl_dst=00:01:02:03:04:05/fe:ff:ff:ff:ff:ff
686 0000 0058 00000000 000003ff dnl
687 000000000000ffffffffffff 000102030405010000000000 dnl
688 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
689 00000000 00 000000 0000000000000000ffffffffffffffff
690
691 # dl_dst=55:55:55:55:55:55/55:55:55:55:55:55
692 0000 0058 00000000 000003ff dnl
693 000000000000ffffffffffff 555555555555aaaaaaaaaaaa dnl
694 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
695 00000000 00 000000 0000000000000000ffffffffffffffff
696
697 dnl dl_vlan_pcp is ignored if dl_vlan is wildcarded, which causes the
698 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
699 # in_port=1
700 # 11: fa -> fe
701 # 38: 03 -> 00
702 0000 0058 00000001 000003fa dnl
703 000000000000ffffffffffff 000000000000ffffffffffff dnl
704 0000 03 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
705 00000000 00 000000 0000000000000000ffffffffffffffff
706
707 # dl_vlan=291
708 0000 0058 00000000 000003fd dnl
709 000000000000ffffffffffff 000000000000ffffffffffff dnl
710 0123 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
711 00000000 00 000000 0000000000000000ffffffffffffffff
712
713 dnl OFPVID_NONE:
714 # vlan_tci=0x0000
715 0000 0058 00000000 000003fd dnl
716 000000000000ffffffffffff 000000000000ffffffffffff dnl
717 ffff 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
718 00000000 00 000000 0000000000000000ffffffffffffffff
719
720 dnl OFPVID_NONE ignores dl_vlan_pcp even if not wildcarded, which causes
721 dnl the wildcard bit and the dl_vlan_pcp to be dropped for output:
722 # vlan_tci=0x0000
723 # 11: f9 -> fd
724 # 38: 05 -> 00
725 0000 0058 00000000 000003f9 dnl
726 000000000000ffffffffffff 000000000000ffffffffffff dnl
727 ffff 05 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
728 00000000 00 000000 0000000000000000ffffffffffffffff
729
730 # vlan_tci=0x1000/0x1000
731 0000 0058 00000000 000003fd dnl
732 000000000000ffffffffffff 000000000000ffffffffffff dnl
733 fffe 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
734 00000000 00 000000 0000000000000000ffffffffffffffff
735
736 dnl Try invalid VID:
737 # bad ofp11_match: OFPBMC_BAD_VALUE
738 0000 0058 00000000 000003fd dnl
739 000000000000ffffffffffff 000000000000ffffffffffff dnl
740 1234 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
741 00000000 00 000000 0000000000000000ffffffffffffffff
742
743 # dl_vlan_pcp=4
744 0000 0058 00000000 000003f9 dnl
745 000000000000ffffffffffff 000000000000ffffffffffff dnl
746 fffe 04 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
747 00000000 00 000000 0000000000000000ffffffffffffffff
748
749 # dl_vlan=10,dl_vlan_pcp=6
750 0000 0058 00000000 000003f9 dnl
751 000000000000ffffffffffff 000000000000ffffffffffff dnl
752 000a 06 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
753 00000000 00 000000 0000000000000000ffffffffffffffff
754
755 # dl_type=0x1234
756 0000 0058 00000000 000003f7 dnl
757 000000000000ffffffffffff 000000000000ffffffffffff dnl
758 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
759 00000000 00 000000 0000000000000000ffffffffffffffff
760
761 # ip,nw_tos=252
762 0000 0058 00000000 000003e7 dnl
763 000000000000ffffffffffff 000000000000ffffffffffff dnl
764 0000 00 00 0800 fc 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
765 00000000 00 000000 0000000000000000ffffffffffffffff
766
767 dnl Try invalid TOS:
768 # bad ofp11_match: OFPBMC_BAD_VALUE
769 0000 0058 00000000 000003e7 dnl
770 000000000000ffffffffffff 000000000000ffffffffffff dnl
771 0000 00 00 0800 01 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
772 00000000 00 000000 0000000000000000ffffffffffffffff
773
774 # ip,nw_proto=5
775 0000 0058 00000000 000003d7 dnl
776 000000000000ffffffffffff 000000000000ffffffffffff dnl
777 0000 00 00 0800 00 05 00000000ffffffff 00000000ffffffff 0000 0000 dnl
778 00000000 00 000000 0000000000000000ffffffffffffffff
779
780 # arp,arp_op=2
781 0000 0058 00000000 000003d7 dnl
782 000000000000ffffffffffff 000000000000ffffffffffff dnl
783 0000 00 00 0806 00 02 00000000ffffffff 00000000ffffffff 0000 0000 dnl
784 00000000 00 000000 0000000000000000ffffffffffffffff
785
786 # ip,nw_src=192.168.128.0/24
787 0000 0058 00000000 000003f7 dnl
788 000000000000ffffffffffff 000000000000ffffffffffff dnl
789 0000 00 00 0800 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
790 00000000 00 000000 0000000000000000ffffffffffffffff
791
792 # ip,nw_src=128.160.128.0/165.165.165.165
793 # 44: c0 -> 80
794 # 45: a8 -> a0
795 0000 0058 00000000 000003f7 dnl
796 000000000000ffffffffffff 000000000000ffffffffffff dnl
797 0000 00 00 0800 00 00 c0a880005a5a5a5a 00000000ffffffff 0000 0000 dnl
798 00000000 00 000000 0000000000000000ffffffffffffffff
799
800 # ip,nw_dst=192.168.128.0/24
801 0000 0058 00000000 000003f7 dnl
802 000000000000ffffffffffff 000000000000ffffffffffff dnl
803 0000 00 00 0800 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
804 00000000 00 000000 0000000000000000ffffffffffffffff
805
806 # ip,nw_dst=128.160.128.0/165.165.165.165
807 # 52: c0 -> 80
808 # 53: a8 -> a0
809 0000 0058 00000000 000003f7 dnl
810 000000000000ffffffffffff 000000000000ffffffffffff dnl
811 0000 00 00 0800 00 00 00000000ffffffff c0a880005a5a5a5a 0000 0000 dnl
812 00000000 00 000000 0000000000000000ffffffffffffffff
813
814 # arp,nw_src=192.168.128.0/24
815 0000 0058 00000000 000003f7 dnl
816 000000000000ffffffffffff 000000000000ffffffffffff dnl
817 0000 00 00 0806 00 00 c0a88000000000ff 00000000ffffffff 0000 0000 dnl
818 00000000 00 000000 0000000000000000ffffffffffffffff
819
820 # arp,nw_dst=192.168.128.0/24
821 0000 0058 00000000 000003f7 dnl
822 000000000000ffffffffffff 000000000000ffffffffffff dnl
823 0000 00 00 0806 00 00 00000000ffffffff c0a88000000000ff 0000 0000 dnl
824 00000000 00 000000 0000000000000000ffffffffffffffff
825
826 # tcp,tp_src=443
827 0000 0058 00000000 00000397 dnl
828 000000000000ffffffffffff 000000000000ffffffffffff dnl
829 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
830 00000000 00 000000 0000000000000000ffffffffffffffff
831
832 # tcp,tp_dst=443
833 0000 0058 00000000 00000357 dnl
834 000000000000ffffffffffff 000000000000ffffffffffff dnl
835 0000 00 00 0800 00 06 00000000ffffffff 00000000ffffffff 0000 01bb dnl
836 00000000 00 000000 0000000000000000ffffffffffffffff
837
838 # udp,tp_src=443
839 0000 0058 00000000 00000397 dnl
840 000000000000ffffffffffff 000000000000ffffffffffff dnl
841 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
842 00000000 00 000000 0000000000000000ffffffffffffffff
843
844 # icmp,icmp_type=5
845 0000 0058 00000000 00000397 dnl
846 000000000000ffffffffffff 000000000000ffffffffffff dnl
847 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0005 0000 dnl
848 00000000 00 000000 0000000000000000ffffffffffffffff
849
850 # icmp,icmp_code=8
851 0000 0058 00000000 00000357 dnl
852 000000000000ffffffffffff 000000000000ffffffffffff dnl
853 0000 00 00 0800 00 01 00000000ffffffff 00000000ffffffff 0000 0008 dnl
854 00000000 00 000000 0000000000000000ffffffffffffffff
855
856 # udp,tp_src=443
857 0000 0058 00000000 00000397 dnl
858 000000000000ffffffffffff 000000000000ffffffffffff dnl
859 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
860 00000000 00 000000 0000000000000000ffffffffffffffff
861
862 # udp,tp_dst=443
863 0000 0058 00000000 00000357 dnl
864 000000000000ffffffffffff 000000000000ffffffffffff dnl
865 0000 00 00 0800 00 11 00000000ffffffff 00000000ffffffff 0000 01bb dnl
866 00000000 00 000000 0000000000000000ffffffffffffffff
867
868 dnl SCTP, no ports.
869 # ip,nw_proto=132
870 0000 0058 00000000 000003d7 dnl
871 000000000000ffffffffffff 000000000000ffffffffffff dnl
872 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 0000 dnl
873 00000000 00 000000 0000000000000000ffffffffffffffff
874
875 dnl SCTP tp_src matching not supported:
876 # bad ofp11_match: OFPBMC_BAD_FIELD
877 0000 0058 00000000 00000397 dnl
878 000000000000ffffffffffff 000000000000ffffffffffff dnl
879 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
880 00000000 00 000000 0000000000000000ffffffffffffffff
881
882 dnl SCTP tp_dst matching not supported:
883 # bad ofp11_match: OFPBMC_BAD_FIELD
884 0000 0058 00000000 00000357 dnl
885 000000000000ffffffffffff 000000000000ffffffffffff dnl
886 0000 00 00 0800 00 84 00000000ffffffff 00000000ffffffff 0000 01bb dnl
887 00000000 00 000000 0000000000000000ffffffffffffffff
888
889 dnl Ignore tp_src if not TCP or UDP or SCTP:
890 # ip,nw_proto=21
891 # 11: 97 -> d7
892 # 60: 01 -> 00
893 # 61: bb -> 00
894 0000 0058 00000000 00000397 dnl
895 000000000000ffffffffffff 000000000000ffffffffffff dnl
896 0000 00 00 0800 00 15 00000000ffffffff 00000000ffffffff 01bb 0000 dnl
897 00000000 00 000000 0000000000000000ffffffffffffffff
898
899 dnl Ignore tp_dst if not TCP or UDP or SCTP:
900 # ip,nw_proto=22
901 # 11: 57 -> d7
902 # 62: 01 -> 00
903 # 63: bb -> 00
904 0000 0058 00000000 00000357 dnl
905 000000000000ffffffffffff 000000000000ffffffffffff dnl
906 0000 00 00 0800 00 16 00000000ffffffff 00000000ffffffff 0000 01bb dnl
907 00000000 00 000000 0000000000000000ffffffffffffffff
908
909 dnl mpls_label not yet supported:
910 # bad ofp11_match: OFPBMC_BAD_TAG
911 0000 0058 00000000 000002f7 dnl
912 000000000000ffffffffffff 000000000000ffffffffffff dnl
913 0000 00 00 8847 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
914 12345678 00 000000 0000000000000000ffffffffffffffff
915
916 dnl mpls_tc not yet supported:
917 # bad ofp11_match: OFPBMC_BAD_TAG
918 0000 0058 00000000 000001f7 dnl
919 000000000000ffffffffffff 000000000000ffffffffffff dnl
920 0000 00 00 8848 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
921 00000000 5a 000000 0000000000000000ffffffffffffffff
922
923 dnl mpls_label and mpls_tc must be ignored if dl_type is not MPLS:
924 # dl_type=0x1234
925 # 10: 00 -> 03
926 # 64: 12 -> 00
927 # 65: 34 -> 00
928 # 66: 56 -> 00
929 # 67: 78 -> 00
930 # 68: 5a -> 00
931 0000 0058 00000000 000000f7 dnl
932 000000000000ffffffffffff 000000000000ffffffffffff dnl
933 0000 00 00 1234 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
934 12345678 5a 000000 0000000000000000ffffffffffffffff
935
936 dnl metadata match not yet supported:
937 # bad ofp11_match: OFPBMC_BAD_FIELD
938 0000 0058 00000000 000003ff dnl
939 000000000000ffffffffffff 000000000000ffffffffffff dnl
940 0000 00 00 0000 00 00 00000000ffffffff 00000000ffffffff 0000 0000 dnl
941 00000000 00 000000 0000000000000001fffffffffffffffe
942
943 ])
944 sed '/^[[#&]]/d' < test-data > input.txt
945 sed -n 's/^# //p; /^$/p' < test-data > expout
946 sed -n 's/^& //p' < test-data > experr
947 AT_CAPTURE_FILE([input.txt])
948 AT_CAPTURE_FILE([expout])
949 AT_CAPTURE_FILE([experr])
950 AT_CHECK(
951   [ovs-ofctl '-vPATTERN:console:%c|%p|%m' parse-ofp11-match < input.txt],
952   [0], [expout], [experr])
953 AT_CLEANUP
954
955 AT_SETUP([ovs-ofctl parse-nx-match loose])
956 AT_KEYWORDS([nx-match])
957 AT_DATA([nx-match.txt], [dnl
958 NXM_OF_IN_PORT(0001), 01020304(1111/2222), NXM_OF_ETH_TYPE(0800)
959 ])
960
961 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
962 nx_pull_match() returned error OFPBMC_BAD_FIELD
963 ])
964
965 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
966 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
967 ])
968 AT_CLEANUP
969
970 AT_SETUP([ovs-ofctl parse-oxm])
971 AT_KEYWORDS([oxm])
972 AT_DATA([oxm.txt], [dnl
973 <any>
974
975 # in port
976 OXM_OF_IN_PORT(00000000)
977 OXM_OF_IN_PORT(fffffffe)
978
979 # eth dst
980 OXM_OF_ETH_DST(0002e30f80a4)
981 OXM_OF_ETH_DST_W(010000000000/010000000000)
982 OXM_OF_ETH_DST_W(000000000000/010000000000)
983 OXM_OF_ETH_DST_W(ffffffffffff/010000000000)
984 OXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
985 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
986
987 # eth src
988 OXM_OF_ETH_SRC(020898456ddb)
989
990 # eth type
991 OXM_OF_ETH_TYPE(0800)
992 OXM_OF_ETH_TYPE(0800) OXM_OF_IN_PORT(00000012)
993
994 # IP ECN
995 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(03)
996 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_ECN(06)
997 OXM_OF_IP_ECN(03)
998
999 # IP protocol
1000 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01)
1001 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(05)
1002 OXM_OF_IP_PROTO(05)
1003
1004 # IP source
1005 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC(ac100014)
1006 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_SRC_W(C0a80000/FFFF0000)
1007 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_SRC(ac100014)
1008 OXM_OF_IPV4_SRC_W(C0D80000/FFFF0000)
1009
1010 # IP destination
1011 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST(ac100014)
1012 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV4_DST_W(C0a88012/FFFF0000)
1013 OXM_OF_IPV4_DST(ac100014)
1014 OXM_OF_ETH_TYPE(0806) OXM_OF_IPV4_DST_W(C0D80000/FFFF0000)
1015
1016 # TCP source port
1017 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC(4231)
1018 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_SRC_W(5050/F0F0)
1019 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_SRC(4231)
1020
1021 # TCP destination port
1022 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST(4231)
1023 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_TCP_DST_W(FDE0/FFF0)
1024 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(07) OXM_OF_TCP_DST(4231)
1025
1026 # UDP source port
1027 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC(8732)
1028 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_SRC_W(0132/01FF)
1029 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(06) OXM_OF_UDP_SRC(7823)
1030
1031 # UDP destination port
1032 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST(1782)
1033 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(11) OXM_OF_UDP_DST_W(5005/F00F)
1034 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(02) OXM_OF_UDP_DST(1293)
1035
1036 # ICMP type
1037 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_TYPE(12)
1038 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_TYPE(10)
1039
1040 # ICMP code
1041 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(01) OXM_OF_ICMPV4_CODE(12)
1042 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(00) OXM_OF_ICMPV4_CODE(10)
1043 OXM_OF_ETH_TYPE(0800) OXM_OF_ICMPV4_CODE(10)
1044 OXM_OF_ICMPV4_CODE(00)
1045
1046 # ARP opcode
1047 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001)
1048 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(1111)
1049 OXM_OF_ETH_TYPE(0000) OXM_OF_ARP_OP(0001)
1050 OXM_OF_ARP_OP(0001)
1051 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_OP(0001) OXM_OF_ARP_OP(0001)
1052
1053 # ARP source protocol address
1054 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA(ac100014)
1055 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
1056 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SPA(ac100014)
1057 OXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
1058
1059 # ARP destination protocol address
1060 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA(ac100014)
1061 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
1062 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_TPA(ac100014)
1063 OXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
1064
1065 # ARP source hardware address
1066 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_SHA(0002e30f80a4)
1067 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_SHA(0002e30f80a4)
1068 OXM_OF_ARP_SHA(0002e30f80a4)
1069
1070 # ARP destination hardware address
1071 OXM_OF_ETH_TYPE(0806) OXM_OF_ARP_THA(0002e30f80a4)
1072 OXM_OF_ETH_TYPE(0800) OXM_OF_ARP_THA(0002e30f80a4)
1073 OXM_OF_ARP_THA(0002e30f80a4)
1074
1075 # IPv6 source
1076 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1077 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1078 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1079 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1080
1081 # IPv6 destination
1082 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1083 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1084 OXM_OF_ETH_TYPE(86dd) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1085 OXM_OF_ETH_TYPE(0800) OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1086
1087 # ND source hardware address
1088 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)
1089 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)
1090 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)
1091 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)
1092
1093 # ND destination hardware address
1094 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)
1095 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)
1096 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)
1097 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)
1098
1099 # Invalid field number.
1100 01020304(1111/2222)
1101 ])
1102 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
1103 <any>
1104
1105 # in port
1106 OXM_OF_IN_PORT(00000000)
1107 OXM_OF_IN_PORT(fffffffe)
1108
1109 # eth dst
1110 OXM_OF_ETH_DST(0002e30f80a4)
1111 OXM_OF_ETH_DST_W(010000000000/010000000000)
1112 OXM_OF_ETH_DST_W(000000000000/010000000000)
1113 OXM_OF_ETH_DST_W(010000000000/010000000000)
1114 OXM_OF_ETH_DST(0002e30f80a4)
1115 OXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
1116
1117 # eth src
1118 OXM_OF_ETH_SRC(020898456ddb)
1119
1120 # eth type
1121 OXM_OF_ETH_TYPE(0800)
1122 OXM_OF_IN_PORT(00000012), OXM_OF_ETH_TYPE(0800)
1123
1124 # IP ECN
1125 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_ECN(03)
1126 nx_pull_match() returned error OFPBMC_BAD_VALUE
1127 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1128
1129 # IP protocol
1130 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01)
1131 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(05)
1132 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1133
1134 # IP source
1135 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC(ac100014)
1136 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_SRC_W(c0a80000/ffff0000)
1137 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1138 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1139
1140 # IP destination
1141 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST(ac100014)
1142 OXM_OF_ETH_TYPE(0800), OXM_OF_IPV4_DST_W(c0a80000/ffff0000)
1143 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1144 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1145
1146 # TCP source port
1147 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC(4231)
1148 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_SRC_W(5050/f0f0)
1149 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1150
1151 # TCP destination port
1152 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST(4231)
1153 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(06), OXM_OF_TCP_DST_W(fde0/fff0)
1154 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1155
1156 # UDP source port
1157 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC(8732)
1158 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_SRC_W(0132/01ff)
1159 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1160
1161 # UDP destination port
1162 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST(1782)
1163 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(11), OXM_OF_UDP_DST_W(5005/f00f)
1164 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1165
1166 # ICMP type
1167 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_TYPE(12)
1168 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1169
1170 # ICMP code
1171 OXM_OF_ETH_TYPE(0800), OXM_OF_IP_PROTO(01), OXM_OF_ICMPV4_CODE(12)
1172 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1173 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1174 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1175
1176 # ARP opcode
1177 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_OP(0001)
1178 nx_pull_match() returned error OFPBMC_BAD_VALUE
1179 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1180 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1181 nx_pull_match() returned error OFPBMC_DUP_FIELD
1182
1183 # ARP source protocol address
1184 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA(ac100014)
1185 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SPA_W(c0a81200/ffffff00)
1186 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1187 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1188
1189 # ARP destination protocol address
1190 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA(ac100014)
1191 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_TPA_W(c0a81200/ffffff00)
1192 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1193 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1194
1195 # ARP source hardware address
1196 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_SHA(0002e30f80a4)
1197 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1198 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1199
1200 # ARP destination hardware address
1201 OXM_OF_ETH_TYPE(0806), OXM_OF_ARP_THA(0002e30f80a4)
1202 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1203 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1204
1205 # IPv6 source
1206 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC(20010db83c4d00010002000300040005)
1207 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1208 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1209 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1210
1211 # IPv6 destination
1212 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST(20010db83c4d00010002000300040005)
1213 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1214 OXM_OF_ETH_TYPE(86dd), OXM_OF_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
1215 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1216
1217 # ND source hardware address
1218 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)
1219 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1220 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1221 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1222
1223 # ND destination hardware address
1224 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)
1225 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1226 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1227 nx_pull_match() returned error OFPBMC_BAD_PREREQ
1228
1229 # Invalid field number.
1230 nx_pull_match() returned error OFPBMC_BAD_FIELD
1231 ])
1232 AT_CLEANUP
1233
1234 AT_SETUP([ovs-ofctl parse-oxm loose])
1235 AT_KEYWORDS([oxm])
1236 AT_DATA([oxm.txt], [dnl
1237 OXM_OF_IN_PORT(00000001), 01020304(1111/2222), OXM_OF_ETH_TYPE(0800)
1238 ])
1239
1240 AT_CHECK([ovs-ofctl --strict parse-oxm < oxm.txt], [0], [dnl
1241 nx_pull_match() returned error OFPBMC_BAD_FIELD
1242 ])
1243
1244 AT_CHECK([ovs-ofctl parse-oxm < oxm.txt], [0], [dnl
1245 OXM_OF_IN_PORT(00000001), OXM_OF_ETH_TYPE(0800)
1246 ])
1247 AT_CLEANUP
1248
1249 dnl Check that "-F openflow10" rejects a flow_mod with a tun_id, since
1250 dnl OpenFlow 1.0 doesn't support tunnels.
1251 AT_SETUP([ovs-ofctl -F option and tun_id])
1252 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
1253   [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1254 ])
1255 AT_CLEANUP
1256
1257 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
1258 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
1259 dnl additionally show up as the top 32 bits of the cookie.)  This checks
1260 dnl for regression against bug #4566.
1261 AT_SETUP([ovs-ofctl -F option with flow_mods])
1262 OVS_VSWITCHD_START
1263 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
1264 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
1265 NXST_FLOW reply:
1266  tun_id=0x12345678 actions=drop
1267 ])
1268 OVS_VSWITCHD_STOP
1269 AT_CLEANUP
1270
1271 dnl Check that "-F openflow10" is really honored on dump-flows.
1272 dnl (If it isn't, then dump-flows will show the register match.)
1273 AT_SETUP([ovs-ofctl dump-flows honors -F option])
1274 OVS_VSWITCHD_START
1275 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
1276 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
1277 OFPST_FLOW reply:
1278  actions=drop
1279 ])
1280 OVS_VSWITCHD_STOP
1281 AT_CLEANUP
1282
1283 dnl Check that "-F openflow10" fails on dump-flows if the requested match
1284 dnl can't be represented in OpenFlow 1.0.
1285 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
1286 OVS_VSWITCHD_START
1287 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
1288   [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
1289 ])
1290 OVS_VSWITCHD_STOP
1291 AT_CLEANUP
1292
1293 dnl Check that add-flow reports non-normalized flows (feature #5029).
1294 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
1295 OVS_VSWITCHD_START
1296 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
1297   [0], [], [dnl
1298 ofp_util|INFO|normalization changed ofp_match, details:
1299 ofp_util|INFO| pre: nw_src=1.2.3.4
1300 ofp_util|INFO|post: @&t@
1301 ])
1302 OVS_VSWITCHD_STOP
1303 AT_CLEANUP
1304