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);
}
Aggregations