Search in sources :

Example 21 with DriverHandler

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);
}
Also used : DriverHandler(org.onosproject.net.driver.DriverHandler) Before(org.junit.Before)

Example 22 with DriverHandler

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();
}
Also used : DriverHandler(org.onosproject.net.driver.DriverHandler) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment)

Example 23 with DriverHandler

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;
}
Also used : NetconfException(org.onosproject.netconf.NetconfException) DeviceId(org.onosproject.net.DeviceId) DriverHandler(org.onosproject.net.driver.DriverHandler) NetconfController(org.onosproject.netconf.NetconfController)

Example 24 with DriverHandler

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;
}
Also used : NetconfException(org.onosproject.netconf.NetconfException) DeviceId(org.onosproject.net.DeviceId) DriverHandler(org.onosproject.net.driver.DriverHandler) IOException(java.io.IOException) NetconfController(org.onosproject.netconf.NetconfController)

Example 25 with DriverHandler

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);
    }
}
Also used : InterfaceConfig(org.onosproject.net.behaviour.InterfaceConfig) DeviceId(org.onosproject.net.DeviceId) DriverHandler(org.onosproject.net.driver.DriverHandler) DriverService(org.onosproject.net.driver.DriverService)

Aggregations

DriverHandler (org.onosproject.net.driver.DriverHandler)104 DeviceId (org.onosproject.net.DeviceId)46 DriverService (org.onosproject.net.driver.DriverService)22 NetconfController (org.onosproject.netconf.NetconfController)22 NetconfException (org.onosproject.netconf.NetconfException)22 MastershipService (org.onosproject.mastership.MastershipService)20 ArrayList (java.util.ArrayList)12 DefaultDriverHandler (org.onosproject.net.driver.DefaultDriverHandler)12 ItemNotFoundException (org.onlab.util.ItemNotFoundException)9 DeviceService (org.onosproject.net.device.DeviceService)9 OvsdbClientService (org.onosproject.ovsdb.controller.OvsdbClientService)9 DefaultDriverData (org.onosproject.net.driver.DefaultDriverData)8 Driver (org.onosproject.net.driver.Driver)8 Test (org.junit.Test)7 ControllerInfo (org.onosproject.net.behaviour.ControllerInfo)6 RestSBController (org.onosproject.protocol.rest.RestSBController)6 JsonNode (com.fasterxml.jackson.databind.JsonNode)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 PolicerConfigurable (org.onosproject.net.behaviour.trafficcontrol.PolicerConfigurable)5 PolicerId (org.onosproject.net.behaviour.trafficcontrol.PolicerId)5