Search in sources :

Example 1 with MeterQuery

use of org.onosproject.net.behaviour.MeterQuery in project onos by opennetworkinglab.

the class DistributedMeterStore method queryMaxMeters.

// queryMaxMeters is implemented in MeterQuery behaviour implementations.
private long queryMaxMeters(DeviceId device) {
    DriverHandler handler = driverService.createHandler(device);
    if (handler == null || !handler.hasBehaviour(MeterQuery.class)) {
        return 0L;
    }
    // FIXME architecturally this is not right, we should fallback to this
    // behavior in the providers. Once we do that we can remove this code.
    MeterQuery query = handler.behaviour(MeterQuery.class);
    // This results to be necessary because the available ids sets are created
    // in the meter features map listener if the device does not provide the meter
    // feature this is the only chance to create this set.
    String setName = AVAILABLEMETERIDSTORE + "-" + device + "global";
    MeterTableKey meterTableKey = MeterTableKey.key(device, MeterScope.globalScope());
    insertAvailableKeySet(meterTableKey, setName);
    return query.getMaxMeters();
}
Also used : MeterTableKey(org.onosproject.net.meter.MeterTableKey) MeterQuery(org.onosproject.net.behaviour.MeterQuery) DriverHandler(org.onosproject.net.driver.DriverHandler)

Aggregations

MeterQuery (org.onosproject.net.behaviour.MeterQuery)1 DriverHandler (org.onosproject.net.driver.DriverHandler)1 MeterTableKey (org.onosproject.net.meter.MeterTableKey)1