use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class RROUnnumberedInterfaceSubobjectParser method parseSubobject.
@Override
public Subobject parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; Expected: " + CONTENT_LENGTH + ".");
}
final SubobjectBuilder builder = new SubobjectBuilder();
final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
builder.setProtectionAvailable(flags.get(LPA_F_OFFSET));
builder.setProtectionInUse(flags.get(LPIU_F_OFFSET));
final UnnumberedBuilder ubuilder = new UnnumberedBuilder();
buffer.skipBytes(RESERVED);
ubuilder.setRouterId(buffer.readUnsignedInt());
ubuilder.setInterfaceId(buffer.readUnsignedInt());
builder.setSubobjectType(new UnnumberedCaseBuilder().setUnnumbered(ubuilder.build()).build());
return builder.build();
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class CInitiated00StatefulCapabilityTlvParser method parseFlags.
@Override
protected void parseFlags(final StatefulBuilder sb, final ByteBuf buffer) {
final BitArray flags = BitArray.valueOf(buffer, FLAGS_F_LENGTH);
sb.setLspUpdateCapability(flags.get(U_FLAG_OFFSET));
if (flags.get(I_FLAG_OFFSET)) {
sb.addAugmentation(Stateful1.class, new Stateful1Builder().setInitiation(Boolean.TRUE).build());
}
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class Stateful07LspObjectParser method serializeFlags.
protected BitArray serializeFlags(final Lsp specObj) {
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(DELEGATE, specObj.isDelegate());
flags.set(REMOVE, specObj.isRemove());
flags.set(SYNC, specObj.isSync());
flags.set(ADMINISTRATIVE, specObj.isAdministrative());
return flags;
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class Stateful07StatefulCapabilityTlvParser method parseFlags.
protected void parseFlags(final StatefulBuilder sb, final ByteBuf buffer) {
final BitArray flags = BitArray.valueOf(buffer, FLAGS_F_LENGTH);
sb.setLspUpdateCapability(flags.get(U_FLAG_OFFSET));
}
use of org.opendaylight.protocol.util.BitArray in project bgpcep by opendaylight.
the class CInitiated00LspObjectParser method serializeFlags.
@Override
protected BitArray serializeFlags(final Lsp specObj) {
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(DELEGATE, specObj.isDelegate());
flags.set(REMOVE, specObj.isRemove());
flags.set(SYNC, specObj.isSync());
flags.set(ADMINISTRATIVE, specObj.isAdministrative());
if (specObj.getAugmentation(Lsp1.class) != null) {
flags.set(CREATE_FLAG_OFFSET, specObj.getAugmentation(Lsp1.class).isCreate());
}
return flags;
}
Aggregations