import java.math.BigInteger;
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutputBuilder;
GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
builder.setVersion(version);
builder.setXid(rawMessage.readUnsignedInt());
- byte[] datapathId = new byte[Long.SIZE/Byte.SIZE];
+ byte[] datapathId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(datapathId);
- builder.setDatapathId(new BigInteger(datapathId));
+ builder.setDatapathId(new BigInteger(1, datapathId));
builder.setBuffers(rawMessage.readUnsignedInt());
builder.setTables(rawMessage.readUnsignedByte());
builder.setAuxiliaryId(rawMessage.readUnsignedByte());
import java.math.BigInteger;
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.MatchDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowRemovedReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;
FlowRemovedMessageBuilder builder = new FlowRemovedMessageBuilder();
builder.setVersion(version);
builder.setXid(rawMessage.readUnsignedInt());
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(cookie);
- builder.setCookie(new BigInteger(cookie));
+ builder.setCookie(new BigInteger(1, cookie));
builder.setPriority(rawMessage.readUnsignedShort());
builder.setReason(FlowRemovedReason.forValue(rawMessage.readUnsignedByte()));
builder.setTableId(new TableId((long)rawMessage.readUnsignedByte()));
builder.setDurationNsec(rawMessage.readUnsignedInt());
builder.setIdleTimeout(rawMessage.readUnsignedShort());
builder.setHardTimeout(rawMessage.readUnsignedShort());
- byte[] packet_count = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packet_count = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(packet_count);
- builder.setPacketCount(new BigInteger(packet_count));
- byte[] byte_count = new byte[Long.SIZE/Byte.SIZE];
+ builder.setPacketCount(new BigInteger(1, packet_count));
+ byte[] byte_count = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(byte_count);
- builder.setByteCount(new BigInteger(byte_count));
+ builder.setByteCount(new BigInteger(1, byte_count));
builder.setMatch(MatchDeserializer.createMatch(rawMessage));
return builder.build();
}
flowStatsBuilder.setHardTimeout(input.readUnsignedShort());
flowStatsBuilder.setFlags(createFlowModFlagsFromBitmap(input.readShort()));
input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(cookie);
- flowStatsBuilder.setCookie(new BigInteger(cookie));
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ flowStatsBuilder.setCookie(new BigInteger(1, cookie));
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- flowStatsBuilder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ flowStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- flowStatsBuilder.setByteCount(new BigInteger(byteCount));
+ flowStatsBuilder.setByteCount(new BigInteger(1, byteCount));
flowStatsBuilder.setMatch(MatchDeserializer.createMatch(input));
flowStatsBuilder.setInstructions(InstructionsDeserializer.createInstructions(input, input.readableBytes()));
flowStatsList.add(flowStatsBuilder.build());
private static MultipartReplyAggregateCase setAggregate(ByteBuf input) {
MultipartReplyAggregateCaseBuilder caseBuilder = new MultipartReplyAggregateCaseBuilder();
MultipartReplyAggregateBuilder builder = new MultipartReplyAggregateBuilder();
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- builder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ builder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- builder.setByteCount(new BigInteger(byteCount));
+ builder.setByteCount(new BigInteger(1, byteCount));
builder.setFlowCount(input.readUnsignedInt());
input.skipBytes(PADDING_IN_AGGREGATE_HEADER);
caseBuilder.setMultipartReplyAggregate(builder.build());
tableStatsBuilder.setTableId(input.readUnsignedByte());
input.skipBytes(PADDING_IN_TABLE_HEADER);
tableStatsBuilder.setActiveCount(input.readUnsignedInt());
- byte[] lookupCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] lookupCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(lookupCount);
- tableStatsBuilder.setLookupCount(new BigInteger(lookupCount));
- byte[] matchedCount = new byte[Long.SIZE/Byte.SIZE];
+ tableStatsBuilder.setLookupCount(new BigInteger(1, lookupCount));
+ byte[] matchedCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(matchedCount);
- tableStatsBuilder.setMatchedCount(new BigInteger(matchedCount));
+ tableStatsBuilder.setMatchedCount(new BigInteger(1, matchedCount));
tableStatsList.add(tableStatsBuilder.build());
}
builder.setTableStats(tableStatsList);
PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
portStatsBuilder.setPortNo(input.readUnsignedInt());
input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
- byte[] rxPackets = new byte[Long.SIZE/Byte.SIZE];
+ byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxPackets);
- portStatsBuilder.setRxPackets(new BigInteger(rxPackets));
- byte[] txPackets = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
+ byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
- portStatsBuilder.setTxPackets(new BigInteger(txPackets));
- byte[] rxBytes = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
+ byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxBytes);
- portStatsBuilder.setRxBytes(new BigInteger(rxBytes));
- byte[] txBytes = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
+ byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
- portStatsBuilder.setTxBytes(new BigInteger(txBytes));
- byte[] rxDropped = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
+ byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxDropped);
- portStatsBuilder.setRxDropped(new BigInteger(rxDropped));
- byte[] txDropped = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
+ byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txDropped);
- portStatsBuilder.setTxDropped(new BigInteger(txDropped));
- byte[] rxErrors = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
+ byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxErrors);
- portStatsBuilder.setRxErrors(new BigInteger(rxErrors));
- byte[] txErrors = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
+ byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
- portStatsBuilder.setTxErrors(new BigInteger(txErrors));
- byte[] rxFrameErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
+ byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxFrameErr);
- portStatsBuilder.setRxFrameErr(new BigInteger(rxFrameErr));
- byte[] rxOverErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
+ byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxOverErr);
- portStatsBuilder.setRxOverErr(new BigInteger(rxOverErr));
- byte[] rxCrcErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
+ byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxCrcErr);
- portStatsBuilder.setRxCrcErr(new BigInteger(rxCrcErr));
- byte[] collisions = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
+ byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(collisions);
- portStatsBuilder.setCollisions(new BigInteger(collisions));
+ portStatsBuilder.setCollisions(new BigInteger(1, collisions));
portStatsBuilder.setDurationSec(input.readUnsignedInt());
portStatsBuilder.setDurationNsec(input.readUnsignedInt());
portStatsList.add(portStatsBuilder.build());
QueueStatsBuilder queueStatsBuilder = new QueueStatsBuilder();
queueStatsBuilder.setPortNo(input.readUnsignedInt());
queueStatsBuilder.setQueueId(input.readUnsignedInt());
- byte[] txBytes = new byte[Long.SIZE/Byte.SIZE];
+ byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
- queueStatsBuilder.setTxBytes(new BigInteger(txBytes));
- byte[] txPackets = new byte[Long.SIZE/Byte.SIZE];
+ queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
+ byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
- queueStatsBuilder.setTxPackets(new BigInteger(txPackets));
- byte[] txErrors = new byte[Long.SIZE/Byte.SIZE];
+ queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
+ byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
- queueStatsBuilder.setTxErrors(new BigInteger(txErrors));
+ queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
queueStatsBuilder.setDurationSec(input.readUnsignedInt());
queueStatsBuilder.setDurationNsec(input.readUnsignedInt());
queueStatsList.add(queueStatsBuilder.build());
groupStatsBuilder.setGroupId(new GroupId(input.readUnsignedInt()));
groupStatsBuilder.setRefCount(input.readUnsignedInt());
input.skipBytes(PADDING_IN_GROUP_HEADER_02);
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- groupStatsBuilder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ groupStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- groupStatsBuilder.setByteCount(new BigInteger(byteCount));
+ groupStatsBuilder.setByteCount(new BigInteger(1, byteCount));
groupStatsBuilder.setDurationSec(input.readUnsignedInt());
groupStatsBuilder.setDurationNsec(input.readUnsignedInt());
int actualLength = GROUP_BODY_LENGTH;
List<BucketStats> bucketStatsList = new ArrayList<>();
while (actualLength < bodyLength) {
BucketStatsBuilder bucketStatsBuilder = new BucketStatsBuilder();
- byte[] packetCountBucket = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCountBucket = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCountBucket);
- bucketStatsBuilder.setPacketCount(new BigInteger(packetCountBucket));
- byte[] byteCountBucket = new byte[Long.SIZE/Byte.SIZE];
+ bucketStatsBuilder.setPacketCount(new BigInteger(1, packetCountBucket));
+ byte[] byteCountBucket = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCountBucket);
- bucketStatsBuilder.setByteCount(new BigInteger(byteCountBucket));
+ bucketStatsBuilder.setByteCount(new BigInteger(1, byteCountBucket));
bucketStatsList.add(bucketStatsBuilder.build());
actualLength += BUCKET_COUNTER_LENGTH;
}
int meterStatsBodyLength = input.readUnsignedShort();
input.skipBytes(PADDING_IN_METER_STATS_HEADER);
meterStatsBuilder.setFlowCount(input.readUnsignedInt());
- byte[] packetInCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetInCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetInCount);
- meterStatsBuilder.setPacketInCount(new BigInteger(packetInCount));
- byte[] byteInCount = new byte[Long.SIZE/Byte.SIZE];
+ meterStatsBuilder.setPacketInCount(new BigInteger(1, packetInCount));
+ byte[] byteInCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteInCount);
- meterStatsBuilder.setByteInCount(new BigInteger(byteInCount));
+ meterStatsBuilder.setByteInCount(new BigInteger(1, byteInCount));
meterStatsBuilder.setDurationSec(input.readUnsignedInt());
meterStatsBuilder.setDurationNsec(input.readUnsignedInt());
int actualLength = METER_BODY_LENGTH;
List<MeterBandStats> meterBandStatsList = new ArrayList<>();
while (actualLength < meterStatsBodyLength) {
MeterBandStatsBuilder meterBandStatsBuilder = new MeterBandStatsBuilder();
- byte[] packetBandCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetBandCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetBandCount);
- meterBandStatsBuilder.setPacketBandCount(new BigInteger(packetBandCount));
- byte[] byteBandCount = new byte[Long.SIZE/Byte.SIZE];
+ meterBandStatsBuilder.setPacketBandCount(new BigInteger(1, packetBandCount));
+ byte[] byteBandCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteBandCount);
- meterBandStatsBuilder.setByteBandCount(new BigInteger(byteBandCount));
+ meterBandStatsBuilder.setByteBandCount(new BigInteger(1, byteBandCount));
meterBandStatsList.add(meterBandStatsBuilder.build());
actualLength += METER_BAND_STATS_LENGTH;
}
GetFeaturesOutputBuilder builder = new GetFeaturesOutputBuilder();
builder.setVersion(version);
builder.setXid(rawMessage.readUnsignedInt());
- byte[] datapathId = new byte[Long.SIZE/Byte.SIZE];
+ byte[] datapathId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(datapathId);
- builder.setDatapathId(new BigInteger(datapathId));
+ builder.setDatapathId(new BigInteger(1, datapathId));
builder.setBuffers(rawMessage.readUnsignedInt());
builder.setTables(rawMessage.readUnsignedByte());
rawMessage.skipBytes(PADDING_IN_FEATURES_REPLY_HEADER);
import java.math.BigInteger;
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.OF10MatchDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowRemovedReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessage;
builder.setVersion(version);
builder.setXid(rawMessage.readUnsignedInt());
builder.setMatchV10(OF10MatchDeserializer.createMatchV10(rawMessage));
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(cookie);
- builder.setCookie(new BigInteger(cookie));
+ builder.setCookie(new BigInteger(1, cookie));
builder.setPriority(rawMessage.readUnsignedShort());
builder.setReason(FlowRemovedReason.forValue(rawMessage.readUnsignedByte()));
rawMessage.skipBytes(PADDING_IN_FLOW_REMOVED_MESSAGE);
builder.setDurationNsec(rawMessage.readUnsignedInt());
builder.setIdleTimeout(rawMessage.readUnsignedShort());
rawMessage.skipBytes(PADDING_IN_FLOW_REMOVED_MESSAGE_2);
- byte[] packet_count = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packet_count = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(packet_count);
- builder.setPacketCount(new BigInteger(packet_count));
- byte[] byte_count = new byte[Long.SIZE/Byte.SIZE];
+ builder.setPacketCount(new BigInteger(1, packet_count));
+ byte[] byte_count = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(byte_count);
- builder.setByteCount(new BigInteger(byte_count));
+ builder.setByteCount(new BigInteger(1, byte_count));
return builder.build();
}
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.OF10ActionsDeserializer;
import org.opendaylight.openflowjava.protocol.impl.util.OF10MatchDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags;
flowStatsBuilder.setIdleTimeout(input.readUnsignedShort());
flowStatsBuilder.setHardTimeout(input.readUnsignedShort());
input.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(cookie);
- flowStatsBuilder.setCookie(new BigInteger(cookie));
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ flowStatsBuilder.setCookie(new BigInteger(1, cookie));
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- flowStatsBuilder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ flowStatsBuilder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- flowStatsBuilder.setByteCount(new BigInteger(byteCount));
+ flowStatsBuilder.setByteCount(new BigInteger(1, byteCount));
flowStatsBuilder.setActionsList(OF10ActionsDeserializer
.createActionsList(input, length - LENGTH_OF_FLOW_STATS));
flowStatsList.add(flowStatsBuilder.build());
private static MultipartReplyAggregateCase setAggregate(ByteBuf input) {
MultipartReplyAggregateCaseBuilder caseBuilder = new MultipartReplyAggregateCaseBuilder();
MultipartReplyAggregateBuilder builder = new MultipartReplyAggregateBuilder();
- byte[] packetCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(packetCount);
- builder.setPacketCount(new BigInteger(packetCount));
- byte[] byteCount = new byte[Long.SIZE/Byte.SIZE];
+ builder.setPacketCount(new BigInteger(1, packetCount));
+ byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(byteCount);
- builder.setByteCount(new BigInteger(byteCount));
+ builder.setByteCount(new BigInteger(1, byteCount));
builder.setFlowCount(input.readUnsignedInt());
input.skipBytes(PADDING_IN_AGGREGATE_HEADER);
caseBuilder.setMultipartReplyAggregate(builder.build());
tableStatsBuilder.setNwDstMask(OF10MatchDeserializer.decodeNwDstMask(wildcards));
tableStatsBuilder.setMaxEntries(input.readUnsignedInt());
tableStatsBuilder.setActiveCount(input.readUnsignedInt());
- byte[] lookupCount = new byte[Long.SIZE/Byte.SIZE];
+ byte[] lookupCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(lookupCount);
- tableStatsBuilder.setLookupCount(new BigInteger(lookupCount));
- byte[] matchedCount = new byte[Long.SIZE/Byte.SIZE];
+ tableStatsBuilder.setLookupCount(new BigInteger(1, lookupCount));
+ byte[] matchedCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(matchedCount);
- tableStatsBuilder.setMatchedCount(new BigInteger(matchedCount));
+ tableStatsBuilder.setMatchedCount(new BigInteger(1, matchedCount));
tableStatsList.add(tableStatsBuilder.build());
}
builder.setTableStats(tableStatsList);
PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
portStatsBuilder.setPortNo((long) input.readUnsignedShort());
input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
- byte[] rxPackets = new byte[Long.SIZE/Byte.SIZE];
+ byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxPackets);
- portStatsBuilder.setRxPackets(new BigInteger(rxPackets));
- byte[] txPackets = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
+ byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
- portStatsBuilder.setTxPackets(new BigInteger(txPackets));
- byte[] rxBytes = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
+ byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxBytes);
- portStatsBuilder.setRxBytes(new BigInteger(rxBytes));
- byte[] txBytes = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
+ byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
- portStatsBuilder.setTxBytes(new BigInteger(txBytes));
- byte[] rxDropped = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
+ byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxDropped);
- portStatsBuilder.setRxDropped(new BigInteger(rxDropped));
- byte[] txDropped = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
+ byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txDropped);
- portStatsBuilder.setTxDropped(new BigInteger(txDropped));
- byte[] rxErrors = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
+ byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxErrors);
- portStatsBuilder.setRxErrors(new BigInteger(rxErrors));
- byte[] txErrors = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
+ byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
- portStatsBuilder.setTxErrors(new BigInteger(txErrors));
- byte[] rxFrameErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
+ byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxFrameErr);
- portStatsBuilder.setRxFrameErr(new BigInteger(rxFrameErr));
- byte[] rxOverErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
+ byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxOverErr);
- portStatsBuilder.setRxOverErr(new BigInteger(rxOverErr));
- byte[] rxCrcErr = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
+ byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxCrcErr);
- portStatsBuilder.setRxCrcErr(new BigInteger(rxCrcErr));
- byte[] collisions = new byte[Long.SIZE/Byte.SIZE];
+ portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
+ byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(collisions);
- portStatsBuilder.setCollisions(new BigInteger(collisions));
+ portStatsBuilder.setCollisions(new BigInteger(1, collisions));
portStatsList.add(portStatsBuilder.build());
}
builder.setPortStats(portStatsList);
queueStatsBuilder.setPortNo((long) input.readUnsignedShort());
input.skipBytes(PADDING_IN_QUEUE_HEADER);
queueStatsBuilder.setQueueId(input.readUnsignedInt());
- byte[] txBytes = new byte[Long.SIZE/Byte.SIZE];
+ byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
- queueStatsBuilder.setTxBytes(new BigInteger(txBytes));
- byte[] txPackets = new byte[Long.SIZE/Byte.SIZE];
+ queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
+ byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
- queueStatsBuilder.setTxPackets(new BigInteger(txPackets));
- byte[] txErrors = new byte[Long.SIZE/Byte.SIZE];
+ queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
+ byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
- queueStatsBuilder.setTxErrors(new BigInteger(txErrors));
+ queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
queueStatsList.add(queueStatsBuilder.build());
}
builder.setQueueStats(queueStatsList);
MultipartReplyExperimenterCaseBuilder caseBuilder = new MultipartReplyExperimenterCaseBuilder();
MultipartReplyExperimenterBuilder builder = new MultipartReplyExperimenterBuilder();
builder.setExperimenter(input.readUnsignedInt());
- byte[] data = new byte[Long.SIZE/Byte.SIZE];
+ byte[] data = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(data);
builder.setData(data);
caseBuilder.setMultipartReplyExperimenter(builder.build());
import java.math.BigInteger;
import org.opendaylight.openflowjava.protocol.impl.deserialization.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.MatchDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PacketInReason;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableId;
builder.setTotalLen(rawMessage.readUnsignedShort());
builder.setReason(PacketInReason.forValue(rawMessage.readUnsignedByte()));
builder.setTableId(new TableId((long)rawMessage.readUnsignedByte()));
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
rawMessage.readBytes(cookie);
- builder.setCookie(new BigInteger(cookie));
+ builder.setCookie(new BigInteger(1, cookie));
builder.setMatch(MatchDeserializer.createMatch(rawMessage));
rawMessage.skipBytes(PADDING_IN_PACKET_IN_HEADER);
builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array());
rawMessage.skipBytes(PADDING_IN_ROLE_REPLY_HEADER);
byte[] generationID = new byte[8];
rawMessage.readBytes(generationID);
- builder.setGenerationId(new BigInteger(generationID));
+ builder.setGenerationId(new BigInteger(1, generationID));
return builder.build();
}
}
private static void addMetadataAugmentation(MatchEntriesBuilder builder, ByteBuf in) {
MetadataMatchEntryBuilder metadata = new MetadataMatchEntryBuilder();
- byte[] metadataBytes = new byte[Long.SIZE/Byte.SIZE];
+ byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
in.readBytes(metadataBytes);
metadata.setMetadata(metadataBytes);
builder.addAugmentation(MetadataMatchEntry.class, metadata.build());
"00 0F "+//hardTimeout
"00 0B "+//flags
"00 00 00 00 "+//pad_02
- "00 01 01 01 01 01 01 01 "+//cookie
- "00 01 01 01 01 01 01 01 "+//packetCount
- "00 01 01 01 01 01 01 01"//byteCount
+ "FF 01 01 01 01 01 01 01 "+//cookie
+ "EF 01 01 01 01 01 01 01 "+//packetCount
+ "7F 01 01 01 01 01 01 01"//byteCount
);
MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
Assert.assertEquals("Wrong flags", new FlowModFlags(true, false, true, false, true),
message.getFlowStats().get(0).getFlags());
Assert.assertEquals("Wrong cookie",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getFlowStats().get(0).getCookie());
Assert.assertEquals("Wrong packetCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xEF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getFlowStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0x7F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getFlowStats().get(0).getByteCount());
}
@Test
public void testMultipartReplyAggregateBody(){
ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 00 00 00 00 "+
- "00 01 01 01 01 01 01 01 "+//packetCount
- "00 01 01 01 01 01 01 01 "+//byteCount
+ "FF 01 01 01 01 01 01 01 "+//packetCount
+ "0F 01 01 01 01 01 01 01 "+//byteCount
"00 00 00 08 "+//flowCount
"00 00 00 00"//pad
);
MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();
MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();
Assert.assertEquals("Wrong packetCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getPacketCount());
Assert.assertEquals("Wrong byteCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getByteCount());
Assert.assertEquals("Wrong flowCount",
8,
"08 "+//tableId
"00 00 00 "+//pad
"00 00 00 10 "+//activeCount
- "00 01 01 01 01 01 01 01 "+//lookupCount
- "00 01 01 01 01 01 01 01"//matchedCount
+ "FF 01 01 01 01 01 01 01 "+//lookupCount
+ "AF 01 01 01 01 01 01 01"//matchedCount
);
MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
Assert.assertEquals("Wrong tableId", 8, message.getTableStats().get(0).getTableId().intValue());
Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());
Assert.assertEquals("Wrong lookupCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getTableStats().get(0).getLookupCount());
Assert.assertEquals("Wrong matchedCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xAF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getTableStats().get(0).getMatchedCount());
}
ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 00 00 00 00 "+
"00 00 00 FF "+//portNo
"00 00 00 00 "+//pad
- "00 01 01 01 01 01 01 01 "+//rxPackets
- "00 02 02 02 02 02 02 02 "+//txPackets
- "00 02 03 02 03 02 03 02 "+//rxBytes
- "00 02 03 02 03 02 03 02 "+//txBytes
- "00 02 03 02 03 02 03 02 "+//rxDropped
- "00 02 03 02 03 02 03 02 "+//txDropped
- "00 02 03 02 03 02 03 02 "+//rxErrors
- "00 02 03 02 03 02 03 02 "+//txErrors
- "00 02 03 02 03 02 03 02 "+//rxFrameErr
- "00 02 03 02 03 02 03 02 "+//rxOverErr
- "00 02 03 02 03 02 03 02 "+//rxCrcErr
- "00 02 03 02 03 02 03 02 "+//collisions
+ "FF 01 01 01 01 01 01 01 "+//rxPackets
+ "FF 02 02 02 02 02 02 02 "+//txPackets
+ "FF 02 03 02 03 02 03 02 "+//rxBytes
+ "FF 02 03 02 03 02 03 02 "+//txBytes
+ "FF 02 03 02 03 02 03 02 "+//rxDropped
+ "FF 02 03 02 03 02 03 02 "+//txDropped
+ "FF 02 03 02 03 02 03 02 "+//rxErrors
+ "FF 02 03 02 03 02 03 02 "+//txErrors
+ "FF 02 03 02 03 02 03 02 "+//rxFrameErr
+ "FF 02 03 02 03 02 03 02 "+//rxOverErr
+ "FF 02 03 02 03 02 03 02 "+//rxCrcErr
+ "FF 02 03 02 03 02 03 02 "+//collisions
"00 00 00 02 "+//durationSec
"00 00 00 04"//durationNsec
);
MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();
Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());
Assert.assertEquals("Wrong rxPackets",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getPortStats().get(0).getRxPackets());
Assert.assertEquals("Wrong txPackets",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getPortStats().get(0).getTxPackets());
Assert.assertEquals("Wrong rxBytes",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getRxBytes());
Assert.assertEquals("Wrong txBytes",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getTxBytes());
Assert.assertEquals("Wrong rxDropped",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getRxDropped());
Assert.assertEquals("Wrong txDropped",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getTxDropped());
Assert.assertEquals("Wrong rxErrors",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getRxErrors());
Assert.assertEquals("Wrong txErrors",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getTxErrors());
Assert.assertEquals("Wrong rxFrameErr",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getRxFrameErr());
Assert.assertEquals("Wrong rxOverErr",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getRxOverErr());
Assert.assertEquals("Wrong rxCrcErr",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getRxCrcErr());
Assert.assertEquals("Wrong collisions",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getPortStats().get(0).getCollisions());
Assert.assertEquals("Wrong durationSec", 2, message.getPortStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 4, message.getPortStats().get(0).getDurationNsec().intValue());
ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 "+
"00 00 00 FF "+//portNo
"00 00 00 10 "+//queueId
- "00 02 03 02 03 02 03 02 "+//txBytes
- "00 02 02 02 02 02 02 02 "+//txPackets
- "00 02 03 02 03 02 03 02 "+//txErrors
+ "FF 02 03 02 03 02 03 02 "+//txBytes
+ "FF 02 02 02 02 02 02 02 "+//txPackets
+ "FF 02 03 02 03 02 03 02 "+//txErrors
"00 00 00 02 "+//durationSec
"00 00 00 04"//durationNsec
);
Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());
Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());
Assert.assertEquals("Wrong txBytes",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getQueueStats().get(0).getTxBytes());
Assert.assertEquals("Wrong txPackets",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getQueueStats().get(0).getTxPackets());
Assert.assertEquals("Wrong txErrors",
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}),
message.getQueueStats().get(0).getTxErrors());
Assert.assertEquals("Wrong durationSec", 2, message.getQueueStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 4, message.getQueueStats().get(0).getDurationNsec().intValue());
"00 00 00 10 "+//groupId
"00 00 00 12 "+//refCount
"00 00 00 00 "+//pad2
- "00 01 01 01 01 01 01 01 "+//packetCount
- "00 01 01 01 01 01 01 01 "+//byteCount
+ "FF 01 01 01 01 01 01 01 "+//packetCount
+ "FF 01 01 01 01 01 01 01 "+//byteCount
"00 00 00 08 "+//durationSec
"00 00 00 09 "+//durationNsec
- "00 01 01 01 01 01 01 01 "+//packetCountBucket
- "00 01 01 01 01 01 01 01 "+//byteCountBucket
- "00 02 02 02 02 02 02 02 "+//packetCountBucket_2
- "00 02 02 02 02 02 02 02 "+//byteCountBucket_2
+ "FF 01 01 01 01 01 01 01 "+//packetCountBucket
+ "FF 01 01 01 01 01 01 01 "+//byteCountBucket
+ "FF 02 02 02 02 02 02 02 "+//packetCountBucket_2
+ "FF 02 02 02 02 02 02 02 "+//byteCountBucket_2
"00 48 "+//length_2
"00 00 "+//pad1.2
"00 00 00 10 "+//groupId_2
"00 00 00 12 "+//refCount_2
"00 00 00 00 "+//pad2.2
- "00 01 01 01 01 01 01 01 "+//packetCount_2
- "00 01 01 01 01 01 01 01 "+//byteCount_2
+ "FF 01 01 01 01 01 01 01 "+//packetCount_2
+ "FF 01 01 01 01 01 01 01 "+//byteCount_2
"00 00 00 08 "+//durationSec_2
"00 00 00 09 "+//durationNsec_2
- "00 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
- "00 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
- "00 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
- "00 02 02 02 02 02 02 02"//byteCountBucket_2.2
+ "FF 01 01 01 01 01 01 01 "+//packetCountBucket_1.2
+ "FF 01 01 01 01 01 01 01 "+//byteCountBucket_1.2
+ "FF 02 02 02 02 02 02 02 "+//packetCountBucket_2.2
+ "FF 02 02 02 02 02 02 02"//byteCountBucket_2.2
);
MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
Assert.assertEquals("Wrong groupId", 16, message.getGroupStats().get(0).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong refCount", 18, message.getGroupStats().get(0).getRefCount().intValue());
Assert.assertEquals("Wrong packetCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(0).getByteCount());
Assert.assertEquals("Wrong durationSec", 8, message.getGroupStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 9, message.getGroupStats().get(0).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetCountBucket",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(0).getBucketStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(0).getBucketStats().get(0).getByteCount());
Assert.assertEquals("Wrong packetCountBucket_2",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getGroupStats().get(0).getBucketStats().get(1).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket_2",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getGroupStats().get(0).getBucketStats().get(1).getByteCount());
Assert.assertEquals("Wrong groupId_2", 16, message.getGroupStats().get(1).getGroupId().getValue().intValue());
Assert.assertEquals("Wrong refCount_2", 18, message.getGroupStats().get(1).getRefCount().intValue());
Assert.assertEquals("Wrong packetCount_2",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(1).getPacketCount());
Assert.assertEquals("Wrong byteCount_2",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(1).getByteCount());
Assert.assertEquals("Wrong durationSec_2", 8, message.getGroupStats().get(1).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec_2", 9, message.getGroupStats().get(1).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetCountBucket_1.2",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(1).getBucketStats().get(0).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket_1.2",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getGroupStats().get(1).getBucketStats().get(0).getByteCount());
Assert.assertEquals("Wrong packetCountBucket_2.2",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getGroupStats().get(1).getBucketStats().get(1).getPacketCount());
Assert.assertEquals("Wrong byteCountBucket_2.2",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getGroupStats().get(1).getBucketStats().get(1).getByteCount());
}
"00 58 "+//len
"00 00 00 00 00 00 "+//pad
"00 00 00 07 "+//flowCount
- "00 01 01 01 01 01 01 01 "+//packetInCount
- "00 01 01 01 01 01 01 01 "+//byteInCount
+ "FF 01 01 01 01 01 01 01 "+//packetInCount
+ "FF 01 01 01 01 01 01 01 "+//byteInCount
"00 00 00 05 "+//durationSec
"00 00 00 05 "+//durationNsec
- "00 01 01 01 01 01 01 01 "+//packetBandCount_01
- "00 01 01 01 01 01 01 01 "+//byteBandCount_01
- "00 02 02 02 02 02 02 02 "+//packetBandCount_02
- "00 02 02 02 02 02 02 02 "+//byteBandCount_02
- "00 03 03 03 03 03 03 03 "+//packetBandCount_03
- "00 03 03 03 03 03 03 03"//byteBandCount_03
+ "FF 01 01 01 01 01 01 01 "+//packetBandCount_01
+ "FF 01 01 01 01 01 01 01 "+//byteBandCount_01
+ "FF 02 02 02 02 02 02 02 "+//packetBandCount_02
+ "FF 02 02 02 02 02 02 02 "+//byteBandCount_02
+ "FF 03 03 03 03 03 03 03 "+//packetBandCount_03
+ "FF 03 03 03 03 03 03 03"//byteBandCount_03
);
MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
Assert.assertEquals("Wrong flowCount", 7,
message.getMeterStats().get(0).getFlowCount().intValue());
Assert.assertEquals("Wrong packetInCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getPacketInCount());
Assert.assertEquals("Wrong byteInCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getByteInCount());
Assert.assertEquals("Wrong durationSec", 5,
message.getMeterStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 5,
message.getMeterStats().get(0).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetBandCount_01",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_01",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_02",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_02",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_03",
- new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_03",
- new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
}
"00 58 "+//len_0
"00 00 00 00 00 00 "+//pad_0
"00 00 00 07 "+//flowCount_0
- "00 01 01 01 01 01 01 01 "+//packetInCount_0
- "00 01 01 01 01 01 01 01 "+//byteInCount_0
+ "FF 01 01 01 01 01 01 01 "+//packetInCount_0
+ "FF 01 01 01 01 01 01 01 "+//byteInCount_0
"00 00 00 05 "+//durationSec_0
"00 00 00 05 "+//durationNsec_0
- "00 01 01 01 01 01 01 01 "+//packetBandCount_01
- "00 01 01 01 01 01 01 01 "+//byteBandCount_01
- "00 02 02 02 02 02 02 02 "+//packetBandCount_02
- "00 02 02 02 02 02 02 02 "+//byteBandCount_02
- "00 03 03 03 03 03 03 03 "+//packetBandCount_03
- "00 03 03 03 03 03 03 03 "+//byteBandCount_03
+ "FF 01 01 01 01 01 01 01 "+//packetBandCount_01
+ "FF 01 01 01 01 01 01 01 "+//byteBandCount_01
+ "FF 02 02 02 02 02 02 02 "+//packetBandCount_02
+ "FF 02 02 02 02 02 02 02 "+//byteBandCount_02
+ "FF 03 03 03 03 03 03 03 "+//packetBandCount_03
+ "FF 03 03 03 03 03 03 03 "+//byteBandCount_03
"00 00 00 08 "+//meterId_1
"00 58 "+//len_1
"00 00 00 00 00 00 "+//pad_1
"00 00 00 07 "+//flowCount_1
- "00 01 01 01 01 01 01 01 "+//packetInCount_1
- "00 01 01 01 01 01 01 01 "+//byteInCount_1
+ "FF 01 01 01 01 01 01 01 "+//packetInCount_1
+ "FF 01 01 01 01 01 01 01 "+//byteInCount_1
"00 00 00 05 "+//durationSec_1
"00 00 00 05 "+//durationNsec_1
- "00 01 01 01 01 01 01 01 "+//packetBandCount_11
- "00 01 01 01 01 01 01 01 "+//byteBandCount_11
- "00 02 02 02 02 02 02 02 "+//packetBandCount_12
- "00 02 02 02 02 02 02 02 "+//byteBandCount_12
- "00 03 03 03 03 03 03 03 "+//packetBandCount_13
- "00 03 03 03 03 03 03 03"//byteBandCount_13
+ "FF 01 01 01 01 01 01 01 "+//packetBandCount_11
+ "FF 01 01 01 01 01 01 01 "+//byteBandCount_11
+ "FF 02 02 02 02 02 02 02 "+//packetBandCount_12
+ "FF 02 02 02 02 02 02 02 "+//byteBandCount_12
+ "FF 03 03 03 03 03 03 03 "+//packetBandCount_13
+ "FF 03 03 03 03 03 03 03"//byteBandCount_13
);
MultipartReplyMessage builtByFactory = BufferHelper.decodeV13(MultipartReplyMessageFactory.getInstance(), bb);
Assert.assertEquals("Wrong flowCount", 7,
message.getMeterStats().get(0).getFlowCount().intValue());
Assert.assertEquals("Wrong packetInCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getPacketInCount());
Assert.assertEquals("Wrong byteInCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getByteInCount());
Assert.assertEquals("Wrong durationSec", 5,
message.getMeterStats().get(0).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 5,
message.getMeterStats().get(0).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetBandCount_01",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getMeterBandStats().get(0).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_01",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(0).getMeterBandStats().get(0).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_02",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getMeterStats().get(0).getMeterBandStats().get(1).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_02",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getMeterStats().get(0).getMeterBandStats().get(1).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_03",
- new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
message.getMeterStats().get(0).getMeterBandStats().get(2).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_03",
- new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
message.getMeterStats().get(0).getMeterBandStats().get(2).getByteBandCount());
Assert.assertEquals("Wrong meterId", 8,
Assert.assertEquals("Wrong flowCount", 7,
message.getMeterStats().get(1).getFlowCount().intValue());
Assert.assertEquals("Wrong packetInCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(1).getPacketInCount());
Assert.assertEquals("Wrong byteInCount",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(1).getByteInCount());
Assert.assertEquals("Wrong durationSec", 5,
message.getMeterStats().get(1).getDurationSec().intValue());
Assert.assertEquals("Wrong durationNsec", 5,
message.getMeterStats().get(1).getDurationNsec().intValue());
Assert.assertEquals("Wrong packetBandCount_01",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(1).getMeterBandStats().get(0).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_01",
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}),
message.getMeterStats().get(1).getMeterBandStats().get(0).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_02",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getMeterStats().get(1).getMeterBandStats().get(1).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_02",
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}),
message.getMeterStats().get(1).getMeterBandStats().get(1).getByteBandCount());
Assert.assertEquals("Wrong packetBandCount_03",
- new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
message.getMeterStats().get(1).getMeterBandStats().get(2).getPacketBandCount());
Assert.assertEquals("Wrong byteBandCount_03",
- new BigInteger(new byte[]{0x00, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03}),
message.getMeterStats().get(1).getMeterBandStats().get(2).getByteBandCount());
}
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
+ "00 00 00 02 00 00 00 03 00 04 00 05 00 06 00 00 00 00 00 00 "\r
- + "00 01 02 03 04 05 06 07 00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 20 "\r
+ + "FF 01 02 03 04 05 06 07 FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 "\r
+ "00 00 00 08 00 01 00 02 00 01 00 08 00 03 00 00");\r
\r
MultipartReplyMessage builtByFactory = \r
Assert.assertEquals("Wrong idleTimeOut", 5, message.getFlowStats().get(0).getIdleTimeout().intValue());\r
Assert.assertEquals("Wrong hardTimeOut", 6, message.getFlowStats().get(0).getHardTimeout().intValue());\r
Assert.assertEquals("Wrong cookie",\r
- new BigInteger(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
message.getFlowStats().get(0).getCookie());\r
Assert.assertEquals("Wrong packetCount",\r
- new BigInteger(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
message.getFlowStats().get(0).getPacketCount());\r
Assert.assertEquals("Wrong byteCount",\r
- new BigInteger(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
message.getFlowStats().get(0).getByteCount());\r
Action action1 = message.getFlowStats().get(0).getActionsList().get(0).getAction();\r
Assert.assertEquals("Wrong action type", Output.class, action1.getType());\r
@Test\r
public void testAggregate() {\r
ByteBuf bb = BufferHelper.buildBuffer("00 02 00 01 "\r
- + "00 01 02 03 04 05 06 07 00 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");\r
+ + "FF 01 02 03 04 05 06 07 FF 00 00 00 00 00 00 20 00 00 00 30 00 00 00 00");\r
\r
MultipartReplyMessage builtByFactory = \r
BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
MultipartReplyAggregateCase messageCase = (MultipartReplyAggregateCase) builtByFactory.getMultipartReplyBody();\r
MultipartReplyAggregate message = messageCase.getMultipartReplyAggregate();\r
Assert.assertEquals("Wrong packet-count",\r
- new BigInteger(new byte[]{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}), \r
message.getPacketCount());\r
Assert.assertEquals("Wrong byte-count",\r
- new BigInteger(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20}), \r
message.getByteCount());\r
Assert.assertEquals("Wrong flow-count", 48, message.getFlowCount().intValue());\r
Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
ByteBuf bb = BufferHelper.buildBuffer("00 03 00 01 "\r
+ "08 00 00 00 4A 41 4D 45 53 20 42 4F 4E 44 00 00 00 00 00 00 00 00 00 "\r
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "\r
- + "00 00 00 30 00 00 00 10 00 01 01 01 01 01 01 01 02 01 01 01 01 01 01 00");\r
+ + "00 00 00 30 00 00 00 10 FF 01 01 01 01 01 01 01 FF 01 01 01 01 01 01 00");\r
\r
MultipartReplyMessage builtByFactory = BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
\r
Assert.assertEquals("Wrong max-entries", 48, message.getTableStats().get(0).getMaxEntries().longValue());\r
Assert.assertEquals("Wrong activeCount", 16, message.getTableStats().get(0).getActiveCount().longValue());\r
Assert.assertEquals("Wrong lookupCount", \r
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
message.getTableStats().get(0).getLookupCount());\r
Assert.assertEquals("Wrong matchedCount", \r
- new BigInteger(new byte[]{0x02, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00}), \r
message.getTableStats().get(0).getMatchedCount());\r
Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
}\r
public void testPort() {\r
ByteBuf bb = BufferHelper.buildBuffer("00 04 00 01 "\r
+ "00 FF 00 00 00 00 00 00 "\r
- + "00 01 01 01 01 01 01 01 00 02 02 02 02 02 02 02 "\r
- + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
- + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
- + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
- + "00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 00 02 03 02 03 02 03 02 "\r
- + "00 02 03 02 03 02 03 02 ");\r
+ + "FF 01 01 01 01 01 01 01 FF 02 02 02 02 02 02 02 "\r
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+ + "FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 FF 02 03 02 03 02 03 02 "\r
+ + "FF 02 03 02 03 02 03 02 ");\r
\r
MultipartReplyMessage builtByFactory = BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
\r
MultipartReplyPortStats message = messageCase.getMultipartReplyPortStats();\r
Assert.assertEquals("Wrong portNo", 255, message.getPortStats().get(0).getPortNo().intValue());\r
Assert.assertEquals("Wrong rxPackets", \r
- new BigInteger(new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}), \r
message.getPortStats().get(0).getRxPackets());\r
Assert.assertEquals("Wrong txPackets", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
message.getPortStats().get(0).getTxPackets());\r
Assert.assertEquals("Wrong rxBytes", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getRxBytes());\r
Assert.assertEquals("Wrong txBytes", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getTxBytes());\r
Assert.assertEquals("Wrong rxDropped", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getRxDropped());\r
Assert.assertEquals("Wrong txDropped", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getTxDropped());\r
Assert.assertEquals("Wrong rxErrors", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getRxErrors());\r
Assert.assertEquals("Wrong txErrors", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getTxErrors());\r
Assert.assertEquals("Wrong rxFrameErr", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getRxFrameErr());\r
Assert.assertEquals("Wrong rxOverErr", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getRxOverErr());\r
Assert.assertEquals("Wrong rxCrcErr", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getRxCrcErr());\r
Assert.assertEquals("Wrong collisions", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getPortStats().get(0).getCollisions());\r
Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
}\r
public void testQueue() {\r
ByteBuf bb = BufferHelper.buildBuffer("00 05 00 00 "\r
+ "00 FF 00 00 00 00 00 10 "\r
- + "00 02 03 02 03 02 03 02 "\r
- + "00 02 02 02 02 02 02 02 "\r
- + "00 02 03 02 03 02 03 02 ");\r
+ + "FF 02 03 02 03 02 03 02 "\r
+ + "FF 02 02 02 02 02 02 02 "\r
+ + "FF 02 03 02 03 02 03 02 ");\r
\r
MultipartReplyMessage builtByFactory = BufferHelper.decodeV10(OF10StatsReplyMessageFactory.getInstance(), bb);\r
\r
Assert.assertEquals("Wrong portNo", 255, message.getQueueStats().get(0).getPortNo().intValue());\r
Assert.assertEquals("Wrong queueId", 16, message.getQueueStats().get(0).getQueueId().intValue());\r
Assert.assertEquals("Wrong txBytes", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getQueueStats().get(0).getTxBytes());\r
Assert.assertEquals("Wrong txPackets", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02}), \r
message.getQueueStats().get(0).getTxPackets());\r
Assert.assertEquals("Wrong txErrors", \r
- new BigInteger(new byte[]{0x00, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
+ new BigInteger(1, new byte[]{(byte) 0xFF, 0x02, 0x03, 0x02, 0x03, 0x02, 0x03, 0x02}), \r
message.getQueueStats().get(0).getTxErrors());\r
Assert.assertTrue("Unread data", bb.readableBytes() == 0);\r
}\r
public void testFlowModInputMessageFactory() throws Exception {
FlowModInputBuilder builder = new FlowModInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
- byte[] cookie = new byte[]{0x00, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
- builder.setCookie(new BigInteger(cookie));
- byte[] cookieMask = new byte[]{0x01, 0x05, 0x00, 0x00, 0x09, 0x30, 0x00, 0x30};
- builder.setCookieMask(new BigInteger(cookieMask));
+ byte[] cookie = new byte[]{(byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
+ builder.setCookie(new BigInteger(1, cookie));
+ byte[] cookieMask = new byte[]{(byte) 0xFF, 0x05, 0x00, 0x00, 0x09, 0x30, 0x00, 0x30};
+ builder.setCookieMask(new BigInteger(1, cookieMask));
builder.setTableId(new TableId(65L));
builder.setCommand(FlowModCommand.forValue(2));
builder.setIdleTimeout(12);
factory.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, message);
BufferHelper.checkHeaderV13(out, factory.getMessageType(), factory.computeLength(message));
- Assert.assertEquals("Wrong cookie", message.getCookie().longValue(), out.readLong());
- Assert.assertEquals("Wrong cookieMask", message.getCookieMask().longValue(), out.readLong());
+ cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(cookie);
+ Assert.assertEquals("Wrong cookie", message.getCookie(), new BigInteger(1, cookie));
+ cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(cookieMask);
+ Assert.assertEquals("Wrong cookieMask", message.getCookieMask(), new BigInteger(1, cookieMask));
Assert.assertEquals("Wrong tableId", message.getTableId().getValue().intValue(), out.readUnsignedByte());
Assert.assertEquals("Wrong command", message.getCommand().getIntValue(), out.readUnsignedByte());
Assert.assertEquals("Wrong idleTimeOut", message.getIdleTimeout().intValue(), out.readShort());
builder.setOutPort(85L);
builder.setOutGroup(95L);
byte[] cookie = new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
- builder.setCookie(new BigInteger(cookie));
+ builder.setCookie(new BigInteger(1, cookie));
byte[] cookieMask = new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
- builder.setCookieMask(new BigInteger(cookieMask));
+ builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestFlow(builder.build());
//TODO match field
return caseBuilder.build();
builder.setOutPort(output.readUnsignedInt());
builder.setOutGroup(output.readUnsignedInt());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(cookie);
- builder.setCookie(new BigInteger(cookie));
- byte[] cookieMask = new byte[Long.SIZE/Byte.SIZE];
+ builder.setCookie(new BigInteger(1, cookie));
+ byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(cookieMask);
- builder.setCookieMask(new BigInteger(cookieMask));
+ builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestFlow(builder.build());
return caseBuilder.build();
}
builder.setOutPort(85L);
builder.setOutGroup(95L);
byte[] cookie = new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
- builder.setCookie(new BigInteger(cookie));
+ builder.setCookie(new BigInteger(1, cookie));
byte[] cookieMask = new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
- builder.setCookieMask(new BigInteger(cookieMask));
+ builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestAggregate(builder.build());
//TODO match field
return caseBuilder.build();
builder.setOutPort(output.readUnsignedInt());
builder.setOutGroup(output.readUnsignedInt());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_02);
- byte[] cookie = new byte[Long.SIZE/Byte.SIZE];
+ byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(cookie);
- builder.setCookie(new BigInteger(cookie));
- byte[] cookieMask = new byte[Long.SIZE/Byte.SIZE];
+ builder.setCookie(new BigInteger(1, cookie));
+ byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(cookieMask);
- builder.setCookieMask(new BigInteger(cookieMask));
+ builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestAggregate(builder.build());
return caseBuilder.build();
}
TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
tableFeaturesBuilder.setTableId((short) 8);
tableFeaturesBuilder.setName("AAAABBBBCCCCDDDDEEEEFFFFGGGG");
- tableFeaturesBuilder.setMetadataMatch(new BigInteger(new byte[] {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}));
- tableFeaturesBuilder.setMetadataWrite(new BigInteger(new byte[] {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}));
+ tableFeaturesBuilder.setMetadataMatch(new BigInteger(1, new byte[] {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}));
+ tableFeaturesBuilder.setMetadataWrite(new BigInteger(1, new byte[] {0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01}));
tableFeaturesBuilder.setConfig(new TableConfig(true));
tableFeaturesBuilder.setMaxEntries(65L);
TableFeatures tableFeature = tableFeaturesBuilder.build();
output.readBytes(tableNameBytes);
String tableName = new String(tableNameBytes);
tableFeaturesBuilder.setName(tableName.trim());
- byte[] metadataMatch = new byte[Long.SIZE/Byte.SIZE];
+ byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(metadataMatch);
- tableFeaturesBuilder.setMetadataMatch(new BigInteger(metadataMatch));
- byte[] metadataWrite = new byte[Long.SIZE/Byte.SIZE];
+ tableFeaturesBuilder.setMetadataMatch(new BigInteger(1, metadataMatch));
+ byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
output.readBytes(metadataWrite);
- tableFeaturesBuilder.setMetadataWrite(new BigInteger(metadataWrite));
+ tableFeaturesBuilder.setMetadataWrite(new BigInteger(1, metadataWrite));
tableFeaturesBuilder.setConfig(decodeTableConfig(output.readInt()));
tableFeaturesBuilder.setMaxEntries(output.readUnsignedInt());
TableFeatures tableFeature = tableFeaturesBuilder.build();
matchBuilder.setTpSrc(6653);
matchBuilder.setTpDst(6633);
builder.setMatchV10(matchBuilder.build());
- byte[] cookie = new byte[]{0x00, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
- builder.setCookie(new BigInteger(cookie));
+ byte[] cookie = new byte[]{(byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
+ builder.setCookie(new BigInteger(1, cookie));
builder.setCommand(FlowModCommand.forValue(0));
builder.setIdleTimeout(12);
builder.setHardTimeout(16);
RoleRequestInputBuilder builder = new RoleRequestInputBuilder();
BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
builder.setRole(ControllerRole.forValue(2));
- byte[] generationId = new byte[]{0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
- builder.setGenerationId(new BigInteger(generationId));
+ byte[] generationId = new byte[]{(byte) 0xFF, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
+ builder.setGenerationId(new BigInteger(1, generationId));
RoleRequestInput message = builder.build();
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);
Assert.assertEquals("Wrong role", message.getRole().getIntValue(), ControllerRole.forValue((int) out.readUnsignedInt()).getIntValue());
out.skipBytes(PADDING_IN_ROLE_REQUEST_MESSAGE);
- Assert.assertEquals("Wrong generation ID", message.getGenerationId().longValue(), out.readLong());
+ byte[] genId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.readBytes(genId);
+ Assert.assertEquals("Wrong generation ID", message.getGenerationId(), new BigInteger(1, genId));
}
}