Search in sources :

Example 1 with PcrepMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.PcrepMessage in project bgpcep by opendaylight.

the class PCEPReplyMessageParser method serializeMessage.

@Override
public void serializeMessage(final Message message, final ByteBuf out) {
    checkArgument(message instanceof Pcrep, "Wrong instance of Message. Passed instance of %s. Need Pcrep.", message.getClass());
    final PcrepMessage repMsg = ((Pcrep) message).getPcrepMessage();
    final List<Replies> replies = repMsg.nonnullReplies();
    checkArgument(!replies.isEmpty(), "Replies cannot be null or empty.");
    final ByteBuf buffer = Unpooled.buffer();
    for (final Replies reply : replies) {
        checkArgument(reply.getRp() != null, "Reply must contain RP object.");
        serializeReply(reply, buffer);
    }
    MessageUtil.formatMessage(TYPE, buffer, out);
}
Also used : Pcrep(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcrep) ByteBuf(io.netty.buffer.ByteBuf) PcrepMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.PcrepMessage) Replies(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.Replies)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 Pcrep (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcrep)1 PcrepMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.PcrepMessage)1 Replies (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.Replies)1