Search in sources :

Example 41 with NetworkCluster

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

the class HostSetupNetworksCommand method getAttachmentsWithMissingUpdatedDefaultRoute.

private List<NetworkAttachment> getAttachmentsWithMissingUpdatedDefaultRoute() {
    NetworkCluster currentDefaultRouteNetworkCluster = findCurrentDefaultRouteNetworkForCluster();
    NetworkAttachment currentDefaultRouteNetworkAttachment = currentDefaultRouteNetworkCluster == null ? null : findNetworkAttachmentBy(networkIdAttachmentPredicate(currentDefaultRouteNetworkCluster.getNetworkId()), getExistingAttachments());
    VdsNetworkInterface previousDefaultRouteNic = findPreviousDefaultRouteNic();
    NetworkAttachment previousDefaultRouteNetworkAttachment = previousDefaultRouteNic == null ? null : findNetworkAttachmentBy(networkNameAttachmentPredicate(previousDefaultRouteNic.getNetworkName()), getExistingAttachments());
    if (currentDefaultRouteNetworkAttachment != null && previousDefaultRouteNetworkAttachment != null && currentDefaultRouteNetworkAttachment.getId().equals(previousDefaultRouteNetworkAttachment.getId())) {
        return getParameters().getNetworkAttachments();
    }
    List<NetworkAttachment> extendedAttachments = getParameters().getNetworkAttachments();
    NetworkAttachment potentialyMissingAttachment = getPotentialyMissingAttachment(currentDefaultRouteNetworkCluster == null ? null : currentDefaultRouteNetworkCluster.getNetworkId(), currentDefaultRouteNetworkAttachment, previousDefaultRouteNetworkAttachment);
    addAttachmentIfMissing(potentialyMissingAttachment, extendedAttachments);
    return extendedAttachments;
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 42 with NetworkCluster

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

the class NetworkAttachmentValidatorTest method testNetworkAttachedToClusterWhenAttached.

@Test
public void testNetworkAttachedToClusterWhenAttached() {
    Network network = new Network();
    network.setId(Guid.newGuid());
    NetworkAttachment attachment = new NetworkAttachment();
    attachment.setNetworkId(network.getId());
    NetworkClusterId networkClusterId = new NetworkClusterId(host.getClusterId(), attachment.getNetworkId());
    when(networkClusterDaoMock.get(eq(networkClusterId))).thenReturn(new NetworkCluster());
    assertThat(createNetworkAttachmentValidator(attachment).networkAttachedToCluster(), isValid());
}
Also used : ProviderNetwork(org.ovirt.engine.core.common.businessentities.network.ProviderNetwork) Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Example 43 with NetworkCluster

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

the class NetworkAttachmentValidatorTest method doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration.

private void doTestBootProtocolSetForRoleNetworkWhenNullValuedIpConfiguration(boolean displayNetwork, boolean migrationNetwork, boolean glusterNetwork, Matcher<ValidationResult> matcher, Network network, NetworkAttachment attachment) {
    NetworkCluster networkCluster = new NetworkCluster();
    networkCluster.setDisplay(displayNetwork);
    networkCluster.setMigration(migrationNetwork);
    networkCluster.setGluster(glusterNetwork);
    NetworkClusterId networkClusterId = new NetworkClusterId(host.getClusterId(), attachment.getNetworkId());
    when(networkClusterDaoMock.get(eq(networkClusterId))).thenReturn(networkCluster);
    when(networkDaoMock.get(eq(network.getId()))).thenReturn(network);
    assertThat(createNetworkAttachmentValidator(attachment).bootProtocolSetForRoleNetwork(), matcher);
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)

Example 44 with NetworkCluster

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

the class UpdateNetworkCommand method executeCommand.

@Override
protected void executeCommand() {
    NetworkUtils.setNetworkVdsmName(getNetwork());
    TransactionSupport.executeInNewTransaction(() -> {
        networkDao.update(getNetwork());
        for (NetworkCluster clusterAttachment : networkClusterDao.getAllForNetwork(getNetwork().getId())) {
            networkClusterHelper.setStatus(clusterAttachment.getClusterId(), getNetwork());
        }
        if (networkChangedToNonVmNetwork()) {
            removeVnicProfiles();
        }
        if (networkNameChanged()) {
            updateDefaultVnicProfileName(getOldNetwork().getName());
        }
        return null;
    });
    if (!getNetwork().isExternal()) {
        applyNetworkChangesToHosts();
    }
    setSucceeded(true);
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Example 45 with NetworkCluster

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

the class MapVnicFlowTestUtils method networkClusterOf.

static NetworkCluster networkClusterOf(Guid networkId) {
    NetworkCluster nc = new NetworkCluster();
    nc.setNetworkId(networkId);
    return nc;
}
Also used : NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster)

Aggregations

NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)62 Test (org.junit.Test)19 Network (org.ovirt.engine.core.common.businessentities.network.Network)17 ArrayList (java.util.ArrayList)15 NetworkClusterId (org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)7 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 ManageNetworkClustersParameters (org.ovirt.engine.core.common.action.ManageNetworkClustersParameters)5 List (java.util.List)4 Map (java.util.Map)4 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)4 Guid (org.ovirt.engine.core.compat.Guid)4 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 Collection (java.util.Collection)2 Collections (java.util.Collections)2 HashSet (java.util.HashSet)2