Search in sources :

Example 6 with Svec

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Svec in project bgpcep by opendaylight.

the class PCEPRequestMessageParser method serializeSvec.

protected void serializeSvec(final PcreqMessage msg, final ByteBuf buffer) {
    for (final Svec s : msg.getSvec()) {
        serializeObject(s.getSvec(), buffer);
        serializeObject(s.getOf(), buffer);
        serializeObject(s.getGc(), buffer);
        serializeObject(s.getXro(), buffer);
        if (s.getMetric() != null) {
            for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.svec.Metric m : s.getMetric()) {
                serializeObject(m.getMetric(), buffer);
            }
        }
        serializeVendorInformationObjects(s.getVendorInformationObject(), buffer);
    }
}
Also used : Svec(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Svec)

Example 7 with Svec

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Svec in project bgpcep by opendaylight.

the class PCEPSvecObjectParser method parseObject.

@Override
public Svec 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.");
    if (bytes.readableBytes() < MIN_SIZE) {
        throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + bytes.readableBytes() + "; Expected: >=" + MIN_SIZE + ".");
    }
    bytes.skipBytes(FLAGS_F_OFFSET);
    final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
    final List<RequestId> requestIDs = Lists.newArrayList();
    while (bytes.isReadable()) {
        requestIDs.add(new RequestId(bytes.readUnsignedInt()));
    }
    if (requestIDs.isEmpty()) {
        throw new PCEPDeserializerException("Empty Svec Object - no request ids.");
    }
    final SvecBuilder builder = new SvecBuilder();
    builder.setIgnore(header.isIgnore());
    builder.setProcessingRule(header.isProcessingRule());
    builder.setLinkDiverse(flags.get(L_FLAG_OFFSET));
    builder.setNodeDiverse(flags.get(N_FLAG_OFFSET));
    builder.setSrlgDiverse(flags.get(S_FLAG_OFFSET));
    builder.setRequestsIds(requestIDs);
    return builder.build();
}
Also used : RequestId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId) SvecBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.SvecBuilder) BitArray(org.opendaylight.protocol.util.BitArray) PCEPDeserializerException(org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)

Aggregations

Svec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Svec)5 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)3 ArrayList (java.util.ArrayList)2 BitArray (org.opendaylight.protocol.util.BitArray)2 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId)2 PcreqMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.PcreqMessageBuilder)2 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Requests)2 Preconditions (com.google.common.base.Preconditions)1 ByteBuf (io.netty.buffer.ByteBuf)1 PcmonreqBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcmonreqBuilder)1 PcreqBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcreqBuilder)1 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)1 Metrics (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.Metrics)1 MonitoringRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.MonitoringRequest)1 SvecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.SvecBuilder)1 Svec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.Svec)1 SvecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.SvecBuilder)1 VendorInformationObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject)1