import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev181109.path.binding.tlv.path.binding.binding.type.value.MplsLabelEntryBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
import org.opendaylight.yangtools.concepts.IllegalArgumentCodec;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
final PathBindingTlvCodec codec = BT_SERIALIZERS.get(bindingTypeValue.implementedInterface());
Preconditions.checkArgument(codec != null,
"Unsupported Path Binding Type: %s", bindingTypeValue.implementedInterface());
- ByteBufWriteUtil.writeUnsignedShort(codec.getBindingType(), body);
+ ByteBufWriteUtil.writeUnsignedShort(Uint16.valueOf(codec.getBindingType()), body);
body.writeBytes(codec.serialize(bindingTypeValue));
TlvUtil.formatTlv(TYPE, body, buffer);
Preconditions.checkArgument(bindingValue instanceof MplsLabel, "bindingValue is not MplsLabel");
final MplsLabel mplsLabel = (MplsLabel) bindingValue;
final ByteBuf value = Unpooled.buffer(MPLS_ENTRY_LENGTH);
- ByteBufWriteUtil.writeUnsignedInt(getMplsStackEntry(mplsLabel.getMplsLabel()), value);
+ ByteBufWriteUtil.writeUnsignedInt(Uint32.valueOf(getMplsStackEntry(mplsLabel.getMplsLabel())), value);
return value;
}
| mplsEntry.getTrafficClass().toJava() << TC_SHIFT
| (mplsEntry.isBottomOfStack() ? 1 : 0) << S_SHIFT
| mplsEntry.getTimeToLive().toJava();
- ByteBufWriteUtil.writeUnsignedInt(entry, value);
+ ByteBufWriteUtil.writeUnsignedInt(Uint32.valueOf(entry), value);
return value;
}
@Override
public BindingTypeValue deserialize(final ByteBuf buffer) {
- final MplsLabelEntryBuilder builder = new MplsLabelEntryBuilder();
final long entry = buffer.readUnsignedInt();
- builder.setLabel(getMplsLabel(entry));
- builder.setTrafficClass(Uint8.valueOf(entry >> TC_SHIFT & TC_MASK));
- builder.setBottomOfStack((entry >> S_SHIFT & S_MASK) == 1);
- builder.setTimeToLive(Uint8.valueOf(entry & TTL_MASK));
+ final MplsLabelEntryBuilder builder = new MplsLabelEntryBuilder()
+ .setLabel(getMplsLabel(entry))
+ .setTrafficClass(Uint8.valueOf(entry >> TC_SHIFT & TC_MASK))
+ .setBottomOfStack((entry >> S_SHIFT & S_MASK) == 1)
+ .setTimeToLive(Uint8.valueOf(entry & TTL_MASK));
return builder.build();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacency;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacencyBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
public abstract class AbstractSrSubobjectParser {
public ByteBuf serializeSubobject(final SrSubobject srSubobject) {
final ByteBuf buffer = Unpooled.buffer(MINIMAL_LENGTH);
// sid type
- writeUnsignedByte((short)(srSubobject.getSidType().getIntValue() << SID_TYPE_BITS_OFFSET), buffer);
+ writeUnsignedByte(Uint8.valueOf(srSubobject.getSidType().getIntValue() << SID_TYPE_BITS_OFFSET), buffer);
final BitArray bits = new BitArray(BITSET_LENGTH);
bits.set(M_FLAG_POSITION, srSubobject.isMFlag());
"Both SID and NAI are absent in SR subobject.");
if (srSubobject.getSid() != null) {
if (srSubobject.isMFlag()) {
- writeUnsignedInt(srSubobject.getSid().toJava() << MPLS_LABEL_OFFSET, buffer);
+ writeUnsignedInt(Uint32.valueOf(srSubobject.getSid().intValue() << MPLS_LABEL_OFFSET), buffer);
} else {
writeUnsignedInt(srSubobject.getSid(), buffer);
}
Registration registerObjectParser(ObjectParser parser);
- @Deprecated
- Registration registerObjectParser(int objectClass, int objectType, ObjectParser parser);
-
Registration registerObjectSerializer(Class<? extends Object> objClass, ObjectSerializer serializer);
Registration registerRROSubobjectParser(int subobjectType, RROSubobjectParser parser);
return this.msgReg.registerMessageSerializer(msgClass, serializer);
}
- @Override
- public final Registration registerObjectParser(final int objectClass, final int objectType,
- final ObjectParser parser) {
- return this.objReg.registerObjectParser(objectClass, objectType, parser);
- }
-
@Override
public final Registration registerObjectParser(final ObjectParser parser) {
return this.objReg.registerObjectParser(parser.getObjectClass(), parser.getObjectType(), parser);
final PCEPExtensionProviderContext ctx = ServiceLoaderPCEPExtensionProviderContext.getSingletonInstance();
+ @SuppressWarnings("unchecked")
@Before
public void setUp() throws PCEPDeserializerException {
doReturn(null).when(this.xroParser).parseSubobject(any(ByteBuf.class), anyBoolean());
*/
package org.opendaylight.protocol.pcep.testtool;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.PCEPSessionListener;
*/
public class SimpleSessionListener implements PCEPSessionListener {
- private final List<Message> messages = Lists.newArrayList();
+ private final List<Message> messages = new ArrayList<>();
private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open;
import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
public final class SessionStateImpl implements PcepSessionState {
private final LongAdder lastReceivedRptMsgTimestamp = new LongAdder();
private StatefulMessagesStatsAug createStatefulMessages() {
return new StatefulMessagesStatsAugBuilder()
- .setLastReceivedRptMsgTimestamp(this.lastReceivedRptMsgTimestamp.longValue())
- .setReceivedRptMsgCount(this.receivedRptMsgCount.longValue())
- .setSentInitMsgCount(this.sentInitMsgCount.longValue())
- .setSentUpdMsgCount(this.sentUpdMsgCount.longValue())
+ .setLastReceivedRptMsgTimestamp(Uint32.valueOf(this.lastReceivedRptMsgTimestamp.longValue()))
+ .setReceivedRptMsgCount(Uint32.valueOf(this.receivedRptMsgCount.longValue()))
+ .setSentInitMsgCount(Uint32.valueOf(this.sentInitMsgCount.longValue()))
+ .setSentUpdMsgCount(Uint32.valueOf(this.sentUpdMsgCount.longValue()))
.build();
}
avg = Math.round((double) this.totalTime.longValue() / this.reqCount.longValue());
}
return new ReplyTimeBuilder()
- .setAverageTime(avg)
- .setMaxTime(this.maxReplyTime.longValue())
- .setMinTime(this.minReplyTime.longValue())
+ .setAverageTime(Uint32.valueOf(avg))
+ .setMaxTime(Uint32.valueOf(this.maxReplyTime.longValue()))
+ .setMinTime(Uint32.valueOf(this.minReplyTime.longValue()))
.build();
}