Search in sources :

Example 1 with DriverData

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

the class DefaultOpticalDevice method delegate.

@Override
public Device delegate() {
    if (delegate == null) {
        // dirty work around.
        // wanted to pass delegate Device at construction,
        // but was not possible. A Behaviour requires no-arg constructor.
        checkState(data() != null, "DriverData must exist");
        DriverData data = data();
        DeviceService service = DefaultServiceDirectory.getService(DeviceService.class);
        delegate = checkNotNull(service.getDevice(data.deviceId()), "No Device found for %s", data.deviceId());
    }
    return delegate;
}
Also used : DriverData(org.onosproject.net.driver.DriverData) DeviceService(org.onosproject.net.device.DeviceService)

Example 2 with DriverData

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

the class OfdpaPipelineTraceableTest method setUpOfdpa.

private PipelineTraceable setUpOfdpa() {
    PipelineTraceable behaviour = new OfdpaPipelineTraceable();
    DriverData driverData = new DefaultDriverData(ofdpaDriver, OFDPA_DEVICE);
    behaviour.setData(driverData);
    behaviour.setHandler(testDriverHandlerOfdpa);
    behaviour.init();
    return behaviour;
}
Also used : PipelineTraceable(org.onosproject.net.behaviour.PipelineTraceable) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) DriverData(org.onosproject.net.driver.DriverData) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

Example 3 with DriverData

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

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

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

the class OfdpaPipelineTraceableTest method setUpOvsOfdpa.

private PipelineTraceable setUpOvsOfdpa() {
    PipelineTraceable behaviour = new OfdpaPipelineTraceable();
    DriverData driverData = new DefaultDriverData(ovsOfdpaDriver, OFDPA_DEVICE);
    behaviour.setData(driverData);
    behaviour.setHandler(testDriverHandlerOvsOfdpa);
    behaviour.init();
    return behaviour;
}
Also used : PipelineTraceable(org.onosproject.net.behaviour.PipelineTraceable) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) DriverData(org.onosproject.net.driver.DriverData) 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