Search in sources :

Example 1 with PcntfMessage

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

the class PCEPNotificationMessageParser method serializeMessage.

@Override
public void serializeMessage(final Message message, final ByteBuf out) {
    Preconditions.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().getNotifications()) {
        if (n.getRps() != null) {
            for (final Rps rps : n.getRps()) {
                serializeObject(rps.getRp(), buffer);
            }
        }
        Preconditions.checkArgument(n.getNotifications() != null && !n.getNotifications().isEmpty(), "Message must contain at least one notification object");
        for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.Notifications not : n.getNotifications()) {
            serializeObject(not.getCNotification(), buffer);
        }
    }
    MessageUtil.formatMessage(TYPE, buffer, out);
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) Rps(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.Rps) PcntfMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcntfMessage) Notifications(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.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.rev131005.PcntfMessage)1 Notifications (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.Notifications)1 Rps (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.Rps)1