X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fsal%2Fapi%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fpacket%2FIEEE8021QTest.java;h=2443b491c7e8a7fb69fba50c65681a6bd691f597;hb=4be60297ba3835ac60e4910540c1b7646f3c4ca3;hp=a4c6c1fc4b335472d302c655ffd52e1544767e36;hpb=400baaf54049cf4d6159e7c03b7c6e724eaa5aa5;p=controller.git diff --git a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/IEEE8021QTest.java b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/IEEE8021QTest.java index a4c6c1fc4b..2443b491c7 100644 --- a/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/IEEE8021QTest.java +++ b/opendaylight/sal/api/src/test/java/org/opendaylight/controller/sal/packet/IEEE8021QTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. + * Copyright (c) 2013-2014 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, @@ -9,7 +9,11 @@ package org.opendaylight.controller.sal.packet; import junit.framework.Assert; + import org.junit.Test; +import org.opendaylight.controller.sal.match.Match; +import org.opendaylight.controller.sal.match.MatchType; +import org.opendaylight.controller.sal.utils.EtherTypes; import org.opendaylight.controller.sal.utils.NetUtils; public class IEEE8021QTest { @@ -212,4 +216,21 @@ public class IEEE8021QTest { Assert.assertTrue(data[44] == (byte) 0x09); Assert.assertTrue(data[45] == (byte) 0xFE); } + + @Test + public void testGetMatchFullPacket() throws Exception { + IEEE8021Q dot1q = new IEEE8021Q(); + byte priority = 4; + short vlanId = 59; + short ethType = EtherTypes.IPv4.shortValue(); + dot1q.setPcp(priority); + dot1q.setVid(vlanId); + dot1q.setEtherType(ethType); + + Match match = dot1q.getMatch(); + + Assert.assertEquals(priority, (byte) match.getField(MatchType.DL_VLAN_PR).getValue()); + Assert.assertEquals(vlanId, (short) match.getField(MatchType.DL_VLAN).getValue()); + Assert.assertEquals(ethType, (short) match.getField(MatchType.DL_TYPE).getValue()); + } }