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