Search in sources :

Example 6 with TlvsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.

the class PCEPRequestParameterObjectParser method parseObject.

@Override
public Object parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
    Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
    final RpBuilder builder = new RpBuilder();
    builder.setIgnore(header.isIgnore());
    builder.setProcessingRule(header.isProcessingRule());
    short priority = 0;
    priority |= flags.get(PRI_SF_OFFSET + 2) ? 1 : 0;
    priority |= (flags.get(PRI_SF_OFFSET + 1) ? 1 : 0) << 1;
    priority |= (flags.get(PRI_SF_OFFSET) ? 1 : 0) << 2;
    if (priority != 0) {
        builder.setPriority(priority);
    }
    builder.setFragmentation(flags.get(F_FLAG_OFFSET));
    builder.setP2mp(flags.get(N_FLAG_OFFSET));
    builder.setEroCompression(flags.get(E_FLAG_OFFSET));
    builder.setMakeBeforeBreak(flags.get(M_FLAG_OFFSET));
    builder.setOrder(flags.get(D_FLAG_OFFSET));
    builder.setPathKey(flags.get(P_FLAG_OFFSET));
    builder.setSupplyOf(flags.get(S_FLAG_OFFSET));
    builder.setLoose(flags.get(O_FLAG_OFFSET));
    builder.setBiDirectional(flags.get(B_FLAG_OFFSET));
    builder.setReoptimization(flags.get(R_FLAG_OFFSET));
    builder.setRequestId(new RequestId(bytes.readUnsignedInt()));
    final TlvsBuilder tlvsBuilder = new TlvsBuilder();
    parseTlvs(tlvsBuilder, bytes.slice());
    builder.setTlvs(tlvsBuilder.build());
    return builder.build();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder) RequestId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId) RpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.RpBuilder) BitArray(org.opendaylight.protocol.util.BitArray)

Example 7 with TlvsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.

the class PCEPGlobalConstraintsObjectParser method parseObject.

@Override
public Gc parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
    Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final GcBuilder builder = new GcBuilder();
    builder.setIgnore(header.isIgnore());
    builder.setProcessingRule(header.isProcessingRule());
    builder.setMaxHop(bytes.readUnsignedByte());
    builder.setMaxUtilization(bytes.readUnsignedByte());
    builder.setMinUtilization(bytes.readUnsignedByte());
    builder.setOverBookingFactor(bytes.readUnsignedByte());
    final TlvsBuilder tlvsBuilder = new TlvsBuilder();
    parseTlvs(tlvsBuilder, bytes.slice());
    builder.setTlvs(tlvsBuilder.build());
    return builder.build();
}
Also used : TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.gc.TlvsBuilder) GcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.GcBuilder)

Example 8 with TlvsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.

the class PCEPLspaObjectParser method parseObject.

@Override
public Lspa parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
    Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final LspaBuilder builder = new LspaBuilder();
    builder.setIgnore(header.isIgnore());
    builder.setProcessingRule(header.isProcessingRule());
    builder.setExcludeAny(new AttributeFilter(bytes.readUnsignedInt()));
    builder.setIncludeAll(new AttributeFilter(bytes.readUnsignedInt()));
    builder.setIncludeAny(new AttributeFilter(bytes.readUnsignedInt()));
    builder.setSetupPriority(bytes.readUnsignedByte());
    builder.setHoldPriority(bytes.readUnsignedByte());
    final BitArray flags = BitArray.valueOf(bytes.readByte());
    builder.setLocalProtectionDesired(flags.get(L_FLAG_OFFSET));
    final TlvsBuilder tbuilder = new TlvsBuilder();
    bytes.skipBytes(RESERVED);
    parseTlvs(tbuilder, bytes.slice());
    builder.setTlvs(tbuilder.build());
    return builder.build();
}
Also used : LspaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.LspaBuilder) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.TlvsBuilder) AttributeFilter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AttributeFilter) BitArray(org.opendaylight.protocol.util.BitArray)

Example 9 with TlvsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.

the class PCEPMonitoringObjectParser method parseObject.

@Override
public Object parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
    Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final MonitoringBuilder builder = new MonitoringBuilder();
    buffer.readBytes(RESERVED);
    final BitArray flagBits = BitArray.valueOf(buffer, FLAGS_SIZE);
    final Flags flags = new Flags(flagBits.get(G_FLAG_POS), flagBits.get(I_FLAG_POS), flagBits.get(L_FLAG_POS), flagBits.get(C_FLAG_POS), flagBits.get(P_FLAG_POS));
    builder.setFlags(flags);
    builder.setMonitoringId(buffer.readUnsignedInt());
    final TlvsBuilder tbuilder = new TlvsBuilder();
    parseTlvs(tbuilder, buffer.slice());
    builder.setTlvs(tbuilder.build());
    return builder.build();
}
Also used : MonitoringBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.MonitoringBuilder) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.monitoring.TlvsBuilder) BitArray(org.opendaylight.protocol.util.BitArray) Flags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring.Flags)

Example 10 with TlvsBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.error.object.TlvsBuilder in project bgpcep by opendaylight.

the class PCEPNoPathObjectParser method parseObject.

@Override
public NoPath parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
    Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final NoPathBuilder builder = new NoPathBuilder();
    builder.setIgnore(header.isIgnore());
    builder.setProcessingRule(header.isProcessingRule());
    builder.setNatureOfIssue(bytes.readUnsignedByte());
    final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
    builder.setUnsatisfiedConstraints(flags.get(C_FLAG_OFFSET));
    bytes.skipBytes(RESERVED_F_LENGTH);
    final TlvsBuilder tlvsBuilder = new TlvsBuilder();
    parseTlvs(tlvsBuilder, bytes.slice());
    builder.setTlvs(tlvsBuilder.build());
    return builder.build();
}
Also used : NoPathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.NoPathBuilder) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.no.path.TlvsBuilder) BitArray(org.opendaylight.protocol.util.BitArray)

Aggregations

Test (org.junit.Test)11 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.initiation.TlvsBuilder)8 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder)8 ByteBuf (io.netty.buffer.ByteBuf)7 Tlvs3Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.Tlvs3Builder)5 LspBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder)5 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.lsp.TlvsBuilder)5 BitArray (org.opendaylight.protocol.util.BitArray)4 LspDbVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev171025.lsp.db.version.tlv.LspDbVersion)4 PlspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)4 SrpIdNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.SrpIdNumber)4 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)3 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)3 InitiationMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.InitiationMessageBuilder)3 Srp1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder)3 SrpBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.SrpBuilder)3 Before (org.junit.Before)2 BmpDeserializationException (org.opendaylight.protocol.bmp.spi.parser.BmpDeserializationException)2 RouteMirroringMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.RouteMirroringMessageBuilder)2 TerminationMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.TerminationMessageBuilder)2