Search in sources :

Example 16 with NetworkAttachment

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

the class NetworkAttachmentsValidatorTest method createNetworkAttachment.

private NetworkAttachment createNetworkAttachment(Network network) {
    NetworkAttachment result = new NetworkAttachment();
    result.setNetworkId(network.getId());
    return result;
}
Also used : NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 17 with NetworkAttachment

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

the class NetworkAttachmentsValidatorTest method testValidateNetworkExclusiveOnNicsAllAttachmentsMustHaveNicNameSet.

@Test(expected = IllegalArgumentException.class)
public void testValidateNetworkExclusiveOnNicsAllAttachmentsMustHaveNicNameSet() throws Exception {
    NetworkAttachment networkAttachment = new NetworkAttachment();
    networkAttachment.setNetworkId(vmNetwork1.getId());
    List<NetworkAttachment> attachmentsToConfigure = Collections.singletonList(networkAttachment);
    new NetworkAttachmentsValidator(attachmentsToConfigure, networkMap, networkExclusivenessValidator).validateNetworkExclusiveOnNics();
}
Also used : NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Example 18 with NetworkAttachment

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

the class NetworkAttachmentsValidatorTest method testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenNoDuplicates.

@Test
public void testVerifyUserAttachmentsDoesNotReferenceSameNetworkDuplicatelyWhenNoDuplicates() {
    Network networkA = createNetworkWithIdAndName("networkA");
    NetworkAttachment networkAttachmentA = createNetworkAttachment(networkA);
    Network networkB = createNetworkWithIdAndName("networkB");
    NetworkAttachment networkAttachmentB = createNetworkAttachment(networkB);
    List<NetworkAttachment> attachments = Arrays.asList(networkAttachmentA, networkAttachmentB);
    BusinessEntityMap<Network> networksMap = new BusinessEntityMap<>(Arrays.asList(networkA, networkB));
    NetworkAttachmentsValidator validator = new NetworkAttachmentsValidator(attachments, networksMap, networkExclusivenessValidator);
    assertThat(validator.verifyUserAttachmentsDoesNotReferenceSameNetworkDuplicately(), isValid());
}
Also used : BusinessEntityMap(org.ovirt.engine.core.common.businessentities.BusinessEntityMap) Network(org.ovirt.engine.core.common.businessentities.network.Network) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Example 19 with NetworkAttachment

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

the class NetworkAttachmentIpConfigurationValidatorTest method init.

@Before
public void init() {
    NetworkAttachment networkAttachment = new NetworkAttachment();
    networkAttachment.setNetworkName(NETWORK_NAME);
    networkAttachment.setNicName(INTERFACE_NAME);
    networkAttachments = new ArrayList<>();
    networkAttachments.add(networkAttachment);
}
Also used : NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Before(org.junit.Before)

Example 20 with NetworkAttachment

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

the class BaseNetworkImplementationDetailsUtilsTest method createNetworkAttachment.

private NetworkAttachment createNetworkAttachment(HostNetworkQos qos, VdsNetworkInterface baseIface) {
    NetworkAttachment networkAttachment = new NetworkAttachment();
    networkAttachment.setId(Guid.newGuid());
    networkAttachment.setNicId(baseIface.getId());
    networkAttachment.setNicName(baseIface.getName());
    networkAttachment.setHostNetworkQos(AnonymousHostNetworkQos.fromHostNetworkQos(qos));
    return networkAttachment;
}
Also used : NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Aggregations

NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)167 Test (org.junit.Test)79 Network (org.ovirt.engine.core.common.businessentities.network.Network)62 Guid (org.ovirt.engine.core.compat.Guid)37 FindActiveVmsUsingNetwork (org.ovirt.engine.core.bll.network.FindActiveVmsUsingNetwork)36 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)35 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)20 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)18 HashMap (java.util.HashMap)15 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)15 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)14 ArrayList (java.util.ArrayList)10 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)10 ProviderNetwork (org.ovirt.engine.core.common.businessentities.network.ProviderNetwork)9 Bond (org.ovirt.engine.core.common.businessentities.network.Bond)8 PersistentHostSetupNetworksParameters (org.ovirt.engine.core.common.action.PersistentHostSetupNetworksParameters)7 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)7 AnonymousHostNetworkQos (org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos)6 HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)5 BusinessEntityMap (org.ovirt.engine.core.common.businessentities.BusinessEntityMap)5