aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorhetengjiao <hetengjiao@chinamobile.com>2020-10-29 11:18:50 +0800
committerHE TENGJIAO <hetengjiao@chinamobile.com>2020-10-29 10:34:40 +0000
commit6b1fda49736a9a5d15385892ae5876aef07ad7bc (patch)
treeadc85410a990a446d960790c0b070b0ba1daaff5 /bpmn
parentaa859daa7e210a286aae0e496fa09b4d9c133b86 (diff)
modify subnetCapabilityQuery interface and some workflow error
Issue-ID: SO-2963 Signed-off-by: hetengjiao <hetengjiao@chinamobile.com> Change-Id: Ieda037b617f3743a28aaba30e7f22bf5df919a24
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy25
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy34
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn4
4 files changed, 41 insertions, 24 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
index 644cf5e387..1964a189f1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
@@ -95,7 +95,7 @@ class DoHandleOofRequest extends AbstractServiceTaskProcessor {
Response httpResponse = httpClient.post(oofRequest)
int responseCode = httpResponse.getStatus()
logger.debug("OOF sync response code is: " + responseCode)
- if(responseCode != 200){
+ if(responseCode < 200 || responseCode >= 300){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index 72fd052f31..5f0d412de0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.scripts
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
+import org.onap.so.serviceinstancebeans.Service
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -126,21 +127,22 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
logger.debug("modelInfo: " + serviceModelInfo)
- //requestParameters
- String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
- logger.debug("subscriptionServiceType: " + subscriptionServiceType)
+// //requestParameters
+// String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType")
+// if (isBlank(subscriptionServiceType)) {
+// msg = "Input subscriptionServiceType is null"
+// logger.debug(msg)
+// exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+// } else {
+// subscriptionServiceType = "5G"
+// execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+// }
+// logger.debug("subscriptionServiceType: " + subscriptionServiceType)
/*
* Extracting User Parameters from incoming Request and converting into a Map
*/
- Map reqMap = jsonSlurper.parseText(ssRequest)
+ Map reqMap = jsonSlurper.parseText(ssRequest) as Map
//InputParams
def userParamsList = reqMap.requestDetails?.requestParameters?.userParams
@@ -168,6 +170,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInputParams", inputMap)
execution.setVariable("uuiRequest", uuiRequest)
execution.setVariable("serviceProfile", serviceProfile)
+ execution.setVariable("subscriptionServiceType", serviceObject.get("serviceType"))
//TODO
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
index 48e1acd523..fc80a9f658 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
@@ -101,6 +101,9 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
*/
String serviceRole = "service-profile"
String serviceType = execution.getVariable("serviceType")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
Map<String, Object> serviceProfile = sliceParams.getServiceProfile()
String ssInstanceId = execution.getVariable("serviceInstanceId")
try {
@@ -121,7 +124,10 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
ss.setEnvironmentContext(snssai)
ss.setServiceRole(serviceRole)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(ssInstanceId))
client.create(uri, ss)
} catch (BpmnError e) {
throw e
@@ -139,8 +145,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
//rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString())
rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true")
rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", ssInstanceId)
- rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
- rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", subscriptionServiceType)
+ rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", globalSubscriberId)
execution.setVariable("rollbackData", rollbackData)
execution.setVariable("RollbackData", rollbackData)
logger.debug("RollbackData:" + rollbackData)
@@ -156,6 +162,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
/**
* todo: ServiceProfile params changed
*/
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
Map<String, Object> serviceProfileMap = sliceParams.getServiceProfile()
@@ -181,11 +189,11 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
serviceProfile.setSurvivalTime("0")
serviceProfile.setReliability("")
try {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId"))
- .serviceSubscription(execution.getVariable("subscriptionServiceType"))
- .serviceInstance(serviceProfileInstanceId)
- .serviceProfile(serviceProfileId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceProfileInstanceId)
+ .serviceProfile(serviceProfileId))
client.create(uri, serviceProfile)
execution.setVariable("sliceTaskParams", sliceParams)
@@ -206,15 +214,21 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
public void createAllottedResource(DelegateExecution execution) {
try {
-
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
ServiceDecomposition serviceDecomposition =
execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources()
for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) {
String allottedResourceId = UUID.randomUUID().toString()
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceId")).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceInstanceId)
+ .allottedResource(allottedResourceId))
execution.setVariable("allottedResourceUri", allottedResourceUri)
String arType = allottedResource.getAllottedResourceType()
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
index 2aa7da2cd2..f2d4d7c701 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn
@@ -44,7 +44,7 @@ dcsi.createAllottedResource(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1wafqwa</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def dcsi= new CreateSliceService()
+def dcsi = new DoCreateSliceServiceInstance()
dcsi.prepareDecomposeService(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:callActivity id="CallActivity_0svmkxh" name="Call Decompose Service" calledElement="DecomposeService">
@@ -135,4 +135,4 @@ dcsi.prepareDecomposeService(execution)</bpmn:script>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions> \ No newline at end of file
+</bpmn:definitions>