Search in sources :

Example 1 with MeterFeaturesKey

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

the class SimpleVirtualMeterStore method deleteMeterFeatures.

@Override
public MeterStoreResult deleteMeterFeatures(NetworkId networkId, DeviceId deviceId) {
    ConcurrentMap<MeterFeaturesKey, MeterFeatures> meterFeatures = getMeterFeaturesByNetwork(networkId);
    MeterStoreResult result = MeterStoreResult.success();
    MeterFeaturesKey key = MeterFeaturesKey.key(deviceId);
    try {
        meterFeatures.remove(key);
    } catch (StorageException e) {
        result = MeterStoreResult.fail(TIMEOUT);
    }
    return result;
}
Also used : MeterStoreResult(org.onosproject.net.meter.MeterStoreResult) MeterFeaturesKey(org.onosproject.net.meter.MeterFeaturesKey) MeterFeatures(org.onosproject.net.meter.MeterFeatures) StorageException(org.onosproject.store.service.StorageException)

Example 2 with MeterFeaturesKey

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

the class SimpleVirtualMeterStore method getMaxMeters.

@Override
public long getMaxMeters(NetworkId networkId, MeterFeaturesKey key) {
    ConcurrentMap<MeterFeaturesKey, MeterFeatures> meterFeatures = getMeterFeaturesByNetwork(networkId);
    MeterFeatures features = meterFeatures.get(key);
    return features == null ? 0L : features.maxMeter();
}
Also used : MeterFeaturesKey(org.onosproject.net.meter.MeterFeaturesKey) MeterFeatures(org.onosproject.net.meter.MeterFeatures)

Example 3 with MeterFeaturesKey

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

the class SimpleVirtualMeterStore method storeMeterFeatures.

@Override
public MeterStoreResult storeMeterFeatures(NetworkId networkId, MeterFeatures meterfeatures) {
    ConcurrentMap<MeterFeaturesKey, MeterFeatures> meterFeatures = getMeterFeaturesByNetwork(networkId);
    MeterStoreResult result = MeterStoreResult.success();
    MeterFeaturesKey key = MeterFeaturesKey.key(meterfeatures.deviceId());
    try {
        meterFeatures.putIfAbsent(key, meterfeatures);
    } catch (StorageException e) {
        result = MeterStoreResult.fail(TIMEOUT);
    }
    return result;
}
Also used : MeterStoreResult(org.onosproject.net.meter.MeterStoreResult) MeterFeaturesKey(org.onosproject.net.meter.MeterFeaturesKey) MeterFeatures(org.onosproject.net.meter.MeterFeatures) StorageException(org.onosproject.store.service.StorageException)

Aggregations

MeterFeatures (org.onosproject.net.meter.MeterFeatures)3 MeterFeaturesKey (org.onosproject.net.meter.MeterFeaturesKey)3 MeterStoreResult (org.onosproject.net.meter.MeterStoreResult)2 StorageException (org.onosproject.store.service.StorageException)2