Search in sources :

Example 16 with IPv4Address

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

the class NetworkConfiguratorTest method assertIpv4Details.

private void assertIpv4Details(IpConfiguration ipConfiguration) {
    assertThat(ipConfiguration.getIPv4Addresses(), hasSize(1));
    final IPv4Address ipv4Address = ipConfiguration.getIPv4Addresses().get(0);
    assertThat(ipv4Address.getAddress(), is(IPV4_ADDRESS));
    assertThat(ipv4Address.getBootProtocol(), is(Ipv4BootProtocol.STATIC_IP));
    assertThat(ipv4Address.getAddress(), is(IPV4_ADDRESS));
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 17 with IPv4Address

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

the class HostNetworkAttachmentsPersisterTest method createIpv4Address.

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

Example 18 with IPv4Address

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

the class NetworkCommonUtils method createDefaultIpConfiguration.

public static IpConfiguration createDefaultIpConfiguration() {
    IpConfiguration ipConfiguration = new IpConfiguration();
    IPv4Address iPv4Address = createDefaultIpv4Address();
    ipConfiguration.getIPv4Addresses().add(iPv4Address);
    IpV6Address ipv6Address = createDefaultIpv6Address();
    ipConfiguration.getIpV6Addresses().add(ipv6Address);
    return ipConfiguration;
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 19 with IPv4Address

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

the class NetworkAttachmentDaoImpl method mapIpv4Configuration.

private void mapIpv4Configuration(MapSqlParameterSource mapper, IpConfiguration ipConfiguration) {
    if (ipConfiguration.hasIpv4PrimaryAddressSet()) {
        final IPv4Address primaryIpv4Address = ipConfiguration.getIpv4PrimaryAddress();
        mapper.addValue("boot_protocol", EnumUtils.nameOrNull(primaryIpv4Address.getBootProtocol())).addValue("address", primaryIpv4Address.getAddress()).addValue("netmask", primaryIpv4Address.getNetmask()).addValue("gateway", primaryIpv4Address.getGateway());
    } else {
        mapper.addValue("boot_protocol", null).addValue("address", null).addValue("netmask", null).addValue("gateway", null);
    }
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 20 with IPv4Address

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

the class NetworkAttachmentMapper method mapIpv4AddressAssignment.

private static IPv4Address mapIpv4AddressAssignment(IpAddressAssignment ipAddressAssignment) {
    IPv4Address iPv4Address = new IPv4Address();
    if (ipAddressAssignment.isSetAssignmentMethod()) {
        Ipv4BootProtocol assignmentMethod = Ipv4BootProtocolMapper.map(ipAddressAssignment.getAssignmentMethod());
        iPv4Address.setBootProtocol(assignmentMethod);
    }
    if (ipAddressAssignment.isSetIp()) {
        if (ipAddressAssignment.getIp().isSetAddress()) {
            iPv4Address.setAddress(ipAddressAssignment.getIp().getAddress());
        }
        if (ipAddressAssignment.getIp().isSetGateway()) {
            iPv4Address.setGateway(ipAddressAssignment.getIp().getGateway());
        }
        if (ipAddressAssignment.getIp().isSetNetmask()) {
            iPv4Address.setNetmask(ipAddressAssignment.getIp().getNetmask());
        }
    }
    return iPv4Address;
}
Also used : Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) 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