Search in sources :

Example 1 with PcntfMessage

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

the class PCEPNotificationMessageParser method serializeMessage.

@Override
public void serializeMessage(final Message message, final ByteBuf out) {
    checkArgument(message instanceof PcntfMessage, "Wrong instance of Message. Passed instance of %s. Need PcntfMessage.", message.getClass());
    final ByteBuf buffer = Unpooled.buffer();
    for (final Notifications n : ((PcntfMessage) message).getPcntfMessage().nonnullNotifications()) {
        for (final Rps rps : n.nonnullRps()) {
            serializeObject(rps.getRp(), buffer);
        }
        final var notifs = n.nonnullNotifications();
        checkArgument(!notifs.isEmpty(), "Message must contain at least one notification object");
        notifs.forEach(not -> serializeObject(not.getCNotification(), buffer));
    }
    MessageUtil.formatMessage(TYPE, buffer, out);
}
Also used : Rps(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcntf.message.pcntf.message.notifications.Rps) PcntfMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.PcntfMessage) ByteBuf(io.netty.buffer.ByteBuf) Notifications(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcntf.message.pcntf.message.Notifications)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 PcntfMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.PcntfMessage)1 Notifications (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcntf.message.pcntf.message.Notifications)1 Rps (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcntf.message.pcntf.message.notifications.Rps)1