Search in sources :

Example 1 with IpConfiguration

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

the class NetworkAttachmentValidatorTest method createNetworkAttachmentWithIpv4Configuration.

private NetworkAttachment createNetworkAttachmentWithIpv4Configuration(Ipv4BootProtocol bootProtocol) {
    IpConfiguration ipConfiguration = new IpConfiguration();
    IPv4Address primaryAddress = new IPv4Address();
    primaryAddress.setAddress(null);
    primaryAddress.setNetmask(null);
    primaryAddress.setBootProtocol(bootProtocol);
    ipConfiguration.getIPv4Addresses().add(primaryAddress);
    NetworkAttachment attachment = new NetworkAttachment();
    attachment.setIpConfiguration(ipConfiguration);
    return attachment;
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 2 with IpConfiguration

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

the class NetworkInSyncWithVdsNetworkInterfaceTest method initIpv4Configuration.

private void initIpv4Configuration() {
    IpConfiguration ipConfiguration = this.testedNetworkAttachment.getIpConfiguration();
    ipConfiguration.setIPv4Addresses(Collections.singletonList(ipv4Address));
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration)

Example 3 with IpConfiguration

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

the class NetworkInSyncWithVdsNetworkInterfaceTest method initIpv6Configuration.

private void initIpv6Configuration() {
    IpConfiguration ipConfiguration = this.testedNetworkAttachment.getIpConfiguration();
    ipConfiguration.setIpV6Addresses(Collections.singletonList(ipv6Address));
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration)

Example 4 with IpConfiguration

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

the class HostNetworkAttachmentsPersisterTest method testPersistNetworkAttachmentsWhenNothingToUpdate.

@Test
public void testPersistNetworkAttachmentsWhenNothingToUpdate() throws Exception {
    NetworkAttachment upToDateNetworkAttachment = createNetworkAttachment(clusterNetworkA);
    upToDateNetworkAttachment.setNicId(interfaceWithAttachedClusterNetworkA.getId());
    IpConfiguration ipConfiguration = NetworkUtils.createIpConfigurationFromVdsNetworkInterface(interfaceWithAttachedClusterNetworkA);
    upToDateNetworkAttachment.setIpConfiguration(ipConfiguration);
    upToDateNetworkAttachment.setProperties(customPropertiesForNics.getCustomPropertiesFor(interfaceWithAttachedClusterNetworkA));
    when(networkAttachmentDao.getAllForHost(eq(hostId))).thenReturn(Collections.singletonList(upToDateNetworkAttachment));
    createPersister(Collections.emptyList()).persistNetworkAttachments();
    verify(networkAttachmentDao).getAllForHost(any());
    verifyNoMoreInteractions(networkAttachmentDao);
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Example 5 with IpConfiguration

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

the class HostNetworkAttachmentsPersisterTest method testPersistNetworkAttachmentsWhenNetworkMovedToDifferentNic.

@Test
public void testPersistNetworkAttachmentsWhenNetworkMovedToDifferentNic() throws Exception {
    NetworkAttachment networkAttachmentForClusterNetworkA = createNetworkAttachment(clusterNetworkA);
    // make network attachment out of sync, by setting different nicId and nicName
    Guid notUpToDateNicId = Guid.newGuid();
    networkAttachmentForClusterNetworkA.setNicId(notUpToDateNicId);
    networkAttachmentForClusterNetworkA.setNicName("nonsense");
    IpConfiguration ipConfiguration = NetworkUtils.createIpConfigurationFromVdsNetworkInterface(interfaceWithAttachedClusterNetworkA);
    networkAttachmentForClusterNetworkA.setIpConfiguration(ipConfiguration);
    networkAttachmentForClusterNetworkA.setProperties(customPropertiesForNics.getCustomPropertiesFor(interfaceWithAttachedClusterNetworkA));
    callPersistNetworkAttachmentsAndVerifyThatNetworkAttachmentIsSynced(networkAttachmentForClusterNetworkA, createPersister(Collections.emptyList()));
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) Guid(org.ovirt.engine.core.compat.Guid) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment) Test(org.junit.Test)

Aggregations

IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)24 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)10 IPv4Address (org.ovirt.engine.core.common.businessentities.network.IPv4Address)6 Test (org.junit.Test)4 IpV6Address (org.ovirt.engine.core.common.businessentities.network.IpV6Address)4 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)3 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)2 DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)2 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)2 Guid (org.ovirt.engine.core.compat.Guid)2 NicToIpv4AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction)2 NicToIpv6AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)1 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)1 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1