Search in sources :

Example 6 with DriverData

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

the class GeneralDeviceProvider method getBehaviour.

private <T extends Behaviour> T getBehaviour(DeviceId deviceId, Class<T> type) {
    Driver driver = getDriver(deviceId);
    if (driver == null) {
        return null;
    }
    if (!driver.hasBehaviour(type)) {
        return null;
    }
    final DriverData data = new DefaultDriverData(driver, deviceId);
    final DefaultDriverHandler handler = new DefaultDriverHandler(data);
    return driver.createBehaviour(handler, type);
}
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) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 7 with DriverData

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

DriverData (org.onosproject.net.driver.DriverData)7 DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)6 DefaultDriverHandler (org.onosproject.net.driver.DefaultDriverHandler)4 Driver (org.onosproject.net.driver.Driver)3 PipelineTraceable (org.onosproject.net.behaviour.PipelineTraceable)2 DeviceAlarmConfig (org.onosproject.alarm.DeviceAlarmConfig)1 DevicesDiscovery (org.onosproject.net.behaviour.DevicesDiscovery)1 DeviceDescriptionDiscovery (org.onosproject.net.device.DeviceDescriptionDiscovery)1 DeviceService (org.onosproject.net.device.DeviceService)1 DriverHandler (org.onosproject.net.driver.DriverHandler)1