Search in sources :

Example 1 with DomainIntentConfigurable

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

the class DomainIntentManager method initDomainIntentDriver.

private DomainIntentConfigurable initDomainIntentDriver(DeviceId deviceId) {
    // Attempt to lookup the handler in the cache
    DriverHandler handler = driverHandlers.get(deviceId);
    if (handler == null) {
        try {
            // Otherwise create it and if it has DomainIntentConfig behaviour, cache it
            handler = driverService.createHandler(deviceId);
            if (!handler.driver().hasBehaviour(DomainIntentConfigurable.class)) {
                log.warn("DomainIntentConfig behaviour not supported for device {}", deviceId);
                return null;
            }
        } catch (ItemNotFoundException e) {
            log.warn("No applicable driver for device {}", deviceId);
            return null;
        }
        driverHandlers.put(deviceId, handler);
    }
    // Always (re)initialize the pipeline behaviour
    log.info("Driver {} bound to device {} ... initializing driver", handler.driver().name(), deviceId);
    return handler.behaviour(DomainIntentConfigurable.class);
}
Also used : DriverHandler(org.onosproject.net.driver.DriverHandler) DomainIntentConfigurable(org.onosproject.net.behaviour.DomainIntentConfigurable) ItemNotFoundException(org.onlab.util.ItemNotFoundException)

Aggregations

ItemNotFoundException (org.onlab.util.ItemNotFoundException)1 DomainIntentConfigurable (org.onosproject.net.behaviour.DomainIntentConfigurable)1 DriverHandler (org.onosproject.net.driver.DriverHandler)1