use of com.cloud.agent.api.PingCommand in project cloudstack by apache.
the class NiciraNvpResourceTest method testPingCommandStatusOk.
@Test
public void testPingCommandStatusOk() throws ConfigurationException, NiciraNvpApiException {
resource.configure("NiciraNvpResource", parameters);
final ControlClusterStatus ccs = mock(ControlClusterStatus.class);
when(ccs.getClusterStatus()).thenReturn("stable");
when(nvpApi.getControlClusterStatus()).thenReturn(ccs);
final PingCommand ping = resource.getCurrentStatus(42);
assertTrue(ping != null);
assertTrue(ping.getHostId() == 42);
assertTrue(ping.getHostType() == Host.Type.L2Networking);
}
use of com.cloud.agent.api.PingCommand in project cloudstack by apache.
the class NiciraNvpResourceTest method testPingCommandStatusFail.
@Test
public void testPingCommandStatusFail() throws ConfigurationException, NiciraNvpApiException {
resource.configure("NiciraNvpResource", parameters);
final ControlClusterStatus ccs = mock(ControlClusterStatus.class);
when(ccs.getClusterStatus()).thenReturn("unstable");
when(nvpApi.getControlClusterStatus()).thenReturn(ccs);
final PingCommand ping = resource.getCurrentStatus(42);
assertTrue(ping == null);
}
use of com.cloud.agent.api.PingCommand in project cloudstack by apache.
the class HypervDirectConnectResource method getCurrentStatus.
@Override
public final PingCommand getCurrentStatus(final long id) {
final PingCommand pingCmd = new PingRoutingCommand(getType(), id, getHostVmStateReport());
if (s_logger.isDebugEnabled()) {
s_logger.debug("Ping host " + _name + " (IP " + _agentIp + ")");
}
final Answer pingAns = executeRequest(pingCmd);
if (pingAns == null || !pingAns.getResult()) {
s_logger.info("Cannot ping host " + _name + " (IP " + _agentIp + "), pingAns (blank means null) is:" + pingAns);
return null;
}
return pingCmd;
}
Aggregations