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