Search in sources :

Example 21 with PhysicalNetworkSetupInfo

use of com.cloud.network.PhysicalNetworkSetupInfo in project cloudstack by apache.

the class LibvirtComputingResourceTest method testCheckNetworkCommandFail2.

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

Aggregations

PhysicalNetworkSetupInfo (com.cloud.network.PhysicalNetworkSetupInfo)21 CheckNetworkCommand (com.cloud.agent.api.CheckNetworkCommand)15 ArrayList (java.util.ArrayList)14 Answer (com.cloud.agent.api.Answer)13 Test (org.junit.Test)13 CheckNetworkAnswer (com.cloud.agent.api.CheckNetworkAnswer)6 AttachAnswer (org.apache.cloudstack.storage.command.AttachAnswer)6 CloudStackPluginTest (com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest)5 ConnectionTest (com.cloud.hypervisor.ovm3.objects.ConnectionTest)5 NetworkTest (com.cloud.hypervisor.ovm3.objects.NetworkTest)5 XenTest (com.cloud.hypervisor.ovm3.objects.XenTest)5 XmlTestResultTest (com.cloud.hypervisor.ovm3.objects.XmlTestResultTest)5 Ovm3HypervisorResourceTest (com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorResourceTest)5 Ovm3SupportTest (com.cloud.hypervisor.ovm3.support.Ovm3SupportTest)5 CheckRouterAnswer (com.cloud.agent.api.CheckRouterAnswer)4 LibvirtRequestWrapper (com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRequestWrapper)4 RebootAnswer (com.cloud.agent.api.RebootAnswer)2 CreateAnswer (com.cloud.agent.api.storage.CreateAnswer)2 StartupRoutingCommand (com.cloud.agent.api.StartupRoutingCommand)1 ClusterVO (com.cloud.dc.ClusterVO)1