aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java14
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java29
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java15
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy290
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy308
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy113
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy33
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy90
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy60
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy274
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy41
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml3
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn42
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn4
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn207
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java49
29 files changed, 967 insertions, 737 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 669441c320..6377d77d19 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -304,6 +304,10 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
Boolean failOnCallbackError = execution.getVariable("failOnCallbackError")
if(failOnCallbackError) {
sdncAdapterBuildWorkflowException(execution, callback)
+ }else {
+ if(ackFinalIndicator.equals('Y')) {
+ sdncAdapterBuildWorkflowException(execution, callback)
+ }
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 4206596c94..3b84b150e0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -213,7 +213,8 @@ public class ExecuteBuildingBlockRainyDay {
String targetState = "";
if ("RollbackToAssigned".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_ASSIGNED.toString();
- } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)) {
+ } else if ("RollbackToCreated".equalsIgnoreCase(handlingCode)
+ || "RollbackToCreatedNoConfiguration".equalsIgnoreCase(handlingCode)) {
targetState = Status.ROLLED_BACK_TO_CREATED.toString();
} else {
targetState = Status.ROLLED_BACK.toString();
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 843cca0848..43db27917e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -232,6 +232,20 @@ public class ExceptionBuilder {
throw new BpmnError("MSOWorkflowException");
}
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
+ ONAPComponentsList extSystemErrorSource, String workStep) {
+ String processKey = getProcessKey(execution);
+ logger.info("Building a WorkflowException for Subflow");
+
+ WorkflowException exception =
+ new WorkflowException(processKey, errorCode, errorMessage, workStep, extSystemErrorSource);
+ execution.setVariable("WorkflowException", exception);
+ execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
+ logger.info("Outgoing WorkflowException is {}", exception);
+ logger.info("Throwing MSOWorkflowException");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
public WorkflowException buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
ONAPComponentsList extSystemErrorSource) {
String processKey = getProcessKey(execution);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
index ee47b514d1..b34d9dce9c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
@@ -259,6 +259,35 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest {
assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
}
+ @Test
+ public void queryRainyDayTableRollbackToCreatedNoConfiguration() throws Exception {
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ serviceInstance.getModelInfoServiceInstance().setServiceType("st1");
+ vnf.setVnfType("vnft1");
+ BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock);
+ delegateExecution.setVariable("buildingBlock", executeBuildingBlock);
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("suppressRollback", false);
+ delegateExecution.setVariable("WorkflowExceptionCode", "7000");
+ RainyDayHandlerStatus rainyDayHandlerStatus = new RainyDayHandlerStatus();
+ rainyDayHandlerStatus.setErrorCode("7000");
+ rainyDayHandlerStatus.setFlowName("AddFabricConfigurationBB");
+ rainyDayHandlerStatus.setServiceType("st1");
+ rainyDayHandlerStatus.setVnfType("vnft1");
+ rainyDayHandlerStatus.setPolicy("RollbackToCreatedNoConfiguration");
+ rainyDayHandlerStatus.setWorkStep(ASTERISK);
+ rainyDayHandlerStatus.setSecondaryPolicy("Abort");
+
+ doReturn(rainyDayHandlerStatus).when(MOCK_catalogDbClient).getRainyDayHandlerStatus("AddFabricConfigurationBB",
+ "st1", "vnft1", "7000", "*", "errorMessage", "*");
+
+ executeBuildingBlockRainyDay.queryRainyDayTable(delegateExecution, true);
+
+ assertEquals("RollbackToCreatedNoConfiguration", delegateExecution.getVariable("handlingCode"));
+ assertEquals(Status.ROLLED_BACK_TO_CREATED.toString(), delegateExecution.getVariable("rollbackTargetState"));
+ }
+
@Test
public void suppressRollbackTest() throws Exception {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
index 5baafbba67..b7e4dd98d8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -22,6 +22,7 @@
package org.onap.so.client.exception;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
@@ -39,6 +40,7 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.WorkflowException;
import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
@@ -95,4 +97,17 @@ public class ExceptionBuilderUnitTest {
thrown.expect(BpmnError.class);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
}
+
+ @Test
+ public void buildAndThrowWorkflowExceptionWithWorkStepTest() {
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+
+ try {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC,
+ "WORKSTEP");
+ } catch (BpmnError e) {
+ }
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals("WORKSTEP", workflowException.getWorkStep());
+ }
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index f2e0ce29ff..5fd9701880 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -95,7 +95,7 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"||execution.getVariable("handlingCode")=="RollbackToCreatedNoConfiguration"}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 5dad9b8687..ebc0264c7e 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -143,17 +143,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
index c7fe7e36a6..eabe58488e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
@@ -32,150 +32,148 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class ActivateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="ActSS"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //NSSI ID
- String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
- if (isBlank(serviceInstanceID)) {
- msg = "Input serviceInstanceID is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceInstanceID", serviceInstanceID)
- }
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- //operationType = deactivateInstance/activateInstance
- String operationType = execution.getVariable("requestAction")
- if (isBlank(operationType)) {
- msg = "Input operationType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("operationType", operationType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in ActivateSliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType(operationType)
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String activateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + activateSyncResponse)
- sendWorkflowResponse(execution, 202, activateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
-
+ String Prefix="ActivateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //NSSI ID
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ //operationType = deactivateInstance/activateInstance
+ String operationType = execution.getVariable("requestAction")
+ if (isBlank(operationType)) {
+ msg = "Input operationType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("operationType", operationType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ActivateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ String operationType = execution.getVariable("operationType")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType(operationType)
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String activateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + activateSyncResponse)
+ sendWorkflowResponse(execution, 202, activateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
index 5a7722d679..9100f2773b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
@@ -33,158 +33,158 @@ import static org.apache.commons.lang3.StringUtils.isBlank
class AllocateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="ASS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
- JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger(AllocateSliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //modelInfo
- String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
- if (isBlank(modelInvariantUuid)) {
- msg = "Input modelInvariantUuid is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- }
-
- logger.debug("modelInvariantUuid: " + modelInvariantUuid)
-
- String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
- if (isBlank(modelUuid)) {
- msg = "Input modelUuid is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("modelUuid", modelUuid)
- }
-
- logger.debug("modelUuid: " + modelUuid)
-
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
- String dummyServiceId = new UUID(0,0).toString();
- execution.setVariable("dummyServiceId", dummyServiceId)
- logger.debug("dummyServiceId: " + dummyServiceId)
- String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
- execution.setVariable("servicename", servicename)
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in AllocateSliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("dummyServiceId")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType("Allocate")
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
- sendWorkflowResponse(execution, 202, allocateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
-
+ String Prefix="AllocateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private static final Logger logger = LoggerFactory.getLogger(AllocateSliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //modelInfo
+ String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
+ if (isBlank(modelInvariantUuid)) {
+ msg = "Input modelInvariantUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ }
+
+ logger.debug("modelInvariantUuid: " + modelInvariantUuid)
+
+ String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
+ if (isBlank(modelUuid)) {
+ msg = "Input modelUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("modelUuid", modelUuid)
+ }
+
+ logger.debug("modelUuid: " + modelUuid)
+
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+ String dummyServiceId = new UUID(0,0).toString();
+ execution.setVariable("dummyServiceId", dummyServiceId)
+ logger.debug("dummyServiceId: " + dummyServiceId)
+ String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
+ execution.setVariable("servicename", servicename)
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in AllocateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("dummyServiceId")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType("Allocate")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
+ sendWorkflowResponse(execution, 202, allocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
index 964baa7a9d..65885f3516 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
@@ -32,14 +32,13 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="DeASS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
-
- @Override
+ String Prefix="DeAllocateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
+
+ @Override
void preProcessRequest(DelegateExecution execution) {
logger.debug(Prefix + "preProcessRequest Start")
execution.setVariable("prefix", Prefix)
@@ -62,8 +61,8 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
} else {
execution.setVariable("globalSubscriberId", globalSubscriberId)
}
-
- //NSSI ID
+
+ //NSSI ID
String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
if (isBlank(serviceInstanceID)) {
msg = "Input serviceInstanceID is null"
@@ -73,27 +72,27 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
{
execution.setVariable("serviceInstanceID", serviceInstanceID)
}
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
//requestParameters, subscriptionServiceType is 5G
String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
if (isBlank(subscriptionServiceType)) {
@@ -106,9 +105,9 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
String jobId = UUID.randomUUID().toString()
execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
} catch(BpmnError e) {
throw e
@@ -131,13 +130,13 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
+ String nsiId = execution.getVariable("nsiId")
logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
ResourceOperationStatus initStatus = new ResourceOperationStatus()
initStatus.setServiceId(serviceId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setResourceTemplateUUID(nsiId)
initStatus.setOperType("Deallocate")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
@@ -145,26 +144,26 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
}
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
- sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
+ sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
index 0900863a62..e5c9514fa5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
@@ -158,7 +158,7 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 88014e7b54..3e834fa7bb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusResponse
import org.onap.so.beans.nsmf.NssiResponse
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.beans.nsmf.ResponseDescriptor
@@ -17,7 +18,6 @@ import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
class DoAllocateNSSI extends AbstractServiceTaskProcessor {
@@ -34,7 +34,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
private static final NSSMF_ALLOCATE_URL = "/api/rest/provMns/v1/NSS/SliceProfiles"
- private static final NSSMF_QUERY_JOB_STATUS_URL = "/NSS/jobs/%s"
+ private static final NSSMF_QUERY_JOB_STATUS_URL = "/api/rest/provMns/v1/NSS/jobs/%s"
@Override
void preProcessRequest(DelegateExecution execution) {
@@ -64,11 +64,12 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL,
objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String respBody = responseEntity.getBody()
- NssiResponse result = objectMapper.readValue(respBody, NssiResponse.class)
- //todo: if success
- //todo:
+
+ if (response != null) {
+ NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class)
+ execution.setVariable("nssiAllocateResult", nssiResponse)
+ }
+
execution.setVariable("serviceInfo", nbiRequest.getServiceInfo())
execution.setVariable("esrInfo", nbiRequest.getEsrInfo())
}
@@ -96,13 +97,14 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
String response =
nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest))
- ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class)
- String result = responseEntity.getBody()
- //todoï¼›if success
- ResponseDescriptor responseDescriptor = objectMapper.readValue(result, ResponseDescriptor.class)
+ if (response != null) {
+ JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class)
+ execution.setVariable("nssiAllocateStatus", jobStatusResponse)
- //todo: handle status
- execution.setVariable("nssiAllocateResult", responseDescriptor)
+ if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+ execution.setVariable("jobFinished", true)
+ }
+ }
}
void prepareUpdateOrchestrationTask(DelegateExecution execution) {
@@ -111,10 +113,10 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor
+ JobStatusResponse jobStatusResponse = execution.getVariable("nssiAllocateStatus") as JobStatusResponse
+ ResponseDescriptor response = jobStatusResponse.getResponseDescriptor()
SubnetType subnetType = execution.getVariable("subnetType") as SubnetType
-
SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo
sliceTaskInfo.progress = response.getProgress()
sliceTaskInfo.status = response.getStatus()
@@ -127,6 +129,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("sliceTaskInfo", sliceTaskInfo)
+
logger.debug("Finish prepareUpdateOrchestrationTask progress")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index 8993127dbc..1d5232f3c5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -95,7 +95,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
List<TemplateInfo> nsstInfos = new ArrayList<>()
ServiceDecomposition nstServiceDecomposition =
execution.getVariable("nstServiceDecomposition") as ServiceDecomposition
- //todo:
+
List<AllottedResource> allottedResources = nstServiceDecomposition.getAllottedResources()
for (AllottedResource allottedResource : allottedResources) {
TemplateInfo nsstInfo = new TemplateInfo()
@@ -150,9 +150,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.setVariable("nsstServiceDecompositions", nsstServiceDecompositions)
-
-
-
int num = execution.getVariable("maxNsstIndex") as Integer
int index = execution.getVariable("currentNsstIndex") as Integer
@@ -180,8 +177,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
List<SubnetCapability> subnetCapabilities = new ArrayList<>()
-
-
for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) {
SubnetCapability subnetCapability = new SubnetCapability()
handleByType(execution, serviceDecomposition, sliceParams, subnetCapability)
@@ -206,7 +201,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnBHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
sliceParams.tnBHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
-
break
case SubnetType.TN_MH:
sliceParams.tnMHSliceTaskInfo.vendor = vendor
@@ -215,7 +209,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
sliceParams.tnMHSliceTaskInfo.NSSTInfo.UUID = modelInfo.getModelUuid()
sliceParams.tnMHSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid()
sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName()
-
break
case SubnetType.AN_NF:
sliceParams.anSliceTaskInfo.vendor = vendor
@@ -236,9 +229,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
default:
subnetType = null
break
-
- //todo
-
}
if (null == subnetType) {
def msg = "Get subnetType failed, modelUUId=" + modelInfo.getModelUuid()
@@ -297,17 +287,16 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
private static String buildQuerySubnetCapRequest(String vendor, SubnetType subnetType) {
NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
- List<String> subnetTypes = new ArrayList<>()
- subnetTypes.add(subnetType.subnetType)
+// List<String> subnetTypes = new ArrayList<>()
+// subnetTypes.add(subnetType.subnetType)
Map<String, Object> paramMap = new HashMap()
- paramMap.put("subnetTypes", subnetTypes)
+ paramMap.put("subnetType", subnetType.subnetType)
request.setSubnetCapabilityQuery(objectMapper.writeValueAsString(paramMap))
EsrInfo esrInfo = new EsrInfo()
esrInfo.setVendor(vendor)
esrInfo.setNetworkType(subnetType.networkType)
-
request.setEsrInfo(esrInfo)
String strRequest = objectMapper.writeValueAsString(request)
@@ -320,7 +309,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
* prepare select nsi request
* @param execution
*/
- public void preNSIRequest(DelegateExecution execution, boolean preferReuse) {
+ public void preNSIRequest(DelegateExecution execution) {
+ boolean preferReuse = execution.getVariable("needQuerySliceProfile") ? false : true
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
@@ -378,8 +368,9 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
if (isSharable && solution.get("existingNSI")) {
//sharedNSISolution
processSharedNSI(solution, sliceTaskParams)
+ execution.setVariable("needQuerySliceProfile", true)
}
- else if(solution.containsKey("newNSISolution")) {
+ else {
processNewNSI(solution, sliceTaskParams)
}
}
@@ -395,6 +386,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
String nsiName = sharedNSISolution.get("NSIName")
sliceParams.setSuggestNsiId(nsiId)
sliceParams.setSuggestNsiName(nsiName)
+
}
private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
index 0f1bf0d8b4..7beafefc28 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
@@ -23,12 +23,10 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.SliceProfile
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
@@ -38,6 +36,7 @@ import org.slf4j.LoggerFactory
class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
+ final String AAI_VERSION = "v21"
JsonUtils jsonUtil = new JsonUtils()
TnNssmfUtils tnNssmfUtils = new TnNssmfUtils()
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -67,23 +66,26 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
void createSliceProfile(DelegateExecution execution) {
- String sliceserviceInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
String sliceProfileStr = execution.getVariable("sliceProfile")
String sliceProfileId = UUID.randomUUID().toString()
SliceProfile sliceProfile = new SliceProfile();
sliceProfile.setProfileId(sliceProfileId)
sliceProfile.setLatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
sliceProfile.setResourceSharingLevel(jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel"))
- sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)) //TODO: should be list
+ //sliceProfile.setSNssai(tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr))
- sliceProfile.setE2ELatency(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "latency")))
sliceProfile.setMaxBandwidth(Integer.parseInt(jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth")))
- //TODO: new API
- sliceProfile.setReliability(new Object())
+ //sliceProfile.setReliability(new Object())
try {
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceserviceInstanceId).sliceProfile(sliceProfileId))
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId)
+ .sliceProfile(sliceProfileId))
client.create(uri, sliceProfile)
} catch (BpmnError e) {
@@ -112,20 +114,25 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
ss.setOrchestrationStatus(serviceStatus)
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
- ss.setModelInvariantId(modelInvariantUuid)
- ss.setModelVersionId(modelUuid)
+ //TODO: need valid model ID from the caller, as AAI does not accept invalid IDs
+ //ss.setModelInvariantId(modelInvariantUuid)
+ //ss.setModelVersionId(modelUuid)
String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
ss.setServiceInstanceLocationId(serviceInstanceLocationid)
String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
ss.setEnvironmentContext(snssai)
ss.setServiceRole(serviceRole)
AAIResourcesClient client = getAAIClient()
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId))
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId))
client.create(uri, ss)
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
- String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance. " + ex.getMessage()
+ String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance: " + ex.getMessage()
logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -133,17 +140,19 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
void createAllottedResource(DelegateExecution execution) {
- String serviceInstanceId = execution.getVariable('sliceServiceInstanceId')
-
- AAIResourcesClient resourceClient = getAAIClient()
- AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+ String ssInstanceId = execution.getVariable('sliceServiceInstanceId')
try {
List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportSliceNetworks"))
for (String networkStr : networkStrList) {
String allottedResourceId = UUID.randomUUID().toString()
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("sliceserviceInstanceId")).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(execution.getVariable("sliceServiceInstanceId"))
+ .allottedResource(allottedResourceId))
execution.setVariable("allottedResourceUri", allottedResourceUri)
String modelInvariantId = execution.getVariable("modelInvariantUuid")
String modelVersionId = execution.getVariable("modelUuid")
@@ -152,27 +161,37 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
resource.setId(allottedResourceId)
resource.setType("TsciNetwork")
resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName"))
- resource.setModelInvariantId(modelInvariantId)
- resource.setModelVersionId(modelVersionId)
getAAIClient().create(allottedResourceUri, resource)
- //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(Types.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build())
- //getAAIClient().connect(allottedResourceUri,ssServiceuri)
- //execution.setVariable("aaiARPath", allottedResourceUri.build().toString());
String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
- createLogicalLinksForAllocatedResource(execution, linkArrayStr, serviceInstanceId, allottedResourceId)
+ createLogicalLinksForAllocatedResource(execution, linkArrayStr, ssInstanceId, allottedResourceId)
}
-
+ } catch (BpmnError e) {
+ throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage())
+ String msg = "Exception in DoCreateTnNssiInstance.createAllottedResource: " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
void createLogicalLinksForAllocatedResource(DelegateExecution execution,
- String linkArrayStr, String serviceInstanceId,
+ String linkArrayStr, String ssInstanceId,
String allottedResourceId) {
-
try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(ssInstanceId)
+ .allottedResource(allottedResourceId))
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
for (String linkStr : linkStrList) {
@@ -186,15 +205,22 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
resource.setLinkId(logicalLinkId)
resource.setLinkName(epA)
resource.setLinkName2(epB)
- resource.setModelInvariantId(modelInvariantId)
- resource.setModelVersionId(modelVersionId)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
- AAIResourceUri logicalLinkUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
getAAIClient().create(logicalLinkUri, resource)
+
+ tnNssmfUtils.attachLogicalLinkToAllottedResource(execution, AAI_VERSION, allottedResourceUri, epA);
}
+ } catch (BpmnError e) {
+ throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
- "Exception in createLogicalLinksForAllocatedResource" + ex.getMessage())
+ String msg = "Exception in DoCreateTnNssiInstance.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
index 9d6c4a1b2a..75ef7d347c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -19,8 +19,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
@@ -47,6 +47,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
private ExceptionUtil exceptionUtil = new ExceptionUtil()
private JsonUtils jsonUtil = new JsonUtils()
+ ObjectMapper objectMapper = new ObjectMapper()
private RequestDBUtil requestDBUtil = new RequestDBUtil()
private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
@@ -133,10 +134,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String nssiId = currentNSSI['nssiServiceInstanceId']
String nsiId = currentNSSI['nsiServiceInstanceId']
String scriptName = execution.getVariable("scriptName")
- boolean modifyAction = execution.getVariable("terminateNSI")
String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
+ String serviceUuid = currentNSSI['modelId']
String globalSubscriberId = currentNSSI['globalSubscriberId']
String subscriptionServiceType = execution.getVariable("serviceType")
@@ -146,37 +146,37 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
deAllocateNssi.setScriptName(scriptName)
- deAllocateNssi.setSliceProfileId(profileId)
- deAllocateNssi.setModifyAction(modifyAction)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
serviceInfo.setServiceUuid(serviceUuid)
+ serviceInfo.setNsiId(nsiId)
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ String serviceInfoString = objectMapper.writeValueAsString(serviceInfo)
EsrInfo esrInfo = getEsrInfo(currentNSSI)
+ String esrInfoString = objectMapper.writeValueAsString(esrInfo)
execution.setVariable("deAllocateNssi",deAllocateNssi)
- execution.setVariable("esrInfo",esrInfo)
- execution.setVariable("serviceInfo",serviceInfo)
+ execution.setVariable("esrInfo", esrInfoString)
+ execution.setVariable("serviceInfo", serviceInfoString)
String nssmfRequest = """
{
- "deAllocateNssi": "${execution.getVariable("deAllocateNssi") as JSONObject}",
- "esrInfo": ${execution.getVariable("esrInfo") as JSONObject},
- "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+ "deAllocateNssi": ${objectMapper.writeValueAsString(deAllocateNssi)},
+ "esrInfo": ${esrInfoString},
+ "serviceInfo": ${serviceInfoString}
}
"""
- String urlStr = String.format("/api/rest/provMns/v1/NSS/nssi/%s",nssiId)
+ String urlStr = String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s", profileId)
NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, NssiResponse.class)
if (nssmfResponse != null) {
currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
currentNSSI['jobProgress'] = 0
execution.setVariable("currentNSSI", currentNSSI)
- }
- else {
+ } else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
}
LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
@@ -190,32 +190,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
{
def currentNSSI = execution.getVariable("currentNSSI")
String jobId = currentNSSI['jobId']
- String nssiId = currentNSSI['nssiServiceInstanceId']
- String nsiId = currentNSSI['nsiServiceInstanceId']
- String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String subscriptionServiceType = execution.getVariable("serviceType")
- String sST = currentNSSI['sST']
- String PLMNIdList = currentNSSI['PLMNIdList']
- String nssiName = currentNSSI['nssiName']
-
+
execution.setVariable("responseId", "3")
- execution.setVariable("esrInfo", getEsrInfo(currentNSSI))
execution.setVariable("jobId", jobId)
-
- Map<String, ?> serviceInfoMap = new HashMap<>()
- serviceInfoMap.put("nssiId", nssiId)
- serviceInfoMap.put("nsiId", nsiId)
- serviceInfoMap.put("nssiName", nssiName)
- serviceInfoMap.put("sST", sST)
- serviceInfoMap.put("PLMNIdList", PLMNIdList)
- serviceInfoMap.put("globalSubscriberId", globalSubscriberId)
- serviceInfoMap.put("subscriptionServiceType", subscriptionServiceType)
- serviceInfoMap.put("serviceInvariantUuid", serviceInvariantUuid)
- serviceInfoMap.put("serviceUuid", serviceUuid)
-
- execution.setVariable("serviceInfo", serviceInfoMap)
}
@@ -238,8 +215,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
LOGGER.error("job progress is null or empty!")
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Job progress from NSSMF.")
}
+ def currentNSSI = execution.getVariable("currentNSSI")
int oldProgress = currentNSSI['jobProgress']
- int currentProgress = progress
+ int currentProgress = Integer.parseInt(progress)
execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
@@ -247,6 +225,8 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
currentNSSI['status'] = status
currentNSSI['statusDescription'] = statusDescription
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
}
else {
@@ -256,7 +236,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
}
catch (any)
{
- String msg = "Received a Bad Response from NSSMF." cause-"+any.getCause()"
+ String msg = "Received a Bad Response from NSSMF. cause-"+any.getCause()
LOGGER.error(any.printStackTrace())
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -309,7 +289,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String nssiServiceInstanceId = currentNSSI['nssiServiceInstanceId']
String profileId = currentNSSI['profileId']
String globalSubscriberId = currentNSSI["globalSubscriberId"]
- String serviceType = currentNSSI["serviceType"]
+ String serviceType = execution.getVariable("serviceType")
try
{
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
index a410b93d16..baf0333a19 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
@@ -162,7 +162,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
index 03a726c52c..4ff15a58c5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
@@ -387,7 +387,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
index 47489b7b84..0465a433eb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
@@ -32,142 +32,142 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class ModifySliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="MSS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //NSSI Info
- String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
- if (isBlank(serviceInstanceID)) {
- msg = "Input serviceInstanceID is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceInstanceID", serviceInstanceID)
- }
-
- String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
- execution.setVariable("servicename", servicename)
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in ModifySliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType("Modify")
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "")
- logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
- sendWorkflowResponse(execution, 202, modifySyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
+ String Prefix="ModifySliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //NSSI Info
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+
+ String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
+ execution.setVariable("servicename", servicename)
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ModifySliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType("Modify")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+ logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
+ sendWorkflowResponse(execution, 202, modifySyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
index 7d2e536af9..e856522fca 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
@@ -27,11 +27,9 @@ import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
-import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -155,7 +153,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
"modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("ssServiceModelInfo", serviceModelInfo)
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
logger.debug("Finish prepareDecomposeService")
}
@@ -186,13 +184,14 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
if (maxIndex < 1) {
String msg = "Exception in TN NSST processDecomposition. There is no NSST associated with TN NSST "
logger.info(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ } else {
+ execution.setVariable("tnNsstInfoList", nsstInfoList)
+ execution.setVariable("tnModelVersion", tnModelVersion)
+ execution.setVariable("tnModelName", tnModelName)
+ execution.setVariable("currentIndex", currentIndex)
+ execution.setVariable("maxIndex", maxIndex)
}
- execution.setVariable("tnNsstInfoList", nsstInfoList)
- execution.setVariable("tnModelVersion", tnModelVersion)
- execution.setVariable("tnModelName", tnModelName)
- execution.setVariable("currentIndex", currentIndex)
- execution.setVariable("maxIndex", maxIndex)
logger.debug("End processDecomposition")
}
@@ -334,7 +333,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
index a1b883c34e..1bb0e8aca7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
@@ -20,8 +20,11 @@
package org.onap.so.bpmn.infrastructure.scripts
-
+import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -241,4 +244,40 @@ class TnNssmfUtils {
return res
}
+
+ void createRelationShipInAAI(DelegateExecution execution, AAIResourceUri uri, Relationship relationship) {
+ logger.debug("createRelationShipInAAI Start")
+ String msg
+ AAIResourcesClient client = new AAIResourcesClient()
+ try {
+ if (!client.exists(uri)) {
+ logger.info("ERROR: createRelationShipInAAI: not exist: uri={}", uri)
+ return
+ }
+ AAIResourceUri from = ((AAIResourceUri) (uri.clone())).relationshipAPI()
+ client.create(from, relationship)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("createRelationShipInAAI Exit")
+ }
+
+ void attachLogicalLinkToAllottedResource(DelegateExecution execution, String aaiVersion, AAIResourceUri arUri,
+ String logicalLinkId) {
+
+
+ String toLink = "aai/${aaiVersion}/network/logical-links/logical-link/${logicalLinkId}"
+
+ Relationship relationship = new Relationship()
+ relationship.setRelatedLink(toLink)
+ relationship.setRelatedTo("logical-link")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+
+ createRelationShipInAAI(execution, arUri, relationship)
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index e6eb284199..a8f35986e7 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -195,17 +195,14 @@
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
- <version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
index 450faaebca..29f024991d 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/AllocateSliceSubnet.bpmn
@@ -91,13 +91,6 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="Flow_0ou7wr9" sourceRef="Activity_1hyt0pb" targetRef="Activity_1ydx2rx" />
<bpmn:sequenceFlow id="Flow_18cgkru" sourceRef="Activity_1ydx2rx" targetRef="Activity_0qlstj2" />
- <bpmn:callActivity id="CallDoAllocateTransportNSSI" name="Call TNAllocateNSSI" calledElement="DoAllocateTransportNSSI">
- <bpmn:extensionElements>
- <camunda:in source="servicename" target="servicename" />
- </bpmn:extensionElements>
- <bpmn:incoming>Flow_0g7721r</bpmn:incoming>
- <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing>
- </bpmn:callActivity>
<bpmn:sequenceFlow id="Flow_189zwjw" sourceRef="CallDoAllocateTransportNSSI" targetRef="Event_18u424w" />
<bpmn:callActivity id="CallDoAllocateCoreNSSI" name="Call CNAllocateNSSI" calledElement="DoAllocateCoreNSSI">
<bpmn:extensionElements>
@@ -118,6 +111,24 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
<bpmn:outgoing>Flow_1coedjo</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="Flow_1coedjo" sourceRef="CallDoAllocateCoreNSSI" targetRef="Event_18u424w" />
+ <bpmn:callActivity id="CallDoAllocateTransportNSSI" name="Call TNAllocateNSSI" calledElement="DoAllocateTransportNSSI">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" />
+ <camunda:in source="modelUuid" target="modelUuid" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="dummyServiceId" target="dummyServiceId" />
+ <camunda:in source="nsiId" target="nsiId" />
+ <camunda:in source="networkType" target="networkType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="sliceParams" target="sliceParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0g7721r</bpmn:incoming>
+ <bpmn:outgoing>Flow_189zwjw</bpmn:outgoing>
+ </bpmn:callActivity>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AllocateSliceSubnet">
@@ -126,8 +137,8 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
<di:waypoint x="1152" y="190" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_189zwjw_di" bpmnElement="Flow_189zwjw">
- <di:waypoint x="1080" y="300" />
- <di:waypoint x="1170" y="300" />
+ <di:waypoint x="1080" y="290" />
+ <di:waypoint x="1170" y="290" />
<di:waypoint x="1170" y="208" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_18cgkru_di" bpmnElement="Flow_18cgkru">
@@ -153,10 +164,10 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0g7721r_di" bpmnElement="Flow_0g7721r">
<di:waypoint x="890" y="215" />
- <di:waypoint x="890" y="300" />
- <di:waypoint x="980" y="300" />
+ <di:waypoint x="890" y="290" />
+ <di:waypoint x="980" y="290" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="912" y="273" width="36" height="14" />
+ <dc:Bounds x="912" y="263" width="36" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1fij4ds_di" bpmnElement="Flow_1fij4ds">
@@ -208,12 +219,13 @@ nss.prepareInitOperationStatus(execution)</bpmn:script>
<bpmndi:BPMNShape id="Activity_1ydx2rx_di" bpmnElement="Activity_1ydx2rx">
<dc:Bounds x="380" y="150" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_008nbm9_di" bpmnElement="CallDoAllocateTransportNSSI">
- <dc:Bounds x="980" y="260" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_01669p4_di" bpmnElement="CallDoAllocateCoreNSSI">
<dc:Bounds x="980" y="150" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_00awuik_di" bpmnElement="CallDoAllocateTransportNSSI">
+ <dc:Bounds x="980" y="250" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
+
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
index f4886322c2..12632dec72 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn
@@ -68,12 +68,12 @@ ex.processJavaException(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def rupScript = new TnAllocateNssi()
+def runScript = new TnAllocateNssi()
runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI started")</bpmn:script>
</bpmn:scriptTask>
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection">
<bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming>
- <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="OofTnNssiSelect" />
+ <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="TnAllocateNssi" />
</bpmn:intermediateThrowEvent>
<bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
index 1bda596c6a..7699e804b4 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
@@ -160,10 +160,11 @@ dcso.processNSIResp(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="ScriptTask_0bgvphs" name="Prepare OOF Select NSI options request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1iawj3m</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1e7iqkm</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_14o0fxe</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcso = new DoCreateSliceServiceOption()
-dcso.preNSIRequest(execution,true)</bpmn:script>
+dcso.preNSIRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_00uke3g" name=" Select NSSI ">
<bpmn:outgoing>SequenceFlow_1iawj3m</bpmn:outgoing>
@@ -190,7 +191,7 @@ dcso.handleNssiSelect(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" />
<bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" />
<bpmn:parallelGateway id="ParallelGateway_05zg916">
- <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0vfe8hp</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing>
@@ -198,7 +199,7 @@ dcso.handleNssiSelect(execution)</bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" />
<bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" />
<bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" />
- <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ParallelGateway_05zg916" />
+ <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ExclusiveGateway_015qbbq" />
<bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" />
<bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" />
<bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" />
@@ -216,212 +217,234 @@ dcso.handleNssiSelect(execution)</bpmn:script>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" />
<bpmn:sequenceFlow id="SequenceFlow_1ezi1oi" sourceRef="Task_00nfg5x" targetRef="ExclusiveGateway_0b52m39" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_015qbbq" default="SequenceFlow_0vfe8hp">
+ <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0vfe8hp</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1e7iqkm</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0vfe8hp" sourceRef="ExclusiveGateway_015qbbq" targetRef="ParallelGateway_05zg916" />
+ <bpmn:sequenceFlow id="SequenceFlow_1e7iqkm" sourceRef="ExclusiveGateway_015qbbq" targetRef="ScriptTask_0bgvphs">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("needQuerySliceProfile") == true}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption">
<bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju">
- <dc:Bounds x="400" y="140" width="100" height="80" />
+ <dc:Bounds x="470" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0c567r4_di" bpmnElement="CallActivity_0c567r4">
- <dc:Bounds x="560" y="140" width="100" height="80" />
+ <dc:Bounds x="630" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0z0dwk2_di" bpmnElement="ScriptTask_0z0dwk2">
- <dc:Bounds x="710" y="140" width="100" height="80" />
+ <dc:Bounds x="780" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1kzy63m_di" bpmnElement="SequenceFlow_1kzy63m">
- <di:waypoint x="500" y="180" />
- <di:waypoint x="560" y="180" />
+ <di:waypoint x="570" y="180" />
+ <di:waypoint x="630" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1t317y2_di" bpmnElement="SequenceFlow_1t317y2">
- <di:waypoint x="660" y="180" />
- <di:waypoint x="710" y="180" />
+ <di:waypoint x="730" y="180" />
+ <di:waypoint x="780" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0">
- <dc:Bounds x="1410" y="320" width="100" height="80" />
+ <dc:Bounds x="1560" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs">
- <dc:Bounds x="162" y="162" width="36" height="36" />
+ <dc:Bounds x="232" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="169" y="198" width="25" height="14" />
+ <dc:Bounds x="239" y="198" width="25" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0w34e57_di" bpmnElement="ScriptTask_0w34e57">
- <dc:Bounds x="230" y="140" width="100" height="80" />
+ <dc:Bounds x="300" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1fuwy35_di" bpmnElement="SequenceFlow_1fuwy35">
- <di:waypoint x="198" y="180" />
- <di:waypoint x="230" y="180" />
+ <di:waypoint x="268" y="180" />
+ <di:waypoint x="300" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1anc3ln_di" bpmnElement="CallActivity_1vzxvna">
- <dc:Bounds x="740" y="320" width="100" height="80" />
+ <dc:Bounds x="950" y="330" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1xgkaqi_di" bpmnElement="CallActivity_0melx8d">
- <dc:Bounds x="740" y="460" width="100" height="80" />
+ <dc:Bounds x="950" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_11y7ba5_di" bpmnElement="CallActivity_0otry7e">
- <dc:Bounds x="740" y="580" width="100" height="80" />
+ <dc:Bounds x="950" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1icyh1a_di" bpmnElement="Task_1m9qoo3">
- <dc:Bounds x="1410" y="460" width="100" height="80" />
+ <dc:Bounds x="1560" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x">
- <dc:Bounds x="1210" y="320" width="100" height="80" />
+ <dc:Bounds x="1360" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_12sydez_di" bpmnElement="ScriptTask_12sydez">
- <dc:Bounds x="860" y="140" width="100" height="80" />
+ <dc:Bounds x="930" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0hfiogq_di" bpmnElement="CallActivity_0hfiogq">
- <dc:Bounds x="1010" y="140" width="100" height="80" />
+ <dc:Bounds x="1080" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_14j28c2_di" bpmnElement="ScriptTask_14j28c2">
- <dc:Bounds x="1170" y="140" width="100" height="80" />
+ <dc:Bounds x="1240" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_12pvazb_di" bpmnElement="SequenceFlow_12pvazb">
- <di:waypoint x="960" y="180" />
- <di:waypoint x="1010" y="180" />
+ <di:waypoint x="1030" y="180" />
+ <di:waypoint x="1080" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1inonqp_di" bpmnElement="SequenceFlow_1inonqp">
- <di:waypoint x="1110" y="180" />
- <di:waypoint x="1170" y="180" />
+ <di:waypoint x="1180" y="180" />
+ <di:waypoint x="1240" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_1bxdugq_di" bpmnElement="IntermediateThrowEvent_1bxdugq">
- <dc:Bounds x="1482" y="162" width="36" height="36" />
+ <dc:Bounds x="1552" y="162" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1459" y="205" width="87" height="14" />
+ <dc:Bounds x="1529" y="205" width="87" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_067xdx1_di" bpmnElement="SequenceFlow_067xdx1">
- <di:waypoint x="330" y="180" />
<di:waypoint x="400" y="180" />
+ <di:waypoint x="470" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_049glzl_di" bpmnElement="SequenceFlow_049glzl">
- <di:waypoint x="1270" y="180" />
- <di:waypoint x="1320" y="180" />
+ <di:waypoint x="1340" y="180" />
+ <di:waypoint x="1390" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0zglfyw_di" bpmnElement="SequenceFlow_0zglfyw">
- <di:waypoint x="1230" y="140" />
- <di:waypoint x="1230" y="80" />
- <di:waypoint x="910" y="80" />
- <di:waypoint x="910" y="140" />
+ <di:waypoint x="1300" y="140" />
+ <di:waypoint x="1300" y="80" />
+ <di:waypoint x="980" y="80" />
+ <di:waypoint x="980" y="140" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0t4gmix_di" bpmnElement="SequenceFlow_0t4gmix">
- <di:waypoint x="810" y="180" />
- <di:waypoint x="860" y="180" />
+ <di:waypoint x="880" y="180" />
+ <di:waypoint x="930" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1tx9eou_di" bpmnElement="Task_1xqjkqx">
- <dc:Bounds x="1320" y="140" width="100" height="80" />
+ <dc:Bounds x="1390" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_16akt81_di" bpmnElement="SequenceFlow_16akt81">
- <di:waypoint x="1420" y="180" />
- <di:waypoint x="1482" y="180" />
+ <di:waypoint x="1490" y="180" />
+ <di:waypoint x="1552" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0vs5jgq_di" bpmnElement="CallActivity_0vs5jgq">
- <dc:Bounds x="360" y="460" width="100" height="80" />
+ <dc:Bounds x="410" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_12t6v71_di" bpmnElement="ScriptTask_12t6v71">
- <dc:Bounds x="490" y="460" width="100" height="80" />
+ <dc:Bounds x="580" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0bgvphs_di" bpmnElement="ScriptTask_0bgvphs">
- <dc:Bounds x="210" y="460" width="100" height="80" />
+ <dc:Bounds x="250" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_00uke3g_di" bpmnElement="IntermediateCatchEvent_00uke3g">
- <dc:Bounds x="142" y="482" width="36" height="36" />
+ <dc:Bounds x="162" y="482" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="135" y="525" width="60" height="14" />
+ <dc:Bounds x="155" y="525" width="60" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_14o0fxe_di" bpmnElement="SequenceFlow_14o0fxe">
- <di:waypoint x="310" y="500" />
- <di:waypoint x="360" y="500" />
+ <di:waypoint x="350" y="500" />
+ <di:waypoint x="410" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0nwt0ci_di" bpmnElement="SequenceFlow_0nwt0ci">
- <di:waypoint x="460" y="500" />
- <di:waypoint x="490" y="500" />
+ <di:waypoint x="510" y="500" />
+ <di:waypoint x="580" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1iawj3m_di" bpmnElement="SequenceFlow_1iawj3m">
- <di:waypoint x="178" y="500" />
- <di:waypoint x="210" y="500" />
+ <di:waypoint x="198" y="500" />
+ <di:waypoint x="250" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs">
- <dc:Bounds x="1010" y="460" width="100" height="80" />
+ <dc:Bounds x="1220" y="460" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u">
- <dc:Bounds x="905" y="475" width="50" height="50" />
+ <dc:Bounds x="1105" y="475" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d">
- <di:waypoint x="955" y="500" />
- <di:waypoint x="1010" y="500" />
+ <di:waypoint x="1155" y="500" />
+ <di:waypoint x="1220" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn">
- <di:waypoint x="840" y="620" />
- <di:waypoint x="930" y="620" />
- <di:waypoint x="930" y="525" />
+ <di:waypoint x="1050" y="620" />
+ <di:waypoint x="1130" y="620" />
+ <di:waypoint x="1130" y="525" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw">
- <di:waypoint x="840" y="500" />
- <di:waypoint x="905" y="500" />
+ <di:waypoint x="1050" y="500" />
+ <di:waypoint x="1105" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9">
- <di:waypoint x="840" y="360" />
- <di:waypoint x="930" y="360" />
- <di:waypoint x="930" y="475" />
+ <di:waypoint x="1050" y="370" />
+ <di:waypoint x="1130" y="370" />
+ <di:waypoint x="1130" y="475" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916">
- <dc:Bounds x="635" y="475" width="50" height="50" />
+ <dc:Bounds x="825" y="475" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01">
- <di:waypoint x="660" y="525" />
- <di:waypoint x="660" y="620" />
- <di:waypoint x="740" y="620" />
+ <di:waypoint x="850" y="525" />
+ <di:waypoint x="850" y="620" />
+ <di:waypoint x="950" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf">
- <di:waypoint x="685" y="500" />
- <di:waypoint x="740" y="500" />
+ <di:waypoint x="875" y="500" />
+ <di:waypoint x="950" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp">
- <di:waypoint x="660" y="475" />
- <di:waypoint x="660" y="360" />
- <di:waypoint x="740" y="360" />
+ <di:waypoint x="850" y="475" />
+ <di:waypoint x="850" y="370" />
+ <di:waypoint x="950" y="370" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1h3kdce_di" bpmnElement="SequenceFlow_1h3kdce">
- <di:waypoint x="590" y="500" />
- <di:waypoint x="635" y="500" />
+ <di:waypoint x="680" y="500" />
+ <di:waypoint x="725" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p">
- <di:waypoint x="1410" y="360" />
- <di:waypoint x="1310" y="360" />
+ <di:waypoint x="1560" y="360" />
+ <di:waypoint x="1460" y="360" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz">
- <di:waypoint x="1110" y="500" />
- <di:waypoint x="1235" y="500" />
+ <di:waypoint x="1320" y="500" />
+ <di:waypoint x="1385" y="500" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1">
- <di:waypoint x="1460" y="460" />
- <di:waypoint x="1460" y="400" />
+ <di:waypoint x="1610" y="460" />
+ <di:waypoint x="1610" y="400" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true">
- <dc:Bounds x="1235" y="475" width="50" height="50" />
+ <dc:Bounds x="1385" y="475" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1218" y="463" width="85" height="14" />
+ <dc:Bounds x="1367" y="535" width="86" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n">
- <di:waypoint x="1285" y="500" />
- <di:waypoint x="1410" y="500" />
+ <di:waypoint x="1435" y="500" />
+ <di:waypoint x="1560" y="500" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1339" y="482" width="17" height="14" />
+ <dc:Bounds x="1489" y="482" width="17" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl">
- <dc:Bounds x="1242" y="632" width="36" height="36" />
+ <dc:Bounds x="1392" y="632" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i">
- <di:waypoint x="1260" y="525" />
- <di:waypoint x="1260" y="632" />
+ <di:waypoint x="1410" y="525" />
+ <di:waypoint x="1410" y="632" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ezi1oi_di" bpmnElement="SequenceFlow_1ezi1oi">
- <di:waypoint x="1260" y="400" />
- <di:waypoint x="1260" y="475" />
+ <di:waypoint x="1410" y="400" />
+ <di:waypoint x="1410" y="475" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_015qbbq_di" bpmnElement="ExclusiveGateway_015qbbq" isMarkerVisible="true">
+ <dc:Bounds x="725" y="475" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0vfe8hp_di" bpmnElement="SequenceFlow_0vfe8hp">
+ <di:waypoint x="775" y="500" />
+ <di:waypoint x="825" y="500" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e7iqkm_di" bpmnElement="SequenceFlow_1e7iqkm">
+ <di:waypoint x="750" y="525" />
+ <di:waypoint x="750" y="620" />
+ <di:waypoint x="300" y="620" />
+ <di:waypoint x="300" y="540" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
index c107cfb53a..a745f7c50d 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
@@ -99,10 +99,11 @@ dnssi.prepareUpdateOperationStatus(execution)</bpmn:script>
<bpmn:callActivity id="Task_1x3et9h" name="Query Job Status" calledElement="QueryJobStatus">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
- <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+ <camunda:in source="esrInfo" target="esrInfo" />
+ <camunda:in source="serviceInfo" target="serviceInfo" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="responseId" target="responseId" />
+ <camunda:out source="responseDescriptor" target="responseDescriptor" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_10nogqz</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 5425b2a725..f0898ace81 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -75,6 +75,7 @@ public class WorkflowActionBBTasks {
private static final String COMPLETED = "completed";
private static final String HANDLINGCODE = "handlingCode";
private static final String ROLLBACKTOCREATED = "RollbackToCreated";
+ private static final String ROLLBACKTOCREATEDNOCONFIGURATION = "RollbackToCreatedNoConfiguration";
private static final String REPLACEINSTANCE = "replaceInstance";
private static final String VFMODULE = "VfModule";
protected String maxRetries = "mso.rainyDay.maxRetries";
@@ -334,14 +335,19 @@ public class WorkflowActionBBTasks {
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
- if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
+ if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)
+ || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) {
for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign")
&& !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
rollbackFlowsFiltered.remove(rollbackFlow);
} else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete")
- && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
- && ROLLBACKTOCREATED.equals(handlingCode)) {
+ && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
+ && (ROLLBACKTOCREATED.equals(handlingCode)
+ || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))
+ || (rollbackFlow.getBuildingBlock().getBpmnFlowName()
+ .contains("FabricConfiguration")
+ && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) {
rollbackFlowsFiltered.remove(rollbackFlow);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
index 682a0471ee..2119ced951 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java
@@ -29,6 +29,7 @@ import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulator;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -48,6 +49,9 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
private Set<String> vFModuleAction =
new HashSet<String>(Arrays.asList("VfModuleConfigAssign", "VfModuleConfigDeploy"));
+ private Set<String> pnfActions =
+ new HashSet<>(Arrays.asList("config-assign", "config-deploy", "PnfConfigAssign", "PnfConfigDeploy"));
+
@Override
public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
@@ -95,9 +99,17 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator {
boolean skipVfModule = vfc.isSkipPostInstConf();
currentSequenceSkipCheck(execution, skipVfModule);
}
- }
+ } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF")
+ && containsIgnoreCaseAction(currentBB, pnfActions)) {
+ PnfResourceCustomization pnfResourceCustomization =
+ catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(customizationUUID);
+ if (null != pnfResourceCustomization) {
+ boolean skipConfigPNF = pnfResourceCustomization.isSkipPostInstConf();
+ currentSequenceSkipCheck(execution, skipConfigPNF);
+ }
+ }
}
private boolean containsIgnoreCaseAction(ExecuteBuildingBlock currentBB, Set<String> actions) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index a7ee89f073..3290bb3dce 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -436,6 +436,40 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToCreatedNoConfigurationWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreatedNoConfiguration");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+
+ BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+ flowsToExecute.add(ebb1);
+
+ BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+ flowsToExecute.add(ebb2);
+
+ BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+ flowsToExecute.add(ebb3);
+
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+ flowsToExecute.add(ebb4);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 4);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(1, ebbs.size());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
index fb162f857b..fdf4d36c89 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java
@@ -36,6 +36,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -47,9 +48,11 @@ public class SkipCDSBuildingBlockListenerTest {
private static final String VNF_SCOPE = "VNF";
private static final String VF_SCOPE = "VFModule";
+ private static final String PNF_SCOPE = "pnf";
private static final String TEST_MODELUUID = "123456789";
private static final String VNF_TEST_ACTION = "VnfConfigAssign";
private static final String VFModule_TEST_ACTION = "VfModuleConfigAssign";
+ private static final String PNFModule_TEST_ACTION = "config-assign";
private static final String MODELCUSTOMIZATIONUUID = "123456789";
private static final String BBNAME = "ControllerExecutionBB";
private static final boolean ISFIRST = true;
@@ -63,6 +66,7 @@ public class SkipCDSBuildingBlockListenerTest {
private BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake());
private VnfResourceCustomization vnfCust = new VnfResourceCustomization();
private VfModuleCustomization vfCust = new VfModuleCustomization();
+ private PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
private BuildingBlock buildingBlock = new BuildingBlock();
@InjectMocks
@@ -166,6 +170,44 @@ public class SkipCDSBuildingBlockListenerTest {
}
+ @Test
+ public void testProcessForPNFToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
+ pnfResourceCustomization = getPnfResourceCustomization(true);
+
+ when(catalogDbClient
+ .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
+ .thenReturn(pnfResourceCustomization);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(1, actual);
+
+ }
+
+ @Test
+ public void testProcessForPNFNotToSkipCDSBB() {
+ // given
+ setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0);
+ pnfResourceCustomization = getPnfResourceCustomization(false);
+
+ when(catalogDbClient
+ .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey()))
+ .thenReturn(pnfResourceCustomization);
+
+ // when
+ skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution);
+
+ // then
+ actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ assertEquals(0, actual);
+
+ }
+
/**
* setting scope action in buildingBlock and BB current sequence in BuildingBlockExecution
*
@@ -199,4 +241,11 @@ public class SkipCDSBuildingBlockListenerTest {
return vfModuleCustomizations;
}
+ private PnfResourceCustomization getPnfResourceCustomization(boolean setSkippost) {
+ PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization();
+ pnfResourceCustomization.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID);
+ pnfResourceCustomization.setSkipPostInstConf(setSkippost);
+ return pnfResourceCustomization;
+ }
+
}