Search in sources :

Example 21 with TransportAddress

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

the class LispMappingServiceTest method handleMapNotifyTest.

/**
 * Tests {@link LispMappingService#handleMapNotify} method.
 */
@Test
@SuppressWarnings("unchecked")
public void handleMapNotifyTest() {
    final MapNotify mapNotify = Mockito.mock(MapNotify.class);
    final List<TransportAddress> list = Mockito.mock(ArrayList.class);
    lispMappingService.handleMapNotify(mapNotify, list);
    Mockito.verify(tlsMapNotifyMock).set(Mockito.any(MutablePair.class));
}
Also used : MutablePair(org.apache.commons.lang3.tuple.MutablePair) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) GotMapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify) MapNotify(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify) Test(org.junit.Test)

Example 22 with TransportAddress

use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress 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 23 with TransportAddress

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

the class MapServerTest method getTransportAddressList.

private static List<TransportAddress> getTransportAddressList() {
    TransportAddressBuilder transportAddressBuilder1 = new TransportAddressBuilder().setIpAddress(IPV4_BINARY_1).setPort(new PortNumber(LispMessage.PORT_NUM));
    TransportAddressBuilder transportAddressBuilder2 = new TransportAddressBuilder().setIpAddress(IPV4_BINARY_2).setPort(new PortNumber(LispMessage.PORT_NUM));
    final List<TransportAddress> transportAddressList = Lists.newArrayList(transportAddressBuilder1.build(), transportAddressBuilder2.build());
    return transportAddressList;
}
Also used : TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)

Example 24 with TransportAddress

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

the class MapServerTest method handleMapRegisterTest_verifyTransportAddresses.

@Test
public void handleMapRegisterTest_verifyTransportAddresses() throws NoSuchFieldException, IllegalAccessException {
    setConfigIniMappingMergeField(true);
    // input
    Mockito.when(mapService.getAuthenticationKey(IPV4_EID_1)).thenReturn(MAPPING_AUTHKEY);
    Mockito.when(mapService.getMapping(MappingOrigin.Southbound, IPV4_EID_1)).thenReturn(OLD_MAPPING_DATA_1).thenReturn(OLD_MAPPING_DATA_2).thenReturn(getDefaultMappingData(getDefaultMappingRecordBuilder().build()));
    Mockito.when(mapService.getData(MappingOrigin.Southbound, IPV4_EID_1, SubKeys.SUBSCRIBERS)).thenReturn(subscriberSetMock_1);
    Mockito.when(mapService.getData(MappingOrigin.Southbound, IPV4_EID_1, SubKeys.SRC_RLOCS)).thenReturn(DEFAULT_IP_ADDRESS_SET);
    // result
    final List<TransportAddress> transportAddressList = getTransportAddressList();
    final MapNotifyBuilder mapNotifyBuilder = getDefaultMapNotifyBuilder(mapRegister);
    mapNotifyBuilder.setMappingRecordItem(new ArrayList<>());
    mapNotifyBuilder.getMappingRecordItem().add(new MappingRecordItemBuilder().setMappingRecord(getDefaultMappingRecordBuilder().build()).build());
    mapServer.handleMapRegister(mapRegister);
    Mockito.verify(notifyHandler).handleMapNotify(mapNotifyBuilder.build(), transportAddressList);
}
Also used : MappingRecordItemBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) MapNotifyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder) Test(org.junit.Test)

Example 25 with TransportAddress

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

the class LispNotificationHelperTest method getTransportAddressFromRlocTest_withIpv4AddressBinary.

/**
 * Tests {@link LispNotificationHelper#getTransportAddressFromRloc} method with Ipv4AddressBinary type address.
 */
@Test
public void getTransportAddressFromRlocTest_withIpv4AddressBinary() {
    final TransportAddress result = new TransportAddressBuilder().setIpAddress(new IpAddressBinary(ADDRESS_IPV4_BINARY)).setPort(new PortNumber(LispMessage.PORT_NUM)).build();
    assertEquals(result, LispNotificationHelper.getTransportAddressFromRloc(RLOC_IPV4_BINARY));
}
Also used : IpAddressBinary(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary) TransportAddress(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress) PortNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber) TransportAddressBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder) Test(org.junit.Test)

Aggregations

TransportAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddress)22 Test (org.junit.Test)18 TransportAddressBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.transport.address.TransportAddressBuilder)17 PortNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber)12 IpAddressBinary (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.inet.binary.types.rev160303.IpAddressBinary)12 MapNotifyBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapnotifymessage.MapNotifyBuilder)4 GotMapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.GotMapNotify)3 MapNotify (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.MapNotify)3 MapRequest (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.maprequestmessage.MapRequest)3 ArrayList (java.util.ArrayList)2 MutablePair (org.apache.commons.lang3.tuple.MutablePair)2 MappingRecordItemBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder)2 SendMapNotifyInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.sb.rev150904.SendMapNotifyInputBuilder)2 InetAddress (java.net.InetAddress)1 UnknownHostException (java.net.UnknownHostException)1 HashSet (java.util.HashSet)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Set (java.util.Set)1 MappingData (org.opendaylight.lispflowmapping.lisp.type.MappingData)1