use of org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction 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.utils.network.function.NicToIpv6AddressFunction in project ovirt-engine by oVirt.
the class NetworkConfigurator method createSetupNetworkParams.
public HostSetupNetworksParameters createSetupNetworkParams(VdsNetworkInterface nic) {
HostSetupNetworksParameters parameters = new HostSetupNetworksParameters(host.getId());
NetworkAttachment managementAttachment = new NetworkAttachment();
managementAttachment.setNetworkId(managementNetwork.getId());
Map<String, VdsNetworkInterface> nicNameToNic = Entities.entitiesByName(host.getInterfaces());
Guid baseNicId = nicNameToNic.get(NetworkCommonUtils.stripVlan(nic)).getId();
managementAttachment.setNicId(baseNicId);
IpConfiguration ipConfiguration = new IpConfiguration();
ipConfiguration.setIPv4Addresses(Collections.singletonList(new NicToIpv4AddressFunction().apply(nic)));
if (FeatureSupported.ipv6Supported(host.getClusterCompatibilityVersion())) {
ipConfiguration.setIpV6Addresses(Collections.singletonList(new NicToIpv6AddressFunction().apply(nic)));
}
managementAttachment.setIpConfiguration(ipConfiguration);
parameters.getNetworkAttachments().add(managementAttachment);
return parameters;
}
Aggregations