aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/main')
-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