X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=extension%2Fopenflowjava-extension-nicira%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fnx%2Fcodec%2Fmatch%2FCtZoneCodecTest.java;h=f18ef9a99c5b09f1921ac8e57722c56d00429d5e;hb=refs%2Fchanges%2F45%2F101745%2F10;hp=fadb9900588fddd69f7c6df4a3826c989337f3ca;hpb=b58d34478435521768132e005b36510fd1de6d38;p=openflowplugin.git diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java index fadb990058..f18ef9a99c 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java @@ -11,34 +11,26 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxCtZone; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.CtZoneCaseValue; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.aug.nx.match.CtZoneCaseValueBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.zone.grouping.CtZoneValuesBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtZoneCaseValue; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtZoneCaseValueBuilder; +import org.opendaylight.yangtools.yang.common.Uint16; public class CtZoneCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final CtZoneCodec ctZoneCodec = new CtZoneCodec(); - CtZoneCodec ctZoneCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 2; private static final int NXM_FIELD_CODE = 106; - - - @Before - public void setUp() { - ctZoneCodec = new CtZoneCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -59,30 +51,29 @@ public class CtZoneCodecTest { final CtZoneCaseValue result = (CtZoneCaseValue) input.getMatchEntryValue(); - assertEquals(Nxm1Class.class, input.getOxmClass()); - assertEquals(NxmNxCtZone.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(Nxm1Class.VALUE, input.getOxmClass()); + assertEquals(NxmNxCtZone.VALUE, input.getOxmMatchField()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getCtZoneValues().getCtZone().shortValue()); } - private static MatchEntry createMatchEntry() { MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder(); final CtZoneCaseValueBuilder caseBuilder = new CtZoneCaseValueBuilder(); final CtZoneValuesBuilder valuesBuilder = new CtZoneValuesBuilder(); - matchEntryBuilder.setOxmClass(Nxm1Class.class); - matchEntryBuilder.setOxmMatchField(NxmNxCtZone.class); + matchEntryBuilder.setOxmClass(Nxm1Class.VALUE); + matchEntryBuilder.setOxmMatchField(NxmNxCtZone.VALUE); matchEntryBuilder.setHasMask(false); - valuesBuilder.setCtZone(1); + valuesBuilder.setCtZone(Uint16.ONE); caseBuilder.setCtZoneValues(valuesBuilder.build()); matchEntryBuilder.setMatchEntryValue(caseBuilder.build()); return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1;