package org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart;
+import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
import java.util.ArrayList;
private static final MessageCodeKey MATCH_KEY = new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_VALUE, Match.class,
- MatchPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH);
+ MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
private static final byte PADDING_IN_FLOW_STATS_HEADER_01 = 1;
private static final byte PADDING_IN_FLOW_STATS_HEADER_02 = 4;
while (message.readableBytes() > 0) {
final FlowAndStatisticsMapListBuilder itemBuilder = new FlowAndStatisticsMapListBuilder();
final int itemLength = message.readUnsignedShort();
- final ByteBuf itemMessage = message.readSlice(itemLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ final ByteBuf itemMessage = message.readSlice(itemLength - Short.BYTES);
itemBuilder.setTableId(itemMessage.readUnsignedByte());
itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
- final byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] cookie = new byte[Long.BYTES];
itemMessage.readBytes(cookie);
- final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCount = new byte[Long.BYTES];
itemMessage.readBytes(packetCount);
- final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCount = new byte[Long.BYTES];
itemMessage.readBytes(byteCount);
itemBuilder
.setPacketCount(new Counter64(new BigInteger(1, packetCount)))
.setByteCount(new Counter64(new BigInteger(1, byteCount)));
- final OFDeserializer<Match> matchDeserializer = registry.getDeserializer(MATCH_KEY);
+ final OFDeserializer<Match> matchDeserializer =
+ Preconditions.checkNotNull(registry).getDeserializer(MATCH_KEY);
itemBuilder.setMatch(MatchUtil.transformMatch(matchDeserializer.deserialize(itemMessage),
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match.class));
final int startIndex = itemMessage.readerIndex();
int offset = 0;
- while ((itemMessage.readerIndex() - startIndex) < length) {
+ while (itemMessage.readerIndex() - startIndex < length) {
instructions.add(new InstructionBuilder()
- .setKey(new InstructionKey(offset))
+ .withKey(new InstructionKey(offset))
.setOrder(offset)
.setInstruction(InstructionUtil
.readInstruction(EncodeConstants.OF13_VERSION_ID, itemMessage, registry))
}
private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
- final Boolean ofp_FF_SendFlowRem = (input & (1)) > 0;
- final Boolean ofp_FF_CheckOverlap = (input & (1 << 1)) > 0;
- final Boolean ofp_FF_ResetCounts = (input & (1 << 2)) > 0;
- final Boolean ofp_FF_NoPktCounts = (input & (1 << 3)) > 0;
- final Boolean ofp_FF_NoBytCounts = (input & (1 << 4)) > 0;
+ final Boolean ofp_FF_SendFlowRem = (input & 1) != 0;
+ final Boolean ofp_FF_CheckOverlap = (input & 1 << 1) != 0;
+ final Boolean ofp_FF_ResetCounts = (input & 1 << 2) != 0;
+ final Boolean ofp_FF_NoPktCounts = (input & 1 << 3) != 0;
+ final Boolean ofp_FF_NoBytCounts = (input & 1 << 4) != 0;
return new FlowModFlags(ofp_FF_CheckOverlap, ofp_FF_NoBytCounts, ofp_FF_NoPktCounts, ofp_FF_ResetCounts,
ofp_FF_SendFlowRem);
}