Search in sources :

Example 6 with Network

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

the class VmInterfaceModel method selectedNetworkExternal.

protected boolean selectedNetworkExternal() {
    VnicProfileView profile = getProfile().getSelectedItem();
    Network network = null;
    if (profile != null && profile.getId() != null) {
        network = getProfileBehavior().findNetworkById(profile.getId());
    }
    return network != null && network.isExternal();
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network) VnicProfileView(org.ovirt.engine.core.common.businessentities.network.VnicProfileView)

Example 7 with Network

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

the class AddNetworkOnProviderCommand method loadPhysicalNetworkProviderParameters.

private void loadPhysicalNetworkProviderParameters() {
    Network physicalProviderNetwork = networkDao.get(getNetwork().getProvidedBy().getPhysicalNetworkId());
    getNetwork().setVlanId(physicalProviderNetwork.getVlanId());
    getNetwork().setLabel(physicalProviderNetwork.getVdsmName());
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network)

Example 8 with Network

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

the class GetExternalSubnetsOnProviderByNetworkQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    Network network = networkDao.get(getParameters().getId());
    if (network == null || !network.isExternal()) {
        return;
    }
    Provider<?> provider = providerDao.get(network.getProvidedBy().getProviderId());
    if (provider == null) {
        return;
    }
    NetworkProviderProxy client = providerProxyFactory.create(provider);
    getQueryReturnValue().setReturnValue(client.getAllSubnets(network.getProvidedBy()));
}
Also used : Network(org.ovirt.engine.core.common.businessentities.network.Network)

Example 9 with Network

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

the class PersistentHostSetupNetworksParametersFactory method create.

/**
 * @param hostId host on which networks to be updated reside
 * @param networks networks to be updated; it is assumed, that all those networks belongs to given host.
 *
 * @return PersistentHostSetupNetworksParameters to refresh all given networks.
 */
public PersistentHostSetupNetworksParameters create(Guid hostId, List<Network> networks) {
    Map<Network, NetworkAttachment> networksToSync = getNetworksToSync(hostId, networks);
    PersistentHostSetupNetworksParameters parameters = new PersistentHostSetupNetworksParameters(hostId);
    parameters.setRollbackOnFailure(true);
    parameters.setShouldBeLogged(false);
    parameters.setNetworkNames(getNetworkNames(networksToSync.keySet()));
    parameters.setNetworkAttachments(new ArrayList<>(networksToSync.values()));
    return parameters;
}
Also used : PersistentHostSetupNetworksParameters(org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters) Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 10 with Network

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

the class RefreshNetworksParametersFactory method create.

/**
 * @param networks networks to be refreshed.
 * @return list of PersistentHostSetupNetworksParameters instances to update all given networks on all hosts where
 * they are used.
 */
public ArrayList<ActionParametersBase> create(List<Network> networks) {
    Map<Guid, List<Network>> vdsIdToNetworksOfAlteredQos = mapNetworksByAttachedHosts(networks);
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (Map.Entry<Guid, List<Network>> entry : vdsIdToNetworksOfAlteredQos.entrySet()) {
        Guid hostId = entry.getKey();
        List<Network> networksOfAlteredQos = entry.getValue();
        PersistentHostSetupNetworksParameters setupNetworkParams = persistentHostSetupNetworksParametersFactory.create(hostId, networksOfAlteredQos);
        parameters.add(setupNetworkParams);
    }
    return parameters;
}
Also used : PersistentHostSetupNetworksParameters(org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters) Network(org.ovirt.engine.core.common.businessentities.network.Network) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Guid(org.ovirt.engine.core.compat.Guid) HashMap(java.util.HashMap) Map(java.util.Map) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Aggregations

Network (org.ovirt.engine.core.common.businessentities.network.Network)292 Test (org.junit.Test)105 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)63 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)47 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)46 ArrayList (java.util.ArrayList)44 Guid (org.ovirt.engine.core.compat.Guid)44 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)39 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)23 List (java.util.List)21 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)21 HashMap (java.util.HashMap)19 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)19 Map (java.util.Map)13 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)13 VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)13 HashSet (java.util.HashSet)9 Set (java.util.Set)9 BusinessEntityMap (org.ovirt.engine.core.common.businessentities.BusinessEntityMap)9 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)9