use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project bgpcep by opendaylight.
the class PeerUpHandler method serializeMessageBody.
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
Preconditions.checkArgument(message instanceof PeerUpNotification, "An instance of Peer Up notification is required");
final PeerUpNotification peerUp = (PeerUpNotification) message;
if (peerUp.getLocalAddress().getIpv4Address() != null) {
buffer.writeZero(Ipv6Util.IPV6_LENGTH - Ipv4Util.IP4_LENGTH);
ByteBufWriteUtil.writeIpv4Address(peerUp.getLocalAddress().getIpv4Address(), buffer);
} else {
ByteBufWriteUtil.writeIpv6Address(peerUp.getLocalAddress().getIpv6Address(), buffer);
}
ByteBufWriteUtil.writeUnsignedShort(peerUp.getLocalPort().getValue(), buffer);
ByteBufWriteUtil.writeUnsignedShort(peerUp.getRemotePort().getValue(), buffer);
this.msgRegistry.serializeMessage(new OpenBuilder(peerUp.getSentOpen()).build(), buffer);
this.msgRegistry.serializeMessage(new OpenBuilder(peerUp.getReceivedOpen()).build(), buffer);
serializeTlvs(peerUp.getInformation(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project bgpcep by opendaylight.
the class RouteMirroringMessageHandler method serializeMessageBody.
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
Preconditions.checkArgument(message instanceof RouteMirroringMessage, "An instance of RouteMirroringMessage is required");
final RouteMirroringMessage routeMirror = (RouteMirroringMessage) message;
serializeTlvs(routeMirror.getTlvs(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project bgpcep by opendaylight.
the class RouteMonitoringMessageHandler method parseMessageBody.
@Override
public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
final RouteMonitoringMessageBuilder routeMonitor = new RouteMonitoringMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
try {
final Notification message = this.msgRegistry.parseMessage(bytes, null);
requireNonNull(message, "UpdateMessage may not be null");
Preconditions.checkArgument(message instanceof UpdateMessage, "An instance of UpdateMessage is required");
final UpdateMessage updateMessage = (UpdateMessage) message;
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route.monitoring.message.Update update = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route.monitoring.message.UpdateBuilder(updateMessage).build();
routeMonitor.setUpdate(update);
} catch (final BGPDocumentedException | BGPParsingException e) {
throw new BmpDeserializationException("Error while parsing Update Message.", e);
}
return routeMonitor.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project bgpcep by opendaylight.
the class StatisticsReportHandler method serializeMessageBody.
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
super.serializeMessageBody(message, buffer);
Preconditions.checkArgument(message instanceof StatsReportsMessage, "An instance of Statistics Reports message is required");
final StatsReportsMessage statsReport = (StatsReportsMessage) message;
serializeTlvs(statsReport.getTlvs(), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message in project bgpcep by opendaylight.
the class TerminationHandler method serializeMessageBody.
@Override
public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
Preconditions.checkArgument(message instanceof TerminationMessage, "An instance of Termination message is required");
final TerminationMessage terminationMsg = (TerminationMessage) message;
serializeTlvs(terminationMsg.getTlvs(), buffer);
}
Aggregations