Search in sources :

Example 1 with PcreqMessage

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

the class PCEPMonitoringRequestMessageParser method serializeMessage.

@Override
public void serializeMessage(final Message message, final ByteBuf out) {
    Preconditions.checkArgument(message instanceof Pcmonreq, "Wrong instance of Message. Passed instance of %s. Need Pcmonreq.", message.getClass());
    final PcreqMessage msg = ((Pcmonreq) message).getPcreqMessage();
    Preconditions.checkArgument(msg.getMonitoringRequest() != null, "MONITORING object MUST be present.");
    final ByteBuf buffer = Unpooled.buffer();
    serializeMonitoringRequest(msg.getMonitoringRequest(), buffer);
    if (msg.getSvec() != null) {
        serializeSvec(msg, buffer);
    }
    if (msg.getRequests() != null) {
        serializeRequest(msg, buffer);
    }
    MessageUtil.formatMessage(TYPE, buffer, out);
}
Also used : Pcmonreq(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcmonreq) ByteBuf(io.netty.buffer.ByteBuf) PcreqMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.PcreqMessage)

Example 2 with PcreqMessage

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

the class PCEPRequestMessageParser method serializeRequest.

protected void serializeRequest(final PcreqMessage msg, final ByteBuf buffer) {
    for (final Requests req : msg.getRequests()) {
        serializeObject(req.getRp(), buffer);
        serializeVendorInformationObjects(req.getVendorInformationObject(), buffer);
        if (req.getPathKeyExpansion() != null) {
            serializeObject(req.getPathKeyExpansion().getPathKey(), buffer);
        }
        if (req.getSegmentComputation() != null) {
            final SegmentComputation sc = req.getSegmentComputation();
            if (sc.getP2p() != null) {
                serializeP2P(buffer, sc.getP2p());
            }
        }
    }
}
Also used : Requests(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Requests) SegmentComputation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.SegmentComputation)

Example 3 with PcreqMessage

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

the class PCEPRequestMessageParser method serializeMessage.

@Override
public void serializeMessage(final Message message, final ByteBuf out) {
    Preconditions.checkArgument(message instanceof Pcreq, "Wrong instance of Message. Passed instance of %s. Need Pcreq.", message.getClass());
    final PcreqMessage msg = ((Pcreq) message).getPcreqMessage();
    Preconditions.checkArgument(msg.getRequests() != null && !msg.getRequests().isEmpty(), "Requests cannot be null or empty.");
    final ByteBuf buffer = Unpooled.buffer();
    if (msg.getMonitoringRequest() != null) {
        serializeMonitoringRequest(msg.getMonitoringRequest(), buffer);
    }
    if (msg.getSvec() != null) {
        serializeSvec(msg, buffer);
    }
    serializeRequest(msg, buffer);
    MessageUtil.formatMessage(TYPE, buffer, out);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Pcreq(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcreq) PcreqMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.PcreqMessage)

Example 4 with PcreqMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.PcreqMessage 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)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 PcreqMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.PcreqMessage)2 Pcmonreq (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcmonreq)1 Pcreq (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcreq)1 Requests (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Requests)1 Svec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.Svec)1 SegmentComputation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcreq.message.pcreq.message.requests.SegmentComputation)1