use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapregistermessage.MapRegister in project lispflowmapping by opendaylight.
the class MapServerTest method handleMapRegisterTest_findNegativeSubscribers.
@Test
@Ignore
public void handleMapRegisterTest_findNegativeSubscribers() throws NoSuchFieldException, IllegalAccessException {
setConfigIniMappingMergeField(true);
mapRegister.getMappingRecordItem().clear();
mapRegister.getMappingRecordItem().add(getDefaultMappingRecordItemBuilder(IPV4_PREFIX_EID_1).build());
final MappingRecordBuilder mappingRecordBuilder_1 = getDefaultMappingRecordBuilder().setEid(IPV4_PREFIX_EID_2);
final MappingRecordBuilder mappingRecordBuilder_2 = getDefaultMappingRecordBuilder();
final Eid maskedEid1 = LispAddressUtil.asIpv4Eid("1.2.0.0");
final Subscriber subscriber1 = Mockito.mock(Subscriber.class);
Mockito.when(subscriber1.timedOut()).thenReturn(true);
Mockito.when(subscriber1.toString()).thenReturn("sub1");
final Set<Subscriber> set1 = Sets.newHashSet(subscriber1);
Mockito.when(mapService.getAuthenticationKey(IPV4_PREFIX_EID_1)).thenReturn(MAPPING_AUTHKEY);
Mockito.when(mapService.getData(MappingOrigin.Southbound, IPV4_PREFIX_EID_1, SubKeys.SRC_RLOCS)).thenReturn(DEFAULT_IP_ADDRESS_SET);
Mockito.when(mapService.getParentPrefix(IPV4_PREFIX_EID_1)).thenReturn(maskedEid1);
Mockito.when(mapService.getData(MappingOrigin.Southbound, IPV4_PREFIX_EID_1, SubKeys.SUBSCRIBERS)).thenReturn(null);
Mockito.when(mapService.getData(MappingOrigin.Southbound, maskedEid1, SubKeys.SUBSCRIBERS)).thenReturn(set1);
Mockito.when(mapService.getMapping(MappingOrigin.Southbound, IPV4_PREFIX_EID_1)).thenReturn(getDefaultMappingData(mappingRecordBuilder_1.build())).thenReturn(getDefaultMappingData(mappingRecordBuilder_2.build())).thenReturn(null);
mapServer.handleMapRegister(mapRegister);
Mockito.verify(subscriber1).timedOut();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapregistermessage.MapRegister 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);
}
Aggregations