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