summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-08-13 15:15:51 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-13 15:15:51 +0000
commiteb802bafa4a955dcd6ddba194808dcb7e3cac291 (patch)
tree53712f2ef138325806b52ceb5b528c3df578ee38
parentd30a899340e9b43d7e0fc4ff430cf91a0aaafce8 (diff)
parent06fb1d8bc8727d476c0998ff19f90a07f14edade (diff)
Merge "SO changes for Service Intent"
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy153
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy127
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy391
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy174
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy502
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy128
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy669
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn175
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn161
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn173
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn321
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn235
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn252
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java431
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java83
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java82
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java48
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java60
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java156
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json29
24 files changed, 4397 insertions, 0 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
index c5a3701a82..c613f26c30 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V1.1__Initial_Recipe_Setup.sql
@@ -55,6 +55,14 @@ INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORC
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (20,'activateInstance','1','Custom recipe to activate/deactivate 3gpp service-instance if no custom BPMN flow is found','/mso/async/services/ActivateSliceSubnet',NULL,180,NULL,'2020-08-18 18:40:03','3d30a774-e149-11ea-87d0-0242ac130003');
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (21,'deactivateInstance','1','Custom recipe to activate/deactivate 3gpp service-instance if no custom BPMN flow is found','/mso/async/services/ActivateSliceSubnet',NULL,180,NULL,'2020-08-18 18:40:03','3d30a774-e149-11ea-87d0-0242ac130003');
+-- Recipe for Service Intent
+
+INSERT INTO `service` (`MODEL_UUID`, `MODEL_NAME`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `DESCRIPTION`, `CREATION_TIMESTAMP`, `TOSCA_CSAR_ARTIFACT_UUID`) VALUES ('6790ab0e-034f-11eb-adc1-0242ac120002','COMMON_SI_DEFAULT','6790ab0e-034f-11eb-adc1-0242ac120002','1.0','Default service for Service Intent','2021-08-18 17:40:03',NULL);
+
+INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (22,'createInstance','1','Custom recipe to create Service Intent instance if no custom BPMN flow is found','/mso/async/services/CreateServiceIntentInstance',NULL,180,NULL,'2021-08-18 17:40:03','6790ab0e-034f-11eb-adc1-0242ac120002');
+INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (23,'deleteInstance','1','Custom recipe to delete Service Intent instance if no custom BPMN flow is found','/mso/async/services/DeleteServiceIntentInstance',NULL,180,NULL,'2021-08-18 18:40:03','6790ab0e-034f-11eb-adc1-0242ac120002');
+INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (24,'updateInstance','1','Custom recipe to modify Service Intent instance if no custom BPMN flow is found','/mso/async/services/ModifyServiceIntentInstance',NULL,180,NULL,'2021-08-18 18:40:03','6790ab0e-034f-11eb-adc1-0242ac120002');
+
-- Recipe for E2E service update (R2 just support adding/deleting network service)
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (15,'updateInstance','1','Custom recipe to update E2E service-instance if no custom BPMN flow is found','/mso/async/services/UpdateCustomE2EServiceInstance',NULL,180,NULL,'2018-03-05 10:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a');
INSERT INTO `service_recipe` (`id`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `SERVICE_PARAM_XSD`, `RECIPE_TIMEOUT`, `SERVICE_TIMEOUT_INTERIM`, `CREATION_TIMESTAMP`, `SERVICE_MODEL_UUID`) VALUES (16,'scaleInstance','1','Custom recipe to scale E2E service-instance if no custom BPMN flow is found','/mso/async/services/ScaleCustomE2EServiceInstance',NULL,180,NULL,'2018-05-15 18:52:03','dfcd7471-16c7-444e-8268-d4c50d90593a');
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy
new file mode 100644
index 0000000000..303b685a38
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateServiceIntentInstance.groovy
@@ -0,0 +1,153 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class CreateServiceIntentInstance extends AbstractServiceTaskProcessor {
+
+ String Prefix = "CreateSiInstance_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ private static final Logger logger = LoggerFactory.getLogger(CreateServiceIntentInstance.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)
+
+ serviceIntentUtils.setCommonExecutionVars(execution)
+
+ //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)
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+ String siId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug
+ if (isBlank(siId)) {
+ siId = UUID.randomUUID().toString()
+ }
+
+ logger.debug("serviceInstanceID: " + modelUuid)
+ execution.setVariable("serviceInstanceID", siId)
+
+ String sST = jsonUtil.getJsonValue(subnetInstanceReq, "sst")
+ execution.setVariable("sst", sST)
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in CreateServiceIntentInstance.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 modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("serviceInstanceID")
+ logger.debug("Generated new job for Service Instance serviceId:" + modelUuid + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(nsiId) // set nsiId to this field
+ initStatus.setOperationId(jobId) // set jobId to this field
+ initStatus.setResourceTemplateUUID(modelUuid) // set modelUuid to this field
+ initStatus.setOperType("Create")
+ //initStatus.setResourceInstanceID() // set nssiId to this field
+ 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/DeleteServiceIntentInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy
new file mode 100644
index 0000000000..59cf5ee7fe
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteServiceIntentInstance.groovy
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DeleteServiceIntentInstance extends AbstractServiceTaskProcessor {
+ String Prefix = "DCLL_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+
+ private static final Logger logger = LoggerFactory.getLogger(DeleteServiceIntentInstance.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)
+
+ serviceIntentUtils.setCommonExecutionVars(execution)
+
+ 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 jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in DeAllocateSliceSubnet.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 siId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = siId
+ String modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(siId)
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(nsiId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(modelUuid)
+ initStatus.setOperType("Delete")
+ 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 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/DoCloudLeasedLineCreate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
new file mode 100644
index 0000000000..2e0f3cfd66
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy
@@ -0,0 +1,391 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+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.NetworkPolicy
+import org.onap.aai.domain.yang.ServiceInstance
+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.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor {
+
+ private static final Logger logger = LoggerFactory.getLogger(DoCloudLeasedLineCreate.class);
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String Prefix = "CLLC_"
+
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+
+ try {
+ execution.setVariable("startTime", System.currentTimeMillis())
+
+ msg = serviceIntentUtils.getExecutionInputParams(execution)
+ logger.debug("Create CLL input parameters: " + msg)
+
+ serviceIntentUtils.setSdncCallbackUrl(execution, true)
+ logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+
+ String cllId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug
+ if (isBlank(cllId)) {
+ cllId = UUID.randomUUID().toString()
+ }
+
+ String operationId = UUID.randomUUID().toString()
+ execution.setVariable("operationId", operationId)
+
+ logger.debug("Generate new CLL ID:" + cllId)
+ cllId = UriUtils.encode(cllId, "UTF-8")
+ execution.setVariable("cllId", cllId)
+
+ String cllName = execution.getVariable("servicename")
+ execution.setVariable("cllName", cllName)
+
+ String sst = execution.getVariable("sst")
+ execution.setVariable("sst", sst)
+
+ String transportNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportNetworks")
+ if (isBlank(transportNetworks)) {
+ msg = "ERROR: preProcessRequest: Input transportNetworks is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("transportNetworks", transportNetworks)
+ }
+ logger.debug("transportNetworks: " + transportNetworks)
+
+ if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
+ "enableSdnc", "enableSdnc"))) {
+ serviceIntentUtils.setEnableSdncConfig(execution)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Finish preProcessRequest")
+ }
+
+ void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String cllId = execution.getVariable("cllId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = new ServiceInstance()
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCE.getFragment(cllId))
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ void prepareUpdateJobStatus(DelegateExecution execution,
+ String status,
+ String progress,
+ String statusDescription) {
+ String cllId = execution.getVariable("cllId")
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = cllId
+ String operType = "CREATE"
+
+ ResourceOperationStatus roStatus = serviceIntentUtils.buildRoStatus(modelUuid, cllId,
+ jobId, nsiId, operType, status, progress, statusDescription)
+
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ }
+
+
+ void createServiceInstance(DelegateExecution execution) {
+
+ String serviceRole = "cll"
+ String serviceType = execution.getVariable("serviceType")
+ String cllId = execution.getVariable("cllId")
+ try {
+ org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
+ ss.setServiceInstanceId(cllId)
+ String cllName = execution.getVariable("cllName")
+ if (isBlank(cllName)) {
+ logger.error("ERROR: createServiceInstance: cllName is null")
+ cllName = cllId
+ }
+ ss.setServiceInstanceName(cllName)
+ ss.setServiceType(serviceType)
+ String serviceStatus = "created"
+ ss.setOrchestrationStatus(serviceStatus)
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ ss.setModelInvariantId(modelInvariantUuid)
+ ss.setModelVersionId(modelUuid)
+ ss.setEnvironmentContext("cll")
+ ss.setServiceRole(serviceRole)
+
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId))
+ client.create(uri, ss)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCloudLeasedLineCreate.createServiceInstance: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ void createAllottedResource(DelegateExecution execution) {
+ String cllId = execution.getVariable('cllId')
+
+ try {
+ List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks"))
+
+ for (String networkStr : networkStrList) {
+ String networkId = jsonUtil.getJsonValue(networkStr, "id")
+ String allottedResourceId = isBlank(networkId) ? UUID.randomUUID().toString() : networkId
+
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(execution.getVariable("cllId"))
+ .allottedResource(allottedResourceId))
+ execution.setVariable("allottedResourceUri", allottedResourceUri)
+ String modelInvariantId = execution.getVariable("modelInvariantUuid")
+ String modelVersionId = execution.getVariable("modelUuid")
+
+ String slaStr = jsonUtil.getJsonValue(networkStr, "sla")
+ if (slaStr == null || slaStr.isEmpty()) {
+ String msg = "ERROR: createNetworkPolicy: SLA is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource()
+ resource.setId(allottedResourceId)
+ resource.setType("TsciNetwork")
+ resource.setAllottedResourceName("network_" + allottedResourceId)
+ getAAIClient().create(allottedResourceUri, resource)
+
+ createNetworkPolicyForAllocatedResource(execution, cllId, allottedResourceId, slaStr)
+
+ String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks")
+ createLogicalLinksForAllocatedResource(execution, linkArrayStr, cllId, allottedResourceId)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCloudLeasedLineCreate.createAllottedResource: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void createNetworkPolicy(DelegateExecution execution, String cllId, String networkPolicyId, String slaStr) {
+ try {
+
+
+ NetworkPolicy networkPolicy = new NetworkPolicy();
+ networkPolicy.setNetworkPolicyId(networkPolicyId)
+ networkPolicy.setName("TSCi policy")
+ networkPolicy.setType("SLA")
+ networkPolicy.setNetworkPolicyFqdn(cllId)
+
+ String latencyStr = jsonUtil.getJsonValue(slaStr, "latency")
+ if (latencyStr != null && !latencyStr.isEmpty()) {
+ networkPolicy.setLatency(Integer.parseInt(latencyStr))
+ }
+
+ String bwStr = jsonUtil.getJsonValue(slaStr, "maxBandwidth")
+ if (bwStr != null && !bwStr.isEmpty()) {
+ networkPolicy.setMaxBandwidth(Integer.parseInt(bwStr))
+ } else {
+ logger.debug("ERROR: createNetworkPolicy: maxBandwidth is null")
+ }
+
+ //networkPolicy.setReliability(new Object())
+
+ AAIResourceUri networkPolicyUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
+ getAAIClient().create(networkPolicyUri, networkPolicy)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void createNetworkPolicyForAllocatedResource(DelegateExecution execution,
+ String cllId,
+ String allottedResourceId, String slaStr) {
+ try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId)
+ .allottedResource(allottedResourceId))
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
+ String networkPolicyId = UUID.randomUUID().toString()
+ createNetworkPolicy(execution, cllId, networkPolicyId, slaStr)
+
+ serviceIntentUtils.attachNetworkPolicyToAllottedResource(execution, serviceIntentUtils.AAI_VERSION,
+ allottedResourceUri,
+ networkPolicyId);
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void createLogicalLinksForAllocatedResource(DelegateExecution execution,
+ String linkArrayStr, String cllId,
+ String allottedResourceId) {
+ try {
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId)
+ .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) {
+ String linkId = jsonUtil.getJsonValue(linkStr, "name")
+ if (isBlank(linkId)) {
+ linkId = "cll-" + UUID.randomUUID().toString()
+ }
+ logger.debug("createLogicalLinksForAllocatedResource: linkId=" + linkId)
+
+ String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA")
+ String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB")
+ String modelInvariantId = execution.getVariable("modelInvariantUuid")
+ String modelVersionId = execution.getVariable("modelUuid")
+
+ org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+ resource.setLinkId(linkId)
+ resource.setLinkName(epA)
+ resource.setLinkName2(epB)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
+
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
+ getAAIClient().create(logicalLinkUri, resource)
+
+ serviceIntentUtils.attachLogicalLinkToAllottedResource(execution, serviceIntentUtils.AAI_VERSION,
+ allottedResourceUri, epA);
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoCloudLeasedLineCreate.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void preprocessSdncCreateCllRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ logger.trace("STARTED preProcessSDNCActivateRequest Process")
+ try {
+ String serviceInstanceId = execution.getVariable("cllId")
+
+ String createSDNCRequest = serviceIntentUtils.buildSDNCRequest(execution, serviceInstanceId, "create")
+
+ execution.setVariable("CLL_SDNCRequest", createSDNCRequest)
+ logger.debug("Outgoing SDNCRequest is: \n" + createSDNCRequest)
+
+ } catch (Exception e) {
+ logger.debug("Exception Occured Processing preProcessSDNCActivateRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002,
+ "Error Occured during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preProcessSDNCActivateRequest Process")
+ }
+
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ serviceIntentUtils.validateSDNCResponse(execution, response, method)
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy
new file mode 100644
index 0000000000..b7f206cedc
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineDelete.groovy
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+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.ServiceInstance
+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.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+
+class DoCloudLeasedLineDelete extends AbstractServiceTaskProcessor {
+ String Prefix = "DCLL_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ private static final Logger logger = LoggerFactory.getLogger(DoCloudLeasedLineDelete.class)
+
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+
+ execution.setVariable("startTime", System.currentTimeMillis())
+ String msg = serviceIntentUtils.getExecutionInputParams(execution)
+ logger.debug("Deallocate CLL input parameters: " + msg)
+
+ execution.setVariable("prefix", Prefix)
+
+ serviceIntentUtils.setSdncCallbackUrl(execution, true)
+ logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+ String cllId = execution.getVariable("serviceInstanceID")
+ execution.setVariable("cllId", cllId)
+
+ String cllName = execution.getVariable("servicename")
+ execution.setVariable("cllName", cllName)
+
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ if (isEmpty(modelUuid)) {
+ modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID"))
+ }
+ def isDebugLogEnabled = true
+ execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+ if (isBlank(additionalPropJsonStr) ||
+ isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution,
+ additionalPropJsonStr,
+ "enableSdnc", "enableSdnc"))) {
+ serviceIntentUtils.setEnableSdncConfig(execution)
+ }
+
+ logger.debug("Finish preProcessRequest")
+ }
+
+ void preprocessSdncDeleteCllRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preprocessSdncDeallocateCllRequest(' +
+ 'execution=' + execution.getId() + ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ try {
+ String serviceInstanceId = execution.getVariable("serviceInstanceID")
+
+ String sdncRequest = serviceIntentUtils.buildSDNCRequest(execution, serviceInstanceId, "delete")
+
+ execution.setVariable("CLL_SDNCRequest", sdncRequest)
+ logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+ } catch (Exception e) {
+ logger.debug("Exception Occurred Processing preprocessSdncDeallocateCllRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preprocessSdncDeallocateCllRequest Process")
+ }
+
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ serviceIntentUtils.validateSDNCResponse(execution, response, method)
+ }
+
+ void deleteServiceInstance(DelegateExecution execution) {
+ try {
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID")))
+ client.delete(uri)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoDeallocateCll.deleteServiceInstance. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ public void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String cllId = execution.getVariable("cllId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = new ServiceInstance()
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(cllId))
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ void prepareUpdateJobStatus(DelegateExecution execution,
+ String status,
+ String progress,
+ String statusDescription) {
+ String cllId = execution.getVariable("cllId")
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+
+ ResourceOperationStatus roStatus = serviceIntentUtils.buildRoStatus(modelUuid, cllId,
+ jobId, nsiId, "DELETE", status, progress, statusDescription)
+
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
new file mode 100644
index 0000000000..5c9877840d
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy
@@ -0,0 +1,502 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License")
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+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.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.ServiceInstance
+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.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+import static org.apache.commons.lang3.StringUtils.isNotBlank
+
+public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor {
+ String Prefix = "MCLL_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+ private static final Logger logger = LoggerFactory.getLogger(DoCloudLeasedLineModify.class)
+
+
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug("Start preProcessRequest")
+ execution.setVariable("prefix", Prefix)
+ String msg = ""
+
+ try {
+ execution.setVariable("startTime", System.currentTimeMillis())
+ msg = serviceIntentUtils.getExecutionInputParams(execution)
+ logger.debug("Modify CLL input parameters: " + msg)
+
+ execution.setVariable("prefix", Prefix)
+
+ serviceIntentUtils.setSdncCallbackUrl(execution, true)
+ logger.debug("SDNC Callback URL: " + execution.getVariable("sdncCallbackUrl"))
+
+ String additionalPropJsonStr = execution.getVariable("serviceIntentParams")
+ if (isBlank(additionalPropJsonStr)) {
+ msg = "ERROR: preProcessRequest: additionalPropJsonStr is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String cllId = execution.getVariable("serviceInstanceID")
+ if (isBlank(cllId)) {
+ msg = "ERROR: cllId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ execution.setVariable("cllId", cllId)
+
+ String cllName = execution.getVariable("servicename")
+ execution.setVariable("cllName", cllName)
+
+ String operationId = UUID.randomUUID().toString()
+ execution.setVariable("operationId", operationId)
+
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+ if (isEmpty(modelUuid)) {
+ modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(execution.getVariable("serviceInstanceID"))
+ }
+
+ def isDebugLogEnabled = true
+ execution.setVariable("isDebugLogEnabled", isDebugLogEnabled)
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+
+
+ serviceIntentUtils.setExecVarFromJsonStr(execution, additionalPropJsonStr,
+ "transportNetworks", "transportNetworks", true)
+ logger.debug("transportNetworks: " + execution.getVariable("transportNetworks"))
+
+ if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr,
+ "enableSdnc", "enableSdnc"))) {
+ serviceIntentUtils.setEnableSdncConfig(execution)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Finish preProcessRequest")
+ }
+
+
+ void deleteServiceInstance(DelegateExecution execution) {
+ try {
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceID")))
+ client.delete(uri)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoDeallocateTnNssi.deleteServiceInstance. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ void getExistingServiceInstance(DelegateExecution execution) {
+ String serviceInstanceId = execution.getVariable("cllId")
+
+ AAIResourcesClient resourceClient = getAAIClient()
+ AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
+
+ try {
+ Optional<ServiceInstance> ssOpt = resourceClient.get(ServiceInstance.class, ssServiceuri)
+ if (ssOpt.isPresent()) {
+ ServiceInstance ss = ssOpt.get()
+ AllottedResources ars = serviceIntentUtils.getAllottedResourcesFromAai(execution, serviceInstanceId, true)
+ if (ars != null) {
+ List<AllottedResource> arList = ars.getAllottedResource()
+ List<String> arIdList = new ArrayList<>()
+ Map<String, String> policyMap = new HashMap<>()
+ Map<String, List<String>> logicalLinksMap = new HashMap<>()
+ for (AllottedResource ar : arList) {
+ String arId = ar.getId()
+ arIdList.add(arId)
+ String policyId = serviceIntentUtils.getPolicyIdFromAr(execution, serviceInstanceId, arId, true)
+ policyMap.put(arId, policyId)
+ List<String> logicalLinkList = serviceIntentUtils.getLogicalLinkNamesFromAr(execution,
+ serviceInstanceId, arId, true)
+ logicalLinksMap.put(arId, logicalLinkList)
+ }
+ execution.setVariable("arIdList", arIdList)
+ execution.setVariable("arPolicyMap", policyMap)
+ execution.setVariable("arLogicalLinkMap", logicalLinksMap)
+ } else {
+ logger.error("ERROR: getExistingServiceInstance: getAllottedResources() returned null. ss=" + ss
+ .toString())
+ }
+ } else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
+ "associate allotted resource for service :" + serviceInstanceId)
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex) {
+ String msg = "Exception in getExistingServiceInstance. " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void updateServiceInstanceInAAI(DelegateExecution execution) {
+ getExistingServiceInstance(execution)
+ updateTsciNetworks(execution)
+ }
+
+ void updateServiceInstance(DelegateExecution execution) {
+ String cllId = execution.getVariable("cllId")
+ try {
+ ServiceInstance ss = new ServiceInstance()
+ //ss.setServiceInstanceId(cllId)
+ String serviceStatus = "modified"
+ ss.setOrchestrationStatus(serviceStatus)
+ ss.setEnvironmentContext("tn")
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(
+ AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(cllId))
+ client.update(uri, ss)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoModifyCllInstance.updateServiceInstance. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ String getValidArId(DelegateExecution execution, String arIdStr) {
+ List<String> arIdList = execution.getVariable("arIdList")
+ /*
+ * If arId is not specified by the caller, then we assume the caller
+ * wants to modify the first network (i.e., allotted resource) in the TSCi tree.
+ */
+ String arId = isBlank(arIdStr) ? arIdList.get(0) : arIdStr
+
+ return arId
+ }
+
+ void updateLogicalLinksInAr(DelegateExecution execution, String arId, String linkArrayJsonStr) {
+ try {
+ String serviceInstanceId = execution.getVariable('cllId')
+
+ /*
+ * Each TSCi connection-link in linkArrayJsonStr is considered as an "ADD" new
+ * link to allotted-resource. So, if the link already exists under AR, then do
+ * nothing. Otherwise, create logical-link.
+ */
+ List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayJsonStr)
+ for (String linkStr : linkStrList) {
+ if (logicalLinkExists(execution, arId, linkStr)) {
+ continue
+ }
+
+ createLogicalLinkForAllocatedResource(execution, linkStr, serviceInstanceId, arId)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "Exception in updateLogicalLinksInAr" + ex.getMessage())
+ }
+ }
+
+ void updateLogicalLinksInNetwork(DelegateExecution execution, String networkJsonStr) {
+ try {
+ String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
+ String linkArrayStr = jsonUtil.getJsonValue(networkJsonStr, "connectionLinks")
+ updateLogicalLinksInAr(execution, arId, linkArrayStr)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = String.format("ERROR: updateLogicalLinksInNetwork: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+ void updateTsciNetworks(DelegateExecution execution) {
+ try {
+ List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks"))
+ for (String networkStr : networkStrList) {
+ updateLogicalLinksInNetwork(execution, networkStr)
+ updateNetworkPolicy(execution, networkStr)
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "Exception in updateTsciNetworks" + ex.getMessage())
+ }
+ }
+
+ int getMaxBwFromNetworkJsonStr(DelegateExecution execution, String networkJsonStr) {
+ int maxBw = 0
+ try {
+ if (isBlank(networkJsonStr)) {
+ String msg = "ERROR: getMaxBw: networkJsonStr is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ String slaStr = jsonUtil.getJsonValue(networkJsonStr, "sla")
+ if (isBlank(slaStr)) {
+ String msg = "ERROR: getMaxBw: slaStr is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ String bwStr = jsonUtil.getJsonValue(slaStr, "maxBandwidth")
+ if (isNotBlank(bwStr)) {
+ maxBw = Integer.parseInt(bwStr)
+ } else {
+ logger.error("ERROR: getMaxBw: maxBandwidth is null")
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
+ "Exception in getMaxBw" + ex.getMessage())
+ }
+
+ return maxBw
+ }
+
+ void updatePolicyMaxBandwidthInAAI(DelegateExecution execution, String policyId, int maxBw) {
+ try {
+ NetworkPolicy networkPolicy = new NetworkPolicy()
+ networkPolicy.setMaxBandwidth(maxBw)
+ AAIResourceUri networkPolicyUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(policyId))
+ getAAIClient().update(networkPolicyUri, networkPolicy)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoModifyCllInstance.updatePolicyMaxBandwidthInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ void updateNetworkPolicy(DelegateExecution execution, String networkJsonStr) {
+ try {
+ int maxBw = getMaxBwFromNetworkJsonStr(execution, networkJsonStr)
+
+ String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
+ Map<String, String> policyMap = execution.getVariable("arPolicyMap")
+ String policyId = policyMap.get(arId)
+ if (isBlank(policyId)) {
+ String msg = String.format("ERROR: updateNetworkPolicy: policyId not found. arId=%s", arId)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ updatePolicyMaxBandwidthInAAI(execution, policyId, maxBw)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+ }
+
+
+ void createLogicalLinkForAllocatedResource(DelegateExecution execution,
+ String linkJsonStr, String cllId,
+ String allottedResourceId) {
+ try {
+ AAIResourceUri allottedResourceUri = serviceIntentUtils.buildAllottedResourceUri(execution,
+ cllId, allottedResourceId)
+
+ if (!getAAIClient().exists(allottedResourceUri)) {
+ logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}",
+ allottedResourceUri)
+ return
+ }
+
+ String linkId = jsonUtil.getJsonValue(linkJsonStr, "id")
+ if (isBlank(linkId)) {
+ linkId = "cll-" + UUID.randomUUID().toString()
+ }
+ logger.debug("createLogicalLinkForAllocatedResource: linkId=" + linkId)
+
+ String epA = jsonUtil.getJsonValue(linkJsonStr, "transportEndpointA")
+ String epB = jsonUtil.getJsonValue(linkJsonStr, "transportEndpointB")
+ String modelInvariantId = execution.getVariable("modelInvariantUuid")
+ String modelVersionId = execution.getVariable("modelUuid")
+
+ org.onap.aai.domain.yang.LogicalLink resource = new org.onap.aai.domain.yang.LogicalLink()
+ resource.setLinkId(linkId)
+ resource.setLinkName(epA)
+ resource.setLinkName2(epB)
+ resource.setLinkType("TsciConnectionLink")
+ resource.setInMaint(false)
+
+ //epA is link-name
+ AAIResourceUri logicalLinkUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(epA))
+ getAAIClient().create(logicalLinkUri, resource)
+
+ serviceIntentUtils.attachLogicalLinkToAllottedResource(execution, serviceIntentUtils.AAI_VERSION,
+ allottedResourceUri, epA);
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in DoModifyCllInstance.createLogicalLinksForAllocatedResource: " + ex.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+
+ void preprocessSdncModifyCllRequest(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preprocessSdncModifyCllRequest(' +
+ 'execution=' + execution.getId() + ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logger.trace('Entered ' + method)
+
+ try {
+ String serviceInstanceId = execution.getVariable("cllId")
+
+ String sdncRequest = serviceIntentUtils.buildSDNCRequest(execution, serviceInstanceId, "update")
+
+ execution.setVariable("CLL_SDNCRequest", sdncRequest)
+ logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ logger.debug("Exception Occurred Processing preprocessSdncModifyCllRequest. Exception is:\n" + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occurred during preProcessSDNCActivateRequest Method:\n" + e.getMessage())
+ }
+ logger.trace("COMPLETED preprocessSdncModifyCllRequest Process")
+ }
+
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ serviceIntentUtils.validateSDNCResponse(execution, response, method)
+ }
+
+
+ void updateAAIOrchStatus(DelegateExecution execution) {
+ logger.debug("Start updateAAIOrchStatus")
+ String cllId = execution.getVariable("cllId")
+ String orchStatus = execution.getVariable("orchestrationStatus")
+
+ try {
+ ServiceInstance si = new ServiceInstance()
+ si.setOrchestrationStatus(orchStatus)
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(cllId))
+ client.update(uri, si)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateSliceService.updateAAIOrchStatus " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.debug("Finish updateAAIOrchStatus")
+ }
+
+ void prepareUpdateJobStatus(DelegateExecution execution,
+ String status,
+ String progress,
+ String statusDescription) {
+ String cllId = execution.getVariable("cllId")
+ String modelUuid = execution.getVariable("modelUuid")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = cllId
+ String operType = "MODIFY"
+
+ ResourceOperationStatus roStatus = serviceIntentUtils.buildRoStatus(modelUuid, cllId,
+ jobId, nsiId, operType, status, progress, statusDescription)
+
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ }
+
+ boolean logicalLinkExists(DelegateExecution execution, String arIdStr, String linkJsonStr) {
+ if (isBlank(arIdStr)) {
+ logger.error("ERROR: logicalLinkExists: arIdStr is empty")
+ return false
+ }
+ if (isBlank(linkJsonStr)) {
+ logger.error("ERROR: logicalLinkExists: linkJsonStr is empty")
+ return false
+ }
+
+ Map<String, List<String>> logicalLinksMap = execution.getVariable("arLogicalLinkMap")
+ if (logicalLinksMap == null) {
+ logger.error("ERROR: logicalLinkExists: logicalLinksMap is null")
+ return false
+ }
+
+ List<String> logicalLinkNameList = logicalLinksMap.get(arIdStr)
+ if (logicalLinksMap == null) {
+ logger.error("ERROR: logicalLinkExists: logicalLinkNameList is null. arIdStr=" + arIdStr)
+ return false
+ }
+
+ String linkName = jsonUtil.getJsonValue(linkJsonStr, "transportEndpointA")
+ if (isBlank(linkName)) {
+ logger.error("ERROR: logicalLinkExists: epA is empty")
+ return false
+ }
+
+ return logicalLinkNameList.contains(linkName)
+ }
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy
new file mode 100644
index 0000000000..df817ed90b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifyServiceIntentInstance.groovy
@@ -0,0 +1,128 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ # Copyright (c) 2020, Wipro Limited.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License")
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class ModifyServiceIntentInstance extends AbstractServiceTaskProcessor {
+ String Prefix="MCLL_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ ServiceIntentUtils serviceIntentUtils = new ServiceIntentUtils()
+
+ private static final Logger logger = LoggerFactory.getLogger(ModifyServiceIntentInstance.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)
+
+ serviceIntentUtils.setCommonExecutionVars(execution)
+
+ 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 jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ModifyServiceIntentInstance.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 siId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = siId
+ String modelUuid = serviceIntentUtils.getModelUuidFromServiceInstance(siId)
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + "jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(nsiId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(modelUuid)
+ 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/ServiceIntentUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
new file mode 100644
index 0000000000..f60bfa1c47
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceIntentUtils.groovy
@@ -0,0 +1,669 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+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.AllottedResources
+import org.onap.aai.domain.yang.LogicalLink
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.Relationship
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.AAIVersion
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
+import org.onap.aaiclient.client.aai.entities.Relationships
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
+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.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.RollbackData
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isNotBlank
+
+class ServiceIntentUtils {
+ static final String AAI_VERSION = AAIVersion.LATEST
+ private static final Logger logger = LoggerFactory.getLogger(ServiceIntentUtils.class);
+
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ MsoUtils msoUtils = new MsoUtils()
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+
+ ServiceIntentUtils() {
+ }
+
+
+ void setCommonExecutionVars(DelegateExecution execution) {
+ setCommonExecutionVars(execution, true)
+ }
+
+ void setCommonExecutionVars(DelegateExecution execution, boolean exceptionOnErr) {
+ def msg
+ try {
+ // get request input
+ String bpmnRequestStr = execution.getVariable("bpmnRequest")
+ logger.debug("Input Request: " + bpmnRequestStr)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("requestId: " + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(bpmnRequestStr, "globalSubscriberId")
+ if (isBlank(globalSubscriberId) && exceptionOnErr) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ String serviceType = jsonUtil.getJsonValue(bpmnRequestStr, "serviceType")
+ if (isBlank(serviceType) && exceptionOnErr) {
+ msg = "Input serviceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("serviceType", serviceType)
+ }
+
+ String servicename = jsonUtil.getJsonValue(bpmnRequestStr, "name")
+ if (isNotBlank(servicename)) {
+ execution.setVariable("servicename", servicename)
+ } else {
+ logger.debug("erviceIntentUtils.setCommonExecutionVars: servicename is NOT set")
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(bpmnRequestStr, "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(bpmnRequestStr, "additionalProperties")
+ execution.setVariable("serviceIntentParams", sliceParams)
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in ServiceIntentUtils.setCommonExecutionVars: " + ex.getMessage()
+ logger.debug(msg)
+ if (exceptionOnErr) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ }
+
+ void setSdncCallbackUrl(DelegateExecution execution, boolean exceptionOnErr) {
+ setSdncCallbackUrl(execution, "sdncCallbackUrl", exceptionOnErr)
+ }
+
+ void setSdncCallbackUrl(DelegateExecution execution, String variableName, boolean exceptionOnErr) {
+ String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution)
+
+ if (isBlank(sdncCallbackUrl) && exceptionOnErr) {
+ String msg = "mso.workflow.sdncadapter.callback is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable(variableName, sdncCallbackUrl)
+ }
+ }
+
+ String buildSDNCRequest(DelegateExecution execution, String svcInstId, String svcAction) {
+ String reqAction
+ switch (svcAction) {
+ case "create":
+ reqAction = "CreateCloudLeasedLineInstance"
+ break
+ case "delete":
+ reqAction = "DeleteCloudLeasedLineInstance"
+ break
+ case "activate":
+ reqAction = "ActivateCloudLeasedLineInstance"
+ break
+ case "deactivate":
+ reqAction = "DeactivateCloudLeasedLineInstance"
+ break
+ case "update":
+ reqAction = "ModifyCloudLeasedLineInstance"
+ break
+ default:
+ reqAction = svcAction
+ }
+
+ buildSDNCRequest(execution, svcInstId, svcAction, reqAction)
+ }
+
+ String buildSDNCRequest(DelegateExecution execution, String svcInstId, String svcAction, String reqAction) {
+
+ String uuid = execution.getVariable('testReqId') // for junits
+ if (uuid == null) {
+ uuid = execution.getVariable("msoRequestId") + "-" + System.currentTimeMillis()
+ }
+
+ def callbackURL = execution.getVariable("sdncCallbackUrl")
+ def requestId = execution.getVariable("msoRequestId")
+ def serviceId = execution.getVariable("sliceServiceInstanceId")
+ def subServiceType = execution.getVariable("subscriptionServiceType")
+ def vnfType = execution.getVariable("serviceType")
+ def vnfName = execution.getVariable("sliceServiceInstanceName")
+ def tenantId = execution.getVariable("sliceServiceInstanceId")
+ def source = execution.getVariable("sliceServiceInstanceId")
+ def vnfId = execution.getVariable("sliceServiceInstanceId")
+ def cloudSiteId = execution.getVariable("sliceServiceInstanceId")
+ def serviceModelInfo = execution.getVariable("serviceModelInfo")
+ def vnfModelInfo = execution.getVariable("serviceModelInfo")
+ def globalSubscriberId = execution.getVariable("globalSubscriberId")
+
+ String vnfNameString = """<vnf-name>${MsoUtils.xmlEscape(vnfName)}</vnf-name>"""
+ String serviceEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(serviceModelInfo)
+ String vnfEcompModelInformation = sdncAdapterUtils.modelInfoToEcompModelInformation(vnfModelInfo)
+
+ String sdncVNFParamsXml = ""
+
+ if (execution.getVariable("vnfParamsExistFlag") == true) {
+ sdncVNFParamsXml = buildSDNCParamsXml(execution)
+ } else {
+ sdncVNFParamsXml = buildDefaultVnfInputParams(vnfId)
+ }
+
+ String sdncRequest =
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <request-action>${MsoUtils.xmlEscape(reqAction)}</request-action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
+ <notification-url/>
+ <order-number/>
+ <order-version/>
+ </request-information>
+ <service-information>
+ <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
+ <subscription-service-type>${MsoUtils.xmlEscape(subServiceType)}</subscription-service-type>
+ ${serviceEcompModelInformation}
+ <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id>
+ <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id>
+ </service-information>
+ <vnf-information>
+ <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id>
+ <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type>
+ ${vnfEcompModelInformation}
+ </vnf-information>
+ <vnf-request-input>
+ ${vnfNameString}
+ <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant>
+ <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region>
+ ${sdncVNFParamsXml}
+ </vnf-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
+
+ logger.debug("sdncRequest: " + sdncRequest)
+ return sdncRequest
+ }
+
+
+ String buildDefaultVnfInputParams(String vnfName) {
+ String res =
+ """<vnf-input-parameters>
+ <param>
+ <name>${MsoUtils.xmlEscape(vnfName)}</name>
+ </param>
+ </vnf-input-parameters>"""
+
+ return res
+ }
+
+ String buildSDNCParamsXml(DelegateExecution execution) {
+ String params = ""
+ StringBuilder sb = new StringBuilder()
+ Map<String, String> paramsMap = execution.getVariable("TNNSSMF_vnfParamsMap")
+
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String key = entry.getKey();
+ String value = entry.getValue()
+ paramsXml = """<${key}>$value</$key>"""
+ params = sb.append(paramsXml)
+ }
+ return params
+ }
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method) {
+ validateSDNCResponse(execution, response, method, true)
+ }
+
+ void validateSDNCResponse(DelegateExecution execution, String response, String method, boolean exceptionOnErr) {
+ logger.debug("STARTED ValidateSDNCResponse Process")
+
+ String msg
+
+ String prefix = execution.getVariable("prefix")
+ if (isBlank(prefix)) {
+ if (exceptionOnErr) {
+ msg = "validateSDNCResponse: prefix is null"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ return
+ }
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+
+ logger.debug("ServiceIntentUtils.validateSDNCResponse: SDNCResponse: " + response)
+ logger.debug("ServiceIntentUtils.validateSDNCResponse: workflowException: " + workflowException)
+
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ String sdncResponse = response
+ if (execution.getVariable(prefix + 'sdncResponseSuccess') == true) {
+ logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse)
+ RollbackData rollbackData = execution.getVariable("rollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData()
+ }
+
+ if (method.equals("allocate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestAllocate", "true")
+ } else if (method.equals("deallocate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeallocate", "true")
+ } else if (method.equals("activate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestActivate", "true")
+ } else if (method.equals("deactivate")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestDeactivate", "true")
+ } else if (method.equals("modify")) {
+ rollbackData.put("VNFMODULE", "rollbackSDNCRequestModify", "true")
+ }
+ execution.setVariable("rollbackData", rollbackData)
+ } else {
+ if (exceptionOnErr) {
+ msg = "ServiceIntentUtils.validateSDNCResponse: bad Response from SDNC Adapter for " + method + " SDNC Call."
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ }
+
+ logger.debug("COMPLETED ValidateSDNCResponse Process")
+ }
+
+ String getExecutionInputParams(DelegateExecution execution) {
+ String res = "\n msoRequestId=" + execution.getVariable("msoRequestId") +
+ "\n modelInvariantUuid=" + execution.getVariable("modelInvariantUuid") +
+ "\n modelUuid=" + execution.getVariable("modelUuid") +
+ "\n serviceInstanceID=" + execution.getVariable("serviceInstanceID") +
+ "\n operationType=" + execution.getVariable("operationType") +
+ "\n globalSubscriberId=" + execution.getVariable("globalSubscriberId") +
+ "\n dummyServiceId=" + execution.getVariable("dummyServiceId") +
+ "\n nsiId=" + execution.getVariable("nsiId") +
+ "\n serviceType=" + execution.getVariable("serviceType") +
+ "\n subscriptionServiceType=" + execution.getVariable("subscriptionServiceType") +
+ "\n jobId=" + execution.getVariable("jobId") +
+ "\n serviceIntentParams=" + execution.getVariable("serviceIntentParams") +
+ "\n servicename=" + execution.getVariable("servicename")
+
+ return res
+ }
+
+ String getFirstSnssaiFromSliceProfile(String sliceProfileStr) {
+ String snssaiListStr = jsonUtil.getJsonValue(sliceProfileStr, "snssaiList")
+ String snssai = jsonUtil.StringArrayToList(snssaiListStr).get(0)
+
+ return snssai
+ }
+
+ String getFirstPlmnIdFromSliceProfile(String sliceProfileStr) {
+ String plmnListStr = jsonUtil.getJsonValue(sliceProfileStr, "plmnIdList")
+ String res = jsonUtil.StringArrayToList(plmnListStr).get(0)
+
+ 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)
+ }
+
+ void attachNetworkPolicyToAllottedResource(DelegateExecution execution, String aaiVersion,
+ AAIResourceUri aaiResourceUri, String networkPolicyId) {
+
+ String toLink = "aai/${aaiVersion}/network/network-policies/network-policy/${networkPolicyId}"
+
+ Relationship relationship = new Relationship()
+ relationship.setRelatedLink(toLink)
+ relationship.setRelatedTo("network-policy")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.Uses")
+
+ createRelationShipInAAI(execution, aaiResourceUri, relationship)
+
+ }
+
+ ResourceOperationStatus buildRoStatus(String nsstId,
+ String nssiId,
+ String jobId,
+ String nsiId,
+ String action,
+ String status,
+ String progress,
+ String statusDescription) {
+ ResourceOperationStatus roStatus = new ResourceOperationStatus()
+ roStatus.setResourceTemplateUUID(nsstId)
+ roStatus.setResourceInstanceID(nssiId)
+ roStatus.setServiceId(nsiId)
+ roStatus.setOperationId(jobId)
+ roStatus.setOperType(action)
+ roStatus.setProgress(progress)
+ roStatus.setStatus(status)
+ roStatus.setStatusDescription(statusDescription)
+
+ return roStatus
+ }
+
+
+ void setEnableSdncConfig(DelegateExecution execution) {
+ String enableSdnc = UrnPropertiesReader.getVariable(
+ "mso.workflow.TnNssmf.enableSDNCNetworkConfig")
+ if (isBlank(enableSdnc)) {
+ logger.debug("mso.workflow.TnNssmf.enableSDNCNetworkConfig is undefined, so use default value (true)")
+ enableSdnc = "true"
+ }
+
+ logger.debug("setEnableSdncConfig: enableSdnc=" + enableSdnc)
+
+ execution.setVariable("enableSdnc", enableSdnc)
+ }
+
+ String setExecVarFromJsonIfExists(DelegateExecution execution,
+ String jsonStr, String jsonKey, String varName) {
+ return setExecVarFromJsonStr(execution, jsonStr, jsonKey, varName, false)
+ }
+
+ String setExecVarFromJsonStr(DelegateExecution execution,
+ String jsonStr, String jsonKey, String varName,
+ boolean exceptionOnErr) {
+ String msg = ""
+ String valueStr = jsonUtil.getJsonValue(jsonStr, jsonKey)
+ if (isBlank(valueStr)) {
+ if (exceptionOnErr) {
+ msg = "cannot find " + jsonKey + " in " + jsonStr
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+ } else {
+ execution.setVariable(varName, valueStr)
+ }
+
+ return valueStr
+ }
+
+ ServiceInstance getServiceInstanceFromAai(String serviceInstanceId) {
+ if (isBlank(serviceInstanceId)) {
+ logger.error("ERROR: getServiceInstanceFromAai: serviceInstanceId is blank")
+ return null
+ }
+
+ ServiceInstance nssi = null
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.Types.SERVICE_INSTANCE
+ .getFragment(serviceInstanceId))
+ Optional<ServiceInstance> nssiOpt = client.get(ServiceInstance.class, uri)
+
+ if (nssiOpt.isPresent()) {
+ nssi = nssiOpt.get()
+ return nssi
+ } else {
+ String msg = String.format("ERROR: getServiceInstanceFromAai: NSSI %s not found in AAI", serviceInstanceId)
+ logger.error(msg)
+ }
+
+ return nssi;
+ }
+
+ String getModelUuidFromServiceInstance(String serviceInstanceId) {
+ ServiceInstance si = getServiceInstanceFromAai(serviceInstanceId)
+ if (si == null) {
+ String msg = String.format("ERROR: getModelUuidFromServiceInstance: getServiceInstanceFromAai() failed. " +
+ "serviceInstanceId=%s", serviceInstanceId)
+ logger.error(msg)
+ return null
+ }
+
+ return si.getModelVersionId()
+ }
+
+ AAIResourceUri buildNetworkPolicyUri(String networkPolicyId) {
+ AAIResourceUri networkPolicyUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId))
+
+ return networkPolicyUri
+ }
+
+ AAIResourceUri buildAllottedResourceUri(DelegateExecution execution, String serviceInstanceId,
+ String allottedResourceId) {
+
+ AAIResourceUri allottedResourceUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(serviceInstanceId)
+ .allottedResource(allottedResourceId))
+
+ return allottedResourceUri
+ }
+
+ AAIPluralResourceUri buildAllottedResourcesUri(DelegateExecution execution, String serviceInstanceId) {
+
+ AAIPluralResourceUri arsUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(serviceInstanceId)
+ .allottedResources())
+
+ return arsUri
+ }
+
+ AllottedResources getAllottedResourcesFromAai(DelegateExecution execution, String serviceInstanceId, boolean exceptionOnErr) {
+ AllottedResources res
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIPluralResourceUri arsUri = buildAllottedResourcesUri(execution, serviceInstanceId)
+
+ //AAIResultWrapper wrapperAllotted = client.get(arsUri, NotFoundException.class)
+ //Optional<AllottedResources> allAllotted = wrapperAllotted.asBean(AllottedResources.class)
+ //AllottedResources allottedResources = allAllotted.get()
+
+ Optional<AllottedResources> arsOpt = client.get(AllottedResources.class, arsUri)
+ if (arsOpt.isPresent()) {
+ res = arsOpt.get()
+ return res
+ } else {
+ String msg = String.format("ERROR: getAllottedResourcesFromAai: ars not found. nssiId=%s", serviceInstanceId)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getAllottedResourcesFromAai: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
+
+ String getPolicyIdFromAr(DelegateExecution execution, String serviceInstanceId,
+ String arId, boolean exceptionOnErr) {
+ String res
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIResourceUri arUri = buildAllottedResourceUri(execution, serviceInstanceId, arId)
+ List<AAIResourceUri> policyUriList = getRelationshipUriListInAai(execution, arUri,
+ AAIFluentTypeBuilder.Types.NETWORK_POLICY, exceptionOnErr)
+ for (AAIResourceUri policyUri : policyUriList) {
+ Optional<NetworkPolicy> policyOpt = client.get(NetworkPolicy.class, policyUri)
+ if (policyOpt.isPresent()) {
+ NetworkPolicy policy = policyOpt.get()
+ return policy.getNetworkPolicyId()
+ } else {
+ String msg = String.format("ERROR: getPolicyIdFromAr: arUri=%s", policyUri)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getPolicyIdFromAr: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
+
+
+ List<AAIResourceUri> getRelationshipUriListInAai(DelegateExecution execution,
+ AAIResourceUri uri,
+ Object info,
+ boolean exceptionOnErr) {
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResultWrapper wrapper = client.get(uri);
+ Optional<Relationships> relationships = wrapper.getRelationships()
+ if (relationships.isPresent()) {
+ return relationships.get().getRelatedUris(info)
+ } else {
+ if (exceptionOnErr) {
+ String msg = "ERROR: getRelationshipUriListInAai: No relationship found"
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return null
+ }
+
+ List<String> getLogicalLinkNamesFromAr(DelegateExecution execution, String serviceInstanceId,
+ String arId, boolean exceptionOnErr) {
+ List<String> res = new ArrayList<>()
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIResourceUri arUri = buildAllottedResourceUri(execution, serviceInstanceId, arId)
+ List<AAIResourceUri> logicalLinkUriList = getRelationshipUriListInAai(execution, arUri,
+ AAIFluentTypeBuilder.Types.LOGICAL_LINK, exceptionOnErr)
+ for (AAIResourceUri logicalLinkUri : logicalLinkUriList) {
+ Optional<LogicalLink> logicalLinkOpt = client.get(LogicalLink.class, logicalLinkUri)
+ if (logicalLinkOpt.isPresent()) {
+ LogicalLink logicalLink = logicalLinkOpt.get()
+ res.add(logicalLink.getLinkName())
+ } else {
+ String msg = String.format("ERROR: getLogicalLinkNamesFromAr: logicalLinkUri=%s", logicalLinkUri)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getLogicalLinkNamesFromAr: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn
new file mode 100644
index 0000000000..7e8290d728
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateServiceIntentInstance.bpmn
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_04bdlh3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="CreateServiceIntentInstance" name="CreateServiceIntentInstance" isExecutable="true">
+ <bpmn:startEvent id="Event_16inlk9" name="Start">
+ <bpmn:outgoing>Flow_0cmaj9d</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="Activity_1hyt0pb" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0cmaj9d</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ou7wr9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new CreateServiceIntentInstance()
+nss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_1usi32q" name="Send Sync Response" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0ayd6dj</bpmn:incoming>
+ <bpmn:outgoing>Flow_0m5n6md</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new CreateServiceIntentInstance()
+nss.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_15a04ct" name="which Intent&#10; service ?">
+ <bpmn:incoming>Flow_0m5n6md</bpmn:incoming>
+ <bpmn:outgoing>Flow_1fij4ds</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0g7721r</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1kk0exp</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="Event_18u424w">
+ <bpmn:incoming>Flow_189zwjw</bpmn:incoming>
+ <bpmn:incoming>Flow_1fij4ds</bpmn:incoming>
+ <bpmn:incoming>Flow_1kk0exp</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="Activity_0qlstj2" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_18cgkru</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ayd6dj</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0cmaj9d" sourceRef="Event_16inlk9" targetRef="Activity_1hyt0pb" />
+ <bpmn:sequenceFlow id="Flow_0ayd6dj" sourceRef="Activity_0qlstj2" targetRef="Activity_1usi32q" />
+ <bpmn:sequenceFlow id="Flow_0m5n6md" sourceRef="Activity_1usi32q" targetRef="Gateway_15a04ct" />
+ <bpmn:sequenceFlow id="Flow_1fij4ds" name="Other" sourceRef="Gateway_15a04ct" targetRef="Event_18u424w">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") != "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0g7721r" name="Clould Leased Line" sourceRef="Gateway_15a04ct" targetRef="CallDoCloudLeasedLineCreate">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") == "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1kk0exp" sourceRef="Gateway_15a04ct" targetRef="Event_18u424w">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "AN"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="Activity_1ydx2rx" name="Init Resource Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0ou7wr9</bpmn:incoming>
+ <bpmn:outgoing>Flow_18cgkru</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new CreateServiceIntentInstance()
+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:sequenceFlow id="Flow_189zwjw" sourceRef="CallDoCloudLeasedLineCreate" targetRef="Event_18u424w" />
+ <bpmn:callActivity id="CallDoCloudLeasedLineCreate" name="Call CloudLeasedLineCreate" calledElement="DoCloudLeasedLineCreate">
+ <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="serviceInstanceID" target="serviceInstanceID" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="serviceIntentParams" target="serviceIntentParams" />
+ <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="CreateServiceIntentInstance">
+ <bpmndi:BPMNEdge id="Flow_189zwjw_di" bpmnElement="Flow_189zwjw">
+ <di:waypoint x="1080" y="230" />
+ <di:waypoint x="1170" y="230" />
+ <di:waypoint x="1170" y="148" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_18cgkru_di" bpmnElement="Flow_18cgkru">
+ <di:waypoint x="480" y="130" />
+ <di:waypoint x="550" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ou7wr9_di" bpmnElement="Flow_0ou7wr9">
+ <di:waypoint x="320" y="130" />
+ <di:waypoint x="380" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1kk0exp_di" bpmnElement="Flow_1kk0exp">
+ <di:waypoint x="915" y="130" />
+ <di:waypoint x="1152" y="130" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="930" y="125" width="37" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0g7721r_di" bpmnElement="Flow_0g7721r">
+ <di:waypoint x="890" y="155" />
+ <di:waypoint x="890" y="230" />
+ <di:waypoint x="980" y="230" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="897" y="203" width="71" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1fij4ds_di" bpmnElement="Flow_1fij4ds">
+ <di:waypoint x="915" y="130" />
+ <di:waypoint x="1152" y="130" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1021" y="112" width="28" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0m5n6md_di" bpmnElement="Flow_0m5n6md">
+ <di:waypoint x="800" y="130" />
+ <di:waypoint x="865" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ayd6dj_di" bpmnElement="Flow_0ayd6dj">
+ <di:waypoint x="650" y="130" />
+ <di:waypoint x="700" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0cmaj9d_di" bpmnElement="Flow_0cmaj9d">
+ <di:waypoint x="188" y="130" />
+ <di:waypoint x="220" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_16inlk9_di" bpmnElement="Event_16inlk9">
+ <dc:Bounds x="152" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="155" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1hyt0pb_di" bpmnElement="Activity_1hyt0pb">
+ <dc:Bounds x="220" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1usi32q_di" bpmnElement="Activity_1usi32q">
+ <dc:Bounds x="700" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_15a04ct_di" bpmnElement="Gateway_15a04ct" isMarkerVisible="true">
+ <dc:Bounds x="865" y="105" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="861" y="76" width="58" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_18u424w_di" bpmnElement="Event_18u424w">
+ <dc:Bounds x="1152" y="112" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0qlstj2_di" bpmnElement="Activity_0qlstj2">
+ <dc:Bounds x="550" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1ydx2rx_di" bpmnElement="Activity_1ydx2rx">
+ <dc:Bounds x="380" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_00awuik_di" bpmnElement="CallDoCloudLeasedLineCreate">
+ <dc:Bounds x="980" y="190" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn
new file mode 100644
index 0000000000..384f9657d3
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteServiceIntentInstance.bpmn
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1stoy5y" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DeleteServiceIntentInstance" name="DeallocateSliceSubnet" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="Start">
+ <bpmn:outgoing>Flow_143ck2k</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="Flow_143ck2k" sourceRef="StartEvent_1" targetRef="Activity_0zyhkvj" />
+ <bpmn:scriptTask id="Activity_0zyhkvj" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_143ck2k</bpmn:incoming>
+ <bpmn:outgoing>Flow_0pttfuf</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeleteServiceIntentInstance()
+nss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_0c6o2o7" name="Send Sync Response" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1c1j5i1</bpmn:incoming>
+ <bpmn:outgoing>Flow_1kljyhj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeleteServiceIntentInstance()
+nss.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Activity_1dykbz9" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_04jsg9s</bpmn:incoming>
+ <bpmn:outgoing>Flow_1c1j5i1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0pttfuf" sourceRef="Activity_0zyhkvj" targetRef="Activity_1fj0cge" />
+ <bpmn:sequenceFlow id="Flow_1c1j5i1" sourceRef="Activity_1dykbz9" targetRef="Activity_0c6o2o7" />
+ <bpmn:scriptTask id="Activity_1fj0cge" name="Init Resource Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0pttfuf</bpmn:incoming>
+ <bpmn:outgoing>Flow_04jsg9s</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new DeleteServiceIntentInstance()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_04jsg9s" sourceRef="Activity_1fj0cge" targetRef="Activity_1dykbz9" />
+ <bpmn:exclusiveGateway id="Gateway_1jagvdq" name="Which Intent service type?">
+ <bpmn:incoming>Flow_1kljyhj</bpmn:incoming>
+ <bpmn:outgoing>Flow_0zwyxxc</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0roz1jy</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:callActivity id="Activity_0li16m1" name="Call CloudLeasedLineDelete" calledElement="DoCloudLeasedLineDelete">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="serviceIntentParams" target="serviceIntentParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0zwyxxc</bpmn:incoming>
+ <bpmn:outgoing>Flow_1l74oic</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="Event_1ecylff">
+ <bpmn:incoming>Flow_1l74oic</bpmn:incoming>
+ <bpmn:incoming>Flow_0roz1jy</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_0zwyxxc" name="Cloud Leased Line" sourceRef="Gateway_1jagvdq" targetRef="Activity_0li16m1">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") == "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0roz1jy" name="Other service type" sourceRef="Gateway_1jagvdq" targetRef="Event_1ecylff">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") != "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1l74oic" sourceRef="Activity_0li16m1" targetRef="Event_1ecylff" />
+ <bpmn:sequenceFlow id="Flow_1kljyhj" sourceRef="Activity_0c6o2o7" targetRef="Gateway_1jagvdq" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteServiceIntentInstance">
+ <bpmndi:BPMNEdge id="Flow_1kljyhj_di" bpmnElement="Flow_1kljyhj">
+ <di:waypoint x="890" y="250" />
+ <di:waypoint x="975" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1l74oic_di" bpmnElement="Flow_1l74oic">
+ <di:waypoint x="1190" y="120" />
+ <di:waypoint x="1280" y="120" />
+ <di:waypoint x="1280" y="232" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0roz1jy_di" bpmnElement="Flow_0roz1jy">
+ <di:waypoint x="1025" y="250" />
+ <di:waypoint x="1262" y="250" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1085" y="232" width="90" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0zwyxxc_di" bpmnElement="Flow_0zwyxxc">
+ <di:waypoint x="1000" y="225" />
+ <di:waypoint x="1000" y="120" />
+ <di:waypoint x="1090" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="996" y="86" width="68" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_04jsg9s_di" bpmnElement="Flow_04jsg9s">
+ <di:waypoint x="520" y="250" />
+ <di:waypoint x="600" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1c1j5i1_di" bpmnElement="Flow_1c1j5i1">
+ <di:waypoint x="700" y="250" />
+ <di:waypoint x="790" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0pttfuf_di" bpmnElement="Flow_0pttfuf">
+ <di:waypoint x="330" y="250" />
+ <di:waypoint x="420" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_143ck2k_di" bpmnElement="Flow_143ck2k">
+ <di:waypoint x="168" y="250" />
+ <di:waypoint x="230" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="132" y="232" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="138" y="275" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1jawdkz_di" bpmnElement="Activity_0zyhkvj">
+ <dc:Bounds x="230" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1n1ajr4_di" bpmnElement="Activity_0c6o2o7">
+ <dc:Bounds x="790" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1dykbz9_di" bpmnElement="Activity_1dykbz9">
+ <dc:Bounds x="600" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1fj0cge_di" bpmnElement="Activity_1fj0cge">
+ <dc:Bounds x="420" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1jagvdq_di" bpmnElement="Gateway_1jagvdq" isMarkerVisible="true">
+ <dc:Bounds x="975" y="225" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="967" y="286" width="65" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0li16m1_di" bpmnElement="Activity_0li16m1">
+ <dc:Bounds x="1090" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1ecylff_di" bpmnElement="Event_1ecylff">
+ <dc:Bounds x="1262" y="232" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn
new file mode 100644
index 0000000000..e042c1a552
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ModifyServiceIntentInstance.bpmn
@@ -0,0 +1,173 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0fme930" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="ModifyServiceIntentInstance" name="ModifyServiceIntentInstance" isExecutable="true">
+ <bpmn:startEvent id="Event_05idy03" name="Start">
+ <bpmn:outgoing>Flow_1t0w8dn</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="Activity_0kd9pxx" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1t0w8dn</bpmn:incoming>
+ <bpmn:outgoing>Flow_0fzchbl</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifyServiceIntentInstance()
+nss.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_1dzkfh2" name="Send Sync Response" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1q030ul</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ps6iyc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifyServiceIntentInstance()
+nss.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_1baxf7k" name="Which Intent Service">
+ <bpmn:incoming>Flow_0ps6iyc</bpmn:incoming>
+ <bpmn:outgoing>Flow_15luvlg</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0usuozn</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1dfyoe6</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="Event_103vvkf">
+ <bpmn:incoming>Flow_1b2k523</bpmn:incoming>
+ <bpmn:incoming>Flow_1dfyoe6</bpmn:incoming>
+ <bpmn:incoming>Flow_15luvlg</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="Activity_0ptby3d" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${initResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1grhlet</bpmn:incoming>
+ <bpmn:outgoing>Flow_1q030ul</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1t0w8dn" sourceRef="Event_05idy03" targetRef="Activity_0kd9pxx" />
+ <bpmn:sequenceFlow id="Flow_0fzchbl" sourceRef="Activity_0kd9pxx" targetRef="Activity_1s8ojcr" />
+ <bpmn:sequenceFlow id="Flow_1q030ul" sourceRef="Activity_0ptby3d" targetRef="Activity_1dzkfh2" />
+ <bpmn:sequenceFlow id="Flow_0ps6iyc" sourceRef="Activity_1dzkfh2" targetRef="Gateway_1baxf7k" />
+ <bpmn:sequenceFlow id="Flow_15luvlg" sourceRef="Gateway_1baxf7k" targetRef="Event_103vvkf">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("networkType") == "TN"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0usuozn" name="Cloud Leased Line" sourceRef="Gateway_1baxf7k" targetRef="Activity_0t1g4mp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") == "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:scriptTask id="Activity_1s8ojcr" name="Init Resource Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0fzchbl</bpmn:incoming>
+ <bpmn:outgoing>Flow_1grhlet</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def nss = new ModifyServiceIntentInstance()
+nss.prepareInitOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1grhlet" sourceRef="Activity_1s8ojcr" targetRef="Activity_0ptby3d" />
+ <bpmn:callActivity id="Activity_0t1g4mp" name="Call CloudLeasedLineModify" calledElement="DoCloudLeasedLineModify">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceInstanceID" target="serviceInstanceID" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="serviceIntentParams" target="serviceIntentParams" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="servicename" target="servicename" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0usuozn</bpmn:incoming>
+ <bpmn:outgoing>Flow_1b2k523</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_1b2k523" sourceRef="Activity_0t1g4mp" targetRef="Event_103vvkf" />
+ <bpmn:sequenceFlow id="Flow_1dfyoe6" name="Other servcie" sourceRef="Gateway_1baxf7k" targetRef="Event_103vvkf">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("serviceType") != "CLL"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ModifyServiceIntentInstance">
+ <bpmndi:BPMNEdge id="Flow_1dfyoe6_di" bpmnElement="Flow_1dfyoe6">
+ <di:waypoint x="855" y="270" />
+ <di:waypoint x="1092" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="917" y="252" width="66" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1b2k523_di" bpmnElement="Flow_1b2k523">
+ <di:waypoint x="1020" y="140" />
+ <di:waypoint x="1110" y="140" />
+ <di:waypoint x="1110" y="252" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1grhlet_di" bpmnElement="Flow_1grhlet">
+ <di:waypoint x="440" y="270" />
+ <di:waypoint x="490" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0usuozn_di" bpmnElement="Flow_0usuozn">
+ <di:waypoint x="830" y="245" />
+ <di:waypoint x="830" y="140" />
+ <di:waypoint x="920" y="140" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="816" y="113" width="68" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_15luvlg_di" bpmnElement="Flow_15luvlg">
+ <di:waypoint x="855" y="270" />
+ <di:waypoint x="1092" y="270" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="852" y="365" width="36" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ps6iyc_di" bpmnElement="Flow_0ps6iyc">
+ <di:waypoint x="740" y="270" />
+ <di:waypoint x="805" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1q030ul_di" bpmnElement="Flow_1q030ul">
+ <di:waypoint x="590" y="270" />
+ <di:waypoint x="640" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0fzchbl_di" bpmnElement="Flow_0fzchbl">
+ <di:waypoint x="310" y="270" />
+ <di:waypoint x="340" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1t0w8dn_di" bpmnElement="Flow_1t0w8dn">
+ <di:waypoint x="188" y="270" />
+ <di:waypoint x="210" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_05idy03_di" bpmnElement="Event_05idy03">
+ <dc:Bounds x="152" y="252" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="295" width="24" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0kd9pxx_di" bpmnElement="Activity_0kd9pxx">
+ <dc:Bounds x="210" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1dzkfh2_di" bpmnElement="Activity_1dzkfh2">
+ <dc:Bounds x="640" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1baxf7k_di" bpmnElement="Gateway_1baxf7k" isMarkerVisible="true">
+ <dc:Bounds x="805" y="245" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="799" y="306" width="62" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_103vvkf_di" bpmnElement="Event_103vvkf">
+ <dc:Bounds x="1092" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0ptby3d_di" bpmnElement="Activity_0ptby3d">
+ <dc:Bounds x="490" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1s8ojcr_di" bpmnElement="Activity_1s8ojcr">
+ <dc:Bounds x="340" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0t1g4mp_di" bpmnElement="Activity_0t1g4mp">
+ <dc:Bounds x="920" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn
new file mode 100644
index 0000000000..96ebce2297
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineCreate.bpmn
@@ -0,0 +1,321 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoCloudLeasedLineCreate" name="DoCloudLeasedLineCreate" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Cloud Leased Line Creation Work Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css= new DoCloudLeasedLineCreate()
+css.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>Flow_06rrcwf</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1xxag1o" name="Prepare Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineCreate()
+runScript.prepareUpdateJobStatus(execution,"INPROGRESS","10","Create Cloud Leased Line started")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineCreate()
+runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Created CLL successfully")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1oouvuh" name="End" />
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="ScriptTask_1xxag1o" />
+ <bpmn:sequenceFlow id="SequenceFlow_0t094g7" sourceRef="ScriptTask_1xxag1o" targetRef="Activity_14an583" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_1xko5pk" />
+ <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1865m9a</bpmn:incoming>
+ <bpmn:incoming>Flow_15mdc4q</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "created")
+def runScript = new DoCloudLeasedLineCreate()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:serviceTask id="Activity_14an583" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0t094g7</bpmn:incoming>
+ <bpmn:outgoing>Flow_1k88aak</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1k88aak" sourceRef="Activity_14an583" targetRef="Activity_1tiyq9t" />
+ <bpmn:serviceTask id="Activity_1xko5pk" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>Flow_06rrcwf</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_06rrcwf" sourceRef="Activity_1xko5pk" targetRef="EndEvent_05h01gx" />
+ <bpmn:scriptTask id="Activity_1tiyq9t" name="create Service Instance in AAI" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1k88aak</bpmn:incoming>
+ <bpmn:outgoing>Flow_0xqfi6l</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.createServiceInstance(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_09pfclp" name="Create Allottedsource in AAI" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0xqfi6l</bpmn:incoming>
+ <bpmn:outgoing>Flow_1wzmy62</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.createAllottedResource(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="Gateway_1h7dpdn" name="Enable SDNC?">
+ <bpmn:incoming>Flow_1wzmy62</bpmn:incoming>
+ <bpmn:outgoing>Flow_08u0q5g</bpmn:outgoing>
+ <bpmn:outgoing>Flow_15mdc4q</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Activity_01xdxaj" name="PreProcess SDNC Create Cloud Leased Line Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_08u0q5g</bpmn:incoming>
+ <bpmn:outgoing>Flow_1xqkjy9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.preprocessSdncCreateCllRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="Activity_01m0xuh" name="Call SDNC Adapter: Create CLL" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CLL_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="msoRequestId" target="mso-request-id" />
+ <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="sdncAdapterResponse" target="CLL_SDNCAdapterResponse" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1xqkjy9</bpmn:incoming>
+ <bpmn:outgoing>Flow_0vvbiux</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="Activity_01eibkt" name="Postprocess Create CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0vvbiux</bpmn:incoming>
+ <bpmn:outgoing>Flow_1865m9a</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("CLL_SDNCAdapterResponse")
+
+def dcsi = new DoCloudLeasedLineCreate()
+dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0xqfi6l" sourceRef="Activity_1tiyq9t" targetRef="Activity_09pfclp" />
+ <bpmn:sequenceFlow id="Flow_1wzmy62" sourceRef="Activity_09pfclp" targetRef="Gateway_1h7dpdn" />
+ <bpmn:sequenceFlow id="Flow_1xqkjy9" name="" sourceRef="Activity_01xdxaj" targetRef="Activity_01m0xuh" />
+ <bpmn:sequenceFlow id="Flow_0vvbiux" name="" sourceRef="Activity_01m0xuh" targetRef="Activity_01eibkt" />
+ <bpmn:sequenceFlow id="Flow_08u0q5g" name="YES" sourceRef="Gateway_1h7dpdn" targetRef="Activity_01xdxaj">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_1865m9a" sourceRef="Activity_01eibkt" targetRef="ScriptTask_19uxoi8" />
+ <bpmn:sequenceFlow id="Flow_15mdc4q" name="NO" sourceRef="Gateway_1h7dpdn" targetRef="ScriptTask_19uxoi8" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCloudLeasedLineCreate">
+ <bpmndi:BPMNEdge id="Flow_15mdc4q_di" bpmnElement="Flow_15mdc4q">
+ <di:waypoint x="765" y="274" />
+ <di:waypoint x="1110" y="274" />
+ <di:waypoint x="1110" y="480" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="926" y="253" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1865m9a_di" bpmnElement="Flow_1865m9a">
+ <di:waypoint x="960" y="520" />
+ <di:waypoint x="1060" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_08u0q5g_di" bpmnElement="Flow_08u0q5g">
+ <di:waypoint x="740" y="299" />
+ <di:waypoint x="740" y="380" />
+ <di:waypoint x="480" y="380" />
+ <di:waypoint x="480" y="470" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="745" y="332" width="23" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0vvbiux_di" bpmnElement="Flow_0vvbiux">
+ <di:waypoint x="730" y="520" />
+ <di:waypoint x="839" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1xqkjy9_di" bpmnElement="Flow_1xqkjy9">
+ <di:waypoint x="540" y="520" />
+ <di:waypoint x="609" y="520" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1wzmy62_di" bpmnElement="Flow_1wzmy62">
+ <di:waypoint x="580" y="274" />
+ <di:waypoint x="715" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0xqfi6l_di" bpmnElement="Flow_0xqfi6l">
+ <di:waypoint x="370" y="274" />
+ <di:waypoint x="480" y="274" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_06rrcwf_di" bpmnElement="Flow_06rrcwf">
+ <di:waypoint x="1330" y="690" />
+ <di:waypoint x="1430" y="690" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1k88aak_di" bpmnElement="Flow_1k88aak">
+ <di:waypoint x="750" y="121" />
+ <di:waypoint x="770" y="121" />
+ <di:waypoint x="770" y="198" />
+ <di:waypoint x="320" y="198" />
+ <di:waypoint x="320" y="230" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+ <di:waypoint x="1110" y="560" />
+ <di:waypoint x="1110" y="650" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="1160" y="690" />
+ <di:waypoint x="1230" y="690" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
+ <di:waypoint x="568" y="121" />
+ <di:waypoint x="650" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="385" y="121" />
+ <di:waypoint x="468" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="214" y="121" />
+ <di:waypoint x="285" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="178" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="171" y="146" width="71" height="53" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="285" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="685" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1079" y="1184" />
+ <di:waypoint x="1353" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="751" y="1184" />
+ <di:waypoint x="979" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="715" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1353" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="979" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1430" y="672" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1438" y="715" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
+ <dc:Bounds x="468" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="1060" y="650" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh">
+ <dc:Bounds x="1562" y="482" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1570" y="525" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+ <dc:Bounds x="1060" y="480" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_14an583_di" bpmnElement="Activity_14an583">
+ <dc:Bounds x="650" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1xko5pk_di" bpmnElement="Activity_1xko5pk">
+ <dc:Bounds x="1230" y="650" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1tiyq9t_di" bpmnElement="Activity_1tiyq9t">
+ <dc:Bounds x="270" y="234" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_09pfclp_di" bpmnElement="Activity_09pfclp">
+ <dc:Bounds x="480" y="234" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1h7dpdn_di" bpmnElement="Gateway_1h7dpdn" isMarkerVisible="true">
+ <dc:Bounds x="715" y="249" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="702" y="233" width="75" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_01xdxaj_di" bpmnElement="Activity_01xdxaj">
+ <dc:Bounds x="419" y="473" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_01m0xuh_di" bpmnElement="Activity_01m0xuh">
+ <dc:Bounds x="609" y="473" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_01eibkt_di" bpmnElement="Activity_01eibkt">
+ <dc:Bounds x="839" y="473" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn
new file mode 100644
index 0000000000..4f84317945
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineDelete.bpmn
@@ -0,0 +1,235 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoCloudLeasedLineDelete" name="DoCloudLeasedLineDelete" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Cloud Leased Line Deletion Work Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Deleted CLL successfully")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" />
+ <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Delete CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0sj0mtu</bpmn:incoming>
+ <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.preprocessSdncDeleteCllRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0cpctye" sourceRef="Activity_1tw8eyy" targetRef="Activity_0p20esb" />
+ <bpmn:callActivity id="Activity_0p20esb" name="Call SDNC Adapter: Delete CLL" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CLL_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="msoRequestId" target="mso-request-id" />
+ <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="sdncAdapterResponse" target="CLL_SDNCAdapterResponse" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_0cpctye</bpmn:incoming>
+ <bpmn:outgoing>Flow_0fuabjs</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_0fuabjs" sourceRef="Activity_0p20esb" targetRef="Activity_0phv8e5" />
+ <bpmn:scriptTask id="Activity_0phv8e5" name="Postprocess SDNC Delete CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0fuabjs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("CLL_SDNCAdapterResponse")
+
+def runScript = new DoCloudLeasedLineDelete()
+runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Activity_013rjwc" name="Delete Service Instance (CLL) in AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+ <bpmn:incoming>Flow_0dirb5b</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jygjln</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.deleteServiceInstance(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_013rjwc" />
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineDelete()
+runScript.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_1spi9lo" />
+ <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:serviceTask id="Activity_0rgeefb" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ca4l8d</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_0ca4l8d" sourceRef="Activity_0rgeefb" targetRef="EndEvent_05h01gx" />
+ <bpmn:exclusiveGateway id="Gateway_1spi9lo" name="Enable SDNC?">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>Flow_0sj0mtu</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0dirb5b</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_0sj0mtu" name="Yes" sourceRef="Gateway_1spi9lo" targetRef="Activity_1tw8eyy">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0dirb5b" name="No" sourceRef="Gateway_1spi9lo" targetRef="Activity_013rjwc" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCloudLeasedLineDelete">
+ <bpmndi:BPMNEdge id="Flow_0dirb5b_di" bpmnElement="Flow_0dirb5b">
+ <di:waypoint x="480" y="146" />
+ <di:waypoint x="480" y="370" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="483" y="166" width="14" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu">
+ <di:waypoint x="505" y="121" />
+ <di:waypoint x="569" y="121" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529" y="103" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d">
+ <di:waypoint x="1030" y="410" />
+ <di:waypoint x="1152" y="410" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln">
+ <di:waypoint x="530" y="410" />
+ <di:waypoint x="660" y="410" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="385" y="121" />
+ <di:waypoint x="455" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+ <di:waypoint x="1130" y="121" />
+ <di:waypoint x="1220" y="121" />
+ <di:waypoint x="1220" y="260" />
+ <di:waypoint x="480" y="260" />
+ <di:waypoint x="480" y="370" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs">
+ <di:waypoint x="910" y="121" />
+ <di:waypoint x="1009" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye">
+ <di:waypoint x="690" y="121" />
+ <di:waypoint x="789" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="760" y="410" />
+ <di:waypoint x="930" y="410" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="214" y="121" />
+ <di:waypoint x="285" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="178" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="169" y="146" width="70" height="53" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="685" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1079" y="1184" />
+ <di:waypoint x="1353" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="751" y="1184" />
+ <di:waypoint x="979" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="715" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1353" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="979" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1152" y="392" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1160" y="435" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="660" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy">
+ <dc:Bounds x="569" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb">
+ <dc:Bounds x="789" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+ <dc:Bounds x="1009" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc">
+ <dc:Bounds x="430" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="285" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb">
+ <dc:Bounds x="930" y="370" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true">
+ <dc:Bounds x="455" y="96" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="443" y="73" width="75" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn
new file mode 100644
index 0000000000..1c2ce98f09
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCloudLeasedLineModify.bpmn
@@ -0,0 +1,252 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoCloudLeasedLineModify" name="DoCloudLeasedLineModify" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Modify Cloud Leased LIne Work Flow">
+ <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:subProcess id="SubProcess_1yv9i68" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_1omdx56">
+ <bpmn:outgoing>SequenceFlow_1w67v6s</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_06xcioh" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jx3026">
+ <bpmn:incoming>SequenceFlow_08mlzwz</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1swzdpw" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1w67v6s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_08mlzwz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1w67v6s" sourceRef="StartEvent_1omdx56" targetRef="ScriptTask_1swzdpw" />
+ <bpmn:sequenceFlow id="SequenceFlow_08mlzwz" sourceRef="ScriptTask_1swzdpw" targetRef="EndEvent_1jx3026" />
+ </bpmn:subProcess>
+ <bpmn:endEvent id="EndEvent_05h01gx" name="End">
+ <bpmn:incoming>Flow_1akxvak</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineModify()
+runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Modified CLL successfully")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" />
+ <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0ziz3ti" />
+ <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0h5rwlh</bpmn:incoming>
+ <bpmn:incoming>Flow_0b3rxne</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+execution.setVariable("orchestrationStatus", "modified")
+def runScript = new DoCloudLeasedLineModify()
+runScript.updateAAIOrchStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" />
+ <bpmn:scriptTask id="Activity_0phv8e5" name="Modify CLL instance in AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jdb2oq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+def runScript = new DoCloudLeasedLineModify()
+runScript.updateServiceInstanceInAAI(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Gateway_1o68a9z" />
+ <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineModify()
+runScript.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_0phv8e5" />
+ <bpmn:scriptTask id="Activity_0h1vr2l" name="PreProcess SDNC Modify CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0cm9i4m</bpmn:incoming>
+ <bpmn:outgoing>Flow_1dvo5ih</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def runScript = new DoCloudLeasedLineModify()
+runScript.preprocessSdncModifyCllRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1dvo5ih" sourceRef="Activity_0h1vr2l" targetRef="Activity_14ab476" />
+ <bpmn:callActivity id="Activity_14ab476" name="Call SDNC Adapter: Modify CLL" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CLL_SDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="msoRequestId" target="mso-request-id" />
+ <camunda:in source="sliceServiceInstanceId" target="mso-service-instance-id" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="sdncAdapterResponse" target="CLL_SDNCAdapterResponse" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1dvo5ih</bpmn:incoming>
+ <bpmn:outgoing>Flow_139j3yd</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_139j3yd" sourceRef="Activity_14ab476" targetRef="Activity_1vtz33q" />
+ <bpmn:scriptTask id="Activity_1vtz33q" name="Postprocess SDNC Modify CLL Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_139j3yd</bpmn:incoming>
+ <bpmn:outgoing>Flow_0h5rwlh</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+
+String response = execution.getVariable("CLL_SDNCAdapterResponse")
+
+def runScript = new DoCloudLeasedLineModify()
+runScript.validateSDNCResponse(execution, response, "modify")</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0h5rwlh" sourceRef="Activity_1vtz33q" targetRef="ScriptTask_19uxoi8" />
+ <bpmn:serviceTask id="Activity_0ziz3ti" name="Update Resource Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1qv8qw1</bpmn:incoming>
+ <bpmn:outgoing>Flow_1akxvak</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_1akxvak" sourceRef="Activity_0ziz3ti" targetRef="EndEvent_05h01gx" />
+ <bpmn:exclusiveGateway id="Gateway_1o68a9z" name="Enable SDNC?">
+ <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming>
+ <bpmn:outgoing>Flow_0cm9i4m</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0b3rxne</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_0cm9i4m" name="Yes" sourceRef="Gateway_1o68a9z" targetRef="Activity_0h1vr2l">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_0b3rxne" name="No" sourceRef="Gateway_1o68a9z" targetRef="ScriptTask_19uxoi8" />
+ </bpmn:process>
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
+ <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCloudLeasedLineModify">
+ <bpmndi:BPMNEdge id="Flow_0b3rxne_di" bpmnElement="Flow_0b3rxne">
+ <di:waypoint x="690" y="146" />
+ <di:waypoint x="690" y="360" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="698" y="203" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0cm9i4m_di" bpmnElement="Flow_0cm9i4m">
+ <di:waypoint x="715" y="121" />
+ <di:waypoint x="789" y="121" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="743" y="103" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1akxvak_di" bpmnElement="Flow_1akxvak">
+ <di:waypoint x="1230" y="400" />
+ <di:waypoint x="1372" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0h5rwlh_di" bpmnElement="Flow_0h5rwlh">
+ <di:waypoint x="1350" y="121" />
+ <di:waypoint x="1430" y="121" />
+ <di:waypoint x="1430" y="280" />
+ <di:waypoint x="690" y="280" />
+ <di:waypoint x="690" y="360" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_139j3yd_di" bpmnElement="Flow_139j3yd">
+ <di:waypoint x="1110" y="121" />
+ <di:waypoint x="1229" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1dvo5ih_di" bpmnElement="Flow_1dvo5ih">
+ <di:waypoint x="910" y="121" />
+ <di:waypoint x="989" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="390" y="121" />
+ <di:waypoint x="479" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq">
+ <di:waypoint x="600" y="121" />
+ <di:waypoint x="665" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+ <di:waypoint x="740" y="400" />
+ <di:waypoint x="860" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="960" y="400" />
+ <di:waypoint x="1130" y="400" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="208" y="121" />
+ <di:waypoint x="290" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
+ <dc:Bounds x="172" y="103" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="163" y="146" width="77" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
+ <dc:Bounds x="735" y="1080" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1129" y="1184" />
+ <di:waypoint x="1403" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="801" y="1184" />
+ <di:waypoint x="1029" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="765" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1403" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="1029" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx">
+ <dc:Bounds x="1372" y="382" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1380" y="425" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
+ <dc:Bounds x="860" y="360" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
+ <dc:Bounds x="640" y="360" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5">
+ <dc:Bounds x="479" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="290" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0h1vr2l_di" bpmnElement="Activity_0h1vr2l">
+ <dc:Bounds x="789" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_14ab476_di" bpmnElement="Activity_14ab476">
+ <dc:Bounds x="989" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1vtz33q_di" bpmnElement="Activity_1vtz33q">
+ <dc:Bounds x="1229" y="74" width="121" height="94" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0ziz3ti_di" bpmnElement="Activity_0ziz3ti">
+ <dc:Bounds x="1130" y="360" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_1o68a9z_di" bpmnElement="Gateway_1o68a9z" isMarkerVisible="true">
+ <dc:Bounds x="665" y="96" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="653" y="73" width="75" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index d69c395f96..031e9eee2a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -65,6 +65,7 @@ public class JerseyConfiguration extends ResourceConfig {
register(NodeHealthcheckHandler.class);
register(ServiceInstances.class);
register(Onap3gppServiceInstances.class);
+ register(ServiceIntentApiHandler.class);
register(TasksHandler.class);
register(CloudOrchestration.class);
register(CloudResourcesOrchestration.class);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java
new file mode 100644
index 0000000000..be63c5fb9a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandler.java
@@ -0,0 +1,431 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Huawei Technologies.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.apihandler.camundabeans.CamundaResponse;
+import org.onap.so.apihandler.common.CamundaClient;
+import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.apihandler.common.RequestClientParameter;
+import org.onap.so.apihandler.common.ResponseBuilder;
+import org.onap.so.apihandler.common.ResponseHandler;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
+import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
+import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentCommonRequest;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentCreationRequest;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentDeletionRequest;
+import org.onap.so.apihandlerinfra.serviceintentinstancebeans.ServiceIntentModificationRequest;
+import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.onap.so.logger.LogConstants;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Component;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.sql.Timestamp;
+import java.util.HashMap;
+import java.util.function.Function;
+
+/**
+ * This class serves as the entry point for Service Intent APIs. Unlike User Intent, which describes Intent using
+ * natural languages, Service Intent describes Intent through technology-agnostic and model-driven APIs. The Service
+ * Intent APIs have the following format: {service-Intent-Root}/{operation}, where {operation} may be "create",
+ * "delete", "modify", etc. And the parameters of the Intent service instance are specified in the payloads of the APIs.
+ * <p>
+ * For scalability, these APIs are designed to be generic, and thus support all the service Intent use-cases. i.e., The
+ * actual intent use-case/application, e.g., Cloud Leased Line, is differentiated by the "serviceType" parameter in the
+ * payload, rather than by specific APIs. Thus, this class does not need to grow when we add new Intent use-cases or
+ * applications.
+ * <p>
+ */
+@Component
+@Path("/onap/so/infra/serviceIntent")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/serviceIntent",
+ description = "API Requests for Intent services and " + "applications"))
+public class ServiceIntentApiHandler {
+
+ private static final Logger logger = LoggerFactory.getLogger(ServiceIntentApiHandler.class);
+
+ private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA";
+
+ private static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: ";
+
+ private static final String SAVE_TO_DB = "save instance to db";
+
+ private static final String URI_PREFIX = "/serviceIntent/";
+
+ @Autowired
+ private MsoRequest msoRequest;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Autowired
+ private RequestsDbClient requestsDbClient;
+
+ @Autowired
+ private RequestHandlerUtils requestHandlerUtils;
+
+ @Autowired
+ private ResponseBuilder builder;
+
+ @Autowired
+ private CamundaClient camundaClient;
+
+ @Autowired
+ private ResponseHandler responseHandler;
+
+ // @Value("${serviceIntent.config.file}")
+ // private String serviceIntentConfigFile;
+
+ /**
+ * POST Requests for create Service Intent Instance on a version provided
+ *
+ * @throws ApiException
+ */
+
+ @POST
+ @Path("/{version:[vV][1]}/create")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Create a SI Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response createServiceIntentInstance(ServiceIntentCreationRequest request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ return processServiceIntentRequest(request, Action.createInstance, version, requestId, null,
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+ }
+
+ /**
+ * PUT Requests for Service Intent Modification on a version provided
+ *
+ * @throws ApiException
+ */
+
+ @PUT
+ @Path("/{version:[vV][1]}/modify")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Modify a SI Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response modifyServiceIntentInstance(ServiceIntentModificationRequest request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return processServiceIntentRequest(request, Action.updateInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+ }
+
+ /**
+ * DELETE Requests for Service Intent Instance on a specified version
+ *
+ * @throws ApiException
+ */
+
+ @DELETE
+ @Path("/{version:[vV][1]}/delete")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Terminate/Delete a SI Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ public Response deleteServiceIntentInstance(ServiceIntentDeletionRequest request,
+ @PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", request.getServiceInstanceID());
+ return processServiceIntentRequest(request, Action.deleteInstance, version, requestId, instanceIdMap,
+ requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX));
+ }
+
+ /**
+ * Process Service Intent request and send request to corresponding workflow
+ *
+ * @param request
+ * @param action
+ * @param version
+ * @return
+ * @throws ApiException
+ */
+ private Response processServiceIntentRequest(ServiceIntentCommonRequest request, Action action, String version,
+ String requestId, HashMap<String, String> instanceIdMap, String requestUri) throws ApiException {
+ String defaultServiceModelName = "COMMON_SI_DEFAULT";
+ String requestScope = ModelType.service.name();
+ String apiVersion = version.substring(1);
+ String serviceRequestJson = toString.apply(request);
+
+ String instanceName = null;
+ String modelUuid = null;
+ String serviceInstanceId = null;
+
+ try {
+ if (action == Action.createInstance) {
+ instanceName = ((ServiceIntentCreationRequest) request).getName();
+ modelUuid = ((ServiceIntentCreationRequest) request).getModelUuid();
+ } else if (action == Action.updateInstance) {
+ instanceName = ((ServiceIntentModificationRequest) request).getName();
+ serviceInstanceId = ((ServiceIntentModificationRequest) request).getServiceInstanceID();
+ } else if (action == Action.deleteInstance) {
+ serviceInstanceId = ((ServiceIntentDeletionRequest) request).getServiceInstanceID();
+ }
+ } catch (Exception e) {
+ logger.error("ERROR: processCllServiceRequest: Exception: ", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "processCllServiceRequest error", ErrorNumbers.SVC_BAD_PARAMETER,
+ null, version);
+ return response;
+ }
+
+ if (serviceRequestJson != null) {
+ InfraActiveRequests currentActiveReq = createRequestObject(request, action, requestId, Status.IN_PROGRESS,
+ requestScope, serviceRequestJson);
+
+ requestHandlerUtils.checkForDuplicateRequests(action, instanceIdMap, requestScope, currentActiveReq,
+ instanceName);
+ try {
+ requestsDbClient.save(currentActiveReq);
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+ }
+
+ RecipeLookupResult recipeLookupResult;
+ try {
+ recipeLookupResult = getServiceInstanceOrchestrationURI(modelUuid, action, defaultServiceModelName);
+ } catch (Exception e) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
+ ErrorCode.AvailabilityError.getValue(), "Exception while communicate with Catalog DB", e);
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "No " + "communication to catalog DB " + e.getMessage(),
+ ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ if (recipeLookupResult == null) {
+ logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(),
+ MSO_PROP_APIHANDLER_INFRA, ErrorCode.DataError.getValue(), "No recipe found in DB");
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND,
+ MsoException.ServiceException, "Recipe does " + "not exist in catalog DB",
+ ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version);
+ logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
+ return response;
+ }
+
+ String serviceInstanceType = request.getSubscriptionServiceType();
+ RequestClientParameter parameter;
+ try {
+ parameter = new RequestClientParameter.Builder().setRequestId(requestId).setBaseVfModule(false)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name())
+ .setServiceInstanceId(serviceInstanceId).setServiceType(serviceInstanceType)
+ .setRequestDetails(serviceRequestJson).setApiVersion(version).setALaCarte(false)
+ .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).setApiVersion(apiVersion).build();
+ } catch (Exception e) {
+ logger.error("Exception occurred", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new ValidateException.Builder("Unable to generate RequestClientParameter object" + e.getMessage(),
+ HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
+ .build();
+ }
+ return postBPELRequest(currentActiveReq, parameter, recipeLookupResult.getOrchestrationURI(), requestScope);
+ } else {
+ Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ MsoException.ServiceException, "JsonProcessingException occurred - " + "serviceRequestJson is null",
+ ErrorNumbers.SVC_BAD_PARAMETER, null, version);
+ return response;
+ }
+ }
+
+ /**
+ * Getting recipes from catalogDb
+ *
+ * @param serviceModelUUID the service model version uuid
+ * @param action the action for the service
+ * @param defaultServiceModelName default service name
+ * @return the service recipe result
+ */
+ private RecipeLookupResult getServiceInstanceOrchestrationURI(String serviceModelUUID, Action action,
+ String defaultServiceModelName) {
+
+ RecipeLookupResult recipeLookupResult = getServiceURI(serviceModelUUID, action, defaultServiceModelName);
+
+ if (recipeLookupResult != null) {
+ logger.debug("Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: "
+ + Integer.toString(recipeLookupResult.getRecipeTimeout()));
+ } else {
+ logger.debug("No matching recipe record found");
+ }
+ return recipeLookupResult;
+ }
+
+ /**
+ * Getting recipes from catalogDb If Service recipe is not set, use default recipe, if set , use special recipe.
+ *
+ * @param serviceModelUUID the service version uuid
+ * @param action the action of the service.
+ * @param defaultServiceModelName default service name
+ * @return the service recipe result.
+ */
+ private RecipeLookupResult getServiceURI(String serviceModelUUID, Action action, String defaultServiceModelName) {
+
+ Service defaultServiceRecord =
+ catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ // set recipe as default generic recipe
+ ServiceRecipe recipe =
+ catalogDbClient.getFirstByServiceModelUUIDAndAction(defaultServiceRecord.getModelUUID(), action.name());
+ // check the service special recipe
+ if (null != serviceModelUUID && !serviceModelUUID.isEmpty()) {
+ ServiceRecipe serviceSpecialRecipe =
+ catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceModelUUID, action.name());
+ if (null != serviceSpecialRecipe) {
+ // set service special recipe.
+ recipe = serviceSpecialRecipe;
+ }
+ }
+
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout(), recipe.getParamXsd());
+
+ }
+
+ Function<Object, String> toString = serviceRequest -> {
+ ObjectMapper mapper = new ObjectMapper();
+ String requestAsString = null;
+ try {
+ requestAsString = mapper.writeValueAsString(serviceRequest);
+ } catch (JsonProcessingException e) {
+ logger.debug("Exception while converting service request object to String {}", e);
+ }
+ return requestAsString;
+ };
+
+ private InfraActiveRequests createRequestObject(ServiceIntentCommonRequest request, Action action, String requestId,
+ Status status, String requestScope, String requestJson) {
+ InfraActiveRequests aq = new InfraActiveRequests();
+ try {
+ String serviceInstanceName = null;
+ String serviceInstanceId = null;
+ String serviceType = request.getServiceType();
+ if (action.name().equals("createInstance")) {
+ serviceInstanceName = ((ServiceIntentCreationRequest) request).getName();
+ aq.setServiceInstanceName(serviceInstanceName);
+ } else if (action.name().equals("updateInstance")) {
+ serviceInstanceName = ((ServiceIntentModificationRequest) request).getName();
+ serviceInstanceId = ((ServiceIntentModificationRequest) request).getServiceInstanceID();
+ aq.setServiceInstanceName(serviceInstanceName);
+ aq.setServiceInstanceId(serviceInstanceId);
+ } else if (action.name().equals("deleteInstance")) {
+ serviceInstanceId = ((ServiceIntentDeletionRequest) request).getServiceInstanceID();
+ aq.setServiceInstanceId(serviceInstanceId);
+ }
+
+ aq.setRequestId(requestId);
+ aq.setRequestAction(action.toString());
+ aq.setRequestUrl(MDC.get(LogConstants.HTTP_URL));
+ Timestamp startTimeStamp = new Timestamp(System.currentTimeMillis());
+ aq.setStartTime(startTimeStamp);
+ aq.setRequestScope(requestScope);
+ aq.setRequestBody(requestJson);
+ aq.setRequestStatus(status.toString());
+ aq.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ aq.setServiceType(serviceType);
+ } catch (Exception e) {
+ logger.error("Exception when creation record request", e);
+
+ if (!status.equals(Status.FAILED)) {
+ throw e;
+ }
+ }
+ return aq;
+ }
+
+ private Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter parameter,
+ String orchestrationURI, String requestScope) throws ApiException {
+ ResponseEntity<String> response =
+ requestHandlerUtils.postRequest(currentActiveReq, parameter, orchestrationURI);
+ logger.debug("BPEL response : " + response);
+ int bpelStatus = responseHandler.setStatus(response.getStatusCodeValue());
+ String jsonResponse;
+ try {
+ responseHandler.acceptedResponse(response);
+ CamundaResponse camundaResponse = responseHandler.getCamundaResponse(response);
+ String responseBody = camundaResponse.getResponse();
+ if ("Success".equalsIgnoreCase(camundaResponse.getMessage())) {
+ jsonResponse = responseBody;
+ } else {
+ BPMNFailureException bpmnException =
+ new BPMNFailureException.Builder(String.valueOf(bpelStatus) + responseBody, bpelStatus,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).build();
+ requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, bpmnException.getMessage());
+ throw bpmnException;
+ }
+ } catch (ApiException e) {
+ requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, e.getMessage());
+ throw e;
+ }
+ return builder.buildResponse(HttpStatus.SC_ACCEPTED, parameter.getRequestId(), jsonResponse,
+ parameter.getApiVersion());
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java
new file mode 100644
index 0000000000..f27f88c428
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCommonRequest.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Model class for common parameter of Service Intent request
+ */
+public class ServiceIntentCommonRequest {
+
+ @JsonProperty("globalSubscriberId")
+ private String globalSubscriberId;
+
+ @JsonProperty("subscriptionServiceType")
+ private String subscriptionServiceType;
+
+ @JsonProperty("additionalProperties")
+ private Map<String, Object> additionalProperties = new HashMap<>();
+
+ @JsonProperty("serviceType")
+ private String serviceType;
+
+ public String getGlobalSubscriberId() {
+ return globalSubscriberId;
+ }
+
+ public void setGlobalSubscriberId(String globalSubscriberId) {
+ this.globalSubscriberId = globalSubscriberId;
+ }
+
+ public String getSubscriptionServiceType() {
+ return subscriptionServiceType;
+ }
+
+ public void setSubscriptionServiceType(String subscriptionServiceType) {
+ this.subscriptionServiceType = subscriptionServiceType;
+ }
+
+ public Map<String, Object> getAdditionalProperties() {
+ return additionalProperties;
+ }
+
+ public void setAdditionalProperties(Map<String, Object> additionalProperties) {
+ this.additionalProperties = additionalProperties;
+ }
+
+ public String getServiceType() {
+ return serviceType;
+ }
+
+ public void setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentCommonRequest [globalSubscriberId=" + globalSubscriberId + ", subscriptionServiceType="
+ + subscriptionServiceType + ", serviceType=" + serviceType + ", additionalProperties="
+ + additionalProperties + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java
new file mode 100644
index 0000000000..bc711a00dc
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentCreationRequest.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for Service Intent Creation request
+ */
+public class ServiceIntentCreationRequest extends ServiceIntentCommonRequest {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("modelInvariantUuid")
+ private String modelInvariantUuid;
+
+ @JsonProperty("modelUuid")
+ private String modelUuid;
+
+ @JsonProperty("sst")
+ private String sST;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getModelInvariantUuid() {
+ return modelInvariantUuid;
+ }
+
+ public void setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ }
+
+ public String getModelUuid() {
+ return modelUuid;
+ }
+
+ public void setModelUuid(String modelUuid) {
+ this.modelUuid = modelUuid;
+ }
+
+ public String getsST() {
+ return sST;
+ }
+
+ public void setsST(String sST) {
+ this.sST = sST;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentCreationRequest [name=" + name + ", modelInvariantUuid=" + modelInvariantUuid
+ + ", modelUuid=" + modelUuid + ", globalSubscriberId=" + getGlobalSubscriberId()
+ + ", subscriptionServiceType=" + getSubscriptionServiceType() + ", serviceType=" + getServiceType()
+ + ", additionalProperties=" + getAdditionalProperties() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java
new file mode 100644
index 0000000000..c463c7bae4
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentDeletionRequest.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for service intent instance terminate request
+ */
+public class ServiceIntentDeletionRequest extends ServiceIntentCommonRequest {
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentDeletionRequest [serviceInstanceID=" + getServiceInstanceID() + ", globalSubscriberId="
+ + getGlobalSubscriberId() + ", subscriptionServiceType=" + getSubscriptionServiceType()
+ + ", serviceType=" + getServiceType() + ", additionalProperties=" + getAdditionalProperties() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java
new file mode 100644
index 0000000000..17d6dc84ab
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/serviceintentinstancebeans/ServiceIntentModificationRequest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2021 Huawei Technologies.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra.serviceintentinstancebeans;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+/**
+ * Model class for Service Intent Update request
+ */
+public class ServiceIntentModificationRequest extends ServiceIntentCommonRequest {
+
+ @JsonProperty("name")
+ private String name;
+
+ @JsonProperty("serviceInstanceID")
+ private String serviceInstanceID;
+
+ public String getServiceInstanceID() {
+ return serviceInstanceID;
+ }
+
+ public void setServiceInstanceID(String serviceInstanceID) {
+ this.serviceInstanceID = serviceInstanceID;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return "ServiceIntentModificationRequest [name=" + name + ", serviceInstanceID=" + getServiceInstanceID()
+ + ", globalSubscriberId=" + getGlobalSubscriberId() + ", subscriptionServiceType="
+ + getSubscriptionServiceType() + ", serviceType=" + getServiceType() + ", additionalProperties="
+ + getAdditionalProperties() + "]";
+ }
+
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java
new file mode 100644
index 0000000000..059c2bc057
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceIntentApiHandlerTest.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.apihandlerinfra;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static org.junit.Assert.assertEquals;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+
+public class ServiceIntentApiHandlerTest extends BaseTest {
+
+ private static final String ROOT_URI = "/onap/so/infra/serviceIntent/";
+
+ private static final ObjectMapper MAPPER = new ObjectMapper();
+
+ @Autowired
+ private Onap3gppServiceInstances objUnderTest;
+
+ @Before
+ public void init() throws JsonProcessingException {
+
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setServiceModelUUID(defaultService.getModelUUID());
+ serviceRecipe.setRecipeTimeout(180);
+ serviceRecipe.setOrchestrationUri("/mso/async/services/commonServiceIntentTest");
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/service/search/findFirstByModelNameOrderByModelVersionDesc"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(MAPPER.writeValueAsString(defaultService)).withStatus(HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlPathEqualTo("/serviceRecipe/search/findFirstByServiceModelUUIDAndAction"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(MAPPER.writeValueAsString(serviceRecipe)).withStatus(HttpStatus.SC_OK)));
+ wireMockServer.stubFor(post(urlMatching(".*/infraActiveRequests/")).willReturn(aResponse()
+ .withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).withStatus(HttpStatus.SC_OK)));
+ Mockito.doReturn(null).when(requestsDbClient).getInfraActiveRequestbyRequestId(Mockito.any());
+ }
+
+ public String inputStream(String JsonInput) throws IOException {
+ JsonInput = "src/test/resources/ServiceIntentTest" + JsonInput;
+ return new String(Files.readAllBytes(Paths.get(JsonInput)));
+ }
+
+ public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod) {
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(ONAP_PARTNER_NAME, "VID");
+ headers.set(REQUESTOR_ID, "xxxxxx");
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath));
+ HttpEntity<String> request = new HttpEntity<>(requestJson, headers);
+
+ return restTemplate.exchange(builder.toUriString(), reqMethod, request, String.class);
+ }
+
+ @Test
+ public void createServiceInstanceTest() throws IOException {
+ String uri = ROOT_URI + "v1/create";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonServiceIntentTest"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("Camunda/BPMN_response.json").withStatus(HttpStatus.SC_ACCEPTED)));
+
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/create-cll-payload.json"), uri, HttpMethod.POST);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void updateServiceInstanceTest() throws IOException {
+ String uri = ROOT_URI + "v1/modify";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonServiceIntentTest"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("Camunda/BPMN_response.json").withStatus(HttpStatus.SC_ACCEPTED)));
+
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/modify-cll-payload.json"), uri, HttpMethod.PUT);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+ @Test
+ public void deleteServiceInstanceTest() throws IOException {
+ String uri = ROOT_URI + "v1/delete";
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/commonServiceIntentTest"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBodyFile("Camunda/BPMN_response.json").withStatus(HttpStatus.SC_ACCEPTED)));
+ String expectedResponse =
+ "{\"jobId\":\"db245365e79c47ed88fcd60caa8f6549\",\"status\":\"\",\"statusDescription\":{}}";
+ ResponseEntity<String> response = sendRequest(inputStream("/delete-cll-payload.json"), uri, HttpMethod.DELETE);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+ String actualResponse = response.getBody();
+ assertEquals(expectedResponse, actualResponse);
+ }
+
+
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json
new file mode 100644
index 0000000000..6018392abd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/create-cll-payload.json
@@ -0,0 +1,29 @@
+{
+ "name": "cloud-leased-line-101",
+ "modelInvariantUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "modelUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "globalSubscriberId": "IBNCustomer",
+ "subscriptionServiceType": "IBN",
+ "serviceType": "CLL",
+ "additionalProperties": {
+ "enableSdnc": "false",
+ "serviceInstanceID": "cll-101",
+ "transportNetworks": [
+ {
+ "id": "cll-101-network-001",
+ "sla": {
+ "latency": 2,
+ "maxBandwidth": 3000
+ },
+ "connectionLinks": [
+ {
+ "name": "cll-link-1",
+ "transportEndpointA": "tranportEp_UNI_ID_311_1",
+ "transportEndpointB": "tranportEp_ROOT_ID_512_1"
+ }
+ ]
+ }
+ ]
+ }
+}
+
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json
new file mode 100644
index 0000000000..f21f4e3cea
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/delete-cll-payload.json
@@ -0,0 +1,9 @@
+{
+ "serviceInstanceID": "cll-101",
+ "globalSubscriberId": "IBNCustomer",
+ "subscriptionServiceType": "IBN",
+ "serviceType": "CLL",
+ "additionalProperties": {
+ "enableSdnc": "false"
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json
new file mode 100644
index 0000000000..3611adaf3b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceIntentTest/modify-cll-payload.json
@@ -0,0 +1,29 @@
+{
+ "serviceInstanceID": "cll-101",
+ "name": "cloud-leased-line-101",
+ "modelInvariantUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "modelUuid": "6790ab0e-034f-11eb-adc1-0242ac120002",
+ "globalSubscriberId": "IBNCustomer",
+ "subscriptionServiceType": "IBN",
+ "serviceType": "CLL",
+ "additionalProperties": {
+ "enableSdnc": "false",
+ "transportNetworks": [
+ {
+ "id": "cll-101-network-001",
+ "sla": {
+ "latency": 2,
+ "maxBandwidth": 8000
+ },
+ "connectionLinks": [
+ {
+ "name": "cll-link-1",
+ "transportEndpointA": "tranportEp_UNI_ID_311_1",
+ "transportEndpointB": "tranportEp_ROOT_ID_512_1"
+ }
+ ]
+ }
+ ]
+ }
+}
+