import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.ct.mark._case.NxActionCtMarkBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNat;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofpact.actions.ofpact.actions.nx.action.nat._case.NxActionNatBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class ConntrackCodecTest {
private static Action createAction() {
NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder();
- nxActionConntrackBuilder.setFlags(1);
- nxActionConntrackBuilder.setZoneSrc((long) 2);
- nxActionConntrackBuilder.setConntrackZone(3);
- nxActionConntrackBuilder.setRecircTable((short) 4);
+ nxActionConntrackBuilder.setFlags(Uint16.ONE);
+ nxActionConntrackBuilder.setZoneSrc(Uint32.TWO);
+ nxActionConntrackBuilder.setConntrackZone(Uint16.valueOf(3));
+ nxActionConntrackBuilder.setRecircTable(Uint8.valueOf(4));
NxActionNatBuilder nxActionNatBuilder = new NxActionNatBuilder();
- nxActionNatBuilder.setFlags(5);
- nxActionNatBuilder.setRangePresent(0x3F);
+ nxActionNatBuilder.setFlags(Uint16.valueOf(5));
+ nxActionNatBuilder.setRangePresent(Uint16.valueOf(0x3F));
nxActionNatBuilder.setIpAddressMin(IpAddressBuilder.getDefaultInstance("192.168.0.0"));
nxActionNatBuilder.setIpAddressMax(IpAddressBuilder.getDefaultInstance("192.168.10.0"));
- nxActionNatBuilder.setPortMin(3000);
- nxActionNatBuilder.setPortMax(4000);
+ nxActionNatBuilder.setPortMin(Uint16.valueOf(3000));
+ nxActionNatBuilder.setPortMax(Uint16.valueOf(4000));
NxActionNatCaseBuilder nxActionNatCaseBuilder = new NxActionNatCaseBuilder();
nxActionNatCaseBuilder.setNxActionNat(nxActionNatBuilder.build());
CtActionsBuilder ctActionsBuilder = new CtActionsBuilder();
List<CtActions> ctActionsList = new ArrayList<>();
ctActionsList.add(ctActionsBuilder.build());
nxActionNatBuilder = new NxActionNatBuilder();
- nxActionNatBuilder.setFlags(5);
- nxActionNatBuilder.setRangePresent(0x21);
+ nxActionNatBuilder.setFlags(Uint16.valueOf(5));
+ nxActionNatBuilder.setRangePresent(Uint16.valueOf(0x21));
nxActionNatBuilder.setIpAddressMin(IpAddressBuilder.getDefaultInstance("192.168.0.0"));
- nxActionNatBuilder.setPortMax(4000);
+ nxActionNatBuilder.setPortMax(Uint16.valueOf(4000));
nxActionNatCaseBuilder = new NxActionNatCaseBuilder();
nxActionNatCaseBuilder.setNxActionNat(nxActionNatBuilder.build());
ctActionsBuilder = new CtActionsBuilder();
nxActionConntrackBuilder.setCtActions(ctActionsList);
NxActionCtMarkBuilder nxActionCtMarkBuilder = new NxActionCtMarkBuilder();
- nxActionCtMarkBuilder.setCtMark((long) 36);
+ nxActionCtMarkBuilder.setCtMark(Uint32.valueOf(36));
NxActionCtMarkCaseBuilder nxActionCtMarkCaseBuilder = new NxActionCtMarkCaseBuilder();
nxActionCtMarkCaseBuilder.setNxActionCtMark(nxActionCtMarkBuilder.build());
ctActionsBuilder = new CtActionsBuilder();
private static Action createActionWithoutCtAction() {
NxActionConntrackBuilder nxActionConntrackBuilder = new NxActionConntrackBuilder();
- nxActionConntrackBuilder.setFlags(1);
- nxActionConntrackBuilder.setZoneSrc((long) 2);
- nxActionConntrackBuilder.setConntrackZone(3);
- nxActionConntrackBuilder.setRecircTable((short) 4);
+ nxActionConntrackBuilder.setFlags(Uint16.ONE);
+ nxActionConntrackBuilder.setZoneSrc(Uint32.TWO);
+ nxActionConntrackBuilder.setConntrackZone(Uint16.valueOf(3));
+ nxActionConntrackBuilder.setRecircTable(Uint8.valueOf(4));
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionDecap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionDecapBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.decap.grouping.NxActionDecapBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class DecapCodecTest {
private static final int LENGTH = 16;
private static final int SUBTYPE = 47;
- private static final long PACKET_TYPE = 0xFFFEL;
+ private static final Uint32 PACKET_TYPE = Uint32.valueOf(0xFFFEL);
DecapCodec decapCodec;
ByteBuf buffer;
ActionDecap result = (ActionDecap) action.getActionChoice();
- assertEquals(PACKET_TYPE, result.getNxActionDecap().getPacketType().longValue());
+ assertEquals(PACKET_TYPE, result.getNxActionDecap().getPacketType());
assertFalse(buffer.isReadable());
}
assertEquals(SUBTYPE, buffer.readUnsignedShort());
//Serialize part
assertEquals(0, buffer.readUnsignedShort());
- assertEquals(PACKET_TYPE, buffer.readUnsignedInt());
+ assertEquals(PACKET_TYPE.longValue(), buffer.readUnsignedInt());
assertFalse(buffer.isReadable());
}
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
message.writeShort(SUBTYPE);
message.writeZero(2);
- message.writeInt((int) PACKET_TYPE);
+ message.writeInt(PACKET_TYPE.intValue());
}
private static Action createAction() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionEncap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionEncapBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.encap.grouping.NxActionEncapBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class EncapCodecTest {
private static final int LENGTH = 16;
private static final int SUBTYPE = 46;
private static final int HEADER_SIZE_NOT_SPECIFIED = 0;
- private static final long PACKET_TYPE = 0x1894FL;
+ private static final Uint32 PACKET_TYPE = Uint32.valueOf(0x1894F);
EncapCodec encapCodec;
ByteBuf buffer;
ActionEncap result = (ActionEncap) action.getActionChoice();
- assertEquals(PACKET_TYPE, result.getNxActionEncap().getPacketType().longValue());
+ assertEquals(PACKET_TYPE, result.getNxActionEncap().getPacketType());
assertFalse(buffer.isReadable());
}
assertEquals(SUBTYPE, buffer.readUnsignedShort());
//Serialize part
assertEquals(HEADER_SIZE_NOT_SPECIFIED, buffer.readUnsignedShort());
- assertEquals(PACKET_TYPE, buffer.readUnsignedInt());
+ assertEquals(PACKET_TYPE.longValue(), buffer.readUnsignedInt());
assertFalse(buffer.isReadable());
}
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
message.writeShort(SUBTYPE);
message.writeShort(HEADER_SIZE_NOT_SPECIFIED);
- message.writeInt((int) PACKET_TYPE);
+ message.writeInt(PACKET_TYPE.intValue());
}
private static Action createAction() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionFinTimeout;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionFinTimeoutBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.fin.timeout.grouping.NxActionFinTimeoutBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class FinTimeoutCodecTest {
@Test
public void serializeTestWithValues() {
- action = createAction((short) 1, (short) 2);
+ action = createAction(Uint16.ONE, Uint16.TWO);
finTimeoutCodec.serialize(action, buffer);
assertEquals(LENGTH, buffer.readableBytes());
ActionFinTimeout result = (ActionFinTimeout) action.getActionChoice();
- assertEquals(1, result.getNxActionFinTimeout().getFinIdleTimeout().intValue());
- assertEquals(2, result.getNxActionFinTimeout().getFinHardTimeout().intValue());
+ assertEquals(Uint16.ONE, result.getNxActionFinTimeout().getFinIdleTimeout());
+ assertEquals(Uint16.TWO, result.getNxActionFinTimeout().getFinHardTimeout());
assertEquals(0, buffer.readableBytes());
}
- private static Action createAction(Short idleTimeout, Short hardTimeout) {
+ private static Action createAction(Uint16 idleTimeout, Uint16 hardTimeout) {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
NxActionFinTimeoutBuilder nxActionFinTimeoutBuilder = new NxActionFinTimeoutBuilder();
if (idleTimeout != null) {
- nxActionFinTimeoutBuilder.setFinIdleTimeout(idleTimeout.intValue());
+ nxActionFinTimeoutBuilder.setFinIdleTimeout(idleTimeout);
}
if (hardTimeout != null) {
- nxActionFinTimeoutBuilder.setFinHardTimeout(hardTimeout.intValue());
+ nxActionFinTimeoutBuilder.setFinHardTimeout(hardTimeout);
}
actionFinTimeoutBuilder.setNxActionFinTimeout(nxActionFinTimeoutBuilder.build());
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
-import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.junit.Assert;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.NxActionLearnBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowMods;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.learn.grouping.nx.action.learn.FlowModsBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class LearnCodecTest {
final ActionLearnBuilder actionLearnBuilder = new ActionLearnBuilder();
NxActionLearnBuilder nxActionLearnBuilder = new NxActionLearnBuilder();
- nxActionLearnBuilder.setIdleTimeout(1);
- nxActionLearnBuilder.setHardTimeout(2);
- nxActionLearnBuilder.setPriority(3);
- nxActionLearnBuilder.setCookie(BigInteger.valueOf(4));
- nxActionLearnBuilder.setFlags(5);
- nxActionLearnBuilder.setTableId((short)6);
- nxActionLearnBuilder.setFinIdleTimeout(7);
- nxActionLearnBuilder.setFinHardTimeout(8);
+ nxActionLearnBuilder.setIdleTimeout(Uint16.ONE);
+ nxActionLearnBuilder.setHardTimeout(Uint16.TWO);
+ nxActionLearnBuilder.setPriority(Uint16.valueOf(3));
+ nxActionLearnBuilder.setCookie(Uint64.valueOf(4));
+ nxActionLearnBuilder.setFlags(Uint16.valueOf(5));
+ nxActionLearnBuilder.setTableId(Uint8.valueOf(6));
+ nxActionLearnBuilder.setFinIdleTimeout(Uint16.valueOf(7));
+ nxActionLearnBuilder.setFinHardTimeout(Uint16.valueOf(8));
nxActionLearnBuilder.setFlowMods(createFlowMods());
actionLearnBuilder.setNxActionLearn(nxActionLearnBuilder.build());
actionBuilder.setActionChoice(actionLearnBuilder.build());
//length = 14
final FlowModsBuilder flowMod = new FlowModsBuilder();
FlowModAddMatchFromFieldBuilder spec = new FlowModAddMatchFromFieldBuilder();
- spec.setFlowModNumBits(48);
- spec.setSrcField((long)9);
- spec.setSrcOfs(10);
- spec.setDstField((long) 11);
- spec.setDstOfs(12);
+ spec.setFlowModNumBits(Uint16.valueOf(48));
+ spec.setSrcField(Uint32.valueOf(9));
+ spec.setSrcOfs(Uint16.TEN);
+ spec.setDstField(Uint32.valueOf(11));
+ spec.setDstOfs(Uint16.valueOf(12));
FlowModAddMatchFromFieldCaseBuilder caseBuilder = new FlowModAddMatchFromFieldCaseBuilder();
caseBuilder.setFlowModAddMatchFromField(spec.build());
flowMod.setFlowModSpec(caseBuilder.build());
//length = 14
final FlowModsBuilder flowMod2 = new FlowModsBuilder();
FlowModCopyFieldIntoFieldBuilder spec2 = new FlowModCopyFieldIntoFieldBuilder();
- spec2.setFlowModNumBits(48);
- spec2.setSrcField((long)9);
- spec2.setSrcOfs(10);
- spec2.setDstField((long) 11);
- spec2.setDstOfs(12);
+ spec2.setFlowModNumBits(Uint16.valueOf(48));
+ spec2.setSrcField(Uint32.valueOf(9));
+ spec2.setSrcOfs(Uint16.TEN);
+ spec2.setDstField(Uint32.valueOf(11));
+ spec2.setDstOfs(Uint16.valueOf(12));
FlowModCopyFieldIntoFieldCaseBuilder caseBuilder2 = new FlowModCopyFieldIntoFieldCaseBuilder();
caseBuilder2.setFlowModCopyFieldIntoField(spec2.build());
flowMod2.setFlowModSpec(caseBuilder2.build());
//length = 10
final FlowModsBuilder flowMod3 = new FlowModsBuilder();
FlowModCopyValueIntoFieldBuilder spec3 = new FlowModCopyValueIntoFieldBuilder();
- spec3.setFlowModNumBits(48);
- spec3.setValue(9);
- spec3.setDstField((long) 10);
- spec3.setDstOfs(11);
+ spec3.setFlowModNumBits(Uint16.valueOf(48));
+ spec3.setValue(Uint16.valueOf(9));
+ spec3.setDstField(Uint32.TEN);
+ spec3.setDstOfs(Uint16.valueOf(11));
FlowModCopyValueIntoFieldCaseBuilder caseBuilder3 = new FlowModCopyValueIntoFieldCaseBuilder();
caseBuilder3.setFlowModCopyValueIntoField(spec3.build());
flowMod3.setFlowModSpec(caseBuilder3.build());
//length = 10
final FlowModsBuilder flowMod4 = new FlowModsBuilder();
FlowModAddMatchFromValueBuilder spec4 = new FlowModAddMatchFromValueBuilder();
- spec4.setFlowModNumBits(48);
- spec4.setValue(9);
- spec4.setSrcField((long) 10);
- spec4.setSrcOfs(11);
+ spec4.setFlowModNumBits(Uint16.valueOf(48));
+ spec4.setValue(Uint16.valueOf(9));
+ spec4.setSrcField(Uint32.TEN);
+ spec4.setSrcOfs(Uint16.valueOf(11));
FlowModAddMatchFromValueCaseBuilder caseBuilder4 = new FlowModAddMatchFromValueCaseBuilder();
caseBuilder4.setFlowModAddMatchFromValue(spec4.build());
flowMod4.setFlowModSpec(caseBuilder4.build());
//length = 8
final FlowModsBuilder flowMod5 = new FlowModsBuilder();
FlowModOutputToPortBuilder spec5 = new FlowModOutputToPortBuilder();
- spec5.setFlowModNumBits(48);
- spec5.setSrcField((long) 9);
- spec5.setSrcOfs(10);
+ spec5.setFlowModNumBits(Uint16.valueOf(48));
+ spec5.setSrcField(Uint32.valueOf(9));
+ spec5.setSrcOfs(Uint16.valueOf(10));
FlowModOutputToPortCaseBuilder caseBuilder5 = new FlowModOutputToPortCaseBuilder();
caseBuilder5.setFlowModOutputToPort(spec5.build());
flowMod5.setFlowModSpec(caseBuilder5.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipathBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.multipath.grouping.NxActionMultipathBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class MultipathCodecTest {
private static final int LENGTH = 32;
NxActionMultipathBuilder nxActionMultipathBuilder = new NxActionMultipathBuilder();
nxActionMultipathBuilder.setFields(OfjNxHashFields.NXHASHFIELDSETHSRC);
- nxActionMultipathBuilder.setBasis(2);
+ nxActionMultipathBuilder.setBasis(Uint16.TWO);
nxActionMultipathBuilder.setAlgorithm(OfjNxMpAlgorithm.NXMPALGMODULON);
- nxActionMultipathBuilder.setMaxLink(4);
- nxActionMultipathBuilder.setArg((long)5);
+ nxActionMultipathBuilder.setMaxLink(Uint16.valueOf(4));
+ nxActionMultipathBuilder.setArg(Uint32.valueOf(5));
- nxActionMultipathBuilder.setOfsNbits(6);
- nxActionMultipathBuilder.setDst((long)7);
+ nxActionMultipathBuilder.setOfsNbits(Uint16.valueOf(6));
+ nxActionMultipathBuilder.setDst(Uint32.valueOf(7));
actionMultipathBuilder.setNxActionMultipath(nxActionMultipathBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg2Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg2.grouping.NxActionOutputReg2Builder;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint64;
public class OutputReg2CodecTest {
private static final int LENGTH = 24;
private static final byte SUBTYPE = 32;
- private static final int OFS_N_BITS = 1;
+ private static final Uint16 OFS_N_BITS = Uint16.ONE;
private static final int SRC = 2;
- private static final int MAX_LEN = 2;
+ private static final Uint16 MAX_LEN = Uint16.TWO;
private static final long SRC_EXP = 0xFFFF000000000000L | SRC;
private static final Uint64 SRC_EXP_BIGINT = Uint64.valueOf(new BigInteger(1, Longs.toByteArray(SRC_EXP)));
ActionOutputReg2 result = (ActionOutputReg2) action.getActionChoice();
- assertEquals(OFS_N_BITS, result.getNxActionOutputReg2().getNBits().shortValue());
- assertEquals(MAX_LEN, result.getNxActionOutputReg2().getMaxLen().shortValue());
+ assertEquals(OFS_N_BITS, result.getNxActionOutputReg2().getNBits());
+ assertEquals(MAX_LEN, result.getNxActionOutputReg2().getMaxLen());
assertEquals(Uint64.valueOf(SRC), result.getNxActionOutputReg2().getSrc());
assertFalse(buffer.isReadable());
}
ActionOutputReg2 result = (ActionOutputReg2) action.getActionChoice();
- assertEquals(OFS_N_BITS, result.getNxActionOutputReg2().getNBits().shortValue());
- assertEquals(MAX_LEN, result.getNxActionOutputReg2().getMaxLen().shortValue());
+ assertEquals(OFS_N_BITS, result.getNxActionOutputReg2().getNBits());
+ assertEquals(MAX_LEN, result.getNxActionOutputReg2().getMaxLen());
assertEquals(SRC_EXP_BIGINT, result.getNxActionOutputReg2().getSrc());
assertFalse(buffer.isReadable());
}
assertEquals(SUBTYPE, buffer.readUnsignedShort());
//Serialize part
- assertEquals(OFS_N_BITS, buffer.readUnsignedShort());
- assertEquals(MAX_LEN, buffer.readUnsignedShort());
+ assertEquals(OFS_N_BITS.shortValue(), buffer.readUnsignedShort());
+ assertEquals(MAX_LEN.shortValue(), buffer.readUnsignedShort());
assertEquals(SRC, buffer.readUnsignedInt());
// padding
assertEquals(SUBTYPE, buffer.readUnsignedShort());
//Serialize part
- assertEquals(OFS_N_BITS, buffer.readUnsignedShort());
- assertEquals(MAX_LEN, buffer.readUnsignedShort());
+ assertEquals(OFS_N_BITS.shortValue(), buffer.readUnsignedShort());
+ assertEquals(MAX_LEN.shortValue(), buffer.readUnsignedShort());
assertEquals(SRC_EXP, buffer.readLong());
// padding
message.writeShort(LENGTH);
message.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
message.writeShort(SUBTYPE);
- message.writeShort(OFS_N_BITS);
- message.writeShort(MAX_LEN);
+ message.writeShort(OFS_N_BITS.shortValue());
+ message.writeShort(MAX_LEN.shortValue());
if (withExpSrc) {
message.writeLong(SRC_EXP);
message.writeZero(2);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputReg;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionOutputRegBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.output.reg.grouping.NxActionOutputRegBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class OutputRegCodecTest {
private static final int LENGTH = 24;
final ActionOutputRegBuilder actionOutputRegBuilder = new ActionOutputRegBuilder();
NxActionOutputRegBuilder nxActionOutputBuilder = new NxActionOutputRegBuilder();
- nxActionOutputBuilder.setNBits(1);
- nxActionOutputBuilder.setSrc((long)2);
- nxActionOutputBuilder.setMaxLen(3);
+ nxActionOutputBuilder.setNBits(Uint16.ONE);
+ nxActionOutputBuilder.setSrc(Uint32.TWO);
+ nxActionOutputBuilder.setMaxLen(Uint16.valueOf(3));
actionOutputRegBuilder.setNxActionOutputReg(nxActionOutputBuilder.build());
actionBuilder.setActionChoice(actionOutputRegBuilder.build());
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
-import java.math.BigInteger;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.openflowjava.nx.api.NiciraConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegLoadBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.load.grouping.NxActionRegLoadBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
public class RegLoadCodecTest {
private static final int LENGTH = 24;
final ActionRegLoadBuilder actionRegLoadBuilder = new ActionRegLoadBuilder();
NxActionRegLoadBuilder nxActionRegLoadBuilder = new NxActionRegLoadBuilder();
- nxActionRegLoadBuilder.setOfsNbits(1);
- nxActionRegLoadBuilder.setDst((long)2);
- nxActionRegLoadBuilder.setValue(BigInteger.valueOf(3));
+ nxActionRegLoadBuilder.setOfsNbits(Uint16.ONE);
+ nxActionRegLoadBuilder.setDst(Uint32.TWO);
+ nxActionRegLoadBuilder.setValue(Uint64.valueOf(3));
actionRegLoadBuilder.setNxActionRegLoad(nxActionRegLoadBuilder.build());
actionBuilder.setActionChoice(actionRegLoadBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMove;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionRegMoveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.reg.move.grouping.NxActionRegMoveBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint64;
public class RegMoveCodecTest {
final ActionRegMoveBuilder actionRegMoveBuilder = new ActionRegMoveBuilder();
NxActionRegMoveBuilder nxActionRegMoveBuilder = new NxActionRegMoveBuilder();
- nxActionRegMoveBuilder.setNBits(1);
- nxActionRegMoveBuilder.setSrcOfs(2);
- nxActionRegMoveBuilder.setDstOfs(3);
+ nxActionRegMoveBuilder.setNBits(Uint16.ONE);
+ nxActionRegMoveBuilder.setSrcOfs(Uint16.TWO);
+ nxActionRegMoveBuilder.setDstOfs(Uint16.valueOf(3));
nxActionRegMoveBuilder.setSrc(src);
nxActionRegMoveBuilder.setDst(dst);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionResubmit;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionResubmitBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.ofj.nx.action.resubmit.grouping.NxActionResubmitBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class ResubmitCodecTest {
private static final int LENGTH = 16;
*/
@Test
public void getSubTypeTest2() {
- action = createAction(null, (byte)1);
+ action = createAction(null, Uint8.ONE);
ActionResubmit actionResubmit = (ActionResubmit) action.getActionChoice();
byte result = resubmitCodec.getSubType(actionResubmit);
*/
@Test
public void serializeTest1() {
- action = createAction((short)1, (byte)2);
+ action = createAction(Uint16.ONE, Uint8.TWO);
resubmitCodec.serialize(action, buffer);
assertEquals(LENGTH, buffer.readableBytes());
assertEquals(0, buffer.readableBytes());
}
- private static Action createAction(Short inPort, Byte table) {
+ private static Action createAction(Uint16 inPort, Uint8 table) {
ExperimenterId experimenterId = new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(experimenterId);
NxActionResubmitBuilder nxActionResubmitBuilder = new NxActionResubmitBuilder();
if (inPort != null) {
- nxActionResubmitBuilder.setInPort(inPort.intValue());
+ nxActionResubmitBuilder.setInPort(inPort);
}
if (table != null) {
- nxActionResubmitBuilder.setTable(table.shortValue());
+ nxActionResubmitBuilder.setTable(table);
}
actionResubmitBuilder.setNxActionResubmit(nxActionResubmitBuilder.build());
private AbstractNshcCodec testCodec;
private ByteBuf buffer;
- private static final Long NSHC_VALUE = 10L;
- private static final Long NSHC_MASK = 0xFL;
+ private static final Uint32 NSHC_VALUE = Uint32.TEN;
+ private static final Uint32 NSHC_MASK = Uint32.valueOf(0xF);
@Before
public void setUp() {
NxExpMatchEntryValue value = testCodec.deserializeValue(buffer, false);
- assertEquals(Uint32.valueOf(NSHC_VALUE), ((NshcCaseValue) value).getNshc());
+ assertEquals(NSHC_VALUE, ((NshcCaseValue) value).getNshc());
assertFalse(buffer.isReadable());
}
NxExpMatchEntryValue value = testCodec.deserializeValue(buffer, true);
- assertEquals(Uint32.valueOf(NSHC_VALUE), ((NshcCaseValue) value).getNshc());
- assertEquals(Uint32.valueOf(NSHC_MASK), ((NshcCaseValue) value).getMask());
+ assertEquals(NSHC_VALUE, ((NshcCaseValue) value).getNshc());
+ assertEquals(NSHC_MASK, ((NshcCaseValue) value).getMask());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(final Long value, final Long mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(final Uint32 value, final Uint32 mask) {
return new NshcCaseValueBuilder().setNshc(value).setMask(mask).build();
}
- private static void writeBuffer(final ByteBuf message, final Long value, final Long mask) {
+ private static void writeBuffer(final ByteBuf message, final Uint32 value, final Uint32 mask) {
message.writeInt(value.intValue());
if (mask != null) {
message.writeInt(mask.intValue());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.op.grouping.ArpOpValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpOpCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class ArpOpCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfArpOp.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue(1);
+ valuesBuilder.setValue(Uint16.ONE);
caseBuilder.setArpOpValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.spa.grouping.ArpSpaValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpSpaCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class ArpSpaCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfArpSpa.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setArpSpaValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.arp.tpa.grouping.ArpTpaValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpTpaCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.ArpTpaCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class ArpTpaCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfArpTpa.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setArpTpaValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.state.grouping.CtStateValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtStateCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class CtStateCodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxCtState.class);
matchEntryBuilder.setHasMask(true);
- valuesBuilder.setCtState((long)1);
- valuesBuilder.setMask((long)2);
+ valuesBuilder.setCtState(Uint32.ONE);
+ valuesBuilder.setMask(Uint32.TWO);
caseBuilder.setCtStateValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.tp.dst.grouping.CtTpDstValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtTpDstCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtTpDstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class CtTpDstCodecTest {
private CtTpDstCodec ctTpDstCodec;
matchEntryBuilder.setOxmMatchField(NxmNxCtTpDst.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setCtTpDst(1);
+ valuesBuilder.setCtTpDst(Uint16.ONE);
caseBuilder.setCtTpDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.ct.tp.src.grouping.CtTpSrcValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtTpSrcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.CtTpSrcCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class CtTpSrcCodecTest {
private CtTpSrcCodec ctTpSrcCodec;
matchEntryBuilder.setOxmMatchField(NxmNxCtTpSrc.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setCtTpSrc(1);
+ valuesBuilder.setCtTpSrc(Uint16.ONE);
caseBuilder.setCtTpSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
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 {
matchEntryBuilder.setOxmMatchField(NxmNxCtZone.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setCtZone(1);
+ valuesBuilder.setCtZone(Uint16.ONE);
caseBuilder.setCtZoneValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.eth.type.grouping.EthTypeValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthTypeCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class EthTypeCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfEthType.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue(1);
+ valuesBuilder.setValue(Uint16.ONE);
caseBuilder.setEthTypeValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.icmp.type.grouping.IcmpTypeValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class IcmpTypeCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfIcmpType.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((short)1);
+ valuesBuilder.setValue(Uint8.ONE);
caseBuilder.setIcmpTypeValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.dst.grouping.IpDstValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class IpDstCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfIpDst.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setIpDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.src.grouping.IpSrcValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class IpSrcCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfIpSrc.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setIpSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.dst.grouping.IpDstValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Ipv6DstCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfIpDst.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setIpDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.src.grouping.IpSrcValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Ipv6SrcCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfIpSrc.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setIpSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
private NshFlagsCodec nshFlagsCodec;
private ByteBuf buffer;
- private static final Short FLAGS_VALUE = (short) 0xA1;
- private static final Short FLAGS_MASK = (short) 0xFFL;
+ private static final Uint8 FLAGS_VALUE = Uint8.valueOf(0xA1);
+ private static final Uint8 FLAGS_MASK = Uint8.MAX_VALUE;
@Before
public void setUp() {
NxExpMatchEntryValue value = nshFlagsCodec.deserializeValue(buffer, false);
- assertEquals(Uint8.valueOf(FLAGS_VALUE), ((NshFlagsCaseValue) value).getNshFlagsValues().getNshFlags());
+ assertEquals(FLAGS_VALUE, ((NshFlagsCaseValue) value).getNshFlagsValues().getNshFlags());
assertFalse(buffer.isReadable());
}
NxExpMatchEntryValue value = nshFlagsCodec.deserializeValue(buffer, true);
- assertEquals(Uint8.valueOf(FLAGS_VALUE), ((NshFlagsCaseValue) value).getNshFlagsValues().getNshFlags());
- assertEquals(Uint8.valueOf(FLAGS_MASK), ((NshFlagsCaseValue) value).getNshFlagsValues().getMask());
+ assertEquals(FLAGS_VALUE, ((NshFlagsCaseValue) value).getNshFlagsValues().getNshFlags());
+ assertEquals(FLAGS_MASK, ((NshFlagsCaseValue) value).getNshFlagsValues().getMask());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(Short value, Short mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Uint8 value, Uint8 mask) {
NshFlagsValues nshFlagsValues = new NshFlagsValuesBuilder().setNshFlags(value).setMask(mask).build();
return new NshFlagsCaseValueBuilder().setNshFlagsValues(nshFlagsValues).build();
}
- private static void writeBuffer(ByteBuf message, Short value, Short mask) {
+ private static void writeBuffer(ByteBuf message, Uint8 value, Uint8 mask) {
message.writeByte(value.intValue());
if (mask != null) {
message.writeByte(mask.intValue());
private NshMdtypeCodec nshMdtypeCodec;
private ByteBuf buffer;
- private static final Short MDTYPE_VALUE = (short) 1;
+ private static final Uint8 MDTYPE_VALUE = Uint8.ONE;
@Before
public void setUp() {
NxExpMatchEntryValue value = nshMdtypeCodec.deserializeValue(buffer, false);
- assertEquals(Uint8.valueOf(MDTYPE_VALUE), ((NshMdtypeCaseValue) value).getNshMdtypeValues().getValue());
+ assertEquals(MDTYPE_VALUE, ((NshMdtypeCaseValue) value).getNshMdtypeValues().getValue());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(Short value) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Uint8 value) {
NshMdtypeValues nshMdtypeValues = new NshMdtypeValuesBuilder().setValue(value).build();
return new NshMdtypeCaseValueBuilder().setNshMdtypeValues(nshMdtypeValues).build();
}
- private static void writeBuffer(ByteBuf message, Short value) {
+ private static void writeBuffer(ByteBuf message, Uint8 value) {
message.writeByte(value.intValue());
}
}
\ No newline at end of file
private NshNpCodec nshNpCodec;
private ByteBuf buffer;
- private static final Short NP_VALUE = (short) 3;
+ private static final Uint8 NP_VALUE = Uint8.valueOf(3);
@Before
public void setUp() {
NxExpMatchEntryValue value = nshNpCodec.deserializeValue(buffer, false);
- assertEquals(Uint8.valueOf(NP_VALUE), ((NshNpCaseValue) value).getNshNpValues().getValue());
+ assertEquals(NP_VALUE, ((NshNpCaseValue) value).getNshNpValues().getValue());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(Short value) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Uint8 value) {
NshNpValues nshNpValues = new NshNpValuesBuilder().setValue(value).build();
return new NshNpCaseValueBuilder().setNshNpValues(nshNpValues).build();
}
- private static void writeBuffer(ByteBuf message, Short value) {
+ private static void writeBuffer(ByteBuf message, Uint8 value) {
message.writeByte(value.intValue());
}
}
\ No newline at end of file
private NshTtlCodec nshTtlCodec;
private ByteBuf buffer;
- private static final Short TTL_VALUE = (short) 0xD8;
- private static final Short TTL_MASK = (short) 0xFFL;
+ private static final Uint8 TTL_VALUE = Uint8.valueOf(0xD8);
+ private static final Uint8 TTL_MASK = Uint8.MAX_VALUE;
@Before
public void setUp() {
NxExpMatchEntryValue value = nshTtlCodec.deserializeValue(buffer, false);
- assertEquals(Uint8.valueOf(TTL_VALUE), ((NshTtlCaseValue) value).getNshTtlValues().getNshTtl());
+ assertEquals(TTL_VALUE, ((NshTtlCaseValue) value).getNshTtlValues().getNshTtl());
assertFalse(buffer.isReadable());
}
NxExpMatchEntryValue value = nshTtlCodec.deserializeValue(buffer, true);
- assertEquals(Uint8.valueOf(TTL_VALUE), ((NshTtlCaseValue) value).getNshTtlValues().getNshTtl());
- assertEquals(Uint8.valueOf(TTL_MASK), ((NshTtlCaseValue) value).getNshTtlValues().getMask());
+ assertEquals(TTL_VALUE, ((NshTtlCaseValue) value).getNshTtlValues().getNshTtl());
+ assertEquals(TTL_MASK, ((NshTtlCaseValue) value).getNshTtlValues().getMask());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(final Short value, final Short mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(final Uint8 value, final Uint8 mask) {
NshTtlValues nshTtlValues = new NshTtlValuesBuilder().setNshTtl(value).setMask(mask).build();
return new NshTtlCaseValueBuilder().setNshTtlValues(nshTtlValues).build();
}
- private static void writeBuffer(final ByteBuf message, final Short value, final Short mask) {
+ private static void writeBuffer(final ByteBuf message, final Uint8 value, final Uint8 mask) {
message.writeByte(value.intValue());
if (mask != null) {
message.writeByte(mask.intValue());
NsiCodec nsiCodec;
ByteBuf buffer;
- private static final Short NSI_VALUE = (short) 255;
- private static final Short NSI_MASK = 0xF0;
+ private static final Uint8 NSI_VALUE = Uint8.MAX_VALUE;
+ private static final Uint8 NSI_MASK = Uint8.valueOf(0xF0);
@Before
public void setUp() {
NxExpMatchEntryValue value = nsiCodec.deserializeValue(buffer, false);
- assertEquals(Uint8.valueOf(NSI_VALUE), ((NsiCaseValue) value).getNsiValues().getNsi());
+ assertEquals(NSI_VALUE, ((NsiCaseValue) value).getNsiValues().getNsi());
assertFalse(buffer.isReadable());
}
NxExpMatchEntryValue value = nsiCodec.deserializeValue(buffer, true);
- assertEquals(Uint8.valueOf(NSI_VALUE), ((NsiCaseValue) value).getNsiValues().getNsi());
- assertEquals(Uint8.valueOf(NSI_MASK), ((NsiCaseValue) value).getNsiValues().getMask());
+ assertEquals(NSI_VALUE, ((NsiCaseValue) value).getNsiValues().getNsi());
+ assertEquals(NSI_MASK, ((NsiCaseValue) value).getNsiValues().getMask());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(Short value, Short mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(Uint8 value, Uint8 mask) {
NsiValues nsiValues = new NsiValuesBuilder().setNsi(value).setMask(mask).build();
return new NsiCaseValueBuilder().setNsiValues(nsiValues).build();
}
- private static void writeBuffer(ByteBuf message, Short value, Short mask) {
+ private static void writeBuffer(ByteBuf message, Uint8 value, Uint8 mask) {
message.writeByte(value.intValue());
if (mask != null) {
message.writeByte(mask.intValue());
private NspCodec nspCodec;
private ByteBuf buffer;
- private static final Long NSP_VALUE = 10L;
- private static final Long NSP_MASK = 0xFL;
+ private static final Uint32 NSP_VALUE = Uint32.TEN;
+ private static final Uint32 NSP_MASK = Uint32.valueOf(0xF);
@Before
public void setUp() {
NxExpMatchEntryValue value = nspCodec.deserializeValue(buffer, false);
- assertEquals(Uint32.valueOf(NSP_VALUE), ((NspCaseValue) value).getNspValues().getNsp());
+ assertEquals(NSP_VALUE, ((NspCaseValue) value).getNspValues().getNsp());
assertFalse(buffer.isReadable());
}
NxExpMatchEntryValue value = nspCodec.deserializeValue(buffer, true);
- assertEquals(Uint32.valueOf(NSP_VALUE), ((NspCaseValue) value).getNspValues().getNsp());
- assertEquals(Uint32.valueOf(NSP_MASK), ((NspCaseValue) value).getNspValues().getMask());
+ assertEquals(NSP_VALUE, ((NspCaseValue) value).getNspValues().getNsp());
+ assertEquals(NSP_MASK, ((NspCaseValue) value).getNspValues().getMask());
assertFalse(buffer.isReadable());
}
- private static NxExpMatchEntryValue createMatchEntryValue(final Long value, final Long mask) {
+ private static NxExpMatchEntryValue createMatchEntryValue(final Uint32 value, final Uint32 mask) {
NspValues nspValues = new NspValuesBuilder().setNsp(value).setMask(mask).build();
return new NspCaseValueBuilder().setNspValues(nspValues).build();
}
- private static void writeBuffer(final ByteBuf message, final Long value, final Long mask) {
+ private static void writeBuffer(final ByteBuf message, final Uint32 value, final Uint32 mask) {
message.writeInt(value.intValue());
if (mask != null) {
message.writeInt(mask.intValue());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.pkt.mark.grouping.PktMarkValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.PktMarkCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.PktMarkCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class PktMarkCodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxPktMark.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setPktMark(1L);
+ valuesBuilder.setPktMark(Uint32.ONE);
caseBuilder.setPktMarkValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg0CodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxReg0.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg1CodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxReg1.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg2CodecTest {
Reg2Codec reg2Codec;
matchEntryBuilder.setOxmMatchField(NxmNxReg2.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg3CodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxReg3.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg4CodecTest {
Reg4Codec reg4Codec;
matchEntryBuilder.setOxmMatchField(NxmNxReg4.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg5CodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxReg5.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg6CodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxReg6.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.reg.grouping.RegValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.RegCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class Reg7CodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxReg7.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setRegValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.dst.grouping.TcpDstValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class TcpDstCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfTcpDst.class);
matchEntryBuilder.setHasMask(true);
- valuesBuilder.setPort(new PortNumber(1));
- valuesBuilder.setMask(0xffff);
+ valuesBuilder.setPort(new PortNumber(Uint16.ONE));
+ valuesBuilder.setMask(Uint16.MAX_VALUE);
caseBuilder.setTcpDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.src.grouping.TcpSrcValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class TcpSrcCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfTcpSrc.class);
matchEntryBuilder.setHasMask(true);
- valuesBuilder.setPort(new PortNumber(1));
- valuesBuilder.setMask(0xffff);
+ valuesBuilder.setPort(new PortNumber(Uint16.ONE));
+ valuesBuilder.setMask(Uint16.MAX_VALUE);
caseBuilder.setTcpSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.id.grouping.TunIdValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIdCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint64;
public class TunIdCodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxTunId.class);
matchEntryBuilder.setHasMask(false);
- byte[] value = new byte[VALUE_LENGTH];
- valuesBuilder.setValue(new BigInteger(value));
+ valuesBuilder.setValue(Uint64.ZERO);
caseBuilder.setTunIdValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.dst.grouping.TunIpv4DstValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIpv4DstCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIpv4DstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class TunIpv4DstCodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxTunIpv4Dst.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setTunIpv4DstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.nx.match.tun.ipv4.src.grouping.TunIpv4SrcValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIpv4SrcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TunIpv4SrcCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class TunIpv4SrcCodecTest {
matchEntryBuilder.setOxmMatchField(NxmNxTunIpv4Src.class);
matchEntryBuilder.setHasMask(false);
- valuesBuilder.setValue((long)1);
+ valuesBuilder.setValue(Uint32.ONE);
caseBuilder.setTunIpv4SrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.dst.grouping.UdpDstValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class UdpDstCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfUdpDst.class);
matchEntryBuilder.setHasMask(true);
- valuesBuilder.setPort(new PortNumber(1));
- valuesBuilder.setMask(0xffff);
+ valuesBuilder.setPort(new PortNumber(Uint16.ONE));
+ valuesBuilder.setMask(Uint16.MAX_VALUE);
caseBuilder.setUdpDstValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.src.grouping.UdpSrcValuesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValueBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
public class UdpSrcCodecTest {
matchEntryBuilder.setOxmMatchField(NxmOfUdpSrc.class);
matchEntryBuilder.setHasMask(true);
- valuesBuilder.setPort(new PortNumber(1));
- valuesBuilder.setMask(0xffff);
+ valuesBuilder.setPort(new PortNumber(Uint16.ONE));
+ valuesBuilder.setMask(Uint16.MAX_VALUE);
caseBuilder.setUdpSrcValues(valuesBuilder.build());
matchEntryBuilder.setMatchEntryValue(caseBuilder.build());