use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration in project ovirt-engine by oVirt.
the class NetworkConfiguratorTest method createSetupNetworkParamsInNewCluster.
@Test
public void createSetupNetworkParamsInNewCluster() {
final IpConfiguration actual = createSetupNetworkParamsTest(Version.v4_0, hasSize(1));
assertIpv6Details(actual);
}
use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration in project ovirt-engine by oVirt.
the class NetworkConfiguratorTest method createSetupNetworkParamsTest.
private IpConfiguration createSetupNetworkParamsTest(Version clusterVersion, Matcher<Collection<? extends IpV6Address>> ipv6AddressMatcher) {
setIpDetails(nic);
host.setClusterCompatibilityVersion(clusterVersion);
final HostSetupNetworksParameters actual = underTest.createSetupNetworkParams(nic);
assertThat(actual.getNetworkAttachments(), hasSize(1));
final IpConfiguration ipConfiguration = actual.getNetworkAttachments().get(0).getIpConfiguration();
assertIpv4Details(ipConfiguration);
assertThat(ipConfiguration.getIpV6Addresses(), ipv6AddressMatcher);
return ipConfiguration;
}
use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration 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.IpConfiguration in project ovirt-engine by oVirt.
the class IpConfigurationCompleterTest method assertIpv4Values.
private void assertIpv4Values(NetworkAttachment networkAttachment, Matcher<Ipv4BootProtocol> bootProtocolMatcher, Matcher<String> addressMatcher, Matcher<String> prefixMatcher, Matcher<String> gatewayMatcher) {
final IpConfiguration ipConfiguration = networkAttachment.getIpConfiguration();
assertThat(ipConfiguration, notNullValue());
assertThat(ipConfiguration.getIPv4Addresses(), hasSize(1));
assertThat(ipConfiguration.getIpv4PrimaryAddress().getBootProtocol(), bootProtocolMatcher);
assertThat(ipConfiguration.getIpv4PrimaryAddress().getAddress(), addressMatcher);
assertThat(ipConfiguration.getIpv4PrimaryAddress().getNetmask(), prefixMatcher);
assertThat(ipConfiguration.getIpv4PrimaryAddress().getGateway(), gatewayMatcher);
}
use of org.ovirt.engine.core.common.businessentities.network.IpConfiguration in project ovirt-engine by oVirt.
the class IpConfigurationCompleterTest method assertIpv6Values.
private void assertIpv6Values(NetworkAttachment networkAttachment, Matcher<Ipv6BootProtocol> bootProtocolMatcher, Matcher<String> addressMatcher, Matcher<Integer> prefixMatcher, Matcher<String> gatewayMatcher) {
final IpConfiguration ipConfiguration = networkAttachment.getIpConfiguration();
assertThat(ipConfiguration, notNullValue());
assertThat(ipConfiguration.getIpV6Addresses(), hasSize(1));
assertThat(ipConfiguration.getIpv6PrimaryAddress().getBootProtocol(), bootProtocolMatcher);
assertThat(ipConfiguration.getIpv6PrimaryAddress().getAddress(), addressMatcher);
assertThat(ipConfiguration.getIpv6PrimaryAddress().getPrefix(), prefixMatcher);
assertThat(ipConfiguration.getIpv6PrimaryAddress().getGateway(), gatewayMatcher);
}
Aggregations