From 67d2cf8b4327e19a1e632f8fd38a05b3184a0e7e Mon Sep 17 00:00:00 2001 From: Elaine_Han Date: Wed, 8 Aug 2018 18:30:11 +0800 Subject: Save sppartner to AAI and call ExternalAPI bug fix Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa70000005 Issue-ID: SO-683 Signed-off-by: Yulian Han --- .../scripts/Create3rdONAPE2EServiceInstance.groovy | 23 ++++++++++++++++------ .../scripts/Delete3rdONAPE2EServiceInstance.groovy | 8 +++++--- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap') diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index fb21574fdd..80e6e758c0 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -326,11 +326,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String subscriberId = execution.getVariable("globalSubscriberId") String customerRole = "" String subscriberName = "" - String referredType = execution.getVariable("serviceType") + String referredType = "Consumer" String orderItemId = "1" String action = "add" //for create String serviceState = "active" String serviceName = execution.getVariable("serviceInstanceName") + String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable("serviceInstanceId") Map valueMap = new HashMap<>() @@ -348,6 +349,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') valueMap.put("serviceName", '"' + serviceName + '"') + valueMap.put("serviceType", '"' + serviceType + '"') valueMap.put("serviceId", '"' + serviceId + '"') ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) @@ -493,6 +495,8 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String sppartnerUrl = execution.getVariable(Prefix + "SppartnerUrl") String callSource = execution.getVariable(Prefix + "CallSource") String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessSPPartnerUri(execution) @@ -502,11 +506,18 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso """ ${sppartnerId} ${sppartnerUrl} - ${callSource} - - ${serviceInstanceId} - - """.trim() + ${callSource} + + + service-instance + /aai/v14/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId} + + service-instance.service-instance-id + ${serviceInstanceId} + + + + """.trim() utils.logAudit(payload) String aai_endpoint = execution.getVariable("URN_aai_endpoint") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy index 122fd50d61..88441271b1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy @@ -56,7 +56,7 @@ import org.onap.so.rest.RESTConfig */ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRE3rdONAPESI_" + String Prefix = "CRE3rdONAPESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -249,11 +249,12 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String subscriberId = execution.getVariable("globalSubscriberId") String customerRole = "" String subscriberName = "" - String referredType = execution.getVariable("serviceType") + String referredType = "Consumer" String orderItemId = "1" String action = "delete" //for delete String serviceState = "active" String serviceName = "" + String serviceType = execution.getVariable("serviceType") String serviceId = execution.getVariable(Prefix + "ServiceInstanceId") Map valueMap = new HashMap<>() @@ -271,6 +272,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso valueMap.put("action", '"' + action + '"') valueMap.put("serviceState", '"' + serviceState + '"') valueMap.put("serviceName", '"' + serviceName + '"') + valueMap.put("serviceType", '"' + serviceType + '"') valueMap.put("serviceId", '"' + serviceId + '"') ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(this) @@ -448,7 +450,7 @@ public class Delete3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String sppartnerVersion = execution.getVariable(Prefix + "sppartnerVersion") AaiUtil aaiUriUtil = new AaiUtil(this) - String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "/${sppartnerVersion}" + String serviceAaiPath = execution.getVariable(Prefix + "serviceAaiPath") + "?resource-version=${sppartnerVersion}" APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath) int responseCode = response.getStatusCode() execution.setVariable(Prefix + "DeleteSppartnerResponseCode", responseCode) -- cgit 1.2.3-korg