use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration in project ovirt-engine by oVirt.
the class HostNetworkAttachmentsPersisterTest method createIpConfiguration.
private IpConfiguration createIpConfiguration() {
IpConfiguration result = new IpConfiguration();
IPv4Address ipv4Address = createIpv4Address();
IpV6Address ipv6Address = createIpv6Address();
result.setIPv4Addresses(Collections.singletonList(ipv4Address));
result.setIpV6Addresses(Collections.singletonList(ipv6Address));
return result;
}
use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration in project ovirt-engine by oVirt.
the class NetworkAttachmentIpConfigurationValidator method validateIpv6Configuration.
private ValidationResult validateIpv6Configuration(NetworkAttachment networkAttachment) {
final IpConfiguration ipConfiguration = networkAttachment.getIpConfiguration();
if (!ipConfiguration.hasIpv6PrimaryAddressSet()) {
return ValidationResult.VALID;
}
IpV6Address ipv6Address = ipConfiguration.getIpv6PrimaryAddress();
String networkName = networkAttachment.getNetworkName();
String nicName = networkAttachment.getNicName();
if (ipv6Address.getBootProtocol() == null) {
return incompleteIpConfigurationValidationResult(EngineMessage.NETWORK_ATTACHMENT_IP_CONFIGURATION_MISSING_BOOT_PROTOCOL, networkName, nicName);
}
Ipv6BootProtocol bootProtocol = ipv6Address.getBootProtocol();
if (bootProtocol == Ipv6BootProtocol.STATIC_IP) {
if (!validStaticIpv6AddressDetails(ipv6Address)) {
return incompleteIpConfigurationValidationResult(EngineMessage.NETWORK_ATTACHMENT_IP_CONFIGURATION_STATIC_BOOT_PROTOCOL_MISSING_IP_ADDRESS_DETAILS, networkName, nicName);
}
} else {
if (!isEmptyIpv6AddressDetails(ipv6Address)) {
return new ValidationResult(EngineMessage.NETWORK_ATTACHMENT_IP_CONFIGURATION_INCOMPATIBLE_BOOT_PROTOCOL_AND_IP_ADDRESS_DETAILS, ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, networkName), ReplacementUtils.createSetVariableString(VAR_INTERFACE_NAME, nicName), ReplacementUtils.createSetVariableString(VAR_BOOT_PROTOCOL, bootProtocol.getDisplayName()));
}
}
return ValidationResult.VALID;
}
use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration in project ovirt-engine by oVirt.
the class NetworkAttachmentIpConfigurationValidator method validateIpv4Configuration.
private ValidationResult validateIpv4Configuration(NetworkAttachment networkAttachment) {
IpConfiguration ipConfiguration = networkAttachment.getIpConfiguration();
if (!ipConfiguration.hasIpv4PrimaryAddressSet()) {
return ValidationResult.VALID;
}
IPv4Address iPv4Address = ipConfiguration.getIpv4PrimaryAddress();
String networkName = networkAttachment.getNetworkName();
String nicName = networkAttachment.getNicName();
if (iPv4Address.getBootProtocol() == null) {
return incompleteIpConfigurationValidationResult(EngineMessage.NETWORK_ATTACHMENT_IP_CONFIGURATION_MISSING_BOOT_PROTOCOL, networkName, nicName);
}
Ipv4BootProtocol bootProtocol = iPv4Address.getBootProtocol();
if (bootProtocol == Ipv4BootProtocol.STATIC_IP) {
if (!validStaticIpv4AddressDetails(iPv4Address)) {
return incompleteIpConfigurationValidationResult(EngineMessage.NETWORK_ATTACHMENT_IP_CONFIGURATION_STATIC_BOOT_PROTOCOL_MISSING_IP_ADDRESS_DETAILS, networkName, nicName);
}
} else {
if (!isEmptyIpv4AddressDetails(iPv4Address)) {
return new ValidationResult(EngineMessage.NETWORK_ATTACHMENT_IP_CONFIGURATION_INCOMPATIBLE_BOOT_PROTOCOL_AND_IP_ADDRESS_DETAILS, ReplacementUtils.createSetVariableString(VAR_NETWORK_NAME, networkName), ReplacementUtils.createSetVariableString(VAR_INTERFACE_NAME, nicName), ReplacementUtils.createSetVariableString(VAR_BOOT_PROTOCOL, bootProtocol.getDisplayName()));
}
}
return ValidationResult.VALID;
}
use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration 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.IpConfiguration in project ovirt-engine by oVirt.
the class IpConfigurationCompleterTest method setUp.
@Before
public void setUp() {
underTest = new IpConfigurationCompleter();
ipConfiguration = new IpConfiguration();
networkAttachment = new NetworkAttachment();
networkAttachment.setIpConfiguration(ipConfiguration);
networkAttachments = Collections.singleton(networkAttachment);
}
Aggregations