aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-10-06 17:50:28 +0300
committerIttay Stern <ittay.stern@att.com>2019-10-06 18:55:05 +0300
commit72ee71bd853417415cba5926a73faae092ee83b5 (patch)
tree24b78f52773c113c544d7388f1740e1b79680a52 /vid-app-common/src/main/java/org
parentfccae62442353fea229184159a56e7a49ad3638c (diff)
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 <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org')
-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