Search in sources :

Example 6 with IPv4Address

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

the class NetworkCommonUtils method createDefaultIpv4Address.

public static IPv4Address createDefaultIpv4Address() {
    IPv4Address ipv4Address = new IPv4Address();
    ipv4Address.setBootProtocol(Ipv4BootProtocol.NONE);
    return ipv4Address;
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 7 with IPv4Address

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

the class NetworkUtils method createIpConfigurationFromVdsNetworkInterface.

public static IpConfiguration createIpConfigurationFromVdsNetworkInterface(VdsNetworkInterface nic) {
    if (nic == null) {
        return NetworkCommonUtils.createDefaultIpConfiguration();
    }
    final List<IPv4Address> iPv4Addresses = Stream.of(nic).map(new NicToIpv4AddressFunction()).collect(toList());
    final List<IpV6Address> ipV6Addresses = Stream.of(nic).map(new NicToIpv6AddressFunction()).collect(toList());
    IpConfiguration ipConfiguration = new IpConfiguration();
    ipConfiguration.setIPv4Addresses(iPv4Addresses);
    ipConfiguration.setIpV6Addresses(ipV6Addresses);
    return ipConfiguration;
}
Also used : NicToIpv6AddressFunction(org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction) IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) NicToIpv4AddressFunction(org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 8 with IPv4Address

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

the class IpConfigurationCompleter method completeDefaultIpConfiguration.

private void completeDefaultIpConfiguration(IpConfiguration ipConfiguration) {
    if (ipConfiguration.getIPv4Addresses().isEmpty()) {
        final IPv4Address ipv4Address = NetworkCommonUtils.createDefaultIpv4Address();
        ipConfiguration.setIPv4Addresses(Collections.singletonList(ipv4Address));
    }
    if (ipConfiguration.getIpV6Addresses().isEmpty()) {
        final IpV6Address ipv6Address = NetworkCommonUtils.createDefaultIpv6Address();
        ipConfiguration.setIpV6Addresses(Collections.singletonList(ipv6Address));
    }
}
Also used : IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 9 with IPv4Address

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

the class IpConfigurationCompleterTest method testFillInUnsetIpConfigsIpv6.

@Test
public void testFillInUnsetIpConfigsIpv6() {
    final IPv4Address ipv4Address = createIpv4Address();
    ipConfiguration.setIPv4Addresses(Collections.singletonList(ipv4Address));
    underTest.fillInUnsetIpConfigs(networkAttachments);
    assertIpv6DefaultValues(networkAttachment);
    assertIpv4Values(networkAttachment, is(Ipv4BootProtocol.DHCP), is(IPV4_ADDRESS), is(IPV4_MASK), is(IPV4_GATEWAY));
}
Also used : IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address) Test(org.junit.Test)

Example 10 with IPv4Address

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

the class NetworkAttachmentDaoImpl method createIpv4Address.

private static IPv4Address createIpv4Address(ResultSet rs, String bootProtocol) throws SQLException {
    final IPv4Address iPv4Address = new IPv4Address();
    iPv4Address.setBootProtocol(Ipv4BootProtocol.valueOf(bootProtocol));
    iPv4Address.setAddress(rs.getString("address"));
    iPv4Address.setNetmask(rs.getString("netmask"));
    iPv4Address.setGateway(rs.getString("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