python: Break unixctl implementation into registry, client, and server.
[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=autopath(5,NXM_NX_REG0[])
185 vlan_tci=0x1123/0x1fff,actions=drop
186 ]])
187 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout])
188 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
189 [[usable protocols: NXM
190 chosen protocol: NXM-table_id
191 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
192 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
193 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
194 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_LABEL(00012345) actions=output:2
195 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
196 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
197 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
198 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
199 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
200 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
201 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
202 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
203 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
204 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
205 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
206 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
207 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
208 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
209 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
210 NXT_FLOW_MOD: ADD <any> actions=drop
211 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[]
212 NXT_FLOW_MOD: ADD <any> actions=autopath(5,NXM_NX_REG0[])
213 NXT_FLOW_MOD: ADD NXM_OF_VLAN_TCI_W(1123/1fff) actions=drop
214 ]])
215 AT_CLEANUP
216
217 AT_SETUP([ovs-ofctl parse-nx-match])
218 AT_KEYWORDS([nx-match])
219 AT_DATA([nx-match.txt], [dnl
220 <any>
221
222 # in port
223 NXM_OF_IN_PORT(0000)
224 NXM_OF_IN_PORT(fffe)
225
226 # eth dst
227 NXM_OF_ETH_DST(0002e30f80a4)
228 NXM_OF_ETH_DST_W(010000000000/010000000000)
229 NXM_OF_ETH_DST_W(000000000000/010000000000)
230 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
231 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
232 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
233
234 # eth src
235 NXM_OF_ETH_SRC(020898456ddb)
236
237 # eth type
238 NXM_OF_ETH_TYPE(0800)
239 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
240
241 # vlan tci
242 NXM_OF_VLAN_TCI(f009)
243 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
244 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
245 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
246 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
247 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
248 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
249 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
250
251 # IP TOS
252 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
253 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(41)
254 NXM_OF_IP_TOS(f0)
255
256 # IP ECN
257 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(03)
258 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_ECN(06)
259 NXM_NX_IP_ECN(03)
260
261 # IP protocol
262 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
263 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
264 NXM_OF_IP_PROTO(05)
265
266 # IP TTL
267 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_TTL(80)
268 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_TTL(ff)
269 NXM_NX_IP_TTL(80)
270
271 # IP source
272 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
273 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
274 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
275 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
276
277 # IP destination
278 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
279 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
280 NXM_OF_IP_DST(ac100014)
281 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
282
283 # TCP source port
284 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
285 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC_W(5050/F0F0)
286 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
287
288 # TCP destination port
289 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
290 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST_W(FDE0/FFF0)
291 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
292
293 # UDP source port
294 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
295 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC_W(0132/01FF)
296 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
297
298 # UDP destination port
299 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
300 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST_W(5005/F00F)
301 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
302
303 # ICMP type
304 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
305 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
306
307 # ICMP code
308 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
309 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
310 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
311 NXM_OF_ICMP_CODE(00)
312
313 # ARP opcode
314 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
315 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
316 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
317 NXM_OF_ARP_OP(0001)
318 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
319
320 # ARP source protocol address
321 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
322 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
323 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
324 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
325
326 # ARP destination protocol address
327 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
328 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
329 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
330 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
331
332 # ARP source hardware address
333 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
334 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
335 NXM_NX_ARP_SHA(0002e30f80a4)
336
337 # ARP destination hardware address
338 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
339 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
340 NXM_NX_ARP_THA(0002e30f80a4)
341
342 # IPv6 source
343 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
344 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
345 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
346 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
347
348 # IPv6 destination
349 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
350 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
351 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
352 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
353
354 # ND source hardware address
355 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)
356 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)
357 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)
358 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)
359
360 # ND destination hardware address
361 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)
362 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)
363 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)
364 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)
365
366 # IPv4 fragments.
367 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(00)
368 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(01)
369 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(02)
370 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(03)
371 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/03)
372 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/fd)
373 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(00/02)
374 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(01/01)
375 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(02/02)
376 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG_W(03/03)
377 NXM_OF_ETH_TYPE(0800) NXM_NX_IP_FRAG(f3)
378
379 # IPv6 fragments.
380 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(00)
381 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(01)
382 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(02)
383 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(03)
384 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/03)
385 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/01)
386 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(00/02)
387 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(01/01)
388 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(02/02)
389 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG_W(03/03)
390 NXM_OF_ETH_TYPE(86dd) NXM_NX_IP_FRAG(f3)
391
392 # Flow cookie.
393 NXM_NX_COOKIE(00000000abcdef01)
394 NXM_NX_COOKIE_W(84200000abcdef01/84200000FFFFFFFF)
395
396 # Tunnel ID.
397 NXM_NX_TUN_ID(00000000abcdef01)
398 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
399
400 # Register 0.
401 NXM_NX_REG0(acebdf56)
402 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
403
404 # Invalid field number.
405 01020304(1111/2222)
406
407 # Unimplemented registers.
408 #
409 # This test assumes that at least two registers, but fewer than 16,
410 # registers are implemented.
411 00010004(12345678)
412 00010108(12345678/12345678)
413 00011e04(12345678)
414 00011f08(12345678/12345678)
415 ])
416 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
417 <any>
418
419 # in port
420 NXM_OF_IN_PORT(0000)
421 NXM_OF_IN_PORT(fffe)
422
423 # eth dst
424 NXM_OF_ETH_DST(0002e30f80a4)
425 NXM_OF_ETH_DST_W(010000000000/010000000000)
426 NXM_OF_ETH_DST_W(000000000000/010000000000)
427 NXM_OF_ETH_DST_W(010000000000/010000000000)
428 NXM_OF_ETH_DST(0002e30f80a4)
429 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
430
431 # eth src
432 NXM_OF_ETH_SRC(020898456ddb)
433
434 # eth type
435 NXM_OF_ETH_TYPE(0800)
436 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
437
438 # vlan tci
439 NXM_OF_VLAN_TCI(f009)
440 nx_pull_match() returned error OFPBMC_DUP_FIELD
441 NXM_OF_VLAN_TCI(0000)
442 NXM_OF_VLAN_TCI(3123)
443 NXM_OF_VLAN_TCI(0123)
444 NXM_OF_VLAN_TCI_W(1123/1fff)
445 NXM_OF_VLAN_TCI_W(f000/f000)
446 NXM_OF_VLAN_TCI_W(0000/e000)
447
448 # IP TOS
449 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
450 nx_pull_match() returned error OFPBMC_BAD_VALUE
451 nx_pull_match() returned error OFPBMC_BAD_PREREQ
452
453 # IP ECN
454 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_ECN(03)
455 nx_pull_match() returned error OFPBMC_BAD_VALUE
456 nx_pull_match() returned error OFPBMC_BAD_PREREQ
457
458 # IP protocol
459 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
460 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
461 nx_pull_match() returned error OFPBMC_BAD_PREREQ
462
463 # IP TTL
464 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_TTL(80)
465 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_TTL(ff)
466 nx_pull_match() returned error OFPBMC_BAD_PREREQ
467
468 # IP source
469 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
470 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
471 nx_pull_match() returned error OFPBMC_BAD_PREREQ
472 nx_pull_match() returned error OFPBMC_BAD_PREREQ
473
474 # IP destination
475 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
476 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
477 nx_pull_match() returned error OFPBMC_BAD_PREREQ
478 nx_pull_match() returned error OFPBMC_BAD_PREREQ
479
480 # TCP source port
481 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
482 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC_W(5050/f0f0)
483 nx_pull_match() returned error OFPBMC_BAD_PREREQ
484
485 # TCP destination port
486 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
487 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST_W(fde0/fff0)
488 nx_pull_match() returned error OFPBMC_BAD_PREREQ
489
490 # UDP source port
491 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
492 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC_W(0132/01ff)
493 nx_pull_match() returned error OFPBMC_BAD_PREREQ
494
495 # UDP destination port
496 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
497 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST_W(5005/f00f)
498 nx_pull_match() returned error OFPBMC_BAD_PREREQ
499
500 # ICMP type
501 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
502 nx_pull_match() returned error OFPBMC_BAD_PREREQ
503
504 # ICMP code
505 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
506 nx_pull_match() returned error OFPBMC_BAD_PREREQ
507 nx_pull_match() returned error OFPBMC_BAD_PREREQ
508 nx_pull_match() returned error OFPBMC_BAD_PREREQ
509
510 # ARP opcode
511 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
512 nx_pull_match() returned error OFPBMC_BAD_VALUE
513 nx_pull_match() returned error OFPBMC_BAD_PREREQ
514 nx_pull_match() returned error OFPBMC_BAD_PREREQ
515 nx_pull_match() returned error OFPBMC_DUP_FIELD
516
517 # ARP source protocol address
518 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
519 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
520 nx_pull_match() returned error OFPBMC_BAD_PREREQ
521 nx_pull_match() returned error OFPBMC_BAD_PREREQ
522
523 # ARP destination protocol address
524 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
525 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
526 nx_pull_match() returned error OFPBMC_BAD_PREREQ
527 nx_pull_match() returned error OFPBMC_BAD_PREREQ
528
529 # ARP source hardware address
530 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
531 nx_pull_match() returned error OFPBMC_BAD_PREREQ
532 nx_pull_match() returned error OFPBMC_BAD_PREREQ
533
534 # ARP destination hardware address
535 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
536 nx_pull_match() returned error OFPBMC_BAD_PREREQ
537 nx_pull_match() returned error OFPBMC_BAD_PREREQ
538
539 # IPv6 source
540 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
541 nx_pull_match() returned error OFPBMC_BAD_PREREQ
542 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
543 nx_pull_match() returned error OFPBMC_BAD_PREREQ
544
545 # IPv6 destination
546 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
547 nx_pull_match() returned error OFPBMC_BAD_PREREQ
548 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
549 nx_pull_match() returned error OFPBMC_BAD_PREREQ
550
551 # ND source hardware address
552 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)
553 nx_pull_match() returned error OFPBMC_BAD_PREREQ
554 nx_pull_match() returned error OFPBMC_BAD_PREREQ
555 nx_pull_match() returned error OFPBMC_BAD_PREREQ
556
557 # ND destination hardware address
558 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)
559 nx_pull_match() returned error OFPBMC_BAD_PREREQ
560 nx_pull_match() returned error OFPBMC_BAD_PREREQ
561 nx_pull_match() returned error OFPBMC_BAD_PREREQ
562
563 # IPv4 fragments.
564 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
565 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(01)
566 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(02)
567 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
568 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(00)
569 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/01)
570 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(00/02)
571 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(01/01)
572 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG_W(02/02)
573 NXM_OF_ETH_TYPE(0800), NXM_NX_IP_FRAG(03)
574 nx_pull_match() returned error OFPBMC_BAD_VALUE
575
576 # IPv6 fragments.
577 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
578 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(01)
579 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(02)
580 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
581 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(00)
582 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/01)
583 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(00/02)
584 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(01/01)
585 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG_W(02/02)
586 NXM_OF_ETH_TYPE(86dd), NXM_NX_IP_FRAG(03)
587 nx_pull_match() returned error OFPBMC_BAD_VALUE
588
589 # Flow cookie.
590 NXM_NX_COOKIE(00000000abcdef01)
591 NXM_NX_COOKIE_W(84200000abcdef01/84200000ffffffff)
592
593 # Tunnel ID.
594 NXM_NX_TUN_ID(00000000abcdef01)
595 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
596
597 # Register 0.
598 NXM_NX_REG0(acebdf56)
599 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
600
601 # Invalid field number.
602 nx_pull_match() returned error OFPBMC_BAD_FIELD
603
604 # Unimplemented registers.
605 #
606 # This test assumes that at least two registers, but fewer than 16,
607 # registers are implemented.
608 NXM_NX_REG0(12345678)
609 NXM_NX_REG0_W(12345678/12345678)
610 nx_pull_match() returned error OFPBMC_BAD_FIELD
611 nx_pull_match() returned error OFPBMC_BAD_FIELD
612 ])
613 AT_CLEANUP
614
615 AT_SETUP([ovs-ofctl parse-nx-match loose])
616 AT_KEYWORDS([nx-match])
617 AT_DATA([nx-match.txt], [dnl
618 NXM_OF_IN_PORT(0001), 01020304(1111/2222), NXM_OF_ETH_TYPE(0800)
619 ])
620
621 AT_CHECK([ovs-ofctl --strict parse-nx-match < nx-match.txt], [0], [dnl
622 nx_pull_match() returned error OFPBMC_BAD_FIELD
623 ])
624
625 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
626 NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
627 ])
628 AT_CLEANUP
629
630 dnl Check that "-F openflow10" rejects a flow_mod with a tun_id, since
631 dnl OpenFlow 1.0 doesn't support tunnels.
632 AT_SETUP([ovs-ofctl -F option and tun_id])
633 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
634   [1], [], [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
635 ])
636 AT_CLEANUP
637
638 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
639 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
640 dnl additionally show up as the top 32 bits of the cookie.)  This checks
641 dnl for regression against bug #4566.
642 AT_SETUP([ovs-ofctl -F option with flow_mods])
643 OVS_VSWITCHD_START
644 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
645 AT_CHECK([ovs-ofctl dump-flows br0 | ofctl_strip], [0], [dnl
646 NXST_FLOW reply:
647  tun_id=0x12345678 actions=drop
648 ])
649 OVS_VSWITCHD_STOP
650 AT_CLEANUP
651
652 dnl Check that "-F openflow10" is really honored on dump-flows.
653 dnl (If it isn't, then dump-flows will show the register match.)
654 AT_SETUP([ovs-ofctl dump-flows honors -F option])
655 OVS_VSWITCHD_START
656 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
657 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | ofctl_strip], [0], [dnl
658 OFPST_FLOW reply:
659  actions=drop
660 ])
661 OVS_VSWITCHD_STOP
662 AT_CLEANUP
663
664 dnl Check that "-F openflow10" fails on dump-flows if the requested match
665 dnl can't be represented in OpenFlow 1.0.
666 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
667 OVS_VSWITCHD_START
668 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
669   [ovs-ofctl: none of the usable flow formats (NXM) is among the allowed flow formats (OpenFlow10)
670 ])
671 OVS_VSWITCHD_STOP
672 AT_CLEANUP
673
674 dnl Check that add-flow reports non-normalized flows (feature #5029).
675 AT_SETUP([ovs-ofctl add-flow reports non-normalized flows])
676 OVS_VSWITCHD_START
677 AT_CHECK([ovs-ofctl TESTABLE_LOG add-flow br0 nw_src=1.2.3.4,actions=5],
678   [0], [], [dnl
679 ofp_util|INFO|normalization changed ofp_match, details:
680 ofp_util|INFO| pre: nw_src=1.2.3.4
681 ofp_util|INFO|post: @&t@
682 ])
683 OVS_VSWITCHD_STOP
684 AT_CLEANUP