Search in sources :

Example 1 with HostProvider

use of org.onosproject.net.host.HostProvider in project onos by opennetworkinglab.

the class HostMonitorTest method testMonitorHostExists.

private void testMonitorHostExists(IpAddress hostIp) throws Exception {
    ProviderId id = new ProviderId("fake://", "id");
    Host host = createMock(Host.class);
    expect(host.providerId()).andReturn(id).anyTimes();
    replay(host);
    HostManager hostManager = createMock(HostManager.class);
    expect(hostManager.getHostsByIp(hostIp)).andReturn(Collections.singleton(host)).anyTimes();
    replay(hostManager);
    HostProvider hostProvider = createMock(HostProvider.class);
    expect(hostProvider.id()).andReturn(id).anyTimes();
    hostProvider.triggerProbe(host);
    expectLastCall().times(2);
    replay(hostProvider);
    hostMonitor = new HostMonitor(null, hostManager, null, edgePortService, null);
    hostMonitor.registerHostProvider(hostProvider);
    hostMonitor.addMonitoringFor(hostIp);
    hostMonitor.run();
    verify(hostProvider);
}
Also used : ProviderId(org.onosproject.net.provider.ProviderId) HostProvider(org.onosproject.net.host.HostProvider) Host(org.onosproject.net.Host)

Aggregations

Host (org.onosproject.net.Host)1 HostProvider (org.onosproject.net.host.HostProvider)1 ProviderId (org.onosproject.net.provider.ProviderId)1