use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class DistributedFpmPrefixStore method activated.
@Activate
protected void activated() {
dhcpFpmRecords = storageService.<IpPrefix, FpmRecord>eventuallyConsistentMapBuilder().withName("DHCP-FPM-Records").withTimestampProvider((k, v) -> new WallClockTimestamp()).withSerializer(APP_KRYO).withPersistence().build();
listener = new InternalMapListener();
dhcpFpmRecords.addListener(listener);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class PiPipeconfWatchdogManager method activate.
@Activate
public void activate() {
eventDispatcher.addSink(PiPipeconfWatchdogEvent.class, listenerRegistry);
localStatusMap = Maps.newConcurrentMap();
// Init distributed status map and configured devices set
KryoNamespace.Builder serializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(PipelineStatus.class);
statusMap = storageService.<DeviceId, PipelineStatus>eventuallyConsistentMapBuilder().withName("onos-pipeconf-status-table").withSerializer(serializer).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
statusMap.addListener(new StatusMapListener());
// Init the set of the configured devices
configuredDevices = new DefaultDistributedSet<>(storageService.<DeviceId>setBuilder().withName(CONFIGURED_DEVICES).withSerializer(Serializer.using(KryoNamespaces.API)).build(), DistributedPrimitive.DEFAULT_OPERATION_TIMEOUT_MILLIS);
// Register component configurable properties.
componentConfigService.registerProperties(getClass());
// Start periodic watchdog task.
startProbeTask();
// Add listeners.
deviceService.addListener(deviceListener);
pipeconfService.addListener(pipeconfListener);
log.info("Started");
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class InstallCoordinatorTest method testUninstallAndInstallIntent.
/**
* Do both uninstall and install test Intents.
*/
@Test
public void testUninstallAndInstallIntent() {
IntentData toUninstall = new IntentData(createTestIntent(), IntentState.INSTALLED, new WallClockTimestamp());
IntentData toInstall = new IntentData(createTestIntent(), IntentState.INSTALLING, new WallClockTimestamp());
List<Intent> intentsToUninstall = Lists.newArrayList();
List<Intent> intentsToInstall = Lists.newArrayList();
IntStream.range(0, 10).forEach(val -> {
intentsToUninstall.add(new TestInstallableIntent(val));
});
IntStream.range(10, 20).forEach(val -> {
intentsToInstall.add(new TestInstallableIntent(val));
});
toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
toInstall = IntentData.compiled(toInstall, intentsToInstall);
installCoordinator.installIntents(Optional.of(toUninstall), Optional.of(toInstall));
Intent toInstallIntent = toInstall.intent();
TestTools.assertAfter(INSTALL_DELAY, INSTALL_DURATION, () -> {
IntentData newData = intentStore.newData;
assertEquals(toInstallIntent, newData.intent());
assertEquals(IntentState.INSTALLED, newData.state());
assertEquals(intentsToInstall, newData.installables());
});
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class FlowObjectiveIntentInstallerTest method testUninstallAndInstallIntent.
/**
* Do both uninstall and install flow objective Intents.
*/
@Test
public void testUninstallAndInstallIntent() {
List<Intent> intentsToUninstall = createFlowObjectiveIntents();
List<Intent> intentsToInstall = createAnotherFlowObjectiveIntents();
IntentData toInstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toInstall = IntentData.compiled(toInstall, intentsToInstall);
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.INSTALLED, new WallClockTimestamp());
toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
IntentOperationContext<FlowObjectiveIntent> operationContext;
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
operationContext = new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
installer.apply(operationContext);
IntentOperationContext successContext = intentInstallCoordinator.successContext;
assertEquals(successContext, operationContext);
}
use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.
the class FlowObjectiveIntentInstallerTest method createUninstallContext.
/**
* Creates Intent operation context for uninstall Intents.
*
* @return the context
*/
private IntentOperationContext createUninstallContext() {
List<Intent> intentsToUninstall = createFlowObjectiveIntents();
List<Intent> intentsToInstall = Lists.newArrayList();
IntentData toInstall = null;
IntentData toUninstall = new IntentData(createP2PIntent(), IntentState.INSTALLING, new WallClockTimestamp());
toUninstall = IntentData.compiled(toUninstall, intentsToUninstall);
IntentInstallationContext context = new IntentInstallationContext(toUninstall, toInstall);
return new IntentOperationContext(intentsToUninstall, intentsToInstall, context);
}
Aggregations