Fix bugs lingering from merge mistakes.
[openvswitch] / tests / ovs-ofctl.at
1 AT_BANNER([ovs-ofctl])
2
3 AT_SETUP([ovs-ofctl parse-flows])
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 arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
9 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
10 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
11 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
12 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
13 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
14 tun_id=0x1234,cookie=0x5678,actions=flood
15 actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel:0x123456789
16 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])
17 table=1,actions=drop
18 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
19 ]])
20 AT_CHECK([ovs-ofctl parse-flows flows.txt
21 ], [0], [stdout], [stderr])
22 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], 
23 [[OFPT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
24 OFPT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
25 OFPT_FLOW_MOD: ADD arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
26 OFPT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
27 OFPT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
28 OFPT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
29 OFPT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
30 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
31 NXT_SET_FLOW_FORMAT: format=nxm
32 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
33 NXT_FLOW_MOD: ADD actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
34 NXT_FLOW_MOD: ADD 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])
35 NXT_FLOW_MOD_TABLE_ID: enable
36 NXT_FLOW_MOD: ADD table_id:1 actions=drop
37 NXT_FLOW_MOD: ADD table_id:255 tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
38 ]])
39 AT_CHECK([sed 's/.*|//' stderr], [0], [dnl
40 normalization changed ofp_match, details:
41  pre: wildcards=  0x3820f8  in_port=65534  dl_src=00:0a:e4:25:6b:b0  dl_dst=00:00:00:00:00:00  dl_vlan=    9  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
42 post: wildcards=  0x3ffff8  in_port=65534  dl_src=00:0a:e4:25:6b:b0  dl_dst=00:00:00:00:00:00  dl_vlan=    9  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
43 normalization changed ofp_match, details:
44  pre: wildcards=  0x3820ff  in_port=    0  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
45 post: wildcards=  0x3fffff  in_port=    0  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
46 normalization changed ofp_match, details:
47  pre: wildcards=  0x3820ff  in_port=    0  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
48 post: wildcards=  0x3fffff  in_port=    0  dl_src=00:00:00:00:00:00  dl_dst=00:00:00:00:00:00  dl_vlan=    0  dl_vlan_pcp=  0  dl_type=     0  nw_tos=   0  nw_proto=   0  nw_src=         0  nw_dst=         0  tp_src=    0  tp_dst=    0
49 ])
50 AT_CLEANUP
51
52 AT_SETUP([ovs-ofctl -F nxm parse-flows])
53 AT_DATA([flows.txt], [
54 # comment
55 tcp,tp_src=123,actions=flood
56 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
57 arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
58 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
59 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
60 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
61 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
62 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
63 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
64 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
65 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
66 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
67 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
68 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
69 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
70 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
71 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
72 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
73 tun_id=0x1234,cookie=0x5678,actions=flood
74 actions=drop
75 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
76 ])
77 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
78 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
79 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
80 NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
81 NXT_FLOW_MOD: ADD arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
82 NXT_FLOW_MOD: ADD arp,dl_src=00:0a:e4:25:6b:b0,arp_sha=00:0a:e4:25:6b:b0 actions=drop
83 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=output:3
84 NXT_FLOW_MOD: ADD ipv6,ipv6_src=2001:db8:3c4d:1::/64 actions=output:4
85 NXT_FLOW_MOD: ADD ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:4/127 actions=output:5
86 NXT_FLOW_MOD: ADD tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop
87 NXT_FLOW_MOD: ADD udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop
88 NXT_FLOW_MOD: ADD icmp6,in_port=3,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
89 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
90 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
91 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
92 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_target=fec0:0:1234:f045:8fff:1111:fe4e:571 actions=drop
93 NXT_FLOW_MOD: ADD icmp6,icmp_type=135,nd_sll=00:0a:e4:25:6b:b0 actions=drop
94 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
95 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
96 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
97 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
98 NXT_FLOW_MOD: ADD actions=drop
99 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
100 ])
101 AT_CLEANUP
102
103 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
104 AT_DATA([flows.txt], [[
105 # comment
106 tcp,tp_src=123,actions=flood
107 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
108 arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
109 arp,dl_src=00:0A:E4:25:6B:B0,arp_sha=00:0A:E4:25:6B:B0 actions=drop
110 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5 actions=3
111 ipv6,ipv6_src=2001:db8:3c4d:1:2:3:4:5/64 actions=4
112 ipv6,ipv6_dst=2001:db8:3c4d:1:2:3:4:5/127 actions=5
113 tcp6,ipv6_src=2001:db8:3c4d:1::1,tp_dst=80 actions=drop 
114 udp6,ipv6_src=2001:db8:3c4d:1::3,tp_dst=53 actions=drop 
115 in_port=3 icmp6,ipv6_src=2001:db8:3c4d:1::1,icmp_type=134 actions=drop
116 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
117 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
118 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
119 icmp6,icmp_type=135,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571 actions=drop
120 icmp6,icmp_type=135,nd_sll=00:0A:E4:25:6B:B0 actions=drop
121 icmp6,icmp_type=136,nd_target=FEC0::1234:F045:8FFF:1111:FE4E:0571,nd_tll=00:0A:E4:25:6B:B1 actions=drop
122 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
123 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
124 tun_id=0x1234,cookie=0x5678,actions=flood
125 actions=drop
126 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[]
127 ]])
128 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout])
129 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
130 [[NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
131 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
132 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(c0a80001) actions=drop_spoofed_arp,NORMAL
133 NXT_FLOW_MOD: ADD NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(000ae4256bb0) actions=drop
134 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005) actions=output:3
135 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000) actions=output:4
136 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010002000300040004/fffffffffffffffffffffffffffffffe) actions=output:5
137 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
138 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
139 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
140 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
141 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
142 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
143 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
144 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
145 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
146 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
147 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
148 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
149 NXT_FLOW_MOD: ADD <any> actions=drop
150 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[]
151 ]])
152 AT_CLEANUP
153
154 AT_SETUP([ovs-ofctl parse-nx-match])
155 AT_KEYWORDS([nx-match])
156 AT_DATA([nx-match.txt], [dnl
157 <any>
158
159 # in port
160 NXM_OF_IN_PORT(0000)
161 NXM_OF_IN_PORT(fffe)
162
163 # eth dst
164 NXM_OF_ETH_DST(0002e30f80a4)
165 NXM_OF_ETH_DST_W(010000000000/010000000000)
166 NXM_OF_ETH_DST_W(000000000000/010000000000)
167 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
168 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
169 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
170
171 # eth src
172 NXM_OF_ETH_SRC(020898456ddb)
173
174 # eth type
175 NXM_OF_ETH_TYPE(0800)
176 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
177
178 # vlan tci
179 NXM_OF_VLAN_TCI(f009)
180 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
181 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
182 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
183 NXM_OF_VLAN_TCI(0123)           # Does not make sense (but supported anyway)
184 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
185 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
186 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0
187
188 # IP TOS
189 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
190 NXM_OF_IP_TOS(f0)
191
192 # IP protocol
193 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
194 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
195 NXM_OF_IP_PROTO(05)
196
197 # IP source
198 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
199 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
200 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
201 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
202
203 # IP destination
204 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
205 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
206 NXM_OF_IP_DST(ac100014)
207 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
208
209 # TCP source port
210 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
211 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
212
213 # TCP destination port
214 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
215 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
216
217 # UDP source port
218 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
219 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
220
221 # UDP destination port
222 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
223 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
224
225 # ICMP type
226 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
227 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
228
229 # ICMP code
230 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
231 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
232 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
233 NXM_OF_ICMP_CODE(00)
234
235 # ARP opcode
236 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
237 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
238 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
239 NXM_OF_ARP_OP(0001)
240 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
241
242 # ARP source protocol address
243 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
244 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
245 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
246 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
247
248 # ARP destination protocol address
249 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
250 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
251 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
252 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
253
254 # ARP source hardware address
255 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_SHA(0002e30f80a4)
256 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_SHA(0002e30f80a4)
257 NXM_NX_ARP_SHA(0002e30f80a4)
258
259 # ARP destination hardware address
260 NXM_OF_ETH_TYPE(0806) NXM_NX_ARP_THA(0002e30f80a4)
261 NXM_OF_ETH_TYPE(0800) NXM_NX_ARP_THA(0002e30f80a4)
262 NXM_NX_ARP_THA(0002e30f80a4)
263
264 # IPv6 source
265 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
266 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
267 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
268 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
269
270 # IPv6 destination
271 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
272 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
273 NXM_OF_ETH_TYPE(86dd) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
274 NXM_OF_ETH_TYPE(0800) NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
275
276 # ND source hardware address
277 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)
278 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)
279 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)
280 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)
281
282 # ND destination hardware address
283 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)
284 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)
285 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)
286 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)
287
288 # Tunnel ID.
289 NXM_NX_TUN_ID(00000000abcdef01)
290 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
291
292 # Register 0.
293 NXM_NX_REG0(acebdf56)
294 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
295
296 # Invalid field number.
297 01020304(1111/2222)
298
299 # Unimplemented registers.
300 #
301 # This test assumes that at least two registers, but fewer than 16,
302 # registers are implemented.
303 00010004(12345678)
304 00010108(12345678/12345678)
305 00011e04(12345678)
306 00011f08(12345678/12345678)
307 ])
308 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
309 <any>
310
311 # in port
312 NXM_OF_IN_PORT(0000)
313 NXM_OF_IN_PORT(fffe)
314
315 # eth dst
316 NXM_OF_ETH_DST(0002e30f80a4)
317 NXM_OF_ETH_DST_W(010000000000/010000000000)
318 NXM_OF_ETH_DST_W(000000000000/010000000000)
319 NXM_OF_ETH_DST_W(010000000000/010000000000)
320 NXM_OF_ETH_DST(0002e30f80a4)
321 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
322
323 # eth src
324 NXM_OF_ETH_SRC(020898456ddb)
325
326 # eth type
327 NXM_OF_ETH_TYPE(0800)
328 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
329
330 # vlan tci
331 NXM_OF_VLAN_TCI(f009)
332 nx_pull_match() returned error 44010105
333 NXM_OF_VLAN_TCI(0000)
334 NXM_OF_VLAN_TCI(3123)
335 NXM_OF_VLAN_TCI(0123)
336 NXM_OF_VLAN_TCI_W(1123/1fff)
337 NXM_OF_VLAN_TCI_W(f000/f000)
338 NXM_OF_VLAN_TCI_W(0000/e000)
339
340 # IP TOS
341 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
342 nx_pull_match() returned error 44010104
343
344 # IP protocol
345 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
346 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
347 nx_pull_match() returned error 44010104
348
349 # IP source
350 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
351 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
352 nx_pull_match() returned error 44010104
353 nx_pull_match() returned error 44010104
354
355 # IP destination
356 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
357 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
358 nx_pull_match() returned error 44010104
359 nx_pull_match() returned error 44010104
360
361 # TCP source port
362 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
363 nx_pull_match() returned error 44010104
364
365 # TCP destination port
366 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
367 nx_pull_match() returned error 44010104
368
369 # UDP source port
370 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
371 nx_pull_match() returned error 44010104
372
373 # UDP destination port
374 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
375 nx_pull_match() returned error 44010104
376
377 # ICMP type
378 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
379 nx_pull_match() returned error 44010104
380
381 # ICMP code
382 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
383 nx_pull_match() returned error 44010104
384 nx_pull_match() returned error 44010104
385 nx_pull_match() returned error 44010104
386
387 # ARP opcode
388 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
389 nx_pull_match() returned error 44010102
390 nx_pull_match() returned error 44010104
391 nx_pull_match() returned error 44010104
392 nx_pull_match() returned error 44010105
393
394 # ARP source protocol address
395 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
396 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
397 nx_pull_match() returned error 44010104
398 nx_pull_match() returned error 44010104
399
400 # ARP destination protocol address
401 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
402 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
403 nx_pull_match() returned error 44010104
404 nx_pull_match() returned error 44010104
405
406 # ARP source hardware address
407 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_SHA(0002e30f80a4)
408 nx_pull_match() returned error 44010104
409 nx_pull_match() returned error 44010104
410
411 # ARP destination hardware address
412 NXM_OF_ETH_TYPE(0806), NXM_NX_ARP_THA(0002e30f80a4)
413 nx_pull_match() returned error 44010104
414 nx_pull_match() returned error 44010104
415
416 # IPv6 source
417 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC(20010db83c4d00010002000300040005)
418 nx_pull_match() returned error 44010104
419 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_SRC_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
420 nx_pull_match() returned error 44010104
421
422 # IPv6 destination
423 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST(20010db83c4d00010002000300040005)
424 nx_pull_match() returned error 44010104
425 NXM_OF_ETH_TYPE(86dd), NXM_NX_IPV6_DST_W(20010db83c4d00010000000000000000/ffffffffffffffff0000000000000000)
426 nx_pull_match() returned error 44010104
427
428 # ND source hardware address
429 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)
430 nx_pull_match() returned error 44010104
431 nx_pull_match() returned error 44010104
432 nx_pull_match() returned error 44010104
433
434 # ND destination hardware address
435 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)
436 nx_pull_match() returned error 44010104
437 nx_pull_match() returned error 44010104
438 nx_pull_match() returned error 44010104
439
440 # Tunnel ID.
441 NXM_NX_TUN_ID(00000000abcdef01)
442 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
443
444 # Register 0.
445 NXM_NX_REG0(acebdf56)
446 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
447
448 # Invalid field number.
449 nx_pull_match() returned error 44010101
450
451 # Unimplemented registers.
452 #
453 # This test assumes that at least two registers, but fewer than 16,
454 # registers are implemented.
455 NXM_NX_REG0(12345678)
456 NXM_NX_REG0_W(12345678/12345678)
457 nx_pull_match() returned error 44010101
458 nx_pull_match() returned error 44010101
459 ])
460 AT_CLEANUP
461
462 dnl Check that "-F openflow10" rejects a flow_mod with a tun_id, since
463 dnl OpenFlow 1.0 doesn't support tunnels.
464 AT_SETUP([ovs-ofctl -F option and tun_id])
465 AT_CHECK([ovs-ofctl -F openflow10 add-flow dummy tun_id=123,actions=drop],
466   [1], [], [ovs-ofctl: flow cannot be expressed in flow format openflow10 (flow format nxm or better is required)
467 ])
468 AT_CLEANUP
469
470 dnl Check that "-F nxm" really forces add-flow to use the NXM flow format.
471 dnl (If it doesn't, then either the tun_id won't show up at all, or it will
472 dnl additionally show up as the top 32 bits of the cookie.)  This checks
473 dnl for regression against bug #4566.
474 AT_SETUP([ovs-ofctl -F option with flow_mods])
475 OFPROTO_START
476 AT_CHECK([ovs-ofctl -F nxm add-flow br0 tun_id=0x12345678,actions=drop])
477 AT_CHECK([ovs-ofctl dump-flows br0 | STRIP_XIDS | STRIP_DURATION], [0], [dnl
478 NXST_FLOW reply:
479  cookie=0x0, duration=?s, table_id=0, n_packets=0, n_bytes=0, tun_id=0x12345678 actions=drop
480 ])
481 OFPROTO_STOP
482 AT_CLEANUP
483
484 dnl Check that "-F openflow10" is really honored on dump-flows.
485 dnl (If it isn't, then dump-flows will show the register match.)
486 AT_SETUP([ovs-ofctl dump-flows honors -F option])
487 OFPROTO_START
488 AT_CHECK([ovs-ofctl add-flow br0 reg0=0x12345,actions=drop])
489 AT_CHECK([ovs-ofctl -F openflow10 dump-flows br0 | STRIP_XIDS | STRIP_DURATION], [0], [dnl
490 OFPST_FLOW reply:
491  cookie=0x0, duration=?s, table_id=0, n_packets=0, n_bytes=0,  actions=drop
492 ])
493 OFPROTO_STOP
494 AT_CLEANUP
495
496 dnl Check that "-F openflow10" fails on dump-flows if the requested match
497 dnl can't be represented in OpenFlow 1.0.
498 AT_SETUP([ovs-ofctl dump-flows rejects bad -F option])
499 OFPROTO_START
500 AT_CHECK([ovs-ofctl -F openflow10 dump-flows unix:br0.mgmt reg0=0xabcdef], [1], [],
501   [ovs-ofctl: unix:br0.mgmt: cannot use requested flow format nxm for specified flow
502 ])
503 OFPROTO_STOP
504 AT_CLEANUP