Search in sources :

Example 16 with DefaultDriverData

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;
}
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 17 with DefaultDriverData

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);
}
Also used : UnresolvedExtensionSelector(org.onosproject.net.flow.criteria.UnresolvedExtensionSelector) ExtensionSelector(org.onosproject.net.flow.criteria.ExtensionSelector) DeviceId(org.onosproject.net.DeviceId) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) ExtensionSelectorResolver(org.onosproject.net.behaviour.ExtensionSelectorResolver) UnresolvedExtensionSelector(org.onosproject.net.flow.criteria.UnresolvedExtensionSelector) DriverHandler(org.onosproject.net.driver.DriverHandler) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) ExtensionSelectorType(org.onosproject.net.flow.criteria.ExtensionSelectorType) DriverService(org.onosproject.net.driver.DriverService) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) ItemNotFoundException(org.onlab.util.ItemNotFoundException)

Example 18 with DefaultDriverData

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);
}
Also used : DeviceId(org.onosproject.net.DeviceId) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) ExtensionTreatmentResolver(org.onosproject.net.behaviour.ExtensionTreatmentResolver) UnresolvedExtensionTreatment(org.onosproject.net.flow.instructions.UnresolvedExtensionTreatment) DriverHandler(org.onosproject.net.driver.DriverHandler) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) ExtensionTreatment(org.onosproject.net.flow.instructions.ExtensionTreatment) UnresolvedExtensionTreatment(org.onosproject.net.flow.instructions.UnresolvedExtensionTreatment) ExtensionTreatmentType(org.onosproject.net.flow.instructions.ExtensionTreatmentType) DriverService(org.onosproject.net.driver.DriverService) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) ItemNotFoundException(org.onlab.util.ItemNotFoundException)

Example 19 with DefaultDriverData

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
}
Also used : DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DefaultDriver(org.onosproject.net.driver.DefaultDriver) ArrayList(java.util.ArrayList) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData) Before(org.junit.Before)

Example 20 with DefaultDriverData

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

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