Search in sources :

Example 6 with DefaultDriverHandler

use of org.onosproject.net.driver.DefaultDriverHandler in project onos by opennetworkinglab.

the class GroupBucketEntryBuilder method getDriver.

private DriverHandler getDriver(Dpid dpid) {
    DeviceId deviceId = DeviceId.deviceId(Dpid.uri(dpid));
    Driver driver = driverService.getDriver(deviceId);
    DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
    return handler;
}
Also used : DeviceId(org.onosproject.net.DeviceId) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DriverHandler(org.onosproject.net.driver.DriverHandler) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) Driver(org.onosproject.net.driver.Driver) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 7 with DefaultDriverHandler

use of org.onosproject.net.driver.DefaultDriverHandler in project onos by opennetworkinglab.

the class SnmpAlarmProvider method getAlarmTranslator.

private DeviceAlarmConfig getAlarmTranslator(SnmpDevice device) {
    Driver deviceDriver = driverService.getDriver(device.deviceId());
    if (deviceDriver != null && deviceDriver.hasBehaviour(DeviceAlarmConfig.class)) {
        DriverData driverData = new DefaultDriverData(deviceDriver, device.deviceId());
        DeviceAlarmConfig alarmTranslator = deviceDriver.createBehaviour(driverData, DeviceAlarmConfig.class);
        alarmTranslator.setHandler(new DefaultDriverHandler(driverData));
        return alarmTranslator;
    } else {
        log.warn("Device does not support alarm {}", device.deviceId());
    }
    return null;
}
Also used : DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) DriverData(org.onosproject.net.driver.DriverData) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) Driver(org.onosproject.net.driver.Driver) DeviceAlarmConfig(org.onosproject.alarm.DeviceAlarmConfig) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 8 with DefaultDriverHandler

use of org.onosproject.net.driver.DefaultDriverHandler in project onos by opennetworkinglab.

the class FlowEntryBuilder method getDriver.

/**
 * Retrieves the driver handler for the specified device.
 *
 * @param deviceId device identifier
 * @param driverService service handle for the driver service
 * @return driver handler
 */
protected static DriverHandler getDriver(DeviceId deviceId, DriverService driverService) {
    Driver driver = driverService.getDriver(deviceId);
    DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
    return handler;
}
Also used : DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DriverHandler(org.onosproject.net.driver.DriverHandler) Driver(org.onosproject.net.driver.Driver) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 9 with DefaultDriverHandler

use of org.onosproject.net.driver.DefaultDriverHandler in project onos by opennetworkinglab.

the class GroupModBuilder method buildExtensionAction.

private OFAction buildExtensionAction(ExtensionTreatment i, DeviceId deviceId) {
    if (!driverService.isPresent()) {
        log.error("No driver service present");
        return null;
    }
    Driver driver = driverService.get().getDriver(deviceId);
    if (driver.hasBehaviour(ExtensionTreatmentInterpreter.class)) {
        DefaultDriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
        ExtensionTreatmentInterpreter interpreter = handler.behaviour(ExtensionTreatmentInterpreter.class);
        return interpreter.mapInstruction(factory, i);
    }
    return null;
}
Also used : DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) Driver(org.onosproject.net.driver.Driver) ExtensionTreatmentInterpreter(org.onosproject.openflow.controller.ExtensionTreatmentInterpreter) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 10 with DefaultDriverHandler

use of org.onosproject.net.driver.DefaultDriverHandler in project onos by opennetworkinglab.

the class RestDeviceProvider method devicesDiscovery.

private DevicesDiscovery devicesDiscovery(RestSBDevice restSBDevice, Driver driver) {
    DriverData driverData = new DefaultDriverData(driver, restSBDevice.deviceId());
    DevicesDiscovery devicesDiscovery = driver.createBehaviour(driverData, DevicesDiscovery.class);
    devicesDiscovery.setHandler(new DefaultDriverHandler(driverData));
    return devicesDiscovery;
}
Also used : DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) DriverData(org.onosproject.net.driver.DriverData) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) DevicesDiscovery(org.onosproject.net.behaviour.DevicesDiscovery)

Aggregations

DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)18 DefaultDriverHandler (org.onosproject.net.driver.DefaultDriverHandler)18 Driver (org.onosproject.net.driver.Driver)13 DriverHandler (org.onosproject.net.driver.DriverHandler)8 DeviceId (org.onosproject.net.DeviceId)5 ItemNotFoundException (org.onlab.util.ItemNotFoundException)3 DriverData (org.onosproject.net.driver.DriverData)3 ArrayList (java.util.ArrayList)2 ExtensionTreatmentResolver (org.onosproject.net.behaviour.ExtensionTreatmentResolver)2 DeviceDescriptionDiscovery (org.onosproject.net.device.DeviceDescriptionDiscovery)2 DriverService (org.onosproject.net.driver.DriverService)2 Beta (com.google.common.annotations.Beta)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 EnumSet (java.util.EnumSet)1 List (java.util.List)1 Optional (java.util.Optional)1 Set (java.util.Set)1 ExecutorService (java.util.concurrent.ExecutorService)1 Executors.newSingleThreadExecutor (java.util.concurrent.Executors.newSingleThreadExecutor)1