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