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