summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java
diff options
context:
space:
mode:
authorAmichai Hemli <amichai.hemli@intl.att.com>2019-10-09 19:16:57 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-09 19:16:57 +0000
commite02ffbb580a3a8049baae4437871129d6e37c91a (patch)
treed1ccce066b7d9913e486e3fa55da84def89adc58 /vid-app-common/src/main/java
parent43531f0fa9eb2b07bc6b3205e66ee18e0a5b4df2 (diff)
parent72ee71bd853417415cba5926a73faae092ee83b5 (diff)
Merge "Dont filter get_vnf_data_by_globalid_and_service_type_response results"
Diffstat (limited to 'vid-app-common/src/main/java')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java24
3 files changed, 7 insertions, 21 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
index 7e96c93cd..159401009 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java
@@ -459,7 +459,7 @@ public class AaiClient implements AaiClientInterface {
}
@Override
- public AaiResponse getVNFData(String globalSubscriberId, String serviceType) {
+ public AaiResponse<AaiGetVnfResponse> getVNFData(String globalSubscriberId, String serviceType) {
String payload = "{\"start\": [\"business/customers/customer/" + globalSubscriberId + SERVICE_SUBSCRIPTIONS_PATH + encodePathSegment(serviceType) +"/service-instances\"]," +
"\"query\": \"query/vnf-topology-fromServiceInstance\"}";
Response resp = doAaiPut(QUERY_FORMAT_SIMPLE, payload, false);
diff --git a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
index af5429c28..2a879e295 100644
--- a/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
+++ b/vid-app-common/src/main/java/org/onap/vid/aai/AaiClientInterface.java
@@ -65,7 +65,7 @@ public interface AaiClientInterface extends ProbeInterface {
AaiResponse getInstanceGroupsByCloudRegion(String cloudOwner, String cloudRegionId, String networkFunction);
- AaiResponse getVNFData(String globalSubscriberId, String serviceType);
+ AaiResponse<AaiGetVnfResponse> getVNFData(String globalSubscriberId, String serviceType);
AaiResponse getVNFData(String globalSubscriberId, String serviceType, String serviceInstanceId);
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index 984812103..b64a233c7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -75,7 +75,6 @@ import org.onap.vid.aai.model.RelationshipData;
import org.onap.vid.aai.model.RelationshipList;
import org.onap.vid.aai.model.Result;
import org.onap.vid.aai.model.ServiceRelationships;
-import org.onap.vid.aai.model.VnfResult;
import org.onap.vid.asdc.beans.Service;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.ServiceInstanceSearchResult;
@@ -152,6 +151,10 @@ public class AaiServiceImpl implements AaiService {
return services;
}
+ private boolean hasData(AaiResponse<?> aaiResponse) {
+ return aaiResponse != null && aaiResponse.getT() != null;
+ }
+
private boolean validateModel(Model model){
if (model == null) {
return false;
@@ -390,24 +393,7 @@ public class AaiServiceImpl implements AaiService {
@Override
public AaiResponse<AaiGetVnfResponse> getVNFData(String globalSubscriberId, String serviceType) {
AaiResponse<AaiGetVnfResponse> response = aaiClient.getVNFData(globalSubscriberId, serviceType);
- return filterChangeManagementVNFCandidatesResponse(response);
- }
-
- protected AaiResponse<AaiGetVnfResponse> filterChangeManagementVNFCandidatesResponse(AaiResponse<AaiGetVnfResponse> response) {
-
- if (response != null && response.getT() != null) {
- List<VnfResult> filteredVnfs = response.getT().results.stream()
- .filter(result -> (
- result.nodeType.equalsIgnoreCase("generic-vnf") ||
- result.nodeType.equalsIgnoreCase("service-instance")))
- .collect(Collectors.toList());
-
- AaiGetVnfResponse aaiGetVnfResponse = new AaiGetVnfResponse();
- aaiGetVnfResponse.results = filteredVnfs;
- return new AaiResponse<>(aaiGetVnfResponse, response.getErrorMessage(), response.getHttpCode());
- }
-
- return new AaiResponse<>();
+ return hasData(response) ? response : new AaiResponse<>();
}
@Override