Search in sources :

Example 1 with XtrRequestMappingBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMappingBuilder in project lispflowmapping by opendaylight.

the class LispXtrSouthboundHandler method handleMapRequest.

@SuppressWarnings("checkstyle:IllegalCatch")
private void handleMapRequest(ByteBuffer inBuffer, InetAddress sourceAddress) {
    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!");
        }
        XtrRequestMappingBuilder requestMappingBuilder = new XtrRequestMappingBuilder();
        requestMappingBuilder.setMapRequest(LispNotificationHelper.convertMapRequest(request));
        TransportAddressBuilder transportAddressBuilder = new TransportAddressBuilder();
        transportAddressBuilder.setIpAddress(LispNotificationHelper.getIpAddressBinaryFromInetAddress(finalSourceAddress));
        transportAddressBuilder.setPort(new PortNumber(LispMessage.PORT_NUM));
        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!");
    }
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest) LispMalformedPacketException(org.opendaylight.lispflowmapping.southbound.lisp.exception.LispMalformedPacketException) XtrRequestMappingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMappingBuilder) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) InetAddress(java.net.InetAddress) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)

Aggregations

InetAddress (java.net.InetAddress)1 LispMalformedPacketException (org.opendaylight.lispflowmapping.southbound.lisp.exception.LispMalformedPacketException)1 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)1 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)1 XtrRequestMappingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMappingBuilder)1 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)1