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());
}
}
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);
}
}
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;
}
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()));
}
}
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();
}
Aggregations