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