import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpResponse;
import org.jvnet.hk2.annotations.Service;
import org.onap.holmes.common.aai.config.AaiConfig;
import org.onap.holmes.common.aai.entity.VmEntity;
import org.jvnet.hk2.annotations.Service;
import org.onap.holmes.common.aai.config.AaiConfig;
import org.onap.holmes.common.aai.entity.VmEntity;
private String getVmUrl(String vserverId, String vserverName) throws CorrelationException {
String url = "";
String resourceLinkUrl = getVmResourceLinks(vserverId, vserverName);
private String getVmUrl(String vserverId, String vserverName) throws CorrelationException {
String url = "";
String resourceLinkUrl = getVmResourceLinks(vserverId, vserverName);
- String baseUrl = getBaseUrl("");
- if (baseUrl.startsWith("http")) {
- url = baseUrl + getMsbSuffixAddr(resourceLinkUrl);
- } else {
- url = baseUrl + resourceLinkUrl;
- }
- return url;
+ return getBaseUrl("") + resourceLinkUrl;
}
private String getVmResourceLinks(String vserverId, String vserverName) throws CorrelationException {
String response = getResourceLinksResponse(vserverId, vserverName);
List linkList = aaiResponseUtil.convertJsonToVmResourceLink(response);
}
private String getVmResourceLinks(String vserverId, String vserverName) throws CorrelationException {
String response = getResourceLinksResponse(vserverId, vserverName);
List linkList = aaiResponseUtil.convertJsonToVmResourceLink(response);
return aaiResponseUtil.convertJsonToVmResourceLink(response).get(0).getResourceLink();
}
return "";
}
private String getResourceLinksResponse(String vserverId, String vserverName) throws CorrelationException {
return aaiResponseUtil.convertJsonToVmResourceLink(response).get(0).getResourceLink();
}
return "";
}
private String getResourceLinksResponse(String vserverId, String vserverName) throws CorrelationException {
response = getResponse(url);
}
return response;
}
private String getVnfDataResponse(String vnfId, String vnfName) throws CorrelationException {
response = getResponse(url);
}
return response;
}
private String getVnfDataResponse(String vnfId, String vnfName) throws CorrelationException {
- HttpResponse httpResponse = HttpsUtils.get(url, getHeaders());
+ httpClient = HttpsUtils.getHttpClient(HttpsUtils.DEFUALT_TIMEOUT);
+ HttpResponse httpResponse = HttpsUtils.get(httpGet, getHeaders(), httpClient);
response = HttpsUtils.extractResponseEntity(httpResponse);
} catch (Exception e) {
throw new CorrelationException("Failed to get data from aai", e);
response = HttpsUtils.extractResponseEntity(httpResponse);
} catch (Exception e) {
throw new CorrelationException("Failed to get data from aai", e);