Search in sources :

Example 11 with IpConfiguration

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

the class NetworkConfiguratorTest method createSetupNetworkParamsInNewCluster.

@Test
public void createSetupNetworkParamsInNewCluster() {
    final IpConfiguration actual = createSetupNetworkParamsTest(Version.v4_0, hasSize(1));
    assertIpv6Details(actual);
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) Test(org.junit.Test)

Example 12 with IpConfiguration

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

the class NetworkConfiguratorTest method createSetupNetworkParamsTest.

private IpConfiguration createSetupNetworkParamsTest(Version clusterVersion, Matcher<Collection<? extends IpV6Address>> ipv6AddressMatcher) {
    setIpDetails(nic);
    host.setClusterCompatibilityVersion(clusterVersion);
    final HostSetupNetworksParameters actual = underTest.createSetupNetworkParams(nic);
    assertThat(actual.getNetworkAttachments(), hasSize(1));
    final IpConfiguration ipConfiguration = actual.getNetworkAttachments().get(0).getIpConfiguration();
    assertIpv4Details(ipConfiguration);
    assertThat(ipConfiguration.getIpV6Addresses(), ipv6AddressMatcher);
    return ipConfiguration;
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters)

Example 13 with IpConfiguration

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

the class HostSetupNetworksParametersBuilder method addBootProtocolForRoleNetworkAttachment.

protected void addBootProtocolForRoleNetworkAttachment(VdsNetworkInterface nic, Network network, NetworkAttachment attachment) {
    if (NetworkUtils.isRoleNetwork(getNetworkCluster(nic, network))) {
        if (attachment.getIpConfiguration() != null && attachment.getIpConfiguration().hasIpv4PrimaryAddressSet()) {
            IPv4Address primaryAddress = attachment.getIpConfiguration().getIpv4PrimaryAddress();
            if (primaryAddress.getBootProtocol() == null || primaryAddress.getBootProtocol() == Ipv4BootProtocol.NONE) {
                primaryAddress.setBootProtocol(Ipv4BootProtocol.DHCP);
            }
        } else {
            IpConfiguration ipConfiguration;
            if (attachment.getIpConfiguration() == null) {
                ipConfiguration = new IpConfiguration();
            } else {
                ipConfiguration = attachment.getIpConfiguration();
            }
            IPv4Address primaryAddress = new IPv4Address();
            primaryAddress.setBootProtocol(Ipv4BootProtocol.DHCP);
            ipConfiguration.setIPv4Addresses(Collections.singletonList(primaryAddress));
            attachment.setIpConfiguration(ipConfiguration);
        }
    }
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 14 with IpConfiguration

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

the class IpConfigurationCompleterTest method assertIpv4Values.

private void assertIpv4Values(NetworkAttachment networkAttachment, Matcher<Ipv4BootProtocol> bootProtocolMatcher, Matcher<String> addressMatcher, Matcher<String> prefixMatcher, Matcher<String> gatewayMatcher) {
    final IpConfiguration ipConfiguration = networkAttachment.getIpConfiguration();
    assertThat(ipConfiguration, notNullValue());
    assertThat(ipConfiguration.getIPv4Addresses(), hasSize(1));
    assertThat(ipConfiguration.getIpv4PrimaryAddress().getBootProtocol(), bootProtocolMatcher);
    assertThat(ipConfiguration.getIpv4PrimaryAddress().getAddress(), addressMatcher);
    assertThat(ipConfiguration.getIpv4PrimaryAddress().getNetmask(), prefixMatcher);
    assertThat(ipConfiguration.getIpv4PrimaryAddress().getGateway(), gatewayMatcher);
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration)

Example 15 with IpConfiguration

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

the class IpConfigurationCompleterTest method assertIpv6Values.

private void assertIpv6Values(NetworkAttachment networkAttachment, Matcher<Ipv6BootProtocol> bootProtocolMatcher, Matcher<String> addressMatcher, Matcher<Integer> prefixMatcher, Matcher<String> gatewayMatcher) {
    final IpConfiguration ipConfiguration = networkAttachment.getIpConfiguration();
    assertThat(ipConfiguration, notNullValue());
    assertThat(ipConfiguration.getIpV6Addresses(), hasSize(1));
    assertThat(ipConfiguration.getIpv6PrimaryAddress().getBootProtocol(), bootProtocolMatcher);
    assertThat(ipConfiguration.getIpv6PrimaryAddress().getAddress(), addressMatcher);
    assertThat(ipConfiguration.getIpv6PrimaryAddress().getPrefix(), prefixMatcher);
    assertThat(ipConfiguration.getIpv6PrimaryAddress().getGateway(), gatewayMatcher);
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration)

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