Search in sources :

Example 1 with WallClockTimestamp

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);
}
Also used : IpPrefix(org.onlab.packet.IpPrefix) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) FpmRecord(org.onosproject.routing.fpm.api.FpmRecord) Activate(org.osgi.service.component.annotations.Activate)

Example 2 with WallClockTimestamp

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");
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) KryoNamespace(org.onlab.util.KryoNamespace) Activate(org.osgi.service.component.annotations.Activate)

Example 3 with WallClockTimestamp

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());
    });
}
Also used : TestInstallableIntent(org.onosproject.net.intent.TestInstallableIntent) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) TestInstallableIntent(org.onosproject.net.intent.TestInstallableIntent) Intent(org.onosproject.net.intent.Intent) PointToPointIntent(org.onosproject.net.intent.PointToPointIntent) Test(org.junit.Test) AbstractIntentTest(org.onosproject.net.intent.AbstractIntentTest)

Example 4 with WallClockTimestamp

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) FlowObjectiveIntent(org.onosproject.net.intent.FlowObjectiveIntent) Intent(org.onosproject.net.intent.Intent) FlowObjectiveIntent(org.onosproject.net.intent.FlowObjectiveIntent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext) Test(org.junit.Test)

Example 5 with WallClockTimestamp

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);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) IntentData(org.onosproject.net.intent.IntentData) IntentInstallationContext(org.onosproject.net.intent.IntentInstallationContext) FlowObjectiveIntent(org.onosproject.net.intent.FlowObjectiveIntent) Intent(org.onosproject.net.intent.Intent) IntentOperationContext(org.onosproject.net.intent.IntentOperationContext)

Aggregations

WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)45 IntentData (org.onosproject.net.intent.IntentData)34 Intent (org.onosproject.net.intent.Intent)33 Test (org.junit.Test)28 IntentInstallationContext (org.onosproject.net.intent.IntentInstallationContext)26 IntentOperationContext (org.onosproject.net.intent.IntentOperationContext)26 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)13 PathIntent (org.onosproject.net.intent.PathIntent)13 Activate (org.osgi.service.component.annotations.Activate)12 Collection (java.util.Collection)8 KryoNamespace (org.onlab.util.KryoNamespace)8 ImmutableList (com.google.common.collect.ImmutableList)6 List (java.util.List)6 Collectors (java.util.stream.Collectors)6 ComponentConfigService (org.onosproject.cfg.ComponentConfigService)5 DefaultFlowRule (org.onosproject.net.flow.DefaultFlowRule)5 FlowRule (org.onosproject.net.flow.FlowRule)5 IntentState (org.onosproject.net.intent.IntentState)5 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)4 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)4