use of org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel in project ovirt-engine by oVirt.
the class BondPanel method getContents.
@Override
protected Widget getContents() {
VerticalPanel vPanel = new VerticalPanel();
// $NON-NLS-1$
vPanel.addStyleName("ts5");
// $NON-NLS-1$
vPanel.setWidth("100%");
Grid titleRow = new Grid(1, 3);
// $NON-NLS-1$
titleRow.addStyleName("ts3");
ColumnFormatter columnFormatter = titleRow.getColumnFormatter();
// $NON-NLS-1$
columnFormatter.setWidth(0, "30px");
// $NON-NLS-1$
columnFormatter.setWidth(1, "100%");
// $NON-NLS-1$
titleRow.setWidth("100%");
// $NON-NLS-1$
titleRow.setHeight("27px");
Label titleLabel = new Label(item.getName());
// $NON-NLS-1$
titleLabel.setHeight("100%");
Image bondImage = new Image(resources.bond());
titleRow.setWidget(0, 0, bondImage);
titleRow.setWidget(0, 1, titleLabel);
titleRow.setWidget(0, 2, actionButton);
// $NON-NLS-1$
titleRow.addStyleName("ts3");
titleRow.setCellPadding(3);
vPanel.add(titleRow);
getElement().addClassName(style.bondPanel());
List<NetworkInterfaceModel> bonded = ((BondNetworkInterfaceModel) item).getSlaves();
Collections.sort(bonded);
for (NetworkInterfaceModel networkInterfaceModel : bonded) {
NicPanel nicPanel = new NicPanel(networkInterfaceModel, style);
nicPanel.parentPanel = this;
if (!networkInterfaceModel.isSriovEnabled()) {
nicPanel.actionButton.setVisible(false);
}
vPanel.add(nicPanel);
}
return vPanel;
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel in project ovirt-engine by oVirt.
the class ItemInfoPopup method addLldpInfo.
private void addLldpInfo(NetworkInterfaceModel nic) {
HostSetupNetworksModel model = nic.getSetupModel();
String name = nic.getOriginalIface().getName();
LldpInfo lldpInfo = model.getNetworkLldpByName(name);
insertHorizontalLine();
addRow(templates.strongTextWithColor(constants.linkLayerInfo(), SafeStylesUtils.forTrustedColor(WHITE_TEXT_COLOR)));
if (lldpInfo != null) {
if (lldpInfo.isEnabled()) {
List<Tlv> filteredTlvs = lldpInfo.getTlvs().stream().filter(this::isTlvImportant).collect(Collectors.toList());
if (!filteredTlvs.isEmpty()) {
filteredTlvs.stream().forEach(tlv -> tlv.getProperties().entrySet().stream().forEach(entry -> addRow(entry.getKey(), entry.getValue())));
} else {
addRow(SafeHtmlUtils.fromSafeConstant(constants.noImportantLLDP()));
}
} else {
addRow(SafeHtmlUtils.fromSafeConstant(constants.lldpInfoDisabled()));
}
} else {
if (model.isNetworkLldpInfoPresent()) {
addRow(SafeHtmlUtils.fromSafeConstant(constants.noLldpInfoAvailable()));
} else {
addRow(SafeHtmlUtils.fromSafeConstant(constants.fetchingLldpInfo()));
}
}
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method attachNetworks.
private void attachNetworks(String bondName, List<LogicalNetworkModel> networks) {
NetworkInterfaceModel bondModel = nicModelByName.get(bondName);
NetworkOperation.attachNetworks(bondModel, new ArrayList<>(networks), hostSetupNetworksParametersData);
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method createSlaveModel.
private NetworkInterfaceModel createSlaveModel(final Map<Guid, VdsNetworkInterface> nicsById, VdsNetworkInterface slave) {
final VdsNetworkInterface physicalFunction = findPhysicalFunction(nicsById, slave.getId());
NetworkInterfaceModel slaveModel = new NetworkInterfaceModel(slave, nicToVfsConfig.containsKey(slave.getId()), physicalFunction == null ? null : physicalFunction.getName(), this);
slaveModel.setBonded(true);
return slaveModel;
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method createBondModels.
private Map<String, NetworkInterfaceModel> createBondModels(Map<String, Set<LogicalNetworkModel>> nicNameToNetworkModels, Map<String, List<VdsNetworkInterface>> bondNameToSlaves, Map<String, List<NetworkLabelModel>> nicNameToLabelModels, final Map<Guid, VdsNetworkInterface> nicsById) {
Map<String, NetworkInterfaceModel> bondModels = new HashMap<>();
for (CreateOrUpdateBond createOrUpdateBond : hostSetupNetworksParametersData.getBonds()) {
String bondName = createOrUpdateBond.getName();
List<NetworkInterfaceModel> slavesModels = createSlaveModels(bondNameToSlaves, nicsById, bondName);
Collection<LogicalNetworkModel> nicNetworks = nicNameToNetworkModels.get(bondName);
Bond originalBond = getOriginalBond(nicsById, createOrUpdateBond);
BondNetworkInterfaceModel bondNetworkInterfaceModel = new BondNetworkInterfaceModel(originalBond, createOrUpdateBond, nicNetworks, nicNameToLabelModels.get(createOrUpdateBond.getName()), slavesModels, this);
bondModels.put(bondName, bondNetworkInterfaceModel);
}
return bondModels;
}
Aggregations