Search in sources :

Example 1 with TIMEOUT

use of org.onosproject.net.meter.MeterFailReason.TIMEOUT in project onos by opennetworkinglab.

the class DistributedMeterStore method deleteMeterFeatures.

@Override
public MeterStoreResult deleteMeterFeatures(DeviceId deviceId) {
    MeterStoreResult result = MeterStoreResult.success();
    try {
        Set<MeterTableKey> keys = metersFeatures.keySet().stream().filter(key -> key.deviceId().equals(deviceId)).collect(Collectors.toUnmodifiableSet());
        keys.forEach(k -> metersFeatures.remove(k));
    } catch (StorageException e) {
        log.error("{} thrown a storage exception: {}", e.getStackTrace()[0].getMethodName(), e.getMessage(), e);
        result = MeterStoreResult.fail(TIMEOUT);
    }
    return result;
}
Also used : ConsistentMap(org.onosproject.store.service.ConsistentMap) DefaultMeter(org.onosproject.net.meter.DefaultMeter) Collections2(com.google.common.collect.Collections2) DriverService(org.onosproject.net.driver.DriverService) MeterStoreDelegate(org.onosproject.net.meter.MeterStoreDelegate) PiMeterId(org.onosproject.net.pi.model.PiMeterId) RandomUtils(org.apache.commons.lang.math.RandomUtils) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) StorageService(org.onosproject.store.service.StorageService) MeterCellId(org.onosproject.net.meter.MeterCellId) Map(java.util.Map) ApplicationId(org.onosproject.core.ApplicationId) DefaultDistributedSet(org.onosproject.store.primitives.DefaultDistributedSet) KryoNamespaces(org.onosproject.store.serializers.KryoNamespaces) MeterFailReason(org.onosproject.net.meter.MeterFailReason) MeterQuery(org.onosproject.net.behaviour.MeterQuery) Band(org.onosproject.net.meter.Band) Serializer(org.onosproject.store.service.Serializer) ImmutableSet(com.google.common.collect.ImmutableSet) MeterEvent(org.onosproject.net.meter.MeterEvent) MeterScope(org.onosproject.net.meter.MeterScope) EventuallyConsistentMapEvent(org.onosproject.store.service.EventuallyConsistentMapEvent) MeterOperation(org.onosproject.net.meter.MeterOperation) Deactivate(org.osgi.service.component.annotations.Deactivate) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) AtomicCounterMap(org.onosproject.store.service.AtomicCounterMap) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Versioned(org.onosproject.store.service.Versioned) INDEX(org.onosproject.net.meter.MeterCellId.MeterCellType.INDEX) List(java.util.List) FIRST_FIT(org.onosproject.store.meter.impl.DistributedMeterStore.ReuseStrategy.FIRST_FIT) MeterKey(org.onosproject.net.meter.MeterKey) DeviceId(org.onosproject.net.DeviceId) MeterStore(org.onosproject.net.meter.MeterStore) Iterables(com.google.common.collect.Iterables) StorageException(org.onosproject.store.service.StorageException) MeterFeatures(org.onosproject.net.meter.MeterFeatures) MeterTableKey(org.onosproject.net.meter.MeterTableKey) PiMeterCellId(org.onosproject.net.pi.runtime.PiMeterCellId) MeterId(org.onosproject.net.meter.MeterId) CompletableFuture(java.util.concurrent.CompletableFuture) KryoNamespace(org.onlab.util.KryoNamespace) DistributedPrimitive(org.onosproject.store.service.DistributedPrimitive) MapEventListener(org.onosproject.store.service.MapEventListener) ConcurrentMap(java.util.concurrent.ConcurrentMap) Component(org.osgi.service.component.annotations.Component) Lists(com.google.common.collect.Lists) MeterStoreResult(org.onosproject.net.meter.MeterStoreResult) FAIL(org.onosproject.net.meter.MeterStoreResult.Type.FAIL) Activate(org.osgi.service.component.annotations.Activate) EventuallyConsistentMap(org.onosproject.store.service.EventuallyConsistentMap) EventuallyConsistentMapListener(org.onosproject.store.service.EventuallyConsistentMapListener) Meter(org.onosproject.net.meter.Meter) Logger(org.slf4j.Logger) DefaultBand(org.onosproject.net.meter.DefaultBand) Maps(com.google.common.collect.Maps) MeterState(org.onosproject.net.meter.MeterState) ReferenceCardinality(org.osgi.service.component.annotations.ReferenceCardinality) DriverHandler(org.onosproject.net.driver.DriverHandler) DistributedSet(org.onosproject.store.service.DistributedSet) TIMEOUT(org.onosproject.net.meter.MeterFailReason.TIMEOUT) DefaultMeterFeatures(org.onosproject.net.meter.DefaultMeterFeatures) MapEvent(org.onosproject.store.service.MapEvent) AbstractStore(org.onosproject.store.AbstractStore) LoggerFactory.getLogger(org.slf4j.LoggerFactory.getLogger) PIPELINE_INDEPENDENT(org.onosproject.net.meter.MeterCellId.MeterCellType.PIPELINE_INDEPENDENT) MeterFeaturesFlag(org.onosproject.net.meter.MeterFeaturesFlag) Reference(org.osgi.service.component.annotations.Reference) MeterStoreResult(org.onosproject.net.meter.MeterStoreResult) MeterTableKey(org.onosproject.net.meter.MeterTableKey) StorageException(org.onosproject.store.service.StorageException)

Aggregations

Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Collections2 (com.google.common.collect.Collections2)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Iterables (com.google.common.collect.Iterables)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Collection (java.util.Collection)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ConcurrentMap (java.util.concurrent.ConcurrentMap)1 Collectors (java.util.stream.Collectors)1 RandomUtils (org.apache.commons.lang.math.RandomUtils)1 KryoNamespace (org.onlab.util.KryoNamespace)1 ApplicationId (org.onosproject.core.ApplicationId)1 DeviceId (org.onosproject.net.DeviceId)1 MeterQuery (org.onosproject.net.behaviour.MeterQuery)1