X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fserialization%2Fmatch%2FOxmVlanVidSerializerTest.java;h=effaccdbd37e8fad4257e88f7a953ff032ab01d7;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=f0ae6dea9a3982ac8541096aed1c43a2f7bcd82c;hpb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanVidSerializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanVidSerializerTest.java index f0ae6dea..effaccdb 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanVidSerializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmVlanVidSerializerTest.java @@ -17,13 +17,11 @@ import org.junit.Assert; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.vid._case.VlanVidBuilder; /** * @author michal.polkorab @@ -38,8 +36,8 @@ public class OxmVlanVidSerializerTest { */ @Test public void testSerializeWithCfiBitSet() { - MatchEntriesBuilder builder = prepareVlanVidMatchEntry(false, true); - + MatchEntryBuilder builder = prepareVlanVidMatchEntry(false, true); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); @@ -53,8 +51,8 @@ public class OxmVlanVidSerializerTest { */ @Test public void testSerializeWithoutCfiBitSet() { - MatchEntriesBuilder builder = prepareVlanVidMatchEntry(true, false); - + MatchEntryBuilder builder = prepareVlanVidMatchEntry(true, false); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); @@ -71,8 +69,8 @@ public class OxmVlanVidSerializerTest { */ @Test public void testSerializeHeaderWithoutMask() { - MatchEntriesBuilder builder = prepareVlanVidHeader(false); - + MatchEntryBuilder builder = prepareVlanVidHeader(false); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); @@ -85,8 +83,8 @@ public class OxmVlanVidSerializerTest { */ @Test public void testSerializeHeaderWithMask() { - MatchEntriesBuilder builder = prepareVlanVidHeader(true); - + MatchEntryBuilder builder = prepareVlanVidHeader(true); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); @@ -118,22 +116,22 @@ public class OxmVlanVidSerializerTest { assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength()); } - private static MatchEntriesBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) { - MatchEntriesBuilder builder = prepareVlanVidHeader(hasMask); + private static MatchEntryBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) { + MatchEntryBuilder builder = prepareVlanVidHeader(hasMask); + VlanVidCaseBuilder casebuilder = new VlanVidCaseBuilder(); + VlanVidBuilder valueBuilder = new VlanVidBuilder(); if (hasMask) { - MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder(); - maskBuilder.setMask(new byte[]{15, 15}); - builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build()); + valueBuilder.setMask(new byte[]{15, 15}); } - VlanVidMatchEntryBuilder vlanBuilder = new VlanVidMatchEntryBuilder(); - vlanBuilder.setVlanVid(500); - vlanBuilder.setCfiBit(cfiBit); - builder.addAugmentation(VlanVidMatchEntry.class, vlanBuilder.build()); + valueBuilder.setVlanVid(500); + valueBuilder.setCfiBit(cfiBit); + casebuilder.setVlanVid(valueBuilder.build()); + builder.setMatchEntryValue(casebuilder.build()); return builder; } - private static MatchEntriesBuilder prepareVlanVidHeader(boolean hasMask) { - MatchEntriesBuilder builder = new MatchEntriesBuilder(); + private static MatchEntryBuilder prepareVlanVidHeader(boolean hasMask) { + MatchEntryBuilder builder = new MatchEntryBuilder(); builder.setOxmClass(OpenflowBasicClass.class); builder.setOxmMatchField(VlanVid.class); builder.setHasMask(hasMask);