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;
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations