Search in sources :

Example 1 with NicToIpv6AddressFunction

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;
}
Also used : NicToIpv6AddressFunction(org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction) IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) IpV6Address(org.ovirt.engine.core.common.businessentities.network.IpV6Address) NicToIpv4AddressFunction(org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 2 with NicToIpv6AddressFunction

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;
}
Also used : IpConfiguration(org.ovirt.engine.core.common.businessentities.network.IpConfiguration) NicToIpv6AddressFunction(org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) NicToIpv4AddressFunction(org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction) HostSetupNetworksParameters(org.ovirt.engine.core.common.action.HostSetupNetworksParameters) Guid(org.ovirt.engine.core.compat.Guid) NetworkAttachment(org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)

Aggregations

IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)2 NicToIpv4AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv4AddressFunction)2 NicToIpv6AddressFunction (org.ovirt.engine.core.utils.network.function.NicToIpv6AddressFunction)2 HostSetupNetworksParameters (org.ovirt.engine.core.common.action.HostSetupNetworksParameters)1 IPv4Address (org.ovirt.engine.core.common.businessentities.network.IPv4Address)1 IpV6Address (org.ovirt.engine.core.common.businessentities.network.IpV6Address)1 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 Guid (org.ovirt.engine.core.compat.Guid)1