Search in sources :

Example 46 with WallClockTimestamp

use of org.onosproject.store.service.WallClockTimestamp in project onos by opennetworkinglab.

the class DistributedDhcpRelayStore method activated.

@Activate
protected void activated() {
    dhcpRecords = storageService.<HostId, DhcpRecord>eventuallyConsistentMapBuilder().withName("DHCP-Relay-Records").withTimestampProvider((hostId, record) -> {
        if (record != null) {
            return new WallClockTimestamp(record.lastSeen());
        } else {
            return new WallClockTimestamp();
        }
    }).withSerializer(APP_KRYO).build();
    listener = new InternalMapListener();
    dhcpRecords.addListener(listener);
}
Also used : Logger(org.slf4j.Logger) EventuallyConsistentMapEvent(org.onosproject.store.service.EventuallyConsistentMapEvent) Deactivate(org.osgi.service.component.annotations.Deactivate) Collection(java.util.Collection) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) KryoNamespace(org.onlab.util.KryoNamespace) StoreDelegate(org.onosproject.store.StoreDelegate) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) DHCP6(org.onlab.packet.DHCP6) Component(org.osgi.service.component.annotations.Component) StorageService(org.onosproject.store.service.StorageService) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) Optional(java.util.Optional) Activate(org.osgi.service.component.annotations.Activate) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) EventuallyConsistentMap(org.onosproject.store.service.EventuallyConsistentMap) DHCP(org.onlab.packet.DHCP) EventuallyConsistentMapListener(org.onosproject.store.service.EventuallyConsistentMapListener) Reference(org.osgi.service.component.annotations.Reference) HostId(org.onosproject.net.HostId) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) Activate(org.osgi.service.component.annotations.Activate)

Example 47 with WallClockTimestamp

use of org.onosproject.store.service.WallClockTimestamp in project trellis-control by opennetworkinglab.

the class SegmentRoutingManager method activate.

@Activate
protected void activate(ComponentContext context) {
    appId = coreService.registerApplication(APP_NAME);
    mainEventExecutor = Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/sr", "event-main-%d", log));
    hostEventExecutor = Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/sr", "event-host-%d", log));
    routeEventExecutor = Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/sr", "event-route-%d", log));
    mcastEventExecutor = Executors.newSingleThreadScheduledExecutor(groupedThreads("onos/sr", "event-mcast-%d", log));
    packetExecutor = Executors.newSingleThreadExecutor(groupedThreads("onos/sr", "packet-%d", log));
    neighborExecutor = Executors.newFixedThreadPool(DEFAULT_POOL_SIZE, groupedThreads("onos/sr", "neighbor-%d", log));
    log.debug("Creating EC map nsnextobjectivestore");
    EventuallyConsistentMapBuilder<DestinationSetNextObjectiveStoreKey, NextNeighbors> nsNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder();
    dsNextObjStore = nsNextObjMapBuilder.withName("nsnextobjectivestore").withSerializer(createSerializer()).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    log.trace("Current size {}", dsNextObjStore.size());
    log.debug("Creating EC map vlannextobjectivestore");
    EventuallyConsistentMapBuilder<VlanNextObjectiveStoreKey, Integer> vlanNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder();
    vlanNextObjStore = vlanNextObjMapBuilder.withName("vlannextobjectivestore").withSerializer(createSerializer()).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    log.debug("Creating EC map macvlannextobjectivestore");
    EventuallyConsistentMapBuilder<MacVlanNextObjectiveStoreKey, Integer> macVlanNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder();
    macVlanNextObjStore = macVlanNextObjMapBuilder.withName("macvlannextobjectivestore").withSerializer(createSerializer()).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    log.debug("Creating EC map subnetnextobjectivestore");
    EventuallyConsistentMapBuilder<PortNextObjectiveStoreKey, Integer> portNextObjMapBuilder = storageService.eventuallyConsistentMapBuilder();
    portNextObjStore = portNextObjMapBuilder.withName("portnextobjectivestore").withSerializer(createSerializer()).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    EventuallyConsistentMapBuilder<String, Tunnel> tunnelMapBuilder = storageService.eventuallyConsistentMapBuilder();
    tunnelStore = tunnelMapBuilder.withName("tunnelstore").withSerializer(createSerializer()).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    EventuallyConsistentMapBuilder<String, Policy> policyMapBuilder = storageService.eventuallyConsistentMapBuilder();
    policyStore = policyMapBuilder.withName("policystore").withSerializer(createSerializer()).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    processor = new InternalPacketProcessor();
    linkListener = new InternalLinkListener();
    deviceListener = new InternalDeviceListener();
    appCfgHandler = new AppConfigHandler(this);
    mcastHandler = new McastHandler(this);
    hostHandler = new HostHandler(this);
    linkHandler = new LinkHandler(this);
    routeHandler = new RouteHandler(this);
    neighbourHandler = new SegmentRoutingNeighbourDispatcher(this);
    l2TunnelHandler = new DefaultL2TunnelHandler(this);
    topologyHandler = new TopologyHandler(this);
    compCfgService.preSetProperty("org.onosproject.provider.host.impl.HostLocationProvider", "requestInterceptsEnabled", "false", false);
    compCfgService.preSetProperty("org.onosproject.net.neighbour.impl.NeighbourResolutionManager", "requestInterceptsEnabled", "false", false);
    compCfgService.preSetProperty("org.onosproject.dhcprelay.DhcpRelayManager", "arpEnabled", "false", false);
    compCfgService.preSetProperty("org.onosproject.net.host.impl.HostManager", "greedyLearningIpv6", "true", false);
    compCfgService.preSetProperty("org.onosproject.routing.cpr.ControlPlaneRedirectManager", "forceUnprovision", "true", false);
    compCfgService.preSetProperty("org.onosproject.routeservice.store.RouteStoreImpl", "distributed", "true", false);
    compCfgService.preSetProperty("org.onosproject.provider.host.impl.HostLocationProvider", "multihomingEnabled", "true", false);
    compCfgService.preSetProperty("org.onosproject.provider.lldp.impl.LldpLinkProvider", "staleLinkAge", "15000", false);
    compCfgService.preSetProperty("org.onosproject.net.host.impl.HostManager", "allowDuplicateIps", "false", false);
    // For P4 switches
    compCfgService.preSetProperty("org.onosproject.net.flow.impl.FlowRuleManager", "fallbackFlowPollFrequency", "4", false);
    compCfgService.preSetProperty("org.onosproject.net.group.impl.GroupManager", "fallbackGroupPollFrequency", "3", false);
    compCfgService.preSetProperty("org.onosproject.net.meter.impl.MeterManager", "fallbackMeterPollFrequency", "3", false);
    compCfgService.registerProperties(getClass());
    modified(context);
    cfgService.addListener(cfgListener);
    cfgService.registerConfigFactory(deviceConfigFactory);
    cfgService.registerConfigFactory(appConfigFactory);
    cfgService.registerConfigFactory(mcastConfigFactory);
    log.info("Configuring network before adding listeners");
    cfgListener.configureNetwork();
    hostService.addListener(hostListener);
    packetService.addProcessor(processor, PacketProcessor.director(2));
    linkService.addListener(linkListener);
    deviceService.addListener(deviceListener);
    multicastRouteService.addListener(mcastListener);
    routeService.addListener(routeListener);
    topologyService.addListener(topologyListener);
    mastershipService.addListener(mastershipListener);
    clusterService.addListener(clusterListener);
    linkHandler.init();
    l2TunnelHandler.init();
    drainEvents();
    log.info("Started");
}
Also used : PortNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey) ReferencePolicy(org.osgi.service.component.annotations.ReferencePolicy) DefaultL2TunnelPolicy(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelPolicy) L2TunnelPolicy(org.onosproject.segmentrouting.pwaas.L2TunnelPolicy) MacVlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.MacVlanNextObjectiveStoreKey) VlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.VlanNextObjectiveStoreKey) MacVlanNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.MacVlanNextObjectiveStoreKey) McastHandler(org.onosproject.segmentrouting.mcast.McastHandler) NextNeighbors(org.onosproject.segmentrouting.grouphandler.NextNeighbors) DefaultL2TunnelHandler(org.onosproject.segmentrouting.pwaas.DefaultL2TunnelHandler) DestinationSetNextObjectiveStoreKey(org.onosproject.segmentrouting.storekey.DestinationSetNextObjectiveStoreKey) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) L2Tunnel(org.onosproject.segmentrouting.pwaas.L2Tunnel) DefaultL2Tunnel(org.onosproject.segmentrouting.pwaas.DefaultL2Tunnel) Activate(org.osgi.service.component.annotations.Activate)

Example 48 with WallClockTimestamp

use of org.onosproject.store.service.WallClockTimestamp in project aaa by opencord.

the class AaaStatisticsManager method activate.

@Activate
public void activate(ComponentContext context) {
    log.info("Activate aaaStatisticsManager");
    modified(context);
    statistics = storageService.<NodeId, AaaStatisticsSnapshot>eventuallyConsistentMapBuilder().withName("aaa-statistics").withSerializer(serializer).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    AaaStatisticsSnapshot snapshot = statistics.get(clusterService.getLocalNode().id());
    if (snapshot == null) {
        aaaStats = new AaaStatistics();
    } else {
        aaaStats = AaaStatistics.fromSnapshot(snapshot);
    }
    leadershipService.runForLeadership(AAA_STATISTICS_LEADERSHIP);
    eventDispatcher.addSink(AuthenticationStatisticsEvent.class, listenerRegistry);
    executor = Executors.newScheduledThreadPool(1);
    clusterCommunicationService.addSubscriber(RESET_SUBJECT, Serializer.using(serializer)::decode, this::resetLocal, executor);
    syncTask = executor.scheduleAtFixedRate(SafeRecurringTask.wrap(this::syncStats), 0, statisticsSyncPeriodInSeconds, TimeUnit.SECONDS);
    publisherTask = executor.scheduleAtFixedRate(SafeRecurringTask.wrap(this::publishStats), 0, statisticsGenerationPeriodInSeconds, TimeUnit.SECONDS);
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) AaaStatistics(org.opencord.aaa.AaaStatistics) AaaStatisticsSnapshot(org.opencord.aaa.AaaStatisticsSnapshot) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)48 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 Activate (org.osgi.service.component.annotations.Activate)15 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)13 PathIntent (org.onosproject.net.intent.PathIntent)13 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