Add support for matching Ethernet multicast frames.
[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 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=drop
14 ])
15 AT_CHECK([ovs-ofctl parse-flows flows.txt], [0], [stdout])
16 AT_CHECK([[sed 's/ (xid=0x[0-9a-fA-F]*)//' stdout]], [0], [dnl
17 flow_mod: tcp,tp_src=123, ADD: actions=FLOOD
18 flow_mod: in_port=65534,dl_vlan=9,dl_src=00:0a:e4:25:6b:b0, ADD: actions=drop
19 flow_mod: arp,nw_src=192.168.0.1, ADD: actions=drop_spoofed_arp,NORMAL
20 flow_mod: udp,dl_vlan_pcp=7, ADD: idle:5 actions=strip_vlan,output:0
21 flow_mod: tcp,nw_src=192.168.0.3,tp_dst=80, ADD: actions=set_queue:37,output:1
22 flow_mod: udp,nw_src=192.168.0.3,tp_dst=53, ADD: actions=pop_queue,output:1
23 flow_mod: ADD: cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTROLLER:65535
24 flow_mod: ADD: actions=drop
25 ])
26 AT_CLEANUP
27
28 AT_SETUP([ovs-ofctl parse-nx-match])
29 AT_KEYWORDS([nx-match])
30 AT_DATA([nx-match.txt], [dnl
31 <any>
32
33 # in port
34 NXM_OF_IN_PORT(0000)
35 NXM_OF_IN_PORT(fffe)
36
37 # eth dst
38 NXM_OF_ETH_DST(0002e30f80a4)
39 NXM_OF_ETH_DST_W(010000000000/010000000000)
40 NXM_OF_ETH_DST_W(000000000000/010000000000)
41 NXM_OF_ETH_DST_W(0002e30f80a4/ffffffffffff)
42 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
43
44 # eth src
45 NXM_OF_ETH_SRC(020898456ddb)
46
47 # eth type
48 NXM_OF_ETH_TYPE(0800)
49 NXM_OF_ETH_TYPE(0800) NXM_OF_IN_PORT(0012)
50
51 # vlan tci
52 NXM_OF_VLAN_TCI(f009)
53 NXM_OF_VLAN_TCI(f009) NXM_OF_VLAN_TCI(f009)
54 NXM_OF_VLAN_TCI(0000)           # Packets without 802.1Q header.
55 NXM_OF_VLAN_TCI(3123)           # Packets with VID=123, PCP=1.
56 NXM_OF_VLAN_TCI(0123)           # Does not make sense.
57 NXM_OF_VLAN_TCI_W(1123/1fff)    # Packets with VID=123, any PCP.
58 NXM_OF_VLAN_TCI_W(f000/f000)    # Packets with any VID, PCP=7.
59 NXM_OF_VLAN_TCI_W(0000/e000)    # No 802.1Q or with VID=0 (not yet supported)
60
61 # IP TOS
62 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_TOS(f0)
63 NXM_OF_IP_TOS(f0)
64
65 # IP protocol
66 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01)
67 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(05)
68 NXM_OF_IP_PROTO(05)
69
70 # IP source
71 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC(ac100014)
72 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_SRC_W(C0a80000/FFFF0000)
73 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_SRC(ac100014)
74 NXM_OF_IP_SRC_W(C0D80000/FFFF0000)
75
76 # IP destination
77 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST(ac100014)
78 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_DST_W(C0a80000/FFFF0000)
79 NXM_OF_IP_DST(ac100014)
80 NXM_OF_ETH_TYPE(0806) NXM_OF_IP_DST_W(C0D80000/FFFF0000)
81
82 # TCP source port
83 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_SRC(4231)
84 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_SRC(4231)
85
86 # TCP destination port
87 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_TCP_DST(4231)
88 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(07) NXM_OF_TCP_DST(4231)
89
90 # UDP source port
91 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_SRC(8732)
92 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(06) NXM_OF_UDP_SRC(7823)
93
94 # UDP destination port
95 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(11) NXM_OF_UDP_DST(1782)
96 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(02) NXM_OF_UDP_DST(1293)
97
98 # ICMP type
99 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_TYPE(12)
100 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_TYPE(10)
101
102 # ICMP code
103 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(01) NXM_OF_ICMP_CODE(12)
104 NXM_OF_ETH_TYPE(0800) NXM_OF_IP_PROTO(00) NXM_OF_ICMP_CODE(10)
105 NXM_OF_ETH_TYPE(0800) NXM_OF_ICMP_CODE(10)
106 NXM_OF_ICMP_CODE(00)
107
108 # ARP opcode
109 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001)
110 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(1111)
111 NXM_OF_ETH_TYPE(0000) NXM_OF_ARP_OP(0001)
112 NXM_OF_ARP_OP(0001)
113 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_OP(0001) NXM_OF_ARP_OP(0001)
114
115 # ARP source
116 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA(ac100014)
117 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_SPA_W(C0a81200/FFFFFF00)
118 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_SPA(ac100014)
119 NXM_OF_ARP_SPA_W(C0D80000/FFFF0000)
120
121 # ARP destination
122 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA(ac100014)
123 NXM_OF_ETH_TYPE(0806) NXM_OF_ARP_TPA_W(C0a81200/FFFFFF00)
124 NXM_OF_ETH_TYPE(0800) NXM_OF_ARP_TPA(ac100014)
125 NXM_OF_ARP_TPA_W(C0D80000/FFFF0000)
126
127 # Tunnel ID.
128 NXM_NX_TUN_ID(00000000abcdef01)
129
130 # Register 0.
131 NXM_NX_REG0(acebdf56)
132 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
133 ])
134 AT_CHECK([ovs-ofctl parse-nx-match < nx-match.txt], [0], [stdout])
135 AT_CHECK([cat stdout], [0], [dnl
136 <any>
137
138 # in port
139 NXM_OF_IN_PORT(fffe)
140 NXM_OF_IN_PORT(fffe)
141
142 # eth dst
143 NXM_OF_ETH_DST(0002e30f80a4)
144 NXM_OF_ETH_DST_W(010000000000/010000000000)
145 NXM_OF_ETH_DST_W(000000000000/010000000000)
146 NXM_OF_ETH_DST(0002e30f80a4)
147 NXM_OF_ETH_DST_W(0002e30f80a4/feffffffffff)
148
149 # eth src
150 NXM_OF_ETH_SRC(020898456ddb)
151
152 # eth type
153 NXM_OF_ETH_TYPE(0800)
154 NXM_OF_IN_PORT(0012), NXM_OF_ETH_TYPE(0800) 
155
156 # vlan tci
157 NXM_OF_VLAN_TCI(f009)
158 nx_pull_match() returned error 44010105
159 NXM_OF_VLAN_TCI(0000)
160 NXM_OF_VLAN_TCI(3123)
161 nx_pull_match() returned error 44010100
162 NXM_OF_VLAN_TCI_W(1123/1fff)
163 NXM_OF_VLAN_TCI_W(f000/f000)
164 nx_pull_match() returned error 44010100
165
166 # IP TOS
167 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_TOS(f0)
168 nx_pull_match() returned error 44010104
169
170 # IP protocol
171 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01)
172 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(05)
173 nx_pull_match() returned error 44010104
174
175 # IP source
176 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC(ac100014)
177 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_SRC_W(c0a80000/ffff0000)
178 nx_pull_match() returned error 44010104
179 nx_pull_match() returned error 44010104
180
181 # IP destination
182 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST(ac100014)
183 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_DST_W(c0a80000/ffff0000)
184 nx_pull_match() returned error 44010104
185 nx_pull_match() returned error 44010104
186
187 # TCP source port
188 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_SRC(4231)
189 nx_pull_match() returned error 44010104
190
191 # TCP destination port
192 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(06), NXM_OF_TCP_DST(4231)
193 nx_pull_match() returned error 44010104
194
195 # UDP source port
196 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_SRC(8732)
197 nx_pull_match() returned error 44010104
198
199 # UDP destination port
200 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(11), NXM_OF_UDP_DST(1782)
201 nx_pull_match() returned error 44010104
202
203 # ICMP type
204 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_TYPE(12)
205 nx_pull_match() returned error 44010104
206
207 # ICMP code
208 NXM_OF_ETH_TYPE(0800), NXM_OF_IP_PROTO(01), NXM_OF_ICMP_CODE(12)
209 nx_pull_match() returned error 44010104
210 nx_pull_match() returned error 44010104
211 nx_pull_match() returned error 44010104
212
213 # ARP opcode
214 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_OP(0001)
215 nx_pull_match() returned error 44010102
216 nx_pull_match() returned error 44010104
217 nx_pull_match() returned error 44010104
218 nx_pull_match() returned error 44010105
219
220 # ARP source
221 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA(ac100014)
222 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_SPA_W(c0a81200/ffffff00)
223 nx_pull_match() returned error 44010104
224 nx_pull_match() returned error 44010104
225
226 # ARP destination
227 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA(ac100014)
228 NXM_OF_ETH_TYPE(0806), NXM_OF_ARP_TPA_W(c0a81200/ffffff00)
229 nx_pull_match() returned error 44010104
230 nx_pull_match() returned error 44010104
231
232 # Tunnel ID.
233 NXM_NX_TUN_ID(00000000abcdef01)
234
235 # Register 0.
236 NXM_NX_REG0(acebdf56)
237 NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
238 ])
239 AT_CLEANUP