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()));
}
}
}
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;
}
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);
}
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;
}
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;
}
Aggregations