summaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2019-09-16 14:31:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-16 14:31:37 +0000
commit6e08835bcfe44b02f73d349b0d87aa3591bc45e4 (patch)
tree685e2e6c59b66908ca3341baccc5f0920bcf73fd /vid-app-common/src/main/java/org
parent616f28883879bb1eb762c6ba1bc24082bf840b24 (diff)
parenta95005030698acf9def8849f44e1649d0bcf00d8 (diff)
Merge "Add cloud-region and nf-role as an optional search criteria"
Diffstat (limited to 'vid-app-common/src/main/java/org')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/aai/AaiClient.java34
-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/controller/AaiController2.java3
3 files changed, 32 insertions, 7 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 c82f5485e..644309d95 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
@@ -289,7 +289,7 @@ public class AaiClient implements AaiClientInterface {
}
@Override
- public AaiResponse getVnfsByParamsForChangeManagement(String subscriberId, String serviceType, @Nullable String nfRole,
+ public AaiResponse<AaiGetVnfResponse> getVnfsByParamsForChangeManagement(String subscriberId, String serviceType, @Nullable String nfRole,
@Nullable String cloudRegion) {
String payloadAsString = "";
ResponseWithRequestInfo response;
@@ -302,19 +302,43 @@ public class AaiClient implements AaiClientInterface {
ExceptionUtils.rethrow(e);
}
response = doAaiPut(QUERY_FORMAT_SIMPLE, payloadAsString, false, false);
- AaiResponseWithRequestInfo aaiResponse = processAaiResponse(response, JsonNode.class, false);
+ AaiResponseWithRequestInfo<AaiGetVnfResponse> aaiResponse = processAaiResponse(response, AaiGetVnfResponse.class, false);
verifyAaiResponseValidityOrThrowExc(aaiResponse, aaiResponse.getAaiResponse().getHttpCode());
return aaiResponse.getAaiResponse();
}
private ImmutableMap<String, Serializable> getMapForAAIQueryByParams(String subscriberId,
String serviceType, @Nullable String nfRole, @Nullable String cloudRegion) {
- String nfRoleParam = nfRole != null ? "?nfRole=" + nfRole : "";
- String query = "query/vnfs-fromServiceInstance-filter" + nfRoleParam;
+ // in a case cloudRegion is null using query/vnfs-fromServiceInstance-filter,
+ // otherwise using query/vnfs-fromServiceInstance-filterByCloudRegion
+ if (nfRole != null){
+ if (cloudRegion != null){
+ return ImmutableMap.of(
+ "start", ImmutableList
+ .of("/business/customers/customer/" + subscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances"),
+ "query", "query/vnfs-fromServiceInstance-filterByCloudRegion?nfRole=" + nfRole + "&cloudRegionID=" + cloudRegion + ""
+ );
+ }else {
+ return ImmutableMap.of(
+ "start", ImmutableList
+ .of("/business/customers/customer/" + subscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances"),
+ "query", "query/vnfs-fromServiceInstance-filter?nfRole=" + nfRole + ""
+ );
+ }
+ }
+
+ if (cloudRegion != null){
+ return ImmutableMap.of(
+ "start", ImmutableList
+ .of("/business/customers/customer/" + subscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances"),
+ "query", "query/vnfs-fromServiceInstance-filterByCloudRegion?cloudRegionID=" + cloudRegion + ""
+ );
+ }
+
return ImmutableMap.of(
"start", ImmutableList
.of("/business/customers/customer/" + subscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances"),
- "query", query
+ "query", "query/vnfs-fromServiceInstance-filter"
);
}
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 8c3c66d17..af5429c28 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
@@ -103,5 +103,5 @@ public interface AaiClientInterface extends ProbeInterface {
Map<String, Properties> getCloudRegionAndTenantByVnfId(String vnfId);
- AaiResponse getVnfsByParamsForChangeManagement(String subscriberId, String serviceType, String nfRole, String cloudRegion);
+ AaiResponse<AaiGetVnfResponse> getVnfsByParamsForChangeManagement(String subscriberId, String serviceType, String nfRole, String cloudRegion);
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
index d1f7a97b5..6431282e7 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
@@ -25,6 +25,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.onap.vid.aai.AaiClientInterface;
+import org.onap.vid.aai.AaiGetVnfResponse;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.model.ModelVer;
import org.onap.vid.aai.model.Permissions;
@@ -134,7 +135,7 @@ public class AaiController2 extends VidRestrictedBaseController {
}
@GetMapping(value = "/get_vnf_data_by_globalid_and_service_type/{globalCustomerId}/{serviceType}")
- public Object getVnfDataByGlobalIdAndServiceType(
+ public AaiGetVnfResponse getVnfDataByGlobalIdAndServiceType(
@PathVariable("globalCustomerId") String globalCustomerId,
@PathVariable("serviceType") String serviceType,
@RequestParam(name="nfRole", required = false) String nfRole,