Search in sources :

Example 41 with BitArray

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();
}
Also used : UnnumberedCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCaseBuilder) BitArray(org.opendaylight.protocol.util.BitArray) PCEPDeserializerException(org.opendaylight.protocol.pcep.spi.PCEPDeserializerException) SubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder) UnnumberedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder)

Example 42 with BitArray

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());
    }
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) Stateful1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1Builder)

Example 43 with BitArray

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;
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray)

Example 44 with BitArray

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));
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray)

Example 45 with BitArray

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;
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) Lsp1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Lsp1)

Aggregations

BitArray (org.opendaylight.protocol.util.BitArray)100 ByteBuf (io.netty.buffer.ByteBuf)27 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)8 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)8 RSVPParsingException (org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException)6 IpPrefixSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject)4 IpPrefixCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCase)4 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 Weight (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight)3 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder)3 LabelType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType)3 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder)3 IpPrefixCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder)3 IpPrefixBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder)3 ArrayList (java.util.ArrayList)2 ByteBufWriteUtil.writeFloat32 (org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32)2 Stateful1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Stateful1)2 Nai (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.Nai)2 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId)2 Flags (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring.Flags)2