Search in sources :

Example 1 with SendMapRequestInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder in project lispflowmapping by opendaylight.

the class LispMappingServiceTest method handleSmrTest.

/**
 * Tests {@link LispMappingService#handleSMR} method.
 */
@Test
public void handleSmrTest() {
    final MapRequest mapRequest = Mockito.mock(MapRequest.class);
    final Rloc subscriber = LispAddressUtil.asIpv4Rloc(IPV4_STRING_1);
    Mockito.when(mapRequest.getSourceEid()).thenReturn(new SourceEidBuilder().setEid(IPV4_SOURCE_EID).build());
    Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
    // result
    final SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder().setMapRequest(new MapRequestBuilder(mapRequest).build()).setTransportAddress(TRANSPORT_ADDRESS);
    lispMappingService.handleSMR(mapRequest, subscriber);
    Mockito.verify(odlLispSbService).sendMapRequest(smrib.build());
}
Also used : SendMapRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest) SourceEidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder) Rloc(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder) Test(org.junit.Test)

Example 2 with SendMapRequestInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder in project lispflowmapping by opendaylight.

the class LispMappingService method handleSMR.

@Override
public void handleSMR(MapRequest smrMapRequest, Rloc subscriber) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("Sending SMR Map-Request to {} with Source-EID {} and EID Record {} (reversed)", LispAddressStringifier.getString(subscriber), LispAddressStringifier.getString(smrMapRequest.getSourceEid().getEid()), LispAddressStringifier.getString(smrMapRequest.getEidItem().get(0).getEid()));
    }
    SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder();
    smrib.setMapRequest(new MapRequestBuilder(smrMapRequest).build());
    smrib.setTransportAddress(LispNotificationHelper.getTransportAddressFromRloc(subscriber));
    getLispSB().sendMapRequest(smrib.build());
}
Also used : SendMapRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)

Example 3 with SendMapRequestInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder in project lispflowmapping by opendaylight.

the class LispMappingServiceTest method handleMapRequestTest_NonProxy.

/**
 * Tests {@link LispMappingService#handleMapRequest} method request from non-proxy xTR.
 */
@Test
public void handleMapRequestTest_NonProxy() {
    final MapRequest mapRequest = Mockito.mock(MapRequest.class);
    final Pair<MapRequest, TransportAddress> pair = getDefaultMapRequestPair();
    final SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder().setMapRequest(pair.getLeft()).setTransportAddress(pair.getRight());
    Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
    Mockito.when(tlsMapRequestMock.get()).thenReturn(pair);
    assertNull(lispMappingService.handleMapRequest(mapRequest));
    Mockito.verify(odlLispSbService).sendMapRequest(smrib.build());
}
Also used : SendMapRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder) MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) Test(org.junit.Test)

Example 4 with SendMapRequestInputBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder in project lispflowmapping by opendaylight.

the class LispMappingService method handleMapRequest.

public MapReply handleMapRequest(MapRequest request) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("LISP: Retrieving mapping for {}", LispAddressStringifier.getString(request.getEidItem().get(0).getEid()));
    }
    tlsMapReply.set(null);
    tlsMapRequest.set(null);
    mapResolver.handleMapRequest(request);
    // After this invocation we assume that the thread local is filled with the reply
    if (tlsMapRequest.get() != null) {
        SendMapRequestInputBuilder smrib = new SendMapRequestInputBuilder();
        smrib.setMapRequest(new MapRequestBuilder(tlsMapRequest.get().getLeft()).build());
        smrib.setTransportAddress(tlsMapRequest.get().getRight());
        getLispSB().sendMapRequest(smrib.build());
        return null;
    } else {
        return tlsMapReply.get();
    }
}
Also used : SendMapRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder) MapRequestBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)

Aggregations

SendMapRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapRequestInputBuilder)4 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)3 Test (org.junit.Test)2 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest)2 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)1 Rloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.Rloc)1 TransportAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress)1