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