Search in sources :

Example 1 with Tlv

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

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

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

the class GetTlvsByHostNicIdQueryTest method testExecuteQueryCommandSucess.

@Test
public void testExecuteQueryCommandSucess() {
    setup(ExpectedError.SUCCESS);
    getQuery().executeQueryCommand();
    List returnValue = getQuery().getQueryReturnValue().getReturnValue();
    assertNotNull(returnValue);
    assertTrue(returnValue.get(0) instanceof Tlv);
}
Also used : ArrayList(java.util.ArrayList) List(java.util.List) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv) Test(org.junit.Test) AbstractQueryTest(org.ovirt.engine.core.bll.AbstractQueryTest)

Example 4 with Tlv

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

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

the class BackendLinkLayerDiscoveryProtocolResourceTest method getEntityList.

protected List<Tlv> getEntityList() {
    List<Tlv> entities = new ArrayList<>();
    for (int index = 0; index < NAMES.length; index++) {
        Tlv tlv = new Tlv();
        tlv.setName(NAMES[index]);
        tlv.setType(getType(index));
        tlv.setOui(getOui(index));
        tlv.setSubtype(getSubType(index));
        tlv.getProperties().put(PROPERTY_NAME, getPropertyValue(index));
        entities.add(tlv);
    }
    return entities;
}
Also used : ArrayList(java.util.ArrayList) Tlv(org.ovirt.engine.core.common.businessentities.network.Tlv)

Aggregations

Tlv (org.ovirt.engine.core.common.businessentities.network.Tlv)7 LldpInfo (org.ovirt.engine.core.common.businessentities.network.LldpInfo)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)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 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Test (org.junit.Test)1 LinkLayerDiscoveryProtocolElements (org.ovirt.engine.api.model.LinkLayerDiscoveryProtocolElements)1 AbstractQueryTest (org.ovirt.engine.core.bll.AbstractQueryTest)1 CreateOrUpdateBond (org.ovirt.engine.core.common.action.CreateOrUpdateBond)1 Ipv4BootProtocol (org.ovirt.engine.core.common.businessentities.network.Ipv4BootProtocol)1