Search in sources :

Example 6 with NetworkInterfaceModel

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;
}
Also used : BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) Grid(com.google.gwt.user.client.ui.Grid) Label(com.google.gwt.user.client.ui.Label) Image(com.google.gwt.user.client.ui.Image) ColumnFormatter(com.google.gwt.user.client.ui.HTMLTable.ColumnFormatter)

Example 7 with NetworkInterfaceModel

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()));
        }
    }
}
Also used : EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) ImageResource(com.google.gwt.resources.client.ImageResource) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) FlexTable(com.google.gwt.user.client.ui.FlexTable) SafeStylesUtils(com.google.gwt.safecss.shared.SafeStylesUtils) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Ipv6BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol) ReportedConfiguration(org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration) Network(org.ovirt.engine.core.common.businessentities.network.Network) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv) AbstractImagePrototype(com.google.gwt.user.client.ui.AbstractImagePrototype) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) ApplicationResources(org.ovirt.engine.ui.webadmin.ApplicationResources) NetworkItemModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel) Linq(org.ovirt.engine.ui.uicommonweb.Linq) DecoratedPopupPanel(com.google.gwt.user.client.ui.DecoratedPopupPanel) ApplicationMessages(org.ovirt.engine.ui.webadmin.ApplicationMessages) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) StringHelper(org.ovirt.engine.core.compat.StringHelper) Ipv4BootProtocol(org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol) TlvSpecificType(org.ovirt.engine.core.common.businessentities.network.TlvSpecificType) Collectors(java.util.stream.Collectors) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) ReportedConfigurations(org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations) ApplicationTemplates(org.ovirt.engine.ui.webadmin.ApplicationTemplates) List(java.util.List) Widget(com.google.gwt.user.client.ui.Widget) InterfacePropertiesAccessor(org.ovirt.engine.ui.uicommonweb.models.hosts.InterfacePropertiesAccessor) NetworkLabelModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) HostSetupNetworksModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostSetupNetworksModel) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv)

Example 8 with NetworkInterfaceModel

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);
}
Also used : NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel)

Example 9 with NetworkInterfaceModel

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;
}
Also used : NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)

Example 10 with NetworkInterfaceModel

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;
}
Also used : BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) NetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel) BondNetworkInterfaceModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel) HashMap(java.util.HashMap) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) LogicalNetworkModel(org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel) CreateOrUpdateBond(org.ovirt.engine.core.common.action.CreateOrUpdateBond) Bond(org.ovirt.engine.core.common.businessentities.network.Bond)

Aggregations

NetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkInterfaceModel)12 BondNetworkInterfaceModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.BondNetworkInterfaceModel)11 LogicalNetworkModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.LogicalNetworkModel)6 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)5 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 NetworkItemModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkItemModel)3 NetworkLabelModel (org.ovirt.engine.ui.uicommonweb.models.hosts.network.NetworkLabelModel)3 List (java.util.List)2 Network (org.ovirt.engine.core.common.businessentities.network.Network)2 BaseCommandTarget (org.ovirt.engine.ui.uicommonweb.BaseCommandTarget)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 ImageResource (com.google.gwt.resources.client.ImageResource)1 SafeStylesUtils (com.google.gwt.safecss.shared.SafeStylesUtils)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)1 AbstractImagePrototype (com.google.gwt.user.client.ui.AbstractImagePrototype)1 DecoratedPopupPanel (com.google.gwt.user.client.ui.DecoratedPopupPanel)1