2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.sal.match;
11 import java.net.InetAddress;
12 import java.net.UnknownHostException;
13 import java.util.Arrays;
15 import org.junit.Assert;
16 import org.junit.Test;
17 import org.opendaylight.controller.sal.core.Node;
18 import org.opendaylight.controller.sal.core.NodeConnector;
19 import org.opendaylight.controller.sal.match.Match;
20 import org.opendaylight.controller.sal.match.MatchField;
21 import org.opendaylight.controller.sal.match.MatchType;
22 import org.opendaylight.controller.sal.utils.EtherTypes;
23 import org.opendaylight.controller.sal.utils.IPProtocols;
24 import org.opendaylight.controller.sal.utils.NodeConnectorCreator;
25 import org.opendaylight.controller.sal.utils.NodeCreator;
27 public class MatchTest {
29 public void testMatchCreation() {
30 Node node = NodeCreator.createOFNode(7l);
31 NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 6, node);
32 MatchField field = new MatchField(MatchType.IN_PORT, port);
34 Assert.assertTrue(field != null);
35 Assert.assertTrue(field.getType() == MatchType.IN_PORT);
36 Assert.assertTrue((NodeConnector) field.getValue() == port);
37 Assert.assertTrue(field.isValid());
40 field = new MatchField(MatchType.TP_SRC, Long.valueOf(23));
41 Assert.assertFalse(field.isValid());
44 field = new MatchField(MatchType.TP_SRC, (long) 45);
45 Assert.assertFalse(field.isValid());
48 field = new MatchField(MatchType.TP_SRC, 120000);
49 Assert.assertFalse(field.isValid());
51 byte mac[] = { (byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xdd, (byte) 11, (byte) 22 };
52 byte mask[] = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff };
54 field = new MatchField(MatchType.DL_SRC, mac, mask);
55 Assert.assertFalse(field.getValue() == null);
58 field = new MatchField(MatchType.NW_TOS, (byte) 0x22, (byte) 0x3);
59 Assert.assertFalse(field.getValue() == null);
63 public void testMatchSetGet() {
64 Match x = new Match();
66 NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector(val, NodeCreator.createOFNode(1l));
67 x.setField(MatchType.IN_PORT, inPort);
68 Assert.assertTrue(((NodeConnector) x.getField(MatchType.IN_PORT).getValue()).equals(inPort));
69 Assert.assertTrue((Short) ((NodeConnector) x.getField(MatchType.IN_PORT).getValue()).getID() == val);
73 public void testMatchSetGetMAC() {
74 Match x = new Match();
75 byte mac[] = { (byte) 0xaa, (byte) 0xbb, (byte) 0xcc, (byte) 0xdd, (byte) 11, (byte) 22 };
76 byte mac2[] = { (byte) 0xaa, (byte) 0xbb, 0, 0, 0, (byte) 0xbb };
77 byte mask1[] = { (byte) 0x11, (byte) 0x22, (byte) 0x33, (byte) 0x44, (byte) 0x55, (byte) 0x66 };
78 byte mask2[] = { (byte) 0xff, (byte) 0xff, (byte) 0, (byte) 0, (byte) 0, (byte) 0xff };
80 x.setField(MatchType.DL_SRC, mac.clone(), mask1);
81 x.setField(MatchType.DL_DST, mac2.clone(), mask2);
82 Assert.assertTrue(Arrays.equals(mac, (byte[]) x.getField(MatchType.DL_SRC).getValue()));
83 Assert.assertFalse(Arrays.equals((byte[]) x.getField(MatchType.DL_SRC).getValue(),
84 (byte[]) x.getField(MatchType.DL_DST).getValue()));
85 Assert.assertFalse(x.getField(MatchType.DL_SRC).getBitMask() == x.getField(MatchType.DL_DST).getBitMask());
87 x.setField(new MatchField(MatchType.DL_DST, mac.clone(), mask1));
88 Assert.assertTrue(Arrays.equals((byte[]) x.getField(MatchType.DL_SRC).getValue(),
89 (byte[]) x.getField(MatchType.DL_DST).getValue()));
93 public void testMatchSetGetNWAddr() throws UnknownHostException {
94 Match x = new Match();
95 String ip = "172.20.231.23";
96 InetAddress address = InetAddress.getByName(ip);
97 InetAddress mask = InetAddress.getByName("255.255.0.0");
99 x.setField(MatchType.NW_SRC, address, mask);
100 Assert.assertTrue(ip.equals(((InetAddress) x.getField(MatchType.NW_SRC).getValue()).getHostAddress()));
101 Assert.assertTrue(x.getField(MatchType.NW_SRC).getMask().equals(mask));
105 public void testMatchSetGetEtherType() throws UnknownHostException {
106 Match x = new Match();
108 x.setField(MatchType.DL_TYPE, EtherTypes.QINQ.shortValue(), (short) 0xffff);
109 Assert.assertTrue(((Short) x.getField(MatchType.DL_TYPE).getValue()).equals(EtherTypes.QINQ.shortValue()));
110 Assert.assertFalse(x.getField(MatchType.DL_TYPE).getValue() == EtherTypes.QINQ);
111 Assert.assertFalse(x.getField(MatchType.DL_TYPE).getValue().equals(EtherTypes.QINQ));
113 x.setField(MatchType.DL_TYPE, EtherTypes.LLDP.shortValue(), (short) 0xffff);
114 Assert.assertTrue(((Short) x.getField(MatchType.DL_TYPE).getValue()).equals(EtherTypes.LLDP.shortValue()));
115 Assert.assertFalse(x.getField(MatchType.DL_TYPE).equals(EtherTypes.LLDP.intValue()));
119 public void testSetGetNwTos() {
120 Match x = new Match();
121 x.setField(MatchType.NW_TOS, (byte) 0xb, (byte) 0xf);
123 Byte t = new Byte((byte) 0xb);
125 Object o = x.getField(MatchType.NW_TOS).getValue();
126 Assert.assertTrue(o.equals(t));
127 Assert.assertTrue(o.equals((byte) 0xb));
131 public void testSetGetNwProto() {
132 Match x = new Match();
133 byte proto = (byte) 199;
134 x.setField(MatchType.NW_PROTO, proto, (byte) 0xff);
136 Object o = x.getField(MatchType.NW_PROTO).getValue();
137 Assert.assertTrue(o.equals(proto));
141 public void testMatchMask() {
142 Match x = new Match();
143 NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 6, NodeCreator.createOFNode(3l));
144 x.setField(MatchType.IN_PORT, inPort);
145 x.setField(MatchType.DL_VLAN, (short) 28, (short) 0xfff);
146 Assert.assertFalse(x.getMatches() == 0);
147 Assert.assertTrue(x.getMatches() == (MatchType.IN_PORT.getIndex() | MatchType.DL_VLAN.getIndex()));
151 public void testMatchBitMask() {
152 byte mac[] = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 22, (byte) 12 };
153 byte mask[] = { (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0 };
154 NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 4095, NodeCreator.createOFNode(7l));
156 MatchField x = new MatchField(MatchType.IN_PORT, inPort);
157 Assert.assertTrue((x.getMask()) == null);
159 x = new MatchField(MatchType.DL_VLAN, (short) 255, (short) 0xff);
160 Assert.assertTrue(x.getBitMask() == 0xff);
162 x = new MatchField(MatchType.DL_SRC, mac, mask);
163 Assert.assertTrue(x.getMask().equals(mask));
164 Assert.assertTrue(x.getBitMask() == 0xffffffffff00L);
168 public void testNullMask() {
169 byte mac[] = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 22, (byte) 12 };
170 NodeConnector inPort = NodeConnectorCreator.createOFNodeConnector((short) 2000, NodeCreator.createOFNode(7l));
172 MatchField x = new MatchField(MatchType.IN_PORT, inPort);
173 Assert.assertTrue(x.getBitMask() == 0);
175 x = new MatchField(MatchType.NW_PROTO, (byte) 17);
176 Assert.assertTrue(x.getBitMask() == 0xff);
178 x = new MatchField(MatchType.DL_VLAN, (short) 255);
179 Assert.assertTrue(x.getBitMask() == 0xfff);
181 x = new MatchField(MatchType.DL_SRC, mac);
182 Assert.assertTrue(x.getBitMask() == 0xffffffffffffL);
186 public void testEquality() throws Exception {
187 Node node = NodeCreator.createOFNode(7l);
188 NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 24, node);
189 NodeConnector port2 = NodeConnectorCreator.createOFNodeConnector((short) 24, node);
190 byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
191 byte dstMac[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f };
192 byte srcMac2[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
193 byte dstMac2[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f };
194 InetAddress srcIP = InetAddress.getByName("2001:420:281:1004:407a:57f4:4d15:c355");
195 InetAddress dstIP = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0");
196 InetAddress ipMask = InetAddress.getByName("ffff:ffff:ffff:ffff:0:0:0:0");
197 InetAddress ipMaskd = InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:0");
198 InetAddress srcIP2 = InetAddress.getByName("2001:420:281:1004:407a:57f4:4d15:c355");
199 InetAddress dstIP2 = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0");
200 InetAddress ipMask2 = InetAddress.getByName("ffff:ffff:ffff:ffff:0:0:0:0");
201 InetAddress ipMaskd2 = InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:0");
202 short ethertype = EtherTypes.IPv6.shortValue();
203 short ethertype2 = EtherTypes.IPv6.shortValue();
204 short vlan = (short) 27, vlan2 = (short) 27;
205 byte vlanPr = (byte) 3, vlanPr2 = (byte) 3;
206 Byte tos = 4, tos2 = 4;
207 byte proto = IPProtocols.UDP.byteValue(), proto2 = IPProtocols.UDP.byteValue();
208 short src = (short) 5500, src2 = (short) 5500;
209 short dst = 80, dst2 = 80;
212 * Create a SAL Flow aFlow
214 Match match1 = new Match();
215 Match match2 = new Match();
216 match1.setField(MatchType.IN_PORT, port);
217 match1.setField(MatchType.DL_SRC, srcMac);
218 match1.setField(MatchType.DL_DST, dstMac);
219 match1.setField(MatchType.DL_TYPE, ethertype);
220 match1.setField(MatchType.DL_VLAN, vlan);
221 match1.setField(MatchType.DL_VLAN_PR, vlanPr);
222 match1.setField(MatchType.NW_SRC, srcIP, ipMask);
223 match1.setField(MatchType.NW_DST, dstIP, ipMaskd);
224 match1.setField(MatchType.NW_TOS, tos);
225 match1.setField(MatchType.NW_PROTO, proto);
226 match1.setField(MatchType.TP_SRC, src);
227 match1.setField(MatchType.TP_DST, dst);
229 match2.setField(MatchType.IN_PORT, port2);
230 match2.setField(MatchType.DL_SRC, srcMac2);
231 match2.setField(MatchType.DL_DST, dstMac2);
232 match2.setField(MatchType.DL_TYPE, ethertype2);
233 match2.setField(MatchType.DL_VLAN, vlan2);
234 match2.setField(MatchType.DL_VLAN_PR, vlanPr2);
235 match2.setField(MatchType.NW_SRC, srcIP2, ipMask2);
236 match2.setField(MatchType.NW_DST, dstIP2, ipMaskd2);
237 match2.setField(MatchType.NW_TOS, tos2);
238 match2.setField(MatchType.NW_PROTO, proto2);
239 match2.setField(MatchType.TP_SRC, src2);
240 match2.setField(MatchType.TP_DST, dst2);
242 Assert.assertTrue(match1.equals(match2));
244 // Make sure all values are equals
245 for (MatchType type : MatchType.values()) {
246 if (match1.isPresent(type)) {
247 Assert.assertTrue(match1.getField(type).equals(match2.getField(type)));
251 // Make none of the fields couples are pointing to the same reference
252 MatchField a = null, b = null;
253 for (MatchType type : MatchType.values()) {
254 a = match1.getField(type);
255 b = match2.getField(type);
256 if (a != null && b != null) {
257 Assert.assertFalse(a == b);
263 public void testEqualityNetMask() throws Exception {
265 InetAddress srcIP = InetAddress.getByName("1.1.1.1");
266 InetAddress ipMask = InetAddress.getByName("255.255.255.255");
267 InetAddress srcIP2 = InetAddress.getByName("1.1.1.1");
268 InetAddress ipMask2 = null;
269 short ethertype = EtherTypes.IPv4.shortValue();
270 short ethertype2 = EtherTypes.IPv4.shortValue();
273 * Create a SAL Flow aFlow
275 Match match1 = new Match();
276 Match match2 = new Match();
278 match1.setField(MatchType.DL_TYPE, ethertype);
279 match1.setField(MatchType.NW_SRC, srcIP, ipMask);
281 match2.setField(MatchType.DL_TYPE, ethertype2);
282 match2.setField(MatchType.NW_SRC, srcIP2, ipMask2);
284 Assert.assertTrue(match1.equals(match2));
286 ipMask2 = InetAddress.getByName("255.255.255.255");
287 match2.setField(MatchType.NW_SRC, srcIP2, ipMask2);
289 srcIP = InetAddress.getByName("2001:420:281:1004:407a:57f4:4d15:c355");
290 srcIP2 = InetAddress.getByName("2001:420:281:1004:407a:57f4:4d15:c355");
292 ipMask2 = InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff");
293 ethertype = EtherTypes.IPv6.shortValue();
294 ethertype2 = EtherTypes.IPv6.shortValue();
296 match1.setField(MatchType.DL_TYPE, ethertype);
297 match1.setField(MatchType.NW_SRC, srcIP, ipMask);
299 match2.setField(MatchType.DL_TYPE, ethertype2);
300 match2.setField(MatchType.NW_SRC, srcIP2, ipMask2);
302 Assert.assertTrue(match1.equals(match2));
306 public void testHashCode() throws Exception {
307 byte srcMac1[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
308 byte srcMac2[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
309 byte dstMac1[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f };
310 byte dstMac2[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f };
311 short ethertype = EtherTypes.IPv4.shortValue();
312 short ethertype2 = EtherTypes.IPv4.shortValue();
313 InetAddress srcIP1 = InetAddress.getByName("1.1.1.1");
314 InetAddress ipMask1 = InetAddress.getByName("255.255.255.255");
315 InetAddress srcIP2 = InetAddress.getByName("1.1.1.1");
316 InetAddress ipMask2 = InetAddress.getByName("255.255.255.255");
318 Match match1 = new Match();
319 Match match2 = new Match();
321 MatchField field1 = new MatchField(MatchType.DL_SRC, srcMac1);
322 MatchField field2 = new MatchField(MatchType.DL_SRC, srcMac2);
323 Assert.assertTrue(field1.hashCode() == field2.hashCode());
325 match1.setField(field1);
326 match2.setField(field2);
327 Assert.assertTrue(match1.hashCode() == match2.hashCode());
329 MatchField field3 = new MatchField(MatchType.DL_DST, dstMac1);
330 MatchField field4 = new MatchField(MatchType.DL_DST, dstMac2);
331 Assert.assertTrue(field3.hashCode() == field4.hashCode());
333 match1.setField(field3);
334 match2.setField(field4);
335 Assert.assertTrue(match1.hashCode() == match2.hashCode());
337 MatchField field5 = new MatchField(MatchType.DL_TYPE, ethertype);
338 MatchField field6 = new MatchField(MatchType.DL_TYPE, ethertype2);
339 Assert.assertTrue(field5.hashCode() == field6.hashCode());
341 match1.setField(field5);
342 match2.setField(field6);
343 Assert.assertTrue(match1.hashCode() == match2 .hashCode());
345 MatchField field7 = new MatchField(MatchType.NW_SRC, srcIP1, ipMask1);
346 MatchField field8 = new MatchField(MatchType.NW_SRC, srcIP2, ipMask2);
347 Assert.assertTrue(field7.hashCode() == field8.hashCode());
349 match1.setField(field7);
350 match2.setField(field8);
351 Assert.assertTrue(match1.hashCode() == match2.hashCode());
356 public void testCloning() throws Exception {
357 Node node = NodeCreator.createOFNode(7l);
358 NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 24, node);
359 byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
360 byte dstMac[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f };
361 InetAddress srcIP = InetAddress.getByName("2001:420:281:1004:407a:57f4:4d15:c355");
362 InetAddress dstIP = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0");
363 InetAddress ipMasks = InetAddress.getByName("ffff:ffff:ffff:ffff:0:0:0:0");
364 InetAddress ipMaskd = InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:0");
365 short ethertype = EtherTypes.IPv6.shortValue();
366 short vlan = (short) 27;
367 byte vlanPr = (byte) 3;
369 byte proto = IPProtocols.UDP.byteValue();
370 short src = (short) 5500;
374 * Create a SAL Flow aFlow
376 Match match = new Match();
377 match.setField(MatchType.IN_PORT, port);
378 match.setField(MatchType.DL_SRC, srcMac);
379 match.setField(MatchType.DL_DST, dstMac);
380 match.setField(MatchType.DL_TYPE, ethertype);
381 match.setField(MatchType.DL_VLAN, vlan);
382 match.setField(MatchType.DL_VLAN_PR, vlanPr);
383 match.setField(MatchType.NW_SRC, srcIP, ipMasks);
384 match.setField(MatchType.NW_DST, dstIP, ipMaskd);
385 match.setField(MatchType.NW_TOS, tos);
386 match.setField(MatchType.NW_PROTO, proto);
387 match.setField(MatchType.TP_SRC, src);
388 match.setField(MatchType.TP_DST, dst);
390 Match cloned = match.clone();
392 // Make sure all values are equals
393 for (MatchType type : MatchType.values()) {
394 if (match.isPresent(type)) {
395 if (!match.getField(type).equals(cloned.getField(type))) {
396 Assert.assertTrue(match.getField(type).equals(cloned.getField(type)));
401 // Make sure none of the fields couples are pointing to the same
403 MatchField a = null, b = null;
404 for (MatchType type : MatchType.values()) {
405 a = match.getField(type);
406 b = cloned.getField(type);
407 if (a != null && b != null) {
408 Assert.assertFalse(a == b);
412 Assert.assertTrue(match.equals(cloned));
414 Assert.assertFalse(match.getField(MatchType.DL_SRC) == cloned.getField(MatchType.DL_SRC));
415 Assert.assertFalse(match.getField(MatchType.NW_DST) == cloned.getField(MatchType.NW_DST));
416 Assert.assertTrue(match.getField(MatchType.NW_DST).getMask()
417 .equals(cloned.getField(MatchType.NW_DST).getMask()));
418 Assert.assertTrue(match.hashCode() == cloned.hashCode());
422 public void testFlip() throws Exception {
423 Node node = NodeCreator.createOFNode(7l);
424 NodeConnector port = NodeConnectorCreator.createOFNodeConnector((short) 24, node);
425 byte srcMac[] = { (byte) 0x12, (byte) 0x34, (byte) 0x56, (byte) 0x78, (byte) 0x9a, (byte) 0xbc };
426 byte dstMac[] = { (byte) 0x1a, (byte) 0x2b, (byte) 0x3c, (byte) 0x4d, (byte) 0x5e, (byte) 0x6f };
427 InetAddress srcIP = InetAddress.getByName("2001:420:281:1004:407a:57f4:4d15:c355");
428 InetAddress dstIP = InetAddress.getByName("2001:420:281:1004:e123:e688:d655:a1b0");
429 InetAddress ipMasks = InetAddress.getByName("ffff:ffff:ffff:ffff:0:0:0:0");
430 InetAddress ipMaskd = InetAddress.getByName("ffff:ffff:ffff:ffff:ffff:ffff:ffff:0");
431 short ethertype = EtherTypes.IPv6.shortValue();
432 short vlan = (short) 27;
433 byte vlanPr = (byte) 3;
435 byte proto = IPProtocols.UDP.byteValue();
436 short src = (short) 5500;
440 * Create a SAL Flow aFlow
442 Match match = new Match();
443 match.setField(MatchType.IN_PORT, port);
444 match.setField(MatchType.DL_SRC, srcMac);
445 match.setField(MatchType.DL_DST, dstMac);
446 match.setField(MatchType.DL_TYPE, ethertype);
447 match.setField(MatchType.DL_VLAN, vlan);
448 match.setField(MatchType.DL_VLAN_PR, vlanPr);
449 match.setField(MatchType.NW_SRC, srcIP, ipMasks);
450 match.setField(MatchType.NW_DST, dstIP, ipMaskd);
451 match.setField(MatchType.NW_TOS, tos);
452 match.setField(MatchType.NW_PROTO, proto);
453 match.setField(MatchType.TP_SRC, src);
454 match.setField(MatchType.TP_DST, dst);
456 Match flipped = match.reverse();
458 Assert.assertTrue(match.getField(MatchType.DL_TYPE).equals(flipped.getField(MatchType.DL_TYPE)));
459 Assert.assertTrue(match.getField(MatchType.DL_VLAN).equals(flipped.getField(MatchType.DL_VLAN)));
461 Assert.assertTrue(match.getField(MatchType.DL_DST).getValue()
462 .equals(flipped.getField(MatchType.DL_SRC).getValue()));
463 Assert.assertTrue(match.getField(MatchType.DL_DST).getMask() == flipped.getField(MatchType.DL_SRC).getMask());
465 Assert.assertTrue(match.getField(MatchType.NW_DST).getValue()
466 .equals(flipped.getField(MatchType.NW_SRC).getValue()));
467 Assert.assertTrue(match.getField(MatchType.NW_DST).getMask() == flipped.getField(MatchType.NW_SRC).getMask());
469 Assert.assertTrue(match.getField(MatchType.TP_DST).getValue()
470 .equals(flipped.getField(MatchType.TP_SRC).getValue()));
471 Assert.assertTrue(match.getField(MatchType.TP_DST).getMask() == flipped.getField(MatchType.TP_SRC).getMask());
473 Match flipflip = flipped.reverse().reverse();
474 Assert.assertTrue(flipflip.equals(flipped));
479 public void testVlanNone() throws Exception {
480 // The value 0 is used to indicate that no VLAN ID is set
481 short vlan = (short) 0;
482 MatchField field = new MatchField(MatchType.DL_VLAN, vlan);
484 Assert.assertTrue(field != null);
485 Assert.assertTrue(field.getValue().equals(new Short(vlan)));
486 Assert.assertTrue(field.isValid());