use of org.onosproject.net.host.HostService in project onos by opennetworkinglab.
the class VirtualNetworkHostManagerTest method testGetHostsByNullVlan.
/**
* Tests querying for hosts with null vlan.
*/
@Test(expected = NullPointerException.class)
public void testGetHostsByNullVlan() {
VirtualNetwork vnet = setupEmptyVnet();
HostService hostService = manager.get(vnet.id(), HostService.class);
hostService.getHostsByVlan(null);
}
use of org.onosproject.net.host.HostService in project onos by opennetworkinglab.
the class VirtualNetworkHostManagerTest method testGetHostByNullId.
/**
* Tests querying for a host using a null host identifier.
*/
@Test(expected = NullPointerException.class)
public void testGetHostByNullId() {
VirtualNetwork vnet = setupEmptyVnet();
HostService hostService = manager.get(vnet.id(), HostService.class);
hostService.getHost(null);
}
use of org.onosproject.net.host.HostService in project onos by opennetworkinglab.
the class VirtualNetworkHostManagerTest method testGetConnectedHostsByNullDeviceId.
/**
* Tests querying for connected hosts with null device id.
*/
@Test(expected = NullPointerException.class)
public void testGetConnectedHostsByNullDeviceId() {
VirtualNetwork vnet = setupVnet();
HostService hostService = manager.get(vnet.id(), HostService.class);
hostService.getConnectedHosts((DeviceId) null);
}
use of org.onosproject.net.host.HostService 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.host.HostService in project fabric-tna by stratum.
the class FabricIntProgrammable method setupBehaviour.
private boolean setupBehaviour() {
deviceId = this.data().deviceId();
flowRuleService = handler().get(FlowRuleService.class);
groupService = handler().get(GroupService.class);
cfgService = handler().get(NetworkConfigService.class);
hostService = handler().get(HostService.class);
final CoreService coreService = handler().get(CoreService.class);
appId = coreService.getAppId(Constants.APP_NAME);
if (appId == null) {
log.warn("Application ID is null. Cannot initialize behaviour.");
return false;
}
return true;
}
Aggregations