diff options
author | Elaine_Han <elaine.hanyulian@huawei.com> | 2018-08-08 18:30:11 +0800 |
---|---|---|
committer | Elaine_Han <elaine.hanyulian@huawei.com> | 2018-08-08 18:30:11 +0800 |
commit | 67d2cf8b4327e19a1e632f8fd38a05b3184a0e7e (patch) | |
tree | 1ced4900983f920c5d57ffdf2682c28313897ad7 /bpmn/so-bpmn-infrastructure-flows/src/main/groovy | |
parent | 3421ba5202d2f99756b66871c1653e889f947e28 (diff) |
Save sppartner to AAI and call ExternalAPI bug fix
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa70000005
Issue-ID: SO-683
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-flows/src/main/groovy')
2 files changed, 22 insertions, 9 deletions
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<String, String> 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 """<sp-partner xmlns=\"${namespace}\"> <id>${sppartnerId}</id> <url>${sppartnerUrl}</url> - <callSource>${callSource}</callSource> - <service-instance> - <service-instance-id>${serviceInstanceId}</service-instance-id> - </service-instance> - </sp-partner>""".trim() + <callsource>${callSource}</callsource> + <relationship-list> + <relationship> + <related-to>service-instance</related-to> + <related-link>/aai/v14/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}</related-link> + <relationship-data> + <relationship-key>service-instance.service-instance-id</relationship-key> + <relationship-value>${serviceInstanceId}</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </sp-partner>""".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<String, String> 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) |