Search in sources :

Example 11 with DefaultDriverData

use of org.onosproject.net.driver.DefaultDriverData 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 12 with DefaultDriverData

use of org.onosproject.net.driver.DefaultDriverData 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 13 with DefaultDriverData

use of org.onosproject.net.driver.DefaultDriverData 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)

Example 14 with DefaultDriverData

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

the class FlowModBuilder method buildExtensionOxm.

private OFOxm buildExtensionOxm(ExtensionSelector extension) {
    if (!driverService.isPresent()) {
        log.error("No driver service present");
        return null;
    }
    Driver driver = driverService.get().getDriver(deviceId);
    if (driver.hasBehaviour(ExtensionSelectorInterpreter.class)) {
        DefaultDriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
        ExtensionSelectorInterpreter interpreter = handler.behaviour(ExtensionSelectorInterpreter.class);
        return interpreter.mapSelector(factory(), extension);
    }
    return null;
}
Also used : ExtensionSelectorInterpreter(org.onosproject.openflow.controller.ExtensionSelectorInterpreter) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) Driver(org.onosproject.net.driver.Driver) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 15 with DefaultDriverData

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

the class NetconfDeviceProvider method getDeviceDescription.

private DeviceDescription getDeviceDescription(DeviceId deviceId, NetconfDeviceConfig config) {
    Driver driver = driverService.getDriver(deviceId);
    if (driver.hasBehaviour(DeviceDescriptionDiscovery.class)) {
        final DriverData data = new DefaultDriverData(driver, deviceId);
        final DriverHandler handler = new DefaultDriverHandler(data);
        // creating the behaviour because the core has yet no notion of device.
        DeviceDescriptionDiscovery deviceDescriptionDiscovery = driver.createBehaviour(handler, DeviceDescriptionDiscovery.class);
        return getDeviceRepresentation(deviceId, config, deviceDescriptionDiscovery);
    } else {
        return existingOrEmptyDescription(deviceId, config);
    }
}
Also used : DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) DriverData(org.onosproject.net.driver.DriverData) DeviceDescriptionDiscovery(org.onosproject.net.device.DeviceDescriptionDiscovery) 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)

Aggregations

DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)22 DefaultDriverHandler (org.onosproject.net.driver.DefaultDriverHandler)18 Driver (org.onosproject.net.driver.Driver)14 DriverHandler (org.onosproject.net.driver.DriverHandler)8 DeviceId (org.onosproject.net.DeviceId)6 DriverData (org.onosproject.net.driver.DriverData)6 ItemNotFoundException (org.onlab.util.ItemNotFoundException)3 DefaultDriver (org.onosproject.net.driver.DefaultDriver)3 ArrayList (java.util.ArrayList)2 ExtensionTreatmentResolver (org.onosproject.net.behaviour.ExtensionTreatmentResolver)2 PipelineTraceable (org.onosproject.net.behaviour.PipelineTraceable)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 HashMap (java.util.HashMap)1 List (java.util.List)1 Optional (java.util.Optional)1