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;
}
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();
}
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;
}
Aggregations