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