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;
}
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;
}
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));
}
}
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));
}
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;
}
Aggregations