Search in sources :

Example 1 with IslLink

use of org.openkilda.integration.model.response.IslLink in project open-kilda by telstra.

the class SwitchIntegrationService method getIslLinkPortsInfo.

/**
 * Gets the isl links port info.
 *
 * @return the isl links port info
 */
public List<IslLink> getIslLinkPortsInfo(final LinkProps keys) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(applicationProperties.getNbBaseUrl() + IConstants.NorthBoundUrl.GET_LINKS);
    builder = setLinkProps(keys, builder);
    String fullUri = builder.build().toUriString();
    HttpResponse response = restClientManager.invoke(fullUri, HttpMethod.GET, "", "", applicationService.getAuthHeader());
    if (RestClientManager.isValidResponse(response)) {
        List<IslLink> links = restClientManager.getResponseList(response, IslLink.class);
        return links;
    }
    return null;
}
Also used : IslLink(org.openkilda.integration.model.response.IslLink) UriComponentsBuilder(org.springframework.web.util.UriComponentsBuilder) HttpResponse(org.apache.http.HttpResponse)

Example 2 with IslLink

use of org.openkilda.integration.model.response.IslLink 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;
}
Also used : PortInfo(org.openkilda.model.PortInfo) IslLink(org.openkilda.integration.model.response.IslLink) IslPath(org.openkilda.integration.model.response.IslPath)

Aggregations

IslLink (org.openkilda.integration.model.response.IslLink)2 HttpResponse (org.apache.http.HttpResponse)1 IslPath (org.openkilda.integration.model.response.IslPath)1 PortInfo (org.openkilda.model.PortInfo)1 UriComponentsBuilder (org.springframework.web.util.UriComponentsBuilder)1