use of org.openkilda.integration.model.response.IslPath in project open-kilda by telstra.
the class IslLinkConverter method toIslLinkInfo.
public static IslLinkInfo toIslLinkInfo(final IslLink islLink) {
IslLinkInfo islLinkInfo = new IslLinkInfo();
islLinkInfo.setAvailableBandwidth(islLink.getAvailableBandwidth());
islLinkInfo.setSpeed(islLink.getSpeed());
List<IslPath> islPaths = islLink.getPath();
if (islPaths != null && !islPaths.isEmpty()) {
if (islPaths.get(0) != null) {
islLinkInfo.setSrcPort(islPaths.get(0).getPortNo());
islLinkInfo.setSrcSwitch(islPaths.get(0).getSwitchId());
}
if (islPaths.get(1) != null) {
islLinkInfo.setDstPort(islPaths.get(1).getPortNo());
islLinkInfo.setDstSwitch(islPaths.get(1).getSwitchId());
}
}
return islLinkInfo;
}
use of org.openkilda.integration.model.response.IslPath in project open-kilda by telstra.
the class IslLinkConverter method toIslLinkInfo.
/**
* To isl link info.
*
* @param islLink the isl link
* @param csNames the cs names
* @param islCostMap the isl cost map
* @return the isl link info
*/
private IslLinkInfo toIslLinkInfo(final IslLink islLink, final Map<String, String> csNames, Map<String, String> islCostMap) {
IslLinkInfo islLinkInfo = new IslLinkInfo();
islLinkInfo.setUnidirectional(true);
islLinkInfo.setAvailableBandwidth(islLink.getAvailableBandwidth());
islLinkInfo.setMaxBandwidth(islLink.getMaxBandwidth());
islLinkInfo.setDefaultMaxBandwidth(islLink.getDefaultMaxBandwidth());
islLinkInfo.setCost(islLink.getCost());
islLinkInfo.setActualState(islLink.getActualState());
islLinkInfo.setSpeed(islLink.getSpeed());
islLinkInfo.setState(islLink.getState());
islLinkInfo.setUnderMaintenance(islLink.isUnderMaintenance());
islLinkInfo.setEvacuate(islLink.isEvacuate());
islLinkInfo.setEnableBfd(islLink.isEnableBfd());
islLinkInfo.setBfdSessionStatus(islLink.getBfdSessionStatus());
List<IslPath> islPaths = islLink.getPath();
if (islPaths != null && !islPaths.isEmpty()) {
if (islPaths.get(0) != null) {
islLinkInfo.setSrcPort(islPaths.get(0).getPortNo());
islLinkInfo.setSrcSwitch(islPaths.get(0).getSwitchId());
islLinkInfo.setSrcSwitchName(switchIntegrationService.customSwitchName(csNames, islPaths.get(0).getSwitchId()));
if (islPaths.get(0).getSegmentLatency() > 0) {
islLinkInfo.setLatency(islPaths.get(0).getSegmentLatency());
}
}
if (islPaths.get(1) != null) {
islLinkInfo.setDstPort(islPaths.get(1).getPortNo());
islLinkInfo.setDstSwitch(islPaths.get(1).getSwitchId());
islLinkInfo.setDstSwitchName(switchIntegrationService.customSwitchName(csNames, islPaths.get(1).getSwitchId()));
if (islPaths.get(1).getSegmentLatency() > 0) {
islLinkInfo.setLatency(islPaths.get(1).getSegmentLatency());
}
}
}
// set isl cost
if (islCostMap.containsKey(islLinkInfo.getForwardKey())) {
islLinkInfo.setCost(islCostMap.get(islLinkInfo.getForwardKey()));
} else if (islCostMap.containsKey(islLinkInfo.getReverseKey())) {
islLinkInfo.setCost(islCostMap.get(islLinkInfo.getReverseKey()));
}
return islLinkInfo;
}
use of org.openkilda.integration.model.response.IslPath 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