Search in sources :

Example 1 with BootProtocol

use of org.ovirt.engine.api.model.BootProtocol in project ovirt-engine by oVirt.

the class HostNicMapper method mapIpv6ToModel.

private static void mapIpv6ToModel(VdsNetworkInterface entity, HostNic model) {
    BootProtocol ipv6BootProtocol = Ipv6BootProtocolMapper.map(entity.getIpv6BootProtocol());
    if (ipv6BootProtocol != null) {
        model.setIpv6BootProtocol(ipv6BootProtocol);
    }
    if (entity.getIpv6Address() != null || entity.getIpv6Gateway() != null || entity.getIpv6Prefix() != null) {
        final Ip ipv6 = new Ip();
        ipv6.setVersion(IpVersion.V6);
        if (entity.getIpv6Address() != null) {
            ipv6.setAddress(entity.getIpv6Address());
        }
        if (entity.getIpv6Gateway() != null) {
            ipv6.setGateway(entity.getIpv6Gateway());
        }
        if (entity.getIpv6Prefix() != null) {
            ipv6.setNetmask(entity.getIpv6Prefix().toString());
        }
        model.setIpv6(ipv6);
    }
}
Also used : Ip(org.ovirt.engine.api.model.Ip) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol) BootProtocol(org.ovirt.engine.api.model.BootProtocol) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)

Example 2 with BootProtocol

use of org.ovirt.engine.api.model.BootProtocol in project ovirt-engine by oVirt.

the class HostNicMapper method mapIpv4ToModel.

private static void mapIpv4ToModel(VdsNetworkInterface entity, HostNic model) {
    BootProtocol ipv4BootProtocol = Ipv4BootProtocolMapper.map(entity.getIpv4BootProtocol());
    if (ipv4BootProtocol != null) {
        model.setBootProtocol(ipv4BootProtocol);
    }
    if (entity.getIpv4Address() != null || entity.getIpv4Gateway() != null || entity.getIpv4Subnet() != null) {
        final Ip ipv4 = new Ip();
        ipv4.setVersion(IpVersion.V4);
        if (entity.getIpv4Address() != null) {
            ipv4.setAddress(entity.getIpv4Address());
        }
        if (entity.getIpv4Gateway() != null) {
            ipv4.setGateway(entity.getIpv4Gateway());
        }
        if (entity.getIpv4Subnet() != null) {
            ipv4.setNetmask(entity.getIpv4Subnet());
        }
        model.setIp(ipv4);
    }
}
Also used : Ip(org.ovirt.engine.api.model.Ip) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol) BootProtocol(org.ovirt.engine.api.model.BootProtocol) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)

Example 3 with BootProtocol

use of org.ovirt.engine.api.model.BootProtocol in project ovirt-engine by oVirt.

the class NetworkAttachmentMapper method mapIpv4Address.

private static IpAddressAssignment mapIpv4Address(IPv4Address iPv4Address) {
    IpAddressAssignment ipAddressAssignment = new IpAddressAssignment();
    Ip ip = new Ip();
    ip.setVersion(IpVersion.V4);
    if (iPv4Address.getAddress() != null) {
        ip.setAddress(iPv4Address.getAddress());
    }
    if (iPv4Address.getGateway() != null) {
        ip.setGateway(iPv4Address.getGateway());
    }
    if (iPv4Address.getNetmask() != null) {
        ip.setNetmask(iPv4Address.getNetmask());
    }
    ipAddressAssignment.setIp(ip);
    BootProtocol assignmentMethod = Ipv4BootProtocolMapper.map(iPv4Address.getBootProtocol());
    ipAddressAssignment.setAssignmentMethod(assignmentMethod == null ? null : assignmentMethod);
    return ipAddressAssignment;
}
Also used : Ip(org.ovirt.engine.api.model.Ip) IpAddressAssignment(org.ovirt.engine.api.model.IpAddressAssignment) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol) BootProtocol(org.ovirt.engine.api.model.BootProtocol)

Example 4 with BootProtocol

use of org.ovirt.engine.api.model.BootProtocol in project ovirt-engine by oVirt.

the class NetworkAttachmentMapper method mapIpv6AddressAssignment.

static IpAddressAssignment mapIpv6AddressAssignment(IpV6Address ipV6Address) {
    IpAddressAssignment ipAddressAssignment = new IpAddressAssignment();
    Ip ip = new Ip();
    ip.setVersion(IpVersion.V6);
    if (ipV6Address.getAddress() != null) {
        ip.setAddress(ipV6Address.getAddress());
    }
    if (ipV6Address.getGateway() != null) {
        ip.setGateway(ipV6Address.getGateway());
    }
    if (ipV6Address.getPrefix() != null) {
        ip.setNetmask(ipV6Address.getPrefix().toString());
    }
    ipAddressAssignment.setIp(ip);
    BootProtocol assignmentMethod = Ipv6BootProtocolMapper.map(ipV6Address.getBootProtocol());
    ipAddressAssignment.setAssignmentMethod(assignmentMethod);
    return ipAddressAssignment;
}
Also used : Ip(org.ovirt.engine.api.model.Ip) IpAddressAssignment(org.ovirt.engine.api.model.IpAddressAssignment) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol) BootProtocol(org.ovirt.engine.api.model.BootProtocol)

Aggregations

BootProtocol (org.ovirt.engine.api.model.BootProtocol)4 Ip (org.ovirt.engine.api.model.Ip)4 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)4 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)4 IpAddressAssignment (org.ovirt.engine.api.model.IpAddressAssignment)2