3 AT_SETUP([ovs-ofctl parse-flows])
4 AT_DATA([flows.txt], [[
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])
18 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
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_TUN_ID_FROM_COOKIE: set=1
32 OFPT_FLOW_MOD: ADD cookie:0x123400005678 actions=FLOOD
33 OFPT_FLOW_MOD: ADD actions=set_tunnel:0x1234,set_tunnel64:0x9876,set_tunnel64:0x123456789
34 OFPT_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 OFPT_FLOW_MOD: ADD actions=drop
36 NXT_SET_FLOW_FORMAT: format=nxm
37 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
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=65534 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=65534 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=65534 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=65534 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 normalization changed ofp_match, details:
50 pre: wildcards= 0x3820ff in_port=65534 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
51 post: wildcards= 0x3fffff in_port=65534 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
52 normalization changed ofp_match, details:
53 pre: wildcards= 0x23820ff in_port=65534 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
54 post: wildcards= 0x23fffff in_port=65534 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
58 AT_SETUP([ovs-ofctl -F nxm parse-flows])
59 AT_DATA([flows.txt], [
61 tcp,tp_src=123,actions=flood
62 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
63 arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
64 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
65 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
66 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
67 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
68 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
69 tun_id=0x1234,cookie=0x5678,actions=flood
71 tun_id=0x1234000056780000/0xffff0000ffff0000,actions=drop
73 AT_CHECK([ovs-ofctl -F nxm parse-flows flows.txt], [0], [stdout])
74 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
75 NXT_FLOW_MOD: ADD tcp,tp_src=123 actions=FLOOD
76 NXT_FLOW_MOD: ADD in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0 actions=drop
77 NXT_FLOW_MOD: ADD arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
78 NXT_FLOW_MOD: ADD udp,dl_vlan_pcp=7 idle:5 actions=strip_vlan,output:0
79 NXT_FLOW_MOD: ADD tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
80 NXT_FLOW_MOD: ADD udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
81 NXT_FLOW_MOD: ADD priority=60000 cookie:0x123456789abcdef hard:10 actions=CONTROLLER:65535
82 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
83 NXT_FLOW_MOD: ADD tun_id=0x1234 cookie:0x5678 actions=FLOOD
84 NXT_FLOW_MOD: ADD actions=drop
85 NXT_FLOW_MOD: ADD tun_id=0x1234000056780000/0xffff0000ffff0000 actions=drop
89 AT_SETUP([ovs-ofctl -F nxm -mmm parse-flows])
90 AT_DATA([flows.txt], [[
92 tcp,tp_src=123,actions=flood
93 in_port=LOCAL dl_vlan=9 dl_src=00:0A:E4:25:6B:B0 actions=drop
94 arp,nw_src=192.168.0.1 actions=drop_spoofed_arp,NORMAL
95 udp dl_vlan_pcp=7 idle_timeout=5 actions=strip_vlan output:0
96 tcp,nw_src=192.168.0.3,tp_dst=80 actions=set_queue:37,output:1
97 udp,nw_src=192.168.0.3,tp_dst=53 actions=pop_queue,output:1
98 cookie=0x123456789abcdef hard_timeout=10 priority=60000 actions=controller
99 actions=note:41.42.43,note:00.01.02.03.04.05.06.07,note
100 tun_id=0x1234,cookie=0x5678,actions=flood
102 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[]
104 AT_CHECK([ovs-ofctl -F nxm -mmm parse-flows flows.txt], [0], [stdout])
105 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0],
106 [[NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(007b) actions=FLOOD
107 NXT_FLOW_MOD: ADD NXM_OF_IN_PORT(fffe), NXM_OF_ETH_SRC(000ae4256bb0), NXM_OF_VLAN_TCI_W(1009/1fff) actions=drop
108 NXT_FLOW_MOD: ADD NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(c0a80001) actions=drop_spoofed_arp,NORMAL
109 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
110 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
111 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
112 NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
113 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
114 NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
115 NXT_FLOW_MOD: ADD <any> actions=drop
116 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[]
120 AT_SETUP([ovs-ofctl parse-nx-match])
121 AT_KEYWORDS([nx-match])
122 AT_DATA([nx-match.txt], [dnl
130 NXM_OF_ETH_DST(0002e30f80a4)
131 NXM_OF_ETH_DST_W(010000000000/010000000000)
132 NXM_OF_ETH_DST_W(000000000000/010000000000)
133 NXM_OF_ETH_DST_W(ffffffffffff/010000000000)
134 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
135 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
138 NXM_OF_ETH_SRC(020898456ddb)
141 NXM_OF_ETH_TYPE(0800)
142 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
145 NXM_OF_VLAN_TCI(f009)
146 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
147 NXM_OF_VLAN_TCI(0000) # Packets without 802.1Q header.
148 NXM_OF_VLAN_TCI(3123) # Packets with VID=123, PCP=1.
149 NXM_OF_VLAN_TCI(0123) # Does not make sense (but supported anyway)
150 NXM_OF_VLAN_TCI_W(1123/1fff) # Packets with VID=123, any PCP.
151 NXM_OF_VLAN_TCI_W(f000/f000) # Packets with any VID, PCP=7.
152 NXM_OF_VLAN_TCI_W(0000/e000) # No 802.1Q or with VID=0
155 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
159 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
160 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
164 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
165 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
166 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
167 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
170 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
171 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a88012/FFFF0000)
172 NXM_OF_IP_DST(ac100014)
173 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
176 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
177 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
179 # TCP destination port
180 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
181 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
184 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
185 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
187 # UDP destination port
188 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
189 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
192 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
193 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
196 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
197 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
198 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
202 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
203 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
204 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
206 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
209 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
210 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81234/FFFFFF00)
211 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
212 NXM_OF_ARP_SPA_W(C0D8fedc/FFFF0000)
215 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
216 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a812fe/FFFFFF00)
217 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
218 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
221 NXM_NX_TUN_ID(00000000abcdef01)
222 NXM_NX_TUN_ID_W(84200000abcdef01/84200000FFFFFFFF)
225 NXM_NX_REG0(acebdf56)
226 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
228 # Invalid field number.
231 # Unimplemented registers.
233 # This test assumes that at least two registers, but fewer than 16,
234 # registers are implemented.
236 00010108(12345678/12345678)
238 00011f08(12345678/12345678)
240 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [dnl
248 NXM_OF_ETH_DST(0002e30f80a4)
249 NXM_OF_ETH_DST_W(010000000000/010000000000)
250 NXM_OF_ETH_DST_W(000000000000/010000000000)
251 NXM_OF_ETH_DST_W(010000000000/010000000000)
252 NXM_OF_ETH_DST(0002e30f80a4)
253 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
256 NXM_OF_ETH_SRC(020898456ddb)
259 NXM_OF_ETH_TYPE(0800)
260 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800)
263 NXM_OF_VLAN_TCI(f009)
264 nx_pull_match() returned error 44010105
265 NXM_OF_VLAN_TCI(0000)
266 NXM_OF_VLAN_TCI(3123)
267 NXM_OF_VLAN_TCI(0123)
268 NXM_OF_VLAN_TCI_W(1123/1fff)
269 NXM_OF_VLAN_TCI_W(f000/f000)
270 NXM_OF_VLAN_TCI_W(0000/e000)
273 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
274 nx_pull_match() returned error 44010104
277 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
278 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
279 nx_pull_match() returned error 44010104
282 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
283 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
284 nx_pull_match() returned error 44010104
285 nx_pull_match() returned error 44010104
288 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
289 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
290 nx_pull_match() returned error 44010104
291 nx_pull_match() returned error 44010104
294 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
295 nx_pull_match() returned error 44010104
297 # TCP destination port
298 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
299 nx_pull_match() returned error 44010104
302 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
303 nx_pull_match() returned error 44010104
305 # UDP destination port
306 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
307 nx_pull_match() returned error 44010104
310 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
311 nx_pull_match() returned error 44010104
314 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
315 nx_pull_match() returned error 44010104
316 nx_pull_match() returned error 44010104
317 nx_pull_match() returned error 44010104
320 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
321 nx_pull_match() returned error 44010102
322 nx_pull_match() returned error 44010104
323 nx_pull_match() returned error 44010104
324 nx_pull_match() returned error 44010105
327 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
328 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
329 nx_pull_match() returned error 44010104
330 nx_pull_match() returned error 44010104
333 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
334 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
335 nx_pull_match() returned error 44010104
336 nx_pull_match() returned error 44010104
339 NXM_NX_TUN_ID(00000000abcdef01)
340 NXM_NX_TUN_ID_W(84200000abcdef01/84200000ffffffff)
343 NXM_NX_REG0(acebdf56)
344 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
346 # Invalid field number.
347 nx_pull_match() returned error 44010101
349 # Unimplemented registers.
351 # This test assumes that at least two registers, but fewer than 16,
352 # registers are implemented.
353 NXM_NX_REG0(12345678)
354 NXM_NX_REG0_W(12345678/12345678)
355 nx_pull_match() returned error 44010101
356 nx_pull_match() returned error 44010101