From: Elaine_Han Date: Wed, 8 Aug 2018 10:30:11 +0000 (+0800) Subject: Save sppartner to AAI and call ExternalAPI bug fix X-Git-Tag: 1.3.1~295 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F47%2F59647%2F1;p=so.git Save sppartner to AAI and call ExternalAPI bug fix Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa70000005 Issue-ID: SO-683 Signed-off-by: Yulian Han --- diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 3646f26fb6..f2f41acb6b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -63,6 +63,7 @@ class ExternalAPIUtil { "\t\t\"service\": {\n" + "\t\t\t\"serviceState\": ,\n" + "\t\t\t\"name\": ,\n" + + "\t\t\t\"serviceType\": ,\n" + "\t\t\t\"serviceSpecification\": { \n" + "\t\t\t\t\"id\": \n" + "\t\t\t},\n" + 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)