Search in sources :

Example 21 with ProviderNetwork

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

the class AutodefineExternalNetworkCommand method createExternalNetwork.

private Network createExternalNetwork(String name, Guid providerId) {
    final Network network = getNetwork();
    Network externalNetwork = new Network();
    externalNetwork.setName(name);
    externalNetwork.setDescription(EXTERNAL_DESCRIPTION);
    externalNetwork.setDataCenterId(network.getDataCenterId());
    ProviderNetwork providerNetwork = new ProviderNetwork();
    providerNetwork.setProviderId(providerId);
    providerNetwork.setPhysicalNetworkId(network.getId());
    externalNetwork.setProvidedBy(providerNetwork);
    return 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 22 with ProviderNetwork

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

the class NewNetworkModel method executeSave.

@Override
protected void executeSave() {
    final AddNetworkWithSubnetParameters parameters = new AddNetworkWithSubnetParameters(getSelectedDc().getId(), getNetwork());
    parameters.setVnicProfileRequired(false);
    parameters.setNetworkClusterList(createNetworkAttachments());
    // New network
    if (getExternal().getEntity()) {
        Provider<?> externalProvider = getExternalProviders().getSelectedItem();
        ProviderNetwork providerNetwork = new ProviderNetwork();
        providerNetwork.setProviderId(externalProvider.getId());
        getNetwork().setProvidedBy(providerNetwork);
        if (hasDefinedSubnet()) {
            getSubnetModel().flush();
            parameters.setExternalSubnet(getSubnetModel().getSubnet());
        }
        if (getConnectedToPhysicalNetwork().getEntity() && getUsePhysicalNetworkFromDatacenter().getEntity()) {
            Network network = getDatacenterPhysicalNetwork().getSelectedItem();
            providerNetwork.setPhysicalNetworkId(network.getId());
        }
        Frontend.getInstance().runAction(hasDefinedSubnet() ? ActionType.AddNetworkWithSubnetOnProvider : ActionType.AddNetworkOnProvider, parameters, addNetworkCallback(), null);
    } else {
        Frontend.getInstance().runAction(ActionType.AddNetwork, parameters, addNetworkCallback(), null);
    }
}
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) AddNetworkWithSubnetParameters(org.ovirt.engine.core.common.action.AddNetworkWithSubnetParameters)

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