Search in sources :

Example 6 with PhysicalNetworkSetupInfo

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

the class CitrixCheckNetworkCommandWrapper method execute.

@Override
public Answer execute(final CheckNetworkCommand command, final CitrixResourceBase citrixResourceBase) {
    if (s_logger.isDebugEnabled()) {
        s_logger.debug("Checking if network name setup is done on the resource");
    }
    final List<PhysicalNetworkSetupInfo> infoList = command.getPhysicalNetworkInfoList();
    try {
        boolean errorout = false;
        String msg = "";
        for (final PhysicalNetworkSetupInfo info : infoList) {
            if (!citrixResourceBase.isNetworkSetupByName(info.getGuestNetworkName())) {
                msg = "For Physical Network id:" + info.getPhysicalNetworkId() + ", Guest Network is not configured on the backend by name " + info.getGuestNetworkName();
                errorout = true;
                break;
            }
            if (!citrixResourceBase.isNetworkSetupByName(info.getPrivateNetworkName())) {
                msg = "For Physical Network id:" + info.getPhysicalNetworkId() + ", Private Network is not configured on the backend by name " + info.getPrivateNetworkName();
                errorout = true;
                break;
            }
            if (!citrixResourceBase.isNetworkSetupByName(info.getPublicNetworkName())) {
                msg = "For Physical Network id:" + info.getPhysicalNetworkId() + ", Public Network is not configured on the backend by name " + info.getPublicNetworkName();
                errorout = true;
                break;
            }
        /*if(!isNetworkSetupByName(info.getStorageNetworkName())){
                    msg = "For Physical Network id:"+ info.getPhysicalNetworkId() + ", Storage Network is not configured on the backend by name " + info.getStorageNetworkName();
                    errorout = true;
                    break;
                }*/
        }
        if (errorout) {
            s_logger.error(msg);
            return new CheckNetworkAnswer(command, false, msg);
        } else {
            return new CheckNetworkAnswer(command, true, "Network Setup check by names is done");
        }
    } catch (final XenAPIException e) {
        final String msg = "CheckNetworkCommand failed with XenAPIException:" + e.toString() + " host:" + citrixResourceBase.getHost().getUuid();
        s_logger.warn(msg, e);
        return new CheckNetworkAnswer(command, false, msg);
    } catch (final Exception e) {
        final String msg = "CheckNetworkCommand failed with Exception:" + e.getMessage() + " host:" + citrixResourceBase.getHost().getUuid();
        s_logger.warn(msg, e);
        return new CheckNetworkAnswer(command, false, msg);
    }
}
Also used : CheckNetworkAnswer(com.cloud.agent.api.CheckNetworkAnswer) XenAPIException(com.xensource.xenapi.Types.XenAPIException) XenAPIException(com.xensource.xenapi.Types.XenAPIException) PhysicalNetworkSetupInfo(com.cloud.network.PhysicalNetworkSetupInfo)

Example 7 with PhysicalNetworkSetupInfo

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

the class Ovm3HypervisorNetworkTest method CheckNetworkCommandPrivateFailTest.

@Test
public void CheckNetworkCommandPrivateFailTest() throws ConfigurationException {
    hypervisor = support.prepare(configTest.getParams());
    List<PhysicalNetworkSetupInfo> setups = new ArrayList<PhysicalNetworkSetupInfo>();
    PhysicalNetworkSetupInfo networkInfo = new PhysicalNetworkSetupInfo();
    networkInfo.setPrivateNetworkName(network.getInterface() + "." + 3000);
    setups.add(networkInfo);
    CheckNetworkCommand cmd = new CheckNetworkCommand(setups);
    Answer ra = hypervisor.executeRequest(cmd);
    results.basicBooleanTest(ra.getResult(), false);
}
Also used : Answer(com.cloud.agent.api.Answer) ArrayList(java.util.ArrayList) CheckNetworkCommand(com.cloud.agent.api.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.network.PhysicalNetworkSetupInfo) Test(org.junit.Test) ConnectionTest(com.cloud.hypervisor.ovm3.objects.ConnectionTest) CloudStackPluginTest(com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest) NetworkTest(com.cloud.hypervisor.ovm3.objects.NetworkTest) XenTest(com.cloud.hypervisor.ovm3.objects.XenTest) Ovm3HypervisorResourceTest(com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorResourceTest) Ovm3SupportTest(com.cloud.hypervisor.ovm3.support.Ovm3SupportTest) XmlTestResultTest(com.cloud.hypervisor.ovm3.objects.XmlTestResultTest)

Example 8 with PhysicalNetworkSetupInfo

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

the class Ovm3HypervisorNetworkTest method CheckNetworkCommandGuestFailTest.

@Test
public void CheckNetworkCommandGuestFailTest() throws ConfigurationException {
    hypervisor = support.prepare(configTest.getParams());
    List<PhysicalNetworkSetupInfo> setups = new ArrayList<PhysicalNetworkSetupInfo>();
    PhysicalNetworkSetupInfo networkInfo = new PhysicalNetworkSetupInfo();
    networkInfo.setGuestNetworkName(network.getInterface() + "." + 3000);
    setups.add(networkInfo);
    CheckNetworkCommand cmd = new CheckNetworkCommand(setups);
    Answer ra = hypervisor.executeRequest(cmd);
    results.basicBooleanTest(ra.getResult(), false);
}
Also used : Answer(com.cloud.agent.api.Answer) ArrayList(java.util.ArrayList) CheckNetworkCommand(com.cloud.agent.api.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.network.PhysicalNetworkSetupInfo) Test(org.junit.Test) ConnectionTest(com.cloud.hypervisor.ovm3.objects.ConnectionTest) CloudStackPluginTest(com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest) NetworkTest(com.cloud.hypervisor.ovm3.objects.NetworkTest) XenTest(com.cloud.hypervisor.ovm3.objects.XenTest) Ovm3HypervisorResourceTest(com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorResourceTest) Ovm3SupportTest(com.cloud.hypervisor.ovm3.support.Ovm3SupportTest) XmlTestResultTest(com.cloud.hypervisor.ovm3.objects.XmlTestResultTest)

Example 9 with PhysicalNetworkSetupInfo

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

the class Ovm3HypervisorNetworkTest method CheckNetworkCommandStorageFalseTest.

@Test
public void CheckNetworkCommandStorageFalseTest() throws ConfigurationException {
    hypervisor = support.prepare(configTest.getParams());
    List<PhysicalNetworkSetupInfo> setups = new ArrayList<PhysicalNetworkSetupInfo>();
    PhysicalNetworkSetupInfo networkInfo = new PhysicalNetworkSetupInfo();
    networkInfo.setStorageNetworkName(network.getInterface() + "." + 3000);
    setups.add(networkInfo);
    CheckNetworkCommand cmd = new CheckNetworkCommand(setups);
    Answer ra = hypervisor.executeRequest(cmd);
    results.basicBooleanTest(ra.getResult());
}
Also used : Answer(com.cloud.agent.api.Answer) ArrayList(java.util.ArrayList) CheckNetworkCommand(com.cloud.agent.api.CheckNetworkCommand) PhysicalNetworkSetupInfo(com.cloud.network.PhysicalNetworkSetupInfo) Test(org.junit.Test) ConnectionTest(com.cloud.hypervisor.ovm3.objects.ConnectionTest) CloudStackPluginTest(com.cloud.hypervisor.ovm3.objects.CloudStackPluginTest) NetworkTest(com.cloud.hypervisor.ovm3.objects.NetworkTest) XenTest(com.cloud.hypervisor.ovm3.objects.XenTest) Ovm3HypervisorResourceTest(com.cloud.hypervisor.ovm3.resources.Ovm3HypervisorResourceTest) Ovm3SupportTest(com.cloud.hypervisor.ovm3.support.Ovm3SupportTest) XmlTestResultTest(com.cloud.hypervisor.ovm3.objects.XmlTestResultTest)

Example 10 with PhysicalNetworkSetupInfo

use of com.cloud.network.PhysicalNetworkSetupInfo in project CloudStack-archive by CloudStack-extras.

the class LibvirtComputingResource method execute.

private CheckNetworkAnswer execute(CheckNetworkCommand cmd) {
    List<PhysicalNetworkSetupInfo> phyNics = cmd.getPhysicalNetworkInfoList();
    String errMsg = null;
    for (PhysicalNetworkSetupInfo nic : phyNics) {
        if (!checkNetwork(nic.getGuestNetworkName())) {
            errMsg = "Can not find network: " + nic.getGuestNetworkName();
            break;
        } else if (!checkNetwork(nic.getPrivateNetworkName())) {
            errMsg = "Can not find network: " + nic.getPrivateNetworkName();
            break;
        } else if (!checkNetwork(nic.getPublicNetworkName())) {
            errMsg = "Can not find network: " + nic.getPublicNetworkName();
            break;
        }
    }
    if (errMsg != null) {
        return new CheckNetworkAnswer(cmd, false, errMsg);
    } else {
        return new CheckNetworkAnswer(cmd, true, null);
    }
}
Also used : CheckNetworkAnswer(com.cloud.agent.api.CheckNetworkAnswer) PhysicalNetworkSetupInfo(com.cloud.network.PhysicalNetworkSetupInfo)

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