use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method handleNonProxyMapRequestTest.
/**
* Tests {@link LispMappingService#handleNonProxyMapRequest} method.
*/
@Test
@SuppressWarnings("unchecked")
public void handleNonProxyMapRequestTest() {
final MapRequest mapRequest = Mockito.mock(MapRequest.class);
final TransportAddress transportAddress = Mockito.mock(TransportAddress.class);
lispMappingService.handleNonProxyMapRequest(mapRequest, transportAddress);
Mockito.verify(tlsMapRequestMock).set(Mockito.any(MutablePair.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method onRequestMappingTest.
/**
* Tests {@link LispMappingService#onRequestMapping} method.
*/
@Test
public void onRequestMappingTest() {
final RequestMapping requestMapping = Mockito.mock(RequestMapping.class);
final org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest mapRequest = Mockito.mock(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest.class);
final MapReply mapReply = new MapReplyBuilder().build();
Mockito.when(requestMapping.getMapRequest()).thenReturn(mapRequest);
Mockito.when(requestMapping.getTransportAddress()).thenReturn(TRANSPORT_ADDRESS_1);
Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
Mockito.when(tlsMapReplyMock.get()).thenReturn(mapReply);
// result
final SendMapReplyInputBuilder smrib = new SendMapReplyInputBuilder().setMapReply(new MapReplyBuilder(mapReply).build()).setTransportAddress(TRANSPORT_ADDRESS_1);
lispMappingService.onRequestMapping(requestMapping);
Mockito.verify(odlLispSbService).sendMapReply(smrib.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method onRequestMappingTest_withNullMapReply.
/**
* Tests {@link LispMappingService#onRequestMapping} method with mapReply == null.
*/
@Test
public void onRequestMappingTest_withNullMapReply() {
final RequestMapping requestMapping = Mockito.mock(RequestMapping.class);
final org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest mapRequest = Mockito.mock(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest.class);
Mockito.when(requestMapping.getMapRequest()).thenReturn(mapRequest);
Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
Mockito.when(tlsMapReplyMock.get()).thenReturn(null);
lispMappingService.onRequestMapping(requestMapping);
Mockito.verifyZeroInteractions(odlLispSbService);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequest 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.proto.rev151105.maprequestnotification.MapRequest in project lispflowmapping by opendaylight.
the class LispMappingServiceTest method handleMapRequestTest.
/**
* Tests {@link LispMappingService#handleMapRequest} method.
*/
@Test
public void handleMapRequestTest() {
final MapRequest mapRequest = Mockito.mock(MapRequest.class);
final MapReply mapReply = new MapReplyBuilder().build();
Mockito.when(mapRequest.getEidItem()).thenReturn(Lists.newArrayList(EID_ITEM_BUILDER.build()));
Mockito.when(tlsMapRequestMock.get()).thenReturn(null);
Mockito.when(tlsMapReplyMock.get()).thenReturn(mapReply);
final MapReply result = lispMappingService.handleMapRequest(mapRequest);
Mockito.verify(tlsMapRequestMock).set(null);
Mockito.verify(tlsMapRequestMock).get();
Mockito.verifyNoMoreInteractions(tlsMapRequestMock);
Mockito.verify(mapResolverMock).handleMapRequest(mapRequest);
Mockito.verify(tlsMapReplyMock).set(Mockito.any(MapReply.class));
Mockito.verify(tlsMapReplyMock).get();
assertEquals(result, mapReply);
}
Aggregations