aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Tabedzki <richard.tabedzki@att.com>2017-05-04 07:33:57 +0000
committerRich Tabedzki <richard.tabedzki@att.com>2017-05-04 07:34:54 +0000
commitdd1a88c29ba7fd4c30c29b54389be1084725a38d (patch)
tree8eff829f78e54ed2fef0bcd0c328f7e36e555822
parent7e0c209c8f74c7af614e4bc0f0d8e0d04c182474 (diff)
[SDNC-9] summary
added custom query, removed deprecated features Change-Id: If44dcd154ef26b7ea146d31e8dc0c18d117c6ff8 Signed-off-by: Rich Tabedzki <richard.tabedzki@att.com>
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java3
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java3
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java4
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java85
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java (renamed from aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/FormattedQueryRequest.java)6
-rw-r--r--aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java4
6 files changed, 10 insertions, 95 deletions
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java
index 7a1077a..fe358df 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIClient.java
@@ -41,9 +41,6 @@ import org.openecomp.aai.inventory.v10.*;
public interface AAIClient extends SvcLogicResource, SvcLogicJavaPlugin {
- // Availability Zone
- public SdnZoneResponse requestSdnZoneQuery(String service_type, String vnf_type, String physical_location) throws AAIServiceException;
-
// VCE
public boolean postNetworkVceData(String vnf_id, Vce request) throws AAIServiceException;
public Vce requestNetworkVceData(String vnf_id) throws AAIServiceException;
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java
index a1bae3d..5d5c6d8 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIDeclarations.java
@@ -100,9 +100,6 @@ public abstract class AAIDeclarations implements AAIClient {
public static final String VNF_IMAGE_QUERY_PATH = "org.openecomp.sdnc.sli.aai.path.vnf.image.query";
- public static final String QUERY_FORMAT = "org.openecomp.sdnc.sli.aai.param.format";
- public static final String PARAM_VNF_TYPE = "org.openecomp.sdnc.sli.aai.param.vnf_type";
- public static final String PARAM_PHYS_LOC_ID = "org.openecomp.sdnc.sli.aai.param.physical.location.id";
public static final String PARAM_SERVICE_TYPE = "org.openecomp.sdnc.sli.aai.param.service.type";
public static final String CERTIFICATE_HOST_ERROR = "org.openecomp.sdnc.sli.aai.host.certificate.ignore";
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java
index a237d84..4badf22 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIRequest.java
@@ -113,8 +113,8 @@ public abstract class AAIRequest {
return new NamedQueryRequest();
case "nodes-query":
return new NodesQueryRequest();
- case "formatted-query":
- return new FormattedQueryRequest();
+ case "custom-query":
+ return new CustomQueryRequest();
case "linterface":
return new LInterfaceRequest(LInterfaceRequest.TYPE.L2_BRIDGE_SBG);
case "l2-bridge-sbg":
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java
index 8c917e9..f316ead 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/AAIService.java
@@ -122,9 +122,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
private final String vnf_image_query_path;
- private final String param_format; //= "filter=%s:%s";
- private final String param_vnf_type; //= "vnf-type";
- private final String param_physical_location_id; //= "physical-location-id";
private final String param_service_type; //= "service-type";
private final String ubb_notify_path;
@@ -231,9 +228,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
svc_inst_qry_path = props.getProperty(SVC_INST_QRY_PATH); // "/aai/v1/search/generic-query?key=service-instance.service-instance-id:{svc-instance-id}&start-node-type=service-instance&include=service-instance");
- param_format = props.getProperty(QUERY_FORMAT, "filter=%s:%s");
- param_vnf_type = props.getProperty(PARAM_VNF_TYPE, "vnf-type");
- param_physical_location_id = props.getProperty(PARAM_PHYS_LOC_ID, "physical-location-id");
param_service_type = props.getProperty(PARAM_SERVICE_TYPE, "service-type");
// P-Interfaces
@@ -383,67 +377,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
return con;
}
- /* (non-Javadoc)
- * @see org.openecomp.sdnc.sli.resource.aic.AnAIClient#requestSdnZoneQuery(java.lang.String, java.lang.String, java.lang.String)
- */
- @Override
- public SdnZoneResponse requestSdnZoneQuery(String service_type, String vnf_type, String physical_location) throws AAIServiceException {
- SdnZoneResponse response = null;
- InputStream inputStream = null;
-
- try {
- URL http_req_url = getRequestURL(service_type, vnf_type, physical_location);
-
- HttpURLConnection con = getConfiguredConnection(http_req_url, HttpMethod.GET);
-
- LOGwriteFirstTrace(HttpMethod.GET, http_req_url.toString());
- LOGwriteDateTrace("service_type", service_type);
- LOGwriteDateTrace("vnf_type", vnf_type);
- LOGwriteDateTrace("physical_location", physical_location);
-
- // Check for errors
- int responseCode = con.getResponseCode();
- if (responseCode == HttpURLConnection.HTTP_OK) {
- inputStream = con.getInputStream();
- } else {
- inputStream = con.getErrorStream();
- }
-
- // Process the response
- LOG.debug("HttpURLConnection result:" + responseCode);
- if(inputStream == null) inputStream = new ByteArrayInputStream("".getBytes(StandardCharsets.UTF_8));
- BufferedReader reader = new BufferedReader( new InputStreamReader( inputStream ) );
-
- ObjectMapper mapper = getObjectMapper();
-
- if (responseCode == HttpURLConnection.HTTP_OK) {
- response = mapper.readValue(reader, SdnZoneResponse.class);
- LOGwriteEndingTrace(HttpURLConnection.HTTP_OK, "SUCCESS", mapper.writeValueAsString(response));
- } else if(responseCode == HttpURLConnection.HTTP_NOT_FOUND ) {
- LOGwriteEndingTrace(responseCode, "HTTP_NOT_FOUND", "Entry does not exist.");
- return response;
- } else {
- ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
- LOGwriteEndingTrace(responseCode, "FAILURE", mapper.writeValueAsString(errorresponse));
- throw new AAIServiceException(responseCode, errorresponse);
- }
-
- } catch(AAIServiceException aaiexc) {
- throw aaiexc;
- } catch (Exception exc) {
- LOG.warn("requestServiceInterfaceData", exc);
- throw new AAIServiceException(exc);
- } finally {
- if(inputStream != null){
- try {
- inputStream.close();
- } catch(Exception exc) {
-
- }
- }
- }
- return response;
- }
@Override
public GenericVnf requestGenericVnfData(String vnf_id) throws AAIServiceException {
@@ -675,22 +608,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
}
}
- /*
- * Supporting methosd
- */
- private URL getRequestURL(String service_type, String vnf_type, String physical_location_id) throws MalformedURLException, URISyntaxException, UnsupportedEncodingException {
-
- StringBuilder query = new StringBuilder();
- query.append("filter=vnf-type:").append(encodeQuery(vnf_type));
- query.append("&filter=service-type:").append(encodeQuery(service_type));
- query.append("&filter=physical-location-id:").append(physical_location_id);
-
- UriBuilder builder = javax.ws.rs.core.UriBuilder.fromUri(target_uri).path(query_path).replaceQuery(query.toString());
-// String y = x.build().toString();
-
- return builder.build().toURL();
-
- }
private static Properties initialize(URL url ) throws ConfigurationException {
@@ -3180,7 +3097,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
}
public void logMetricResponse(String requestId, int responseCode, String responseDescription){
- ml.logResponse(responseCode < 400 ? "SUCCESS" : "FAILURE", Integer.toBinaryString(responseCode), responseDescription);
+ ml.logResponse(responseCode < 400 ? "SUCCESS" : "FAILURE", Integer.toString(responseCode), responseDescription);
}
public void logKeyError(String keys){
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/FormattedQueryRequest.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java
index fba5bfe..7980895 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/FormattedQueryRequest.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/CustomQueryRequest.java
@@ -37,16 +37,16 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-public class FormattedQueryRequest extends AAIRequest {
+public class CustomQueryRequest extends AAIRequest {
- public static final String GENERIC_SEARCH_PATH = "com.att.sdnctl.sli.aai.query.generic";
+ public static final String GENERIC_SEARCH_PATH = "org.openecomp.sdnc.sli.aai.query.generic";
private final String generic_search_path;
public static final String FORMAT = "format";
- public FormattedQueryRequest() {
+ public CustomQueryRequest() {
String tmp_generic_search_path = configProperties.getProperty(GENERIC_SEARCH_PATH);
tmp_generic_search_path = tmp_generic_search_path.split("search")[0];
generic_search_path = tmp_generic_search_path +"query";
diff --git a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java
index 72222d9..1a281af 100644
--- a/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java
+++ b/aai-service/provider/src/main/java/org/openecomp/sdnc/sli/aai/query/FormattedQueryRequestData.java
@@ -76,4 +76,8 @@ public class FormattedQueryRequestData implements AAIDatum {
return " [start = "+start+", query = "+query+"]";
}
+ public String getResourceVersion() {
+ return null;
+ }
+
}