use of org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry in project openflowplugin by opendaylight.
the class SimplifiedConfigListenerTest method testOnDataTreeChangedAdd.
@Test
public void testOnDataTreeChangedAdd() {
Mockito.when(configModification.getDataBefore()).thenReturn(null);
Mockito.when(configModification.getDataAfter()).thenReturn(dataAfter);
final SyncupEntry syncupEntry = loadOperationalDSAndPrepareSyncupEntry(dataAfter, confgDS, dataBefore, operationalDS);
nodeListenerConfig.onDataTreeChanged(Collections.singleton(dataTreeModification));
Mockito.verify(reactor).syncup(fcNodePath, syncupEntry);
Mockito.verifyNoMoreInteractions(reactor);
Mockito.verify(roTx).close();
}
use of org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry in project openflowplugin by opendaylight.
the class SimplifiedConfigListenerTest method testOnDataTreeChangedUpdate.
@Test
public void testOnDataTreeChangedUpdate() {
Mockito.when(configModification.getDataBefore()).thenReturn(dataBefore);
Mockito.when(configModification.getDataAfter()).thenReturn(dataAfter);
final SyncupEntry syncupEntry = loadOperationalDSAndPrepareSyncupEntry(dataAfter, confgDS, dataBefore, confgDS);
nodeListenerConfig.onDataTreeChanged(Collections.singleton(dataTreeModification));
Mockito.verify(reactor).syncup(fcNodePath, syncupEntry);
Mockito.verifyNoMoreInteractions(reactor);
Mockito.verify(roTx).close();
}
use of org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry in project openflowplugin by opendaylight.
the class SimplifiedOperationalListenerTest method testOnDataTreeChangedReconcileAndFreshOperationalNotPresentButAdd.
@Test
public void testOnDataTreeChangedReconcileAndFreshOperationalNotPresentButAdd() throws ParseException {
Mockito.when(reconciliationRegistry.isRegistered(NODE_ID)).thenReturn(true);
operationalAdd();
prepareFreshOperational(false);
final SyncupEntry syncupEntry = loadConfigDSAndPrepareSyncupEntry(configNode, configDS, fcOperationalNode, operationalDS);
nodeListenerOperational.onDataTreeChanged(Collections.singleton(dataTreeModification));
Mockito.verify(reactor).syncup(fcNodePath, syncupEntry);
Mockito.verify(roTx).close();
}
use of org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry in project openflowplugin by opendaylight.
the class SimplifiedOperationalListenerTest method testOnDataTreeChangedReconcileAndFreshOperationalPresent.
@Test
public void testOnDataTreeChangedReconcileAndFreshOperationalPresent() throws Exception {
Mockito.when(reconciliationRegistry.isRegistered(NODE_ID)).thenReturn(true);
operationalUpdate();
prepareFreshOperational(true);
final SyncupEntry syncupEntry = loadConfigDSAndPrepareSyncupEntry(configNode, configDS, fcOperationalNode, operationalDS);
nodeListenerOperational.onDataTreeChanged(Collections.singleton(dataTreeModification));
Mockito.verify(reactor).syncup(fcNodePath, syncupEntry);
Mockito.verify(roTx).close();
}
use of org.opendaylight.openflowplugin.applications.frsync.util.SyncupEntry in project openflowplugin by opendaylight.
the class SyncReactorFutureZipDecoratorTest method testSyncupRewriteZipEntryWithOperationalDelta.
@Test
public void testSyncupRewriteZipEntryWithOperationalDelta() throws Exception {
final FlowCapableNode configBefore = Mockito.mock(FlowCapableNode.class);
final FlowCapableNode configAfter = Mockito.mock(FlowCapableNode.class);
final FlowCapableNode configActual = Mockito.mock(FlowCapableNode.class);
final FlowCapableNode freshOperational = Mockito.mock(FlowCapableNode.class);
final CountDownLatch latchForFirst = new CountDownLatch(1);
final CountDownLatch latchForNext = new CountDownLatch(1);
final SyncupEntry first = new SyncupEntry(configAfter, configDS, configBefore, configDS);
final SyncupEntry second = new SyncupEntry(configActual, configDS, freshOperational, operationalDS);
Mockito.when(delegate.syncup(Matchers.<InstanceIdentifier<FlowCapableNode>>any(), Mockito.eq(first))).thenAnswer(invocationOnMock -> {
LOG.info("unlocking for fresh operational");
latchForNext.countDown();
latchForFirst.await();
LOG.info("unlocking first delegate");
return Futures.immediateFuture(Boolean.TRUE);
});
reactor.syncup(fcNodePath, first);
latchForNext.await();
mockSyncupWithEntry(second);
reactor.syncup(fcNodePath, second);
latchForFirst.countDown();
syncThreadPool.shutdown();
boolean terminated = syncThreadPool.awaitTermination(1, TimeUnit.SECONDS);
if (!terminated) {
LOG.info("thread pool not terminated.");
syncThreadPool.shutdownNow();
}
Mockito.verify(delegate, Mockito.times(1)).syncup(fcNodePath, second);
}
Aggregations