Search in sources :

Example 11 with IPv4Address

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

the class NetworkAttachmentDaoImplTest method createIpv4Address.

private IPv4Address createIpv4Address(Ipv4BootProtocol ipv4BootProtocol) {
    IPv4Address primaryIpv4Address = new IPv4Address();
    primaryIpv4Address.setBootProtocol(ipv4BootProtocol);
    primaryIpv4Address.setAddress(randomIpv4Address());
    primaryIpv4Address.setGateway(randomIpv4Address());
    primaryIpv4Address.setNetmask(randomIpv4Address());
    return primaryIpv4Address;
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 12 with IPv4Address

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

the class NetworkAttachmentDaoImplTest method createPrimaryIpv4Address.

public IPv4Address createPrimaryIpv4Address() {
    IPv4Address iPv4Address = new IPv4Address();
    iPv4Address.setBootProtocol(Ipv4BootProtocol.DHCP);
    return iPv4Address;
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 13 with IPv4Address

use of org.ovirt.engine.core.common.businessentities.network.IPv4Address 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 IPv4Address

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

the class LogicalNetworkModelParametersHelper method storeAttachmentParamsBeforeDetach.

private void storeAttachmentParamsBeforeDetach() {
    NetworkAttachment networkAttachment = networkModel.getNetworkAttachment();
    if (networkAttachment == null) {
        return;
    }
    NetworkParameters netParams = new NetworkParameters();
    IPv4Address ipv4Address = networkAttachment.getIpConfiguration().getIpv4PrimaryAddress();
    if (ipv4Address != null) {
        netParams.setIpv4BootProtocol(ipv4Address.getBootProtocol());
        netParams.setIpv4Address(ipv4Address.getAddress());
        netParams.setIpv4Netmask(ipv4Address.getNetmask());
        netParams.setIpv4Gateway(ipv4Address.getGateway());
    }
    IpV6Address ipv6Address = networkAttachment.getIpConfiguration().getIpv6PrimaryAddress();
    if (ipv6Address != null) {
        netParams.setIpv6BootProtocol(ipv6Address.getBootProtocol());
        netParams.setIpv6Address(ipv6Address.getAddress());
        netParams.setIpv6Prefix(ipv6Address.getPrefix());
        netParams.setIpv6Gateway(ipv6Address.getGateway());
    }
    netParams.setHostNetworkQos(HostNetworkQos.fromAnonymousHostNetworkQos(networkAttachment.getHostNetworkQos()));
    netParams.setQosOverridden(networkAttachment.isQosOverridden());
    netParams.setCustomProperties(networkAttachment.getProperties());
    netParams.setDnsResolverConfiguration(networkAttachment.getDnsResolverConfiguration());
    networkModel.getSetupModel().getNetworkToLastDetachParams().put(networkModel.getName(), netParams);
}
Also used : NetworkParameters(org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkParameters) IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Example 15 with IPv4Address

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

the class IpConfigurationCompleterTest method createIpv4Address.

private IPv4Address createIpv4Address() {
    final IPv4Address iPv4Address = new IPv4Address();
    iPv4Address.setBootProtocol(Ipv4BootProtocol.DHCP);
    iPv4Address.setAddress(IPV4_ADDRESS);
    iPv4Address.setNetmask(IPV4_MASK);
    iPv4Address.setGateway(IPV4_GATEWAY);
    return iPv4Address;
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Aggregations

IPv4Address (org.ovirt.engine.core.common.businessentities.network.IPv4Address)25 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)6 Test (org.junit.Test)5 IpV6Address (org.ovirt.engine.core.common.businessentities.network.IpV6Address)5 ReportedConfiguration (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration)4 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)2 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)2 ReportedConfigurations (org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations)2 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 NicToIpv4AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction)1 NicToIpv6AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction)1 NetworkParameters (org.ovirt.engine.ui.uicommonweb.models.hosts.NetworkParameters)1