From 72ee71bd853417415cba5926a73faae092ee83b5 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Sun, 6 Oct 2019 17:50:28 +0300 Subject: Dont filter get_vnf_data_by_globalid_and_service_type_response results Filtering happen on AAI as part of FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG. Issue-ID: VID-659 Change-Id: If43034cce545c90ac44d6d0e70bc0baa3d21283b Signed-off-by: Ittay Stern --- .../src/main/java/org/onap/vid/aai/AaiClient.java | 2 +- .../java/org/onap/vid/aai/AaiClientInterface.java | 2 +- .../java/org/onap/vid/services/AaiServiceImpl.java | 24 +++++----------------- 3 files changed, 7 insertions(+), 21 deletions(-) (limited to 'vid-app-common/src/main/java') 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 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 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 getVNFData(String globalSubscriberId, String serviceType) { AaiResponse response = aaiClient.getVNFData(globalSubscriberId, serviceType); - return filterChangeManagementVNFCandidatesResponse(response); - } - - protected AaiResponse filterChangeManagementVNFCandidatesResponse(AaiResponse response) { - - if (response != null && response.getT() != null) { - List 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 -- cgit 1.2.3-korg