Search in sources :

Example 16 with MapRequest

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));
}
Also used : MutablePair(org.apache.commons.lang3.tuple.MutablePair) 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 17 with MapRequest

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());
}
Also used : SendMapReplyInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapReplyInputBuilder) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) MapReplyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapreplymessage.MapReplyBuilder) RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) XtrRequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping) Test(org.junit.Test)

Example 18 with MapRequest

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);
}
Also used : RequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.RequestMapping) XtrRequestMapping(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping) Test(org.junit.Test)

Example 19 with MapRequest

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());
}
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 20 with MapRequest

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);
}
Also used : MapRequest(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest) MapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply) GotMapReply(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply) MapReplyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapreplymessage.MapReplyBuilder) Test(org.junit.Test)

Aggregations

MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRequest)33 Test (org.junit.Test)24 GotMapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapReply)11 MapReply (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapReply)11 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)10 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequestBuilder)10 ItrRlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRlocBuilder)9 InetAddress (java.net.InetAddress)8 EidItem (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItem)6 ItrRloc (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.ItrRloc)6 MapRequestBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestnotification.MapRequestBuilder)6 RlocBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.rloc.container.RlocBuilder)6 GotMapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify)5 MapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify)5 MapRegister (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapRegister)5 EidItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.list.EidItemBuilder)5 SourceEidBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequest.SourceEidBuilder)5 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest)5 Ipv4Binary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.binary.address.types.rev160504.augmented.lisp.address.address.Ipv4Binary)4 XtrRequestMapping (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrRequestMapping)4