From c046f09ca7eb5bf91c3c7508dafc4e6d7e78f77f Mon Sep 17 00:00:00 2001 From: zm330 Date: Fri, 28 Feb 2020 18:47:14 +0800 Subject: Get service model uuid from AAI in delete E2EServiceInstances Issue-ID: SO-2368 Signed-off-by: zm330 Change-Id: I1208da1ed2bd534172c3ab996a9767cae484befb --- .../so/apihandlerinfra/E2EServiceInstances.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'mso-api-handlers') 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 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); -- cgit 1.2.3-korg