Search in sources :

Example 26 with DriverService

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

the class VoltSetPonLinkCommand method doExecute.

@Override
protected void doExecute() {
    DriverService service = get(DriverService.class);
    deviceId = DeviceId.deviceId(uri);
    DriverHandler h = service.createHandler(deviceId);
    VoltPonLinkConfig volt = h.behaviour(VoltPonLinkConfig.class);
    volt.setPonLink(target);
}
Also used : VoltPonLinkConfig(org.onosproject.drivers.fujitsu.behaviour.VoltPonLinkConfig) DriverHandler(org.onosproject.net.driver.DriverHandler) DriverService(org.onosproject.net.driver.DriverService)

Example 27 with DriverService

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

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

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

the class NetconfRpcTestCommand method doExecute.

@Override
protected void doExecute() {
    DriverService service = get(DriverService.class);
    deviceId = DeviceId.deviceId(uri);
    DriverHandler h = service.createHandler(deviceId);
    ConfigSetter config = h.behaviour(ConfigSetter.class);
    checkNotNull(cfgFile, "Configuration file cannot be null");
    print(config.setConfiguration(cfgFile));
}
Also used : DriverHandler(org.onosproject.net.driver.DriverHandler) ConfigSetter(org.onosproject.net.behaviour.ConfigSetter) DriverService(org.onosproject.net.driver.DriverService)

Example 30 with DriverService

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

the class DeviceControllersCommand method doExecute.

@Override
protected void doExecute() {
    DriverService service = get(DriverService.class);
    deviceId = DeviceId.deviceId(uri);
    DriverHandler h = service.createHandler(deviceId);
    ControllerConfig config = h.behaviour(ControllerConfig.class);
    config.getControllers().forEach(c -> print(c.target()));
}
Also used : ControllerConfig(org.onosproject.net.behaviour.ControllerConfig) DriverHandler(org.onosproject.net.driver.DriverHandler) DriverService(org.onosproject.net.driver.DriverService)

Aggregations

DriverService (org.onosproject.net.driver.DriverService)32 DriverHandler (org.onosproject.net.driver.DriverHandler)23 DeviceId (org.onosproject.net.DeviceId)9 DeviceService (org.onosproject.net.device.DeviceService)5 List (java.util.List)3 Set (java.util.Set)3 Tools.groupedThreads (org.onlab.util.Tools.groupedThreads)3 VoltOnuConfig (org.onosproject.drivers.fujitsu.behaviour.VoltOnuConfig)3 DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)3 DefaultDriverHandler (org.onosproject.net.driver.DefaultDriverHandler)3 Driver (org.onosproject.net.driver.Driver)3 Beta (com.google.common.annotations.Beta)2 ImmutableSet (com.google.common.collect.ImmutableSet)2 Lists (com.google.common.collect.Lists)2 Maps (com.google.common.collect.Maps)2 Dictionary (java.util.Dictionary)2 Map (java.util.Map)2 Objects (java.util.Objects)2 Optional (java.util.Optional)2 ExecutorService (java.util.concurrent.ExecutorService)2