Search in sources :

Example 6 with Ipv4BootProtocol

use of org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol in project ovirt-engine by oVirt.

the class NetworkInSyncWithVdsNetworkInterface method addReportedIpv4Configuration.

private void addReportedIpv4Configuration(ReportedConfigurations result) {
    if (!isIpv4PrimaryAddressExist()) {
        return;
    }
    Ipv4BootProtocol definedIpv4BootProtocol = getIpv4PrimaryAddress().getBootProtocol();
    result.add(ReportedConfigurationType.IPV4_BOOT_PROTOCOL, iface.getIpv4BootProtocol(), definedIpv4BootProtocol);
    if (definedIpv4BootProtocol == Ipv4BootProtocol.STATIC_IP && iface.getIpv4BootProtocol() == definedIpv4BootProtocol) {
        result.add(ReportedConfigurationType.IPV4_NETMASK, iface.getIpv4Subnet(), getIpv4PrimaryAddress().getNetmask(), isIpv4NetworkSubnetInSync());
        result.add(ReportedConfigurationType.IPV4_ADDRESS, iface.getIpv4Address(), getIpv4PrimaryAddress().getAddress());
        result.add(ReportedConfigurationType.IPV4_GATEWAY, iface.getIpv4Gateway(), getIpv4PrimaryAddress().getGateway(), isIpv4GatewayInSync());
    }
}
Also used : Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)

Example 7 with Ipv4BootProtocol

use of org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol 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 8 with Ipv4BootProtocol

use of org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol in project ovirt-engine by oVirt.

the class NetworkAttachmentMapper method mapIpv4AddressAssignment.

private static IPv4Address mapIpv4AddressAssignment(IpAddressAssignment ipAddressAssignment) {
    IPv4Address iPv4Address = new IPv4Address();
    if (ipAddressAssignment.isSetAssignmentMethod()) {
        Ipv4BootProtocol assignmentMethod = Ipv4BootProtocolMapper.map(ipAddressAssignment.getAssignmentMethod());
        iPv4Address.setBootProtocol(assignmentMethod);
    }
    if (ipAddressAssignment.isSetIp()) {
        if (ipAddressAssignment.getIp().isSetAddress()) {
            iPv4Address.setAddress(ipAddressAssignment.getIp().getAddress());
        }
        if (ipAddressAssignment.getIp().isSetGateway()) {
            iPv4Address.setGateway(ipAddressAssignment.getIp().getGateway());
        }
        if (ipAddressAssignment.getIp().isSetNetmask()) {
            iPv4Address.setNetmask(ipAddressAssignment.getIp().getNetmask());
        }
    }
    return iPv4Address;
}
Also used : Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) IPv4Address(org.ovirt.engine.core.common.businessentities.network.IPv4Address)

Example 9 with Ipv4BootProtocol

use of org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol in project ovirt-engine by oVirt.

the class ItemInfoPopup method addBootProtoAndIpInfo.

private void addBootProtoAndIpInfo(InterfacePropertiesAccessor accessor) {
    insertHorizontalLine();
    // IPv4
    addRow(// $NON-NLS-1$
    templates.strongTextWithColor(// $NON-NLS-1$
    constants.ipv4ItemInfo() + ":", SafeStylesUtils.forTrustedColor(WHITE_TEXT_COLOR)));
    if (accessor.isIpv4Available()) {
        Ipv4BootProtocol ipv4BootProtocol = accessor.getIpv4BootProtocol();
        addRow(constants.bootProtocolItemInfo(), IPV4_RENDERER.render(ipv4BootProtocol));
        addNonNullOrEmptyValueRow(constants.addressItemInfo(), accessor.getIpv4Address());
        addNonNullOrEmptyValueRow(constants.subnetItemInfo(), accessor.getIpv4Netmask());
        addNonNullOrEmptyValueRow(constants.gatewayItemInfo(), accessor.getIpv4Gateway());
    } else {
        addRow(SafeHtmlUtils.fromSafeConstant(constants.notAvailableLabel()));
    }
    // IPv6
    addRow(// $NON-NLS-1$
    templates.strongTextWithColor(// $NON-NLS-1$
    constants.ipv6ItemInfo() + ":", SafeStylesUtils.forTrustedColor(WHITE_TEXT_COLOR)));
    if (accessor.isIpv6Available()) {
        Ipv6BootProtocol ipv6BootProtocol = accessor.getIpv6BootProtocol();
        addRow(constants.bootProtocolItemInfo(), IPV6_RENDERER.render(ipv6BootProtocol));
        addNonNullOrEmptyValueRow(constants.addressItemInfo(), accessor.getIpv6Address());
        addNonNullOrEmptyValueRow(constants.prefixItemInfo(), accessor.getIpv6Prefix() != null ? accessor.getIpv6Prefix().toString() : null);
        addNonNullOrEmptyValueRow(constants.gatewayItemInfo(), accessor.getIpv6Gateway());
    } else {
        addRow(SafeHtmlUtils.fromSafeConstant(constants.notAvailableLabel()));
    }
}
Also used : Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)

Example 10 with Ipv4BootProtocol

use of org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol in project ovirt-engine by oVirt.

the class VmInitModel method updateNetworkDisplay.

/* Update displayed network properties to reflect currently-selected item */
private void updateNetworkDisplay() {
    String networkName = null;
    VmInitNetwork vmInitNetwork = null;
    if (getNetworkList().getSelectedItem() != null) {
        networkName = getNetworkList().getSelectedItem();
        vmInitNetwork = networkMap.get(networkName);
    }
    final Ipv4BootProtocol ipv4bootProtocol = vmInitNetwork == null || vmInitNetwork.getBootProtocol() == null ? Ipv4BootProtocol.NONE : vmInitNetwork.getBootProtocol();
    getIpv4BootProtocolList().setSelectedItem(ipv4bootProtocol);
    final Ipv6BootProtocol ipv6bootProtocol = vmInitNetwork == null || vmInitNetwork.getIpv6BootProtocol() == null ? Ipv6BootProtocol.NONE : vmInitNetwork.getIpv6BootProtocol();
    getIpv6BootProtocolList().setSelectedItem(ipv6bootProtocol);
    getNetworkIpAddress().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIp());
    getNetworkNetmask().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getNetmask());
    getNetworkGateway().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getGateway());
    getNetworkIpv6Address().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Address());
    getNetworkIpv6Prefix().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Prefix());
    getNetworkIpv6Gateway().setEntity(vmInitNetwork == null ? null : vmInitNetwork.getIpv6Gateway());
    hardCodeStartOnBoot();
}
Also used : VmInitNetwork(org.ovirt.engine.core.common.businessentities.VmInitNetwork) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)

Aggregations

Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)10 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)3 VmInitNetwork (org.ovirt.engine.core.common.businessentities.VmInitNetwork)2 IPv4Address (org.ovirt.engine.core.common.businessentities.network.IPv4Address)2 ArrayList (java.util.ArrayList)1 AuthorizedKey (org.ovirt.engine.api.model.AuthorizedKey)1 BootProtocol (org.ovirt.engine.api.model.BootProtocol)1 File (org.ovirt.engine.api.model.File)1 Host (org.ovirt.engine.api.model.Host)1 Ip (org.ovirt.engine.api.model.Ip)1 Nic (org.ovirt.engine.api.model.Nic)1 User (org.ovirt.engine.api.model.User)1 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)1 VmInit (org.ovirt.engine.core.common.businessentities.VmInit)1 IpConfiguration (org.ovirt.engine.core.common.businessentities.network.IpConfiguration)1