Search in sources :

Example 6 with ControlClusterStatus

use of com.cloud.network.nicira.ControlClusterStatus in project cloudstack by apache.

the class NiciraCheckHealthCommandWrapperTest method tetsExecuteWhenClusterIsNotStable.

@Test
public void tetsExecuteWhenClusterIsNotStable() throws Exception {
    when(niciraApi.getControlClusterStatus()).thenReturn(new ControlClusterStatus());
    final NiciraCheckHealthCommandWrapper commandWrapper = new NiciraCheckHealthCommandWrapper();
    final Answer answer = commandWrapper.execute(new CheckHealthCommand(), niciraResource);
    assertThat(answer.getResult(), equalTo(false));
}
Also used : ControlClusterStatus(com.cloud.network.nicira.ControlClusterStatus) Answer(com.cloud.agent.api.Answer) CheckHealthCommand(com.cloud.agent.api.CheckHealthCommand) Test(org.junit.Test)

Example 7 with ControlClusterStatus

use of com.cloud.network.nicira.ControlClusterStatus 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);
}
Also used : ControlClusterStatus(com.cloud.network.nicira.ControlClusterStatus) PingCommand(com.cloud.agent.api.PingCommand) Test(org.junit.Test)

Aggregations

ControlClusterStatus (com.cloud.network.nicira.ControlClusterStatus)7 Test (org.junit.Test)5 PingCommand (com.cloud.agent.api.PingCommand)4 NiciraNvpApiException (com.cloud.network.nicira.NiciraNvpApiException)3 Answer (com.cloud.agent.api.Answer)2 CheckHealthCommand (com.cloud.agent.api.CheckHealthCommand)2 CheckHealthAnswer (com.cloud.agent.api.CheckHealthAnswer)1 NiciraNvpApi (com.cloud.network.nicira.NiciraNvpApi)1