Search in sources :

Example 36 with DriverHandler

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

the class ServerControllerConfigTest method testGetControllers.

/**
 * Test of getControllers().
 */
@Test
public void testGetControllers() {
    // Get device handler
    DriverHandler driverHandler = null;
    try {
        driverHandler = driverService.createHandler(restDeviceId1);
    } catch (Exception e) {
        throw e;
    }
    assertThat(driverHandler, notNullValue());
    // Ask for the controllers of this device
    List<ControllerInfo> receivedControllers = null;
// TODO: Fix this test
}
Also used : DriverHandler(org.onosproject.net.driver.DriverHandler) ControllerInfo(org.onosproject.net.behaviour.ControllerInfo) Test(org.junit.Test)

Example 37 with DriverHandler

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

the class ServerControllerConfigTest method testSetControllers.

/**
 * Test of setControllers().
 */
@Test
public void testSetControllers() {
    // Get device handler
    DriverHandler driverHandler = null;
    try {
        driverHandler = driverService.createHandler(restDeviceId1);
    } catch (Exception e) {
        throw e;
    }
    assertThat(driverHandler, notNullValue());
// TODO: Fix this test
}
Also used : DriverHandler(org.onosproject.net.driver.DriverHandler) Test(org.junit.Test)

Example 38 with DriverHandler

use of org.onosproject.net.driver.DriverHandler in project fabric-tna by stratum.

the class FabricIntProgrammableTest method setup.

@Before
public void setup() {
    FabricCapabilities capabilities = createMock(FabricCapabilities.class);
    expect(capabilities.isArchTna()).andReturn(!this.isArchV1model).anyTimes();
    expect(capabilities.isArchV1model()).andReturn(this.isArchV1model).anyTimes();
    expect(capabilities.hasHashedTable()).andReturn(true).anyTimes();
    expect(capabilities.supportDoubleVlanTerm()).andReturn(false).anyTimes();
    expect(capabilities.hwPipeCount()).andReturn(4).anyTimes();
    replay(capabilities);
    // Services mock
    flowRuleService = createMock(FlowRuleService.class);
    groupService = createMock(GroupService.class);
    netcfgService = createMock(NetworkConfigService.class);
    coreService = createMock(CoreService.class);
    hostService = createMock(HostService.class);
    expect(coreService.getAppId(anyString())).andReturn(APP_ID).anyTimes();
    expect(netcfgService.getConfig(LEAF_DEVICE_ID, SegmentRoutingDeviceConfig.class)).andReturn(getSrConfig(LEAF_DEVICE_ID, "/sr.json")).anyTimes();
    expect(netcfgService.getConfig(SPINE_DEVICE_ID, SegmentRoutingDeviceConfig.class)).andReturn(getSrConfig(SPINE_DEVICE_ID, "/sr-spine.json")).anyTimes();
    expect(hostService.getHostsByIp(COLLECTOR_IP)).andReturn(ImmutableSet.of(COLLECTOR_HOST)).anyTimes();
    replay(coreService, netcfgService, hostService);
    DriverHandler driverHandler = createMock(DriverHandler.class);
    expect(driverHandler.get(FlowRuleService.class)).andReturn(flowRuleService).anyTimes();
    expect(driverHandler.get(GroupService.class)).andReturn(groupService).anyTimes();
    expect(driverHandler.get(NetworkConfigService.class)).andReturn(netcfgService).anyTimes();
    expect(driverHandler.get(CoreService.class)).andReturn(coreService).anyTimes();
    expect(driverHandler.get(HostService.class)).andReturn(hostService).anyTimes();
    replay(driverHandler);
    driverData = createMock(DriverData.class);
    expect(driverData.deviceId()).andReturn(LEAF_DEVICE_ID).anyTimes();
    replay(driverData);
    intProgrammable = partialMockBuilder(FabricIntProgrammable.class).addMockedMethod("getFieldSize").createMock();
    expect(intProgrammable.getFieldSize(P4InfoConstants.FABRIC_EGRESS_INT_EGRESS_QUEUE_LATENCY_THRESHOLDS, P4InfoConstants.HDR_HOP_LATENCY_UPPER)).andReturn(16).anyTimes();
    expect(intProgrammable.getFieldSize(P4InfoConstants.FABRIC_EGRESS_INT_EGRESS_QUEUE_LATENCY_THRESHOLDS, P4InfoConstants.HDR_HOP_LATENCY_LOWER)).andReturn(16).anyTimes();
    replay(intProgrammable);
    TestUtils.setField(intProgrammable, "capabilities", capabilities);
    TestUtils.setField(intProgrammable, "handler", driverHandler);
    TestUtils.setField(intProgrammable, "data", driverData);
    TestUtils.setField(intProgrammable, "log", getLogger(""));
    testInit();
}
Also used : HostService(org.onosproject.net.host.HostService) SegmentRoutingDeviceConfig(org.onosproject.segmentrouting.config.SegmentRoutingDeviceConfig) DriverData(org.onosproject.net.driver.DriverData) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) DriverHandler(org.onosproject.net.driver.DriverHandler) CoreService(org.onosproject.core.CoreService) FlowRuleService(org.onosproject.net.flow.FlowRuleService) GroupService(org.onosproject.net.group.GroupService) Before(org.junit.Before)

Example 39 with DriverHandler

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

the class DistributedMeterStore method queryMaxMeters.

// queryMaxMeters is implemented in MeterQuery behaviour implementations.
private long queryMaxMeters(DeviceId device) {
    DriverHandler handler = driverService.createHandler(device);
    if (handler == null || !handler.hasBehaviour(MeterQuery.class)) {
        return 0L;
    }
    // FIXME architecturally this is not right, we should fallback to this
    // behavior in the providers. Once we do that we can remove this code.
    MeterQuery query = handler.behaviour(MeterQuery.class);
    // This results to be necessary because the available ids sets are created
    // in the meter features map listener if the device does not provide the meter
    // feature this is the only chance to create this set.
    String setName = AVAILABLEMETERIDSTORE + "-" + device + "global";
    MeterTableKey meterTableKey = MeterTableKey.key(device, MeterScope.globalScope());
    insertAvailableKeySet(meterTableKey, setName);
    return query.getMaxMeters();
}
Also used : MeterTableKey(org.onosproject.net.meter.MeterTableKey) MeterQuery(org.onosproject.net.behaviour.MeterQuery) DriverHandler(org.onosproject.net.driver.DriverHandler)

Example 40 with DriverHandler

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

the class FlowEntryBuilder method getDriver.

/**
 * Retrieves the driver handler for the specified device.
 *
 * @param deviceId device identifier
 * @param driverService service handle for the driver service
 * @return driver handler
 */
protected static DriverHandler getDriver(DeviceId deviceId, DriverService driverService) {
    Driver driver = driverService.getDriver(deviceId);
    DriverHandler handler = new DefaultDriverHandler(new DefaultDriverData(driver, deviceId));
    return handler;
}
Also used : DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DefaultDriverHandler(org.onosproject.net.driver.DefaultDriverHandler) DriverHandler(org.onosproject.net.driver.DriverHandler) Driver(org.onosproject.net.driver.Driver) DefaultDriverData(org.onosproject.net.driver.DefaultDriverData)

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