Search in sources :

Example 6 with ProviderNetwork

use of org.ovirt.engine.core.common.businessentities.network.ProviderNetwork in project ovirt-engine by oVirt.

the class RemoveNetworkCommand method getRemoveExternalNetworkValidationResult.

private ValidationResult getRemoveExternalNetworkValidationResult() {
    ProviderNetwork providerNetwork = getNetwork().getProvidedBy();
    if (providerNetwork == null || !getParameters().isRemoveFromNetworkProvider()) {
        return ValidationResult.VALID;
    }
    ProviderValidator providerValidator = new ProviderValidator(getProvider());
    return providerValidator.validateReadOnlyActions();
}
Also used : ProviderValidator(org.ovirt.engine.core.bll.provider.ProviderValidator) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)

Example 7 with ProviderNetwork

use of org.ovirt.engine.core.common.businessentities.network.ProviderNetwork in project ovirt-engine by oVirt.

the class UpdateNetworkValidatorTest method createProviderNetwork.

private ProviderNetwork createProviderNetwork(Guid providerId) {
    final ProviderNetwork result = new ProviderNetwork();
    result.setProviderId(providerId);
    return result;
}
Also used : ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)

Example 8 with ProviderNetwork

use of org.ovirt.engine.core.common.businessentities.network.ProviderNetwork in project ovirt-engine by oVirt.

the class AddNetworkValidatorTest method externalNetworkNewInDataCenterTestSetup.

private void externalNetworkNewInDataCenterTestSetup(boolean equalToNetwork) {
    Network externalNetwork = mock(Network.class);
    ProviderNetwork providerNetwork = mock(ProviderNetwork.class);
    when(network.getProvidedBy()).thenReturn(providerNetwork);
    if (equalToNetwork) {
        when(externalNetwork.getProvidedBy()).thenReturn(providerNetwork);
    }
    networks.add(externalNetwork);
}
Also used : ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)

Example 9 with ProviderNetwork

use of org.ovirt.engine.core.common.businessentities.network.ProviderNetwork in project ovirt-engine by oVirt.

the class AutodefineExternalNetworkCommandTest method testCommandExternalNetwork.

@Test
public void testCommandExternalNetwork() {
    setUpPhysicalNetwork(HAS_SHORT_NAME, IS_VM_NETWORK);
    physicalNetwork.setProvidedBy(new ProviderNetwork());
    Assert.assertFalse(command.validate());
    Assert.assertTrue(command.getReturnValue().getValidationMessages().contains(EngineMessage.ACTION_TYPE_FAILED_NOT_SUPPORTED_FOR_EXTERNAL_NETWORK.name()));
}
Also used : ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Test(org.junit.Test) BaseCommandTest(org.ovirt.engine.core.bll.BaseCommandTest)

Example 10 with ProviderNetwork

use of org.ovirt.engine.core.common.businessentities.network.ProviderNetwork in project ovirt-engine by oVirt.

the class ImportExternalNetworkCommandTest method getProviderNetworks.

private List<Network> getProviderNetworks() {
    ProviderNetwork providerNetwork = new ProviderNetwork();
    providerNetwork.setExternalId(EXTERNAL_ID);
    providerNetwork.setProviderId(PROVIDER_ID);
    Network network = new Network();
    network.setProvidedBy(providerNetwork);
    return Collections.singletonList(network);
}
Also used : ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)

Aggregations

ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)22 Network (org.ovirt.engine.core.common.businessentities.network.Network)13 OpenStackNetwork (org.ovirt.engine.api.model.OpenStackNetwork)4 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 Guid (org.ovirt.engine.core.compat.Guid)2 HashMap (java.util.HashMap)1 Set (java.util.Set)1 NetworkUsage (org.ovirt.engine.api.model.NetworkUsage)1 Mapping (org.ovirt.engine.api.restapi.types.Mapping)1 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)1 BaseCommandTest (org.ovirt.engine.core.bll.BaseCommandTest)1 ProviderValidator (org.ovirt.engine.core.bll.provider.ProviderValidator)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 AddExternalSubnetParameters (org.ovirt.engine.core.common.action.AddExternalSubnetParameters)1 AddNetworkStoragePoolParameters (org.ovirt.engine.core.common.action.AddNetworkStoragePoolParameters)1 AddNetworkWithSubnetParameters (org.ovirt.engine.core.common.action.AddNetworkWithSubnetParameters)1 Provider (org.ovirt.engine.core.common.businessentities.Provider)1 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)1 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)1