use of org.opendaylight.lispflowmapping.southbound.lisp.exception.LispMalformedPacketException in project lispflowmapping by opendaylight.
the class LispSouthboundHandler method handleMapRequest.
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleMapRequest(ByteBuffer inBuffer, InetAddress sourceAddress, int port) {
try {
MapRequest request = MapRequestSerializer.getInstance().deserialize(inBuffer, sourceAddress);
InetAddress finalSourceAddress = MapRequestUtil.selectItrRloc(request);
if (finalSourceAddress == null) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request, no ITR Rloc found!");
}
RequestMappingBuilder requestMappingBuilder = new RequestMappingBuilder();
requestMappingBuilder.setMapRequest(LispNotificationHelper.convertMapRequest(request));
TransportAddressBuilder transportAddressBuilder = new TransportAddressBuilder();
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressBinaryFromInetAddress(finalSourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
requestMappingBuilder.setTransportAddress(transportAddressBuilder.build());
lispSbPlugin.sendNotificationIfPossible(requestMappingBuilder.build());
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Request (len=" + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
}
use of org.opendaylight.lispflowmapping.southbound.lisp.exception.LispMalformedPacketException in project lispflowmapping by opendaylight.
the class LispSouthboundHandler method handleMapReply.
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleMapReply(ByteBuffer inBuffer, InetAddress sourceAddress, int port) {
try {
MapReply mapReply = MapReplySerializer.getInstance().deserialize(inBuffer);
GotMapReplyBuilder gotMapReplyBuilder = new GotMapReplyBuilder();
gotMapReplyBuilder.setMapReply(LispNotificationHelper.convertMapReply(mapReply));
TransportAddressBuilder transportAddressBuilder = new TransportAddressBuilder();
transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressBinaryFromInetAddress(sourceAddress));
transportAddressBuilder.setPort(new PortNumber(port));
gotMapReplyBuilder.setTransportAddress(transportAddressBuilder.build());
lispSbPlugin.sendNotificationIfPossible(gotMapReplyBuilder.build());
} catch (RuntimeException re) {
throw new LispMalformedPacketException("Couldn't deserialize Map-Reply (len=" + inBuffer.capacity() + ")", re);
} catch (InterruptedException e) {
LOG.warn("Notification publication interrupted!");
}
}
Aggregations