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