use of org.onosproject.net.driver.DefaultDriverData 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;
}
use of org.onosproject.net.driver.DefaultDriverData in project onos by opennetworkinglab.
the class ExtensionCriterionSerializer method read.
@Override
public ExtensionCriterion read(Kryo kryo, Input input, Class<ExtensionCriterion> type) {
ExtensionSelectorType exType = (ExtensionSelectorType) kryo.readClassAndObject(input);
DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);
DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
byte[] bytes = (byte[]) kryo.readClassAndObject(input);
ExtensionSelector selector;
try {
DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driverService.getDriver(deviceId), deviceId));
ExtensionSelectorResolver resolver = handler.behaviour(ExtensionSelectorResolver.class);
selector = resolver.getExtensionSelector(exType);
selector.deserialize(bytes);
} catch (ItemNotFoundException | IllegalArgumentException e) {
selector = new UnresolvedExtensionSelector(bytes, exType);
}
return Criteria.extension(selector, deviceId);
}
use of org.onosproject.net.driver.DefaultDriverData in project onos by opennetworkinglab.
the class ExtensionInstructionSerializer method read.
@Override
public Instructions.ExtensionInstructionWrapper read(Kryo kryo, Input input, Class<Instructions.ExtensionInstructionWrapper> type) {
ExtensionTreatmentType exType = (ExtensionTreatmentType) kryo.readClassAndObject(input);
DeviceId deviceId = (DeviceId) kryo.readClassAndObject(input);
String driverName = (String) kryo.readClassAndObject(input);
DriverService driverService = DefaultServiceDirectory.getService(DriverService.class);
byte[] bytes = (byte[]) kryo.readClassAndObject(input);
ExtensionTreatment instruction;
try {
DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driverService.getDriver(driverName), deviceId));
ExtensionTreatmentResolver resolver = handler.behaviour(ExtensionTreatmentResolver.class);
instruction = resolver.getExtensionInstruction(exType);
instruction.deserialize(bytes);
} catch (ItemNotFoundException | IllegalArgumentException e) {
instruction = new UnresolvedExtensionTreatment(bytes, exType);
}
return Instructions.extension(instruction, deviceId);
}
use of org.onosproject.net.driver.DefaultDriverData in project onos by opennetworkinglab.
the class OvsdbControllerConfigTest method setUp.
@Before
public void setUp() {
controllerConfig = new OvsdbControllerConfig();
ddc = new DefaultDriver("foo.bar", new ArrayList<>(), "Circus", "lux", "1.2a", ImmutableMap.of(ControllerConfig.class, OvsdbControllerConfig.class), ImmutableMap.of("foo", "bar"));
data = new DefaultDriverData(ddc, DEVICE_ID);
handler = new DefaultDriverHandler(data);
// handler.controllerConfig.setHandler(handler);
// TODO setTestService directory on handler
// TODO setup ovsdb fake controller with fake ovsdbclient
// TODO setup fake device service
}
use of org.onosproject.net.driver.DefaultDriverData 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);
}
Aggregations