aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorElaine_Han <elaine.hanyulian@huawei.com>2018-08-08 18:30:11 +0800
committerElaine_Han <elaine.hanyulian@huawei.com>2018-08-08 18:30:11 +0800
commit67d2cf8b4327e19a1e632f8fd38a05b3184a0e7e (patch)
tree1ced4900983f920c5d57ffdf2682c28313897ad7 /bpmn
parent3421ba5202d2f99756b66871c1653e889f947e28 (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')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy23
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy8
3 files changed, 23 insertions, 9 deletions
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\": <serviceState>,\n" +
"\t\t\t\"name\": <serviceName>,\n" +
+ "\t\t\t\"serviceType\": <serviceType>,\n" +
"\t\t\t\"serviceSpecification\": { \n" +
"\t\t\t\t\"id\": <serviceUuId> \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<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)