use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged in project lispflowmapping by opendaylight.
the class MappingDataListenerTest method onDataTreeChangedTest_subtreeModified_NB.
/**
* Tests {@link MappingDataListener#onDataTreeChanged} method with SUBTREE_MODIFIED modification type from
* northbound.
*/
@Test
@Ignore
@SuppressWarnings("unchecked")
public void onDataTreeChangedTest_subtreeModified_NB() throws InterruptedException {
final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_subtreeModified);
final MappingChanged mapChanged = MSNotificationInputUtil.toMappingChanged(MAPPING_EID_2_NB.getMappingRecord(), null, null, null, MappingChange.Updated);
Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(MAPPING_EID_2_NB);
mappingDataListener.onDataTreeChanged(changes);
final ArgumentCaptor<MappingData> captor = ArgumentCaptor.forClass(MappingData.class);
Mockito.verify(iMappingSystemMock).addMapping(Mockito.eq(MappingOrigin.Northbound), Mockito.eq(IPV4_EID_2), captor.capture());
assertEquals(captor.getValue().getRecord(), MAPPING_EID_2_NB.getMappingRecord());
Mockito.verify(notificationPublishServiceMock).putNotification(mapChanged);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged in project lispflowmapping by opendaylight.
the class MappingDataListenerTest method onDataTreeChangedTest_write_NB.
/**
* Tests {@link MappingDataListener#onDataTreeChanged} method with WRITE modification type from northbound.
*/
@Test
@Ignore
@SuppressWarnings("unchecked")
public void onDataTreeChangedTest_write_NB() throws InterruptedException {
final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_write);
final MappingChanged mapChanged = MSNotificationInputUtil.toMappingChanged(MAPPING_EID_3_NB.getMappingRecord(), null, null, null, MappingChange.Created);
Mockito.when(mod_write.getDataAfter()).thenReturn(MAPPING_EID_3_NB);
mappingDataListener.onDataTreeChanged(changes);
final ArgumentCaptor<MappingData> captor = ArgumentCaptor.forClass(MappingData.class);
Mockito.verify(iMappingSystemMock).addMapping(Mockito.eq(MappingOrigin.Northbound), Mockito.eq(IPV4_EID_3), captor.capture());
assertEquals(captor.getValue().getRecord(), MAPPING_EID_3_NB.getMappingRecord());
Mockito.verify(notificationPublishServiceMock).putNotification(mapChanged);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged in project lispflowmapping by opendaylight.
the class MapServer method onMappingChanged.
@Override
public void onMappingChanged(MappingChanged notification) {
if (subscriptionService) {
Eid eid = notification.getEid();
if (eid == null) {
eid = notification.getMappingRecord().getEid();
}
LOG.trace("MappingChanged event for {} of type: `{}'", LispAddressStringifier.getString(eid), notification.getChangeType());
Set<Subscriber> subscribers = MSNotificationInputUtil.toSubscriberSet(notification.getSubscriberItem());
LoggingUtil.logSubscribers(LOG, eid, subscribers);
if (mapService.isMaster()) {
sendSmrs(eid, subscribers);
if (eid.getAddress() instanceof SourceDestKey) {
Set<Subscriber> dstSubscribers = MSNotificationInputUtil.toSubscriberSetFromDst(notification.getDstSubscriberItem());
LoggingUtil.logSubscribers(LOG, SourceDestKeyHelper.getDstBinary(eid), dstSubscribers);
sendSmrs(SourceDestKeyHelper.getDstBinary(eid), dstSubscribers);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingChanged in project lispflowmapping by opendaylight.
the class MappingDataListenerTest method onDataTreeChangedTest_multipleChanges.
/**
* Tests {@link MappingDataListener#onDataTreeChanged} method with multiple changes.
*/
@Test
@Ignore
@SuppressWarnings("unchecked")
public void onDataTreeChangedTest_multipleChanges() throws InterruptedException {
final List<DataTreeModification<Mapping>> changes = Lists.newArrayList(change_del, change_subtreeModified, change_write);
final MappingChanged mapChangedSubtreeMod = MSNotificationInputUtil.toMappingChanged(MAPPING_EID_2_NB.getMappingRecord(), null, null, null, MappingChange.Updated);
Mockito.when(mod_del.getDataBefore()).thenReturn(MAPPING_EID_1_NB);
Mockito.when(mod_subtreeModified.getDataAfter()).thenReturn(MAPPING_EID_2_NB);
Mockito.when(mod_write.getDataAfter()).thenReturn(MAPPING_EID_3_SB);
mappingDataListener.onDataTreeChanged(changes);
final ArgumentCaptor<MappingData> captor = ArgumentCaptor.forClass(MappingData.class);
Mockito.verify(iMappingSystemMock).removeMapping(MappingOrigin.Northbound, IPV4_EID_1);
Mockito.verify(iMappingSystemMock).addMapping(Mockito.eq(MappingOrigin.Northbound), Mockito.eq(IPV4_EID_2), captor.capture());
assertEquals(captor.getValue().getRecord(), MAPPING_EID_2_NB.getMappingRecord());
Mockito.verify(notificationPublishServiceMock).putNotification(mapChangedSubtreeMod);
// Mockito.verifyNoMoreInteractions(iMappingSystemMock);
Mockito.verifyNoMoreInteractions(notificationPublishServiceMock);
}
Aggregations