Search in sources :

Example 6 with CheckNetworkCommand

use of com.cloud.legacymodel.communication.command.CheckNetworkCommand in project cosmic by MissionCriticalCloud.

the class LibvirtComputingResourceTest method testCheckNetworkCommandFail3.

@Test
public void testCheckNetworkCommandFail3() {
    final List<PhysicalNetworkSetupInfo> networkInfoList = new ArrayList<>();
    final PhysicalNetworkSetupInfo networkSetupInfo = Mockito.mock(PhysicalNetworkSetupInfo.class);
    networkInfoList.add(networkSetupInfo);
    final CheckNetworkCommand command = new CheckNetworkCommand(networkInfoList);
    when(this.libvirtComputingResource.checkNetwork(networkSetupInfo.getGuestNetworkName())).thenReturn(true);
    when(this.libvirtComputingResource.checkNetwork(networkSetupInfo.getPrivateNetworkName())).thenReturn(true);
    when(this.libvirtComputingResource.checkNetwork(networkSetupInfo.getPublicNetworkName())).thenReturn(false);
    final LibvirtRequestWrapper wrapper = LibvirtRequestWrapper.getInstance();
    assertNotNull(wrapper);
    final Answer answer = wrapper.execute(command, this.libvirtComputingResource);
    assertFalse(answer.getResult());
    verify(this.libvirtComputingResource, times(1)).checkNetwork(networkSetupInfo.getGuestNetworkName());
    verify(this.libvirtComputingResource, times(1)).checkNetwork(networkSetupInfo.getPrivateNetworkName());
}
Also used : Answer(com.cloud.legacymodel.communication.answer.Answer) CheckRouterAnswer(com.cloud.legacymodel.communication.answer.CheckRouterAnswer) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) LibvirtRequestWrapper(com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper) ArrayList(java.util.ArrayList) CheckNetworkCommand(com.cloud.legacymodel.communication.command.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.legacymodel.network.PhysicalNetworkSetupInfo) Test(org.junit.Test)

Example 7 with CheckNetworkCommand

use of com.cloud.legacymodel.communication.command.CheckNetworkCommand in project cosmic by MissionCriticalCloud.

the class XenServer610WrapperTest method testCheckNetworkCommandFailure.

@Test
public void testCheckNetworkCommandFailure() {
    final XenServer610Resource xenServer610Resource = new XenServer610Resource();
    final PhysicalNetworkSetupInfo info = new PhysicalNetworkSetupInfo();
    final List<PhysicalNetworkSetupInfo> setupInfos = new ArrayList<>();
    setupInfos.add(info);
    final CheckNetworkCommand checkNet = new CheckNetworkCommand(setupInfos);
    final Answer answer = xenServer610Resource.executeRequest(checkNet);
    assertTrue(answer.getResult());
}
Also used : Answer(com.cloud.legacymodel.communication.answer.Answer) XenServer610Resource(com.cloud.hypervisor.xenserver.resource.XenServer610Resource) ArrayList(java.util.ArrayList) CheckNetworkCommand(com.cloud.legacymodel.communication.command.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.legacymodel.network.PhysicalNetworkSetupInfo) Test(org.junit.Test)

Example 8 with CheckNetworkCommand

use of com.cloud.legacymodel.communication.command.CheckNetworkCommand in project cosmic by MissionCriticalCloud.

the class XenServer620WrapperTest method testCheckNetworkCommandFailure.

@Test
public void testCheckNetworkCommandFailure() {
    final XenServer620Resource xenServer620Resource = new XenServer620Resource();
    final PhysicalNetworkSetupInfo info = new PhysicalNetworkSetupInfo();
    final List<PhysicalNetworkSetupInfo> setupInfos = new ArrayList<>();
    setupInfos.add(info);
    final CheckNetworkCommand checkNet = new CheckNetworkCommand(setupInfos);
    final Answer answer = xenServer620Resource.executeRequest(checkNet);
    assertTrue(answer.getResult());
}
Also used : Answer(com.cloud.legacymodel.communication.answer.Answer) ArrayList(java.util.ArrayList) XenServer620Resource(com.cloud.hypervisor.xenserver.resource.XenServer620Resource) CheckNetworkCommand(com.cloud.legacymodel.communication.command.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.legacymodel.network.PhysicalNetworkSetupInfo) Test(org.junit.Test)

Example 9 with CheckNetworkCommand

use of com.cloud.legacymodel.communication.command.CheckNetworkCommand in project cosmic by MissionCriticalCloud.

the class NotAValidCommand method testCheckNetworkCommandFailure.

@Test
public void testCheckNetworkCommandFailure() {
    final PhysicalNetworkSetupInfo info = new PhysicalNetworkSetupInfo();
    final List<PhysicalNetworkSetupInfo> setupInfos = new ArrayList<>();
    setupInfos.add(info);
    final CheckNetworkCommand checkNet = new CheckNetworkCommand(setupInfos);
    final CitrixRequestWrapper wrapper = CitrixRequestWrapper.getInstance();
    assertNotNull(wrapper);
    final Answer answer = wrapper.execute(checkNet, this.citrixResourceBase);
    assertFalse(answer.getResult());
}
Also used : RebootAnswer(com.cloud.legacymodel.communication.answer.RebootAnswer) Answer(com.cloud.legacymodel.communication.answer.Answer) CreateAnswer(com.cloud.legacymodel.communication.answer.CreateAnswer) AttachAnswer(com.cloud.legacymodel.communication.answer.AttachAnswer) ArrayList(java.util.ArrayList) CheckNetworkCommand(com.cloud.legacymodel.communication.command.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.legacymodel.network.PhysicalNetworkSetupInfo) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

CheckNetworkCommand (com.cloud.legacymodel.communication.command.CheckNetworkCommand)9 PhysicalNetworkSetupInfo (com.cloud.legacymodel.network.PhysicalNetworkSetupInfo)9 ArrayList (java.util.ArrayList)9 Answer (com.cloud.legacymodel.communication.answer.Answer)8 Test (org.junit.Test)8 AttachAnswer (com.cloud.legacymodel.communication.answer.AttachAnswer)6 LibvirtRequestWrapper (com.cloud.agent.resource.kvm.wrapper.LibvirtRequestWrapper)4 CheckRouterAnswer (com.cloud.legacymodel.communication.answer.CheckRouterAnswer)4 CreateAnswer (com.cloud.legacymodel.communication.answer.CreateAnswer)2 RebootAnswer (com.cloud.legacymodel.communication.answer.RebootAnswer)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 Zone (com.cloud.db.model.Zone)1 XenServer610Resource (com.cloud.hypervisor.xenserver.resource.XenServer610Resource)1 XenServer620Resource (com.cloud.hypervisor.xenserver.resource.XenServer620Resource)1 CheckNetworkAnswer (com.cloud.legacymodel.communication.answer.CheckNetworkAnswer)1 StartupCommand (com.cloud.legacymodel.communication.command.startup.StartupCommand)1 StartupRoutingCommand (com.cloud.legacymodel.communication.command.startup.StartupRoutingCommand)1 ConnectionException (com.cloud.legacymodel.exceptions.ConnectionException)1 HypervisorType (com.cloud.model.enumeration.HypervisorType)1 PhysicalNetworkTrafficTypeVO (com.cloud.network.dao.PhysicalNetworkTrafficTypeVO)1