use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class TapiFlowRuleProgrammableTest method setUp.
@Before
public void setUp() throws Exception {
tapiFrp = new TapiFlowRuleProgrammable();
DriverHandler mockHandler = new InternalDriverHandler();
tapiFrp.setHandler(mockHandler);
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class OFAgentVirtualGroupBucketEntryBuilder method buildTreatment.
private TrafficTreatment buildTreatment(List<OFAction> actions) {
DriverHandler driverHandler = getDriver(dpid);
TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
// If this is a drop rule
if (actions.isEmpty()) {
builder.drop();
return builder.build();
}
return FlowEntryBuilder.configureTreatmentBuilder(actions, builder, driverHandler, DeviceId.deviceId(Dpid.uri(dpid))).build();
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class NetconfConfigGetter method getConfiguration.
@Override
public String getConfiguration(String type) {
DriverHandler handler = handler();
NetconfController controller = handler.get(NetconfController.class);
DeviceId ofDeviceId = handler.data().deviceId();
Preconditions.checkNotNull(controller, "Netconf controller is null");
try {
return controller.getDevicesMap().get(ofDeviceId).getSession().getConfig(DatastoreId.datastore(type));
} catch (NetconfException e) {
log.error("Configuration could not be retrieved {}", e.getMessage());
}
return UNABLE_TO_READ_CONFIG;
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class NetconfConfigSetter method setConfiguration.
@Override
public String setConfiguration(String filePath) {
DriverHandler handler = handler();
NetconfController controller = handler.get(NetconfController.class);
DeviceId deviceId = handler.data().deviceId();
Preconditions.checkNotNull(controller, "Netconf controller is null");
String request;
try {
request = new String(Files.readAllBytes(Paths.get(filePath)));
} catch (IOException e) {
log.error("Cannot read configuration file", e);
return UNABLE_TO_READ_FILE;
}
try {
return controller.getDevicesMap().get(deviceId).getSession().requestSync(request);
} catch (NetconfException e) {
log.error("Configuration could not be set", e);
}
return UNABLE_TO_SET_CONFIG;
}
use of org.onosproject.net.driver.DriverHandler in project onos by opennetworkinglab.
the class DeviceInterfaceAddCommand method doExecute.
@Override
protected void doExecute() {
DriverService service = get(DriverService.class);
DeviceId deviceId = DeviceId.deviceId(uri);
DriverHandler h = service.createHandler(deviceId);
InterfaceConfig interfaceConfig = h.behaviour(InterfaceConfig.class);
if (accessVlanString != null && trunkVlanStrings == null && limitString == null) {
// Access mode to be enabled for VLAN.
addAccessModeToIntf(interfaceConfig);
} else if (trunkVlanStrings != null && accessVlanString == null && limitString == null) {
// Trunk mode to be enabled for VLANs.
addTrunkModeToIntf(interfaceConfig);
} else if (limitString != null && accessVlanString == null && trunkVlanStrings == null) {
// Rate limit to be set on interface.
addRateLimitToIntf(interfaceConfig);
} else {
// Option has not been correctly set.
print(ONE_ACTION_ALLOWED);
}
}
Aggregations