Search in sources :

Example 6 with HostService

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);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) HostService(org.onosproject.net.host.HostService) Test(org.junit.Test)

Example 7 with HostService

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);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) HostService(org.onosproject.net.host.HostService) Test(org.junit.Test)

Example 8 with HostService

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);
}
Also used : VirtualNetwork(org.onosproject.incubator.net.virtual.VirtualNetwork) HostService(org.onosproject.net.host.HostService) Test(org.junit.Test)

Example 9 with HostService

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();
}
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 10 with HostService

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;
}
Also used : HostService(org.onosproject.net.host.HostService) NetworkConfigService(org.onosproject.net.config.NetworkConfigService) CoreService(org.onosproject.core.CoreService) FlowRuleService(org.onosproject.net.flow.FlowRuleService) GroupService(org.onosproject.net.group.GroupService)

Aggregations

HostService (org.onosproject.net.host.HostService)19 Test (org.junit.Test)9 Host (org.onosproject.net.Host)9 VirtualNetwork (org.onosproject.incubator.net.virtual.VirtualNetwork)8 IpAddress (org.onlab.packet.IpAddress)4 Set (java.util.Set)3 StringsCompleter (org.apache.karaf.shell.support.completers.StringsCompleter)3 Before (org.junit.Before)3 CoreService (org.onosproject.core.CoreService)3 NetworkConfigService (org.onosproject.net.config.NetworkConfigService)3 FlowRuleService (org.onosproject.net.flow.FlowRuleService)3 List (java.util.List)2 Map (java.util.Map)2 IpPrefix (org.onlab.packet.IpPrefix)2 MacAddress (org.onlab.packet.MacAddress)2 VlanId (org.onlab.packet.VlanId)2 VirtualHost (org.onosproject.incubator.net.virtual.VirtualHost)2 DefaultHost (org.onosproject.net.DefaultHost)2 GroupService (org.onosproject.net.group.GroupService)2 Logger (org.slf4j.Logger)2