Search in sources :

Example 1 with LldpInfo

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

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

the class GetTlvsByHostNicIdQuery method executeQueryCommand.

@Override
protected void executeQueryCommand() {
    String interfaceName = getNic().getName();
    setLldpVDSCommandParameters(new GetLldpVDSCommandParameters(getNic().getVdsId(), new String[] { interfaceName }));
    super.executeQueryCommand();
    Map<String, LldpInfo> lldpInfos = getQueryReturnValue().getReturnValue();
    if (lldpInfos != null) {
        LldpInfo lldpInfo = lldpInfos.get(interfaceName);
        getQueryReturnValue().setReturnValue(lldpInfo.isEnabled() ? lldpInfo.getTlvs() : null);
    }
}
Also used : LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) GetLldpVDSCommandParameters(org.ovirt.engine.core.common.vdscommands.GetLldpVDSCommandParameters)

Example 3 with LldpInfo

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

the class GetMultipleTlvsByHostIdTest method creatLldpInfoMap.

private Map<String, LldpInfo> creatLldpInfoMap(boolean lldpEnabled) {
    LldpInfo lldpInfo = new LldpInfo();
    lldpInfo.setEnabled(lldpEnabled);
    lldpInfo.setTlvs(new ArrayList<>(Arrays.asList(new Tlv())));
    Map<String, LldpInfo> lldpInfoMap = new HashMap<>();
    IntStream.range(0, RANGE).forEach(index -> lldpInfoMap.put("eth" + index, lldpInfo));
    return lldpInfoMap;
}
Also used : HashMap(java.util.HashMap) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv)

Example 4 with LldpInfo

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

the class GetTlvsByHostNicIdQueryTest method creatLldpInfoMap.

Map<String, LldpInfo> creatLldpInfoMap(boolean lldpEnabled) {
    LldpInfo lldpInfo = new LldpInfo();
    lldpInfo.setEnabled(lldpEnabled);
    lldpInfo.setTlvs(new ArrayList<Tlv>(Arrays.asList(new Tlv())));
    Map<String, LldpInfo> lldpInfoMap = new HashMap<>();
    lldpInfoMap.put(NIC_NAME, lldpInfo);
    return lldpInfoMap;
}
Also used : HashMap(java.util.HashMap) LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv)

Example 5 with LldpInfo

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

the class GetLldpVDSCommand method parseLldpInfo.

private LldpInfo parseLldpInfo(Map<String, Object> lldp) {
    LldpInfo lldpInfo = new LldpInfo();
    lldpInfo.setEnabled((boolean) lldp.get(VdsProperties.LLDP_ENABLED));
    lldpInfo.setTlvs(parseTlvs((Object[]) lldp.get(VdsProperties.LLDP_TLVS)));
    return lldpInfo;
}
Also used : LldpInfo(org.ovirt.engine.core.common.businessentities.network.LldpInfo)

Aggregations

LldpInfo (org.ovirt.engine.core.common.businessentities.network.LldpInfo)5 Tlv (org.ovirt.engine.core.common.businessentities.network.Tlv)3 HashMap (java.util.HashMap)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 FlexTable (com.google.gwt.user.client.ui.FlexTable)1 Widget (com.google.gwt.user.client.ui.Widget)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)1 Ipv6BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv6BootProtocol)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 ReportedConfiguration (org.ovirt.engine.core.common.businessentities.network.ReportedConfiguration)1 ReportedConfigurations (org.ovirt.engine.core.common.businessentities.network.ReportedConfigurations)1 TlvSpecificType (org.ovirt.engine.core.common.businessentities.network.TlvSpecificType)1