aboutsummaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-infra/src/main/java
diff options
context:
space:
mode:
authorzm330 <zhangminyj@chinamobile.com>2020-02-28 18:47:14 +0800
committerzm330 <zhangminyj@chinamobile.com>2020-02-28 18:47:28 +0800
commitc046f09ca7eb5bf91c3c7508dafc4e6d7e78f77f (patch)
treee60c70e5b4f299d2f27edde3b2dc74129e09c5ec /mso-api-handlers/mso-api-handler-infra/src/main/java
parent806a46b2f785dd6b0a453ae1a6f74f4091e2d656 (diff)
Get service model uuid from AAI in delete E2EServiceInstances
Issue-ID: SO-2368 Signed-off-by: zm330 <zhangminyj@chinamobile.com> Change-Id: I1208da1ed2bd534172c3ab996a9767cae484befb
Diffstat (limited to 'mso-api-handlers/mso-api-handler-infra/src/main/java')
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java22
1 files changed, 16 insertions, 6 deletions
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index 0bcb0f1c86..ef51ebe9de 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -23,11 +23,7 @@
package org.onap.so.apihandlerinfra;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
@@ -38,6 +34,12 @@ import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.apihandlerinfra.e2eserviceinstancebeans.*;
+import org.onap.aai.domain.yang.v16.ServiceInstance;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -370,7 +372,15 @@ public class E2EServiceInstances {
RecipeLookupResult recipeLookupResult;
try {
// TODO Get the service template model version uuid from AAI.
- recipeLookupResult = getServiceInstanceOrchestrationURI(null, action);
+ String modelVersionId = null;
+ AAIResourcesClient client = new AAIResourcesClient();
+ AAIResourceUri url = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ e2eDelReq.getGlobalSubscriberId(), e2eDelReq.getServiceType(), instanceIdMap.get(SERVICE_ID));
+ Optional<ServiceInstance> serviceInstanceOpt = client.get(ServiceInstance.class, url);
+ if (serviceInstanceOpt.isPresent()) {
+ modelVersionId = serviceInstanceOpt.get().getModelVersionId();
+ }
+ recipeLookupResult = getServiceInstanceOrchestrationURI(modelVersionId, action);
} catch (Exception e) {
logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e);