use of org.openkilda.model.PortInfo in project open-kilda by telstra.
the class PortConverter method setPortInfo.
/**
* Sets the port info.
*
* @param key the key
* @param portDetail the port detail
* @return the port info
*/
private static PortInfo setPortInfo(final String key, final PortDetail portDetail) {
PortInfo portInfo = new PortInfo();
StringBuilder currentFeatures = new StringBuilder();
if (portDetail.getCurrentFeatures() != null && portDetail.getCurrentFeatures().size() > 0) {
for (int i = 0; i < portDetail.getCurrentFeatures().size(); i++) {
if (currentFeatures.length() == 0) {
currentFeatures = currentFeatures.append(portDetail.getCurrentFeatures().get(i));
} else {
currentFeatures = currentFeatures.append("," + portDetail.getCurrentFeatures().get(i));
}
}
portInfo.setInterfacetype(currentFeatures.toString());
}
portInfo.setSwitchName(key);
portInfo.setPortNumber(portDetail.getPortNumber());
portInfo.setPortName(portDetail.getName());
if (portDetail.getState() != null && !portDetail.getState().isEmpty()) {
portInfo.setStatus(portDetail.getState().get(0));
}
return portInfo;
}
use of org.openkilda.model.PortInfo in project open-kilda by telstra.
the class StatsService method getIslPorts.
/**
* Sets the isl ports.
*
* @param portInfos
* the port infos
* @param switchid
* the switchid
* @return the list
*/
private List<PortInfo> getIslPorts(final Map<String, Map<String, Double>> portStatsByPortNo, String switchid) {
List<PortInfo> portInfos = getPortInfo(portStatsByPortNo);
List<IslLink> islLinkPorts = switchIntegrationService.getIslLinkPortsInfo(null);
String switchIdInfo = null;
if (islLinkPorts != null) {
for (IslLink islLink : islLinkPorts) {
for (IslPath islPath : islLink.getPath()) {
switchIdInfo = ("SW" + islPath.getSwitchId().replaceAll(":", "")).toUpperCase();
if (switchIdInfo.equals(switchid)) {
for (int i = 0; i < portInfos.size(); i++) {
if (portInfos.get(i).getPortNumber().equals(islPath.getPortNo().toString())) {
portInfos.get(i).setAssignmenttype("ISL");
}
}
}
}
}
}
return portInfos;
}
Aggregations