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