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%2FOxmTunnelIdSerializerTest.java;h=193bf057fafb516591ae2e135b640884c56e20d5;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=35f2986e84d8dcb3d31a83638720fe2232134e5d;hpb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;p=openflowjava.git diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTunnelIdSerializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTunnelIdSerializerTest.java index 35f2986e..193bf057 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTunnelIdSerializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/OxmTunnelIdSerializerTest.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.MetadataMatchEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId; -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.TunnelId; +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.TunnelIdCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelIdBuilder; /** * @author michal.polkorab @@ -38,8 +36,8 @@ public class OxmTunnelIdSerializerTest { */ @Test public void testSerializeWithoutMask() { - MatchEntriesBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7}); - + MatchEntryBuilder builder = prepareMatchEntry(false, new byte[]{0, 1, 2, 3, 4, 5, 6, 7}); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); @@ -55,13 +53,13 @@ public class OxmTunnelIdSerializerTest { */ @Test public void testSerializeWithMask() { - MatchEntriesBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15}); - + MatchEntryBuilder builder = prepareMatchEntry(true, new byte[]{8, 9, 10, 11, 12, 13, 14, 15}); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(builder.build(), buffer); checkHeader(buffer, true); - + byte[] address = new byte[8]; buffer.readBytes(address); Assert.assertArrayEquals("Wrong address", new byte[]{8, 9, 10, 11, 12, 13, 14, 15}, address); @@ -76,8 +74,8 @@ public class OxmTunnelIdSerializerTest { */ @Test public void testSerializeHeaderWithoutMask() { - MatchEntriesBuilder builder = prepareHeader(false); - + MatchEntryBuilder builder = prepareHeader(false); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); @@ -90,8 +88,8 @@ public class OxmTunnelIdSerializerTest { */ @Test public void testSerializeHeaderWithMask() { - MatchEntriesBuilder builder = prepareHeader(true); - + MatchEntryBuilder builder = prepareHeader(true); + ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializer.serializeHeader(builder.build(), buffer); @@ -123,21 +121,21 @@ public class OxmTunnelIdSerializerTest { assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength()); } - private static MatchEntriesBuilder prepareMatchEntry(boolean hasMask, byte[] value) { - MatchEntriesBuilder builder = prepareHeader(hasMask); + private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, byte[] value) { + MatchEntryBuilder builder = prepareHeader(hasMask); + TunnelIdCaseBuilder casebuilder = new TunnelIdCaseBuilder(); + TunnelIdBuilder valueBuilder = new TunnelIdBuilder(); if (hasMask) { - MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder(); - maskBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0}); - builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build()); + valueBuilder.setMask(new byte[]{30, 30, 25, 25, 15, 15, 0, 0}); } - MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder(); - metadataBuilder.setMetadata(value); - builder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build()); + valueBuilder.setTunnelId(value); + casebuilder.setTunnelId(valueBuilder.build()); + builder.setMatchEntryValue(casebuilder.build()); return builder; } - private static MatchEntriesBuilder prepareHeader(boolean hasMask) { - MatchEntriesBuilder builder = new MatchEntriesBuilder(); + private static MatchEntryBuilder prepareHeader(boolean hasMask) { + MatchEntryBuilder builder = new MatchEntryBuilder(); builder.setOxmClass(OpenflowBasicClass.class); builder.setOxmMatchField(TunnelId.class); builder.setHasMask(hasMask);