use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class BaseImportNetworksModel method onProviderChosen.
private void onProviderChosen() {
final Provider<?> provider = providers.getSelectedItem();
if (provider == null) {
return;
}
startProgress();
AsyncQuery<List<StoragePool>> dataCenterQuery = new AsyncQuery<>(returnValue -> {
final List<StoragePool> dataCenters = new LinkedList<>(returnValue);
Collections.sort(dataCenters, new NameableComparator());
AsyncQuery<QueryReturnValue> externalNetworksQuery = new AsyncQuery<>(queryReturnValue -> {
if (queryReturnValue.getSucceeded()) {
Map<Network, Set<Guid>> externalNetworkToDataCenters = queryReturnValue.getReturnValue();
providerNetworks.setItems(getExternalNetworks(externalNetworkToDataCenters, dataCenters));
importedNetworks.setItems(new LinkedList<ExternalNetwork>());
} else {
final ErrorPopupManager popupManager = (ErrorPopupManager) TypeResolver.getInstance().resolve(ErrorPopupManager.class);
popupManager.show(ConstantsManager.getInstance().getMessages().failedToListExternalNetworks(queryReturnValue.getExceptionMessage()));
}
stopProgress();
}, true);
AsyncDataProvider.getInstance().getExternalNetworksByProviderId(externalNetworksQuery, provider.getId());
});
AsyncDataProvider.getInstance().getDataCenterList(dataCenterQuery);
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class BaseImportNetworksModel method onImport.
public void onImport() {
if (!validate()) {
return;
}
List<ActionParametersBase> multipleActionParameters = new LinkedList<>();
for (final ExternalNetwork externalNetwork : importedNetworks.getItems()) {
final Network network = externalNetwork.getNetwork();
final Guid dcId = externalNetwork.getDataCenters().getSelectedItem().getId();
ImportExternalNetworkParameters params = new ImportExternalNetworkParameters(network.getProvidedBy().getProviderId(), network.getProvidedBy().getExternalId(), dcId, externalNetwork.isPublicUse(), true);
multipleActionParameters.add(params);
}
Frontend.getInstance().runMultipleActions(ActionType.ImportExternalNetwork, multipleActionParameters, result -> sourceListModel.getSearchCommand().execute());
cancel();
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class NetworkGeneralModel method updateProperties.
private void updateProperties() {
Network extendedNetwork = getEntity();
setName(extendedNetwork.getName());
setId(extendedNetwork.getId());
setDescription(extendedNetwork.getDescription());
setVmNetwork(extendedNetwork.isVmNetwork());
setVlan(extendedNetwork.getVlanId());
setMtu(extendedNetwork.getMtu());
if (extendedNetwork.isExternal()) {
setExternalId(extendedNetwork.getProvidedBy().getExternalId());
} else {
setExternalId(null);
}
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class VfsConfigModel method initNetworks.
private void initNetworks(List<Network> allClusterNetworks) {
List<VfsConfigNetwork> vfsConfigNetworks = new ArrayList<>();
Set<Guid> attachedNetworks = getEntity().getNetworks();
for (Network network : allClusterNetworks) {
boolean isAttached = attachedNetworks.contains(network.getId());
VfsConfigNetwork vfsConfigNetwork = new VfsConfigNetwork(isAttached, labelsModel, network);
vfsConfigNetworks.add(vfsConfigNetwork);
}
networks.setItems(vfsConfigNetworks);
}
use of org.ovirt.engine.core.common.businessentities.network.Network in project ovirt-engine by oVirt.
the class ItemInfoPopup method showNetwork.
private void showNetwork(LogicalNetworkModel networkModel) {
boolean descriptionSectionHasValues = false;
contents.removeAllRows();
Network entity = networkModel.getNetwork();
addRow(templates.titleSetupNetworkTooltip(networkModel.getName(), SafeStylesUtils.forTrustedBackgroundColor(BACKGROUND_COLOR)));
// Not managed
if (!networkModel.isManaged()) {
addRow(templates.imageWithText(unknownImage, constants.unmanagedNetworkItemInfo()));
addRow(SafeHtmlUtils.fromString(constants.unmanagedNetworkDescriptionItemInfo()));
descriptionSectionHasValues = true;
} else {
if (networkModel.getErrorMessage() != null) {
addRow(templates.imageTextSetupNetwork(alertImage, templates.maxWidthNteworkItemPopup(networkModel.getErrorMessage())));
descriptionSectionHasValues = true;
}
// Description
if (entity.getDescription() != null && !entity.getDescription().trim().equals("")) {
// $NON-NLS-1$
addRow(SafeHtmlUtils.fromString(entity.getDescription()));
descriptionSectionHasValues = true;
}
// Not in sync
if (!networkModel.isInSync()) {
addSyncDiff(networkModel);
descriptionSectionHasValues = true;
}
}
if (descriptionSectionHasValues) {
insertHorizontalLine();
}
boolean isDisplay = false;
boolean isMigration = false;
boolean isGluster = false;
boolean isDefaultRoute = false;
if (entity.getCluster() != null) {
isDisplay = entity.getCluster().isDisplay();
isMigration = entity.getCluster().isMigration();
isGluster = entity.getCluster().isGluster();
isDefaultRoute = entity.getCluster().isDefaultRoute();
}
// Usages
if (networkModel.isManagement() || isDisplay || entity.isVmNetwork() || isMigration || isGluster || isDefaultRoute) {
addRow(// $NON-NLS-1$
templates.strongTextWithColor(// $NON-NLS-1$
constants.usageItemInfo() + ":", SafeStylesUtils.forTrustedColor(WHITE_TEXT_COLOR)));
if (networkModel.isManagement()) {
addRow(templates.imageTextSetupNetworkUsage(mgmtNetworkImage, constants.managementItemInfo(), SafeStylesUtils.forTrustedColor(TEXT_COLOR)));
}
if (isDisplay) {
addRow(templates.imageTextSetupNetworkUsage(monitorImage, constants.displayItemInfo(), SafeStylesUtils.forTrustedColor(TEXT_COLOR)));
}
if (entity.isVmNetwork()) {
addRow(templates.imageTextSetupNetworkUsage(vmImage, constants.vmItemInfo(), SafeStylesUtils.forTrustedColor(TEXT_COLOR)));
}
if (isMigration) {
addRow(templates.imageTextSetupNetworkUsage(migrationImage, constants.migrationItemInfo(), SafeStylesUtils.forTrustedColor(TEXT_COLOR)));
}
if (isGluster) {
addRow(templates.imageTextSetupNetworkUsage(glusterNwImage, constants.glusterNwItemInfo(), SafeStylesUtils.forTrustedColor(TEXT_COLOR)));
}
if (isDefaultRoute) {
addRow(templates.imageTextSetupNetworkUsage(defaultRouteImage, constants.defaultRouteItemInfo(), SafeStylesUtils.forTrustedColor(TEXT_COLOR)));
}
insertHorizontalLine();
}
// Mtu
if (!entity.isExternal()) {
addMtuInfo(entity.getMtu());
}
// Boot protocol and IP info
if (networkModel.isAttached() && networkModel.isManaged()) {
addBootProtoAndIpInfo(new InterfacePropertiesAccessor.FromNetworkAttachmentForModel(networkModel.getNetworkAttachment(), null, networkModel.getVlanDevice() != null ? networkModel.getVlanDevice() : networkModel.getAttachedToNic().getOriginalIface()));
}
}
Aggregations