summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src
diff options
context:
space:
mode:
authorPriyadharshini <priyadharshini.b96@wipro.com>2020-10-04 21:21:26 -0700
committerPriyadharshini <priyadharshini.b96@wipro.com>2020-10-05 06:17:32 -0700
commit0f70c7c9291d1a27095e9d12e7192a3398e396ae (patch)
treee35b202bcc159968b9c94b4efe8eade9d60944b3 /bpmn/so-bpmn-infrastructure-common/src
parentd3adacc3bb11111e77c50e373710ca53971a53ef (diff)
Fix - Missing required attributes to TN Allocate NSSMF
Issue-ID: SO-3288 Signed-off-by: Priyadharshini <priyadharshini.b96@wipro.com> Change-Id: If81cc1e6f8dfa772154eccbf8d75b6ff87692b65
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy290
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy308
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy113
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy274
4 files changed, 491 insertions, 494 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
index c7fe7e36a6..eabe58488e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
@@ -32,150 +32,148 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class ActivateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="ActSS"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //NSSI ID
- String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
- if (isBlank(serviceInstanceID)) {
- msg = "Input serviceInstanceID is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceInstanceID", serviceInstanceID)
- }
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- //operationType = deactivateInstance/activateInstance
- String operationType = execution.getVariable("requestAction")
- if (isBlank(operationType)) {
- msg = "Input operationType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("operationType", operationType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in ActivateSliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType(operationType)
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String activateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + activateSyncResponse)
- sendWorkflowResponse(execution, 202, activateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
-
+ String Prefix="ActivateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //NSSI ID
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ //operationType = deactivateInstance/activateInstance
+ String operationType = execution.getVariable("requestAction")
+ if (isBlank(operationType)) {
+ msg = "Input operationType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("operationType", operationType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ActivateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ String operationType = execution.getVariable("operationType")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType(operationType)
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String activateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + activateSyncResponse)
+ sendWorkflowResponse(execution, 202, activateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
index 5a7722d679..9100f2773b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy
@@ -33,158 +33,158 @@ import static org.apache.commons.lang3.StringUtils.isBlank
class AllocateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="ASS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
- JsonUtils jsonUtil = new JsonUtils()
- private static final Logger logger = LoggerFactory.getLogger(AllocateSliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //modelInfo
- String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
- if (isBlank(modelInvariantUuid)) {
- msg = "Input modelInvariantUuid is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- }
-
- logger.debug("modelInvariantUuid: " + modelInvariantUuid)
-
- String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
- if (isBlank(modelUuid)) {
- msg = "Input modelUuid is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("modelUuid", modelUuid)
- }
-
- logger.debug("modelUuid: " + modelUuid)
-
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
- String dummyServiceId = new UUID(0,0).toString();
- execution.setVariable("dummyServiceId", dummyServiceId)
- logger.debug("dummyServiceId: " + dummyServiceId)
- String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
- execution.setVariable("servicename", servicename)
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in AllocateSliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("dummyServiceId")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType("Allocate")
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
- sendWorkflowResponse(execution, 202, allocateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
-
+ String Prefix="AllocateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private static final Logger logger = LoggerFactory.getLogger(AllocateSliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //modelInfo
+ String modelInvariantUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelInvariantUuid")
+ if (isBlank(modelInvariantUuid)) {
+ msg = "Input modelInvariantUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ }
+
+ logger.debug("modelInvariantUuid: " + modelInvariantUuid)
+
+ String modelUuid = jsonUtil.getJsonValue(subnetInstanceReq, "modelUuid")
+ if (isBlank(modelUuid)) {
+ msg = "Input modelUuid is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("modelUuid", modelUuid)
+ }
+
+ logger.debug("modelUuid: " + modelUuid)
+
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+ String dummyServiceId = new UUID(0,0).toString();
+ execution.setVariable("dummyServiceId", dummyServiceId)
+ logger.debug("dummyServiceId: " + dummyServiceId)
+ String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
+ execution.setVariable("servicename", servicename)
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in AllocateSliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("dummyServiceId")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType("Allocate")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String allocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "").trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + allocateSyncResponse)
+ sendWorkflowResponse(execution, 202, allocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
index 964baa7a9d..65885f3516 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
@@ -32,14 +32,13 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="DeASS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
-
- @Override
+ String Prefix="DeAllocateSliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+ private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
+
+ @Override
void preProcessRequest(DelegateExecution execution) {
logger.debug(Prefix + "preProcessRequest Start")
execution.setVariable("prefix", Prefix)
@@ -62,8 +61,8 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
} else {
execution.setVariable("globalSubscriberId", globalSubscriberId)
}
-
- //NSSI ID
+
+ //NSSI ID
String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
if (isBlank(serviceInstanceID)) {
msg = "Input serviceInstanceID is null"
@@ -73,27 +72,27 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
{
execution.setVariable("serviceInstanceID", serviceInstanceID)
}
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
//requestParameters, subscriptionServiceType is 5G
String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
if (isBlank(subscriptionServiceType)) {
@@ -106,9 +105,9 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
String jobId = UUID.randomUUID().toString()
execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
} catch(BpmnError e) {
throw e
@@ -131,13 +130,13 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
+ String nsiId = execution.getVariable("nsiId")
logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
ResourceOperationStatus initStatus = new ResourceOperationStatus()
initStatus.setServiceId(serviceId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setResourceTemplateUUID(nsiId)
initStatus.setOperType("Deallocate")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
@@ -145,26 +144,26 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
}
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
-
- logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
- sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String deAllocateSyncResponse = """{"jobId": "${jobId}","status": "processing"}""".trim().replaceAll(" ", "")
+
+ logger.debug("sendSyncResponse to APIH:" + "\n" + deAllocateSyncResponse)
+ sendWorkflowResponse(execution, 202, deAllocateSyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
index 47489b7b84..0465a433eb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
@@ -32,142 +32,142 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class ModifySliceSubnet extends AbstractServiceTaskProcessor {
- String Prefix="MSS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- RequestDBUtil requestDBUtil = new RequestDBUtil()
-
- private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
-
- @Override
- void preProcessRequest(DelegateExecution execution) {
- logger.debug(Prefix + "preProcessRequest Start")
- execution.setVariable("prefix", Prefix)
- execution.setVariable("startTime", System.currentTimeMillis())
- def msg
- try {
- // get request input
- String subnetInstanceReq = execution.getVariable("bpmnRequest")
- logger.debug(subnetInstanceReq)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //NSSI Info
- String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
- if (isBlank(serviceInstanceID)) {
- msg = "Input serviceInstanceID is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceInstanceID", serviceInstanceID)
- }
-
- String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
- execution.setVariable("servicename", servicename)
-
- String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
- if (isBlank(nsiId)) {
- msg = "Input nsiId is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("nsiId", nsiId)
- }
-
- String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
- if (isBlank(networkType)) {
- msg = "Input networkType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("networkType", networkType.toUpperCase())
- }
-
- //requestParameters, subscriptionServiceType is 5G
- String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
- String jobId = UUID.randomUUID().toString()
- execution.setVariable("jobId", jobId)
-
- String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
- execution.setVariable("sliceParams", sliceParams)
-
- } catch(BpmnError e) {
- throw e
- } catch(Exception ex) {
- msg = "Exception in ModifySliceSubnet.preProcessRequest " + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "preProcessRequest Exit")
- }
-
-
- /**
- * create operation status in request db
- *
- * Init the Operation Status
- */
- def prepareInitOperationStatus = { DelegateExecution execution ->
- logger.debug(Prefix + "prepareInitOperationStatus Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
- String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
-
- ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
- initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
- initStatus.setOperType("Modify")
- requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
-
- logger.debug(Prefix + "prepareInitOperationStatus Exit")
- }
-
-
-
- /**
- * return sync response
- */
- def sendSyncResponse = { DelegateExecution execution ->
- logger.debug(Prefix + "sendSyncResponse Start")
- try {
- String jobId = execution.getVariable("jobId")
- String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
- .trim().replaceAll(" ", "")
- logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
- sendWorkflowResponse(execution, 202, modifySyncResponse)
-
- execution.setVariable("sentSyncResponse", true)
- } catch (Exception ex) {
- String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- logger.debug(Prefix + "sendSyncResponse Exit")
- }
+ String Prefix="ModifySliceSubnet_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("startTime", System.currentTimeMillis())
+ def msg
+ try {
+ // get request input
+ String subnetInstanceReq = execution.getVariable("bpmnRequest")
+ logger.debug(subnetInstanceReq)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ logger.debug("Input Request:" + subnetInstanceReq + " reqId:" + requestId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(subnetInstanceReq, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //NSSI Info
+ String serviceInstanceID = jsonUtil.getJsonValue(subnetInstanceReq, "serviceInstanceID")
+ if (isBlank(serviceInstanceID)) {
+ msg = "Input serviceInstanceID is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceInstanceID", serviceInstanceID)
+ }
+
+ String servicename = jsonUtil.getJsonValue(subnetInstanceReq, "name")
+ execution.setVariable("servicename", servicename)
+
+ String nsiId = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties.nsiInfo.nsiId")
+ if (isBlank(nsiId)) {
+ msg = "Input nsiId is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("nsiId", nsiId)
+ }
+
+ String networkType = jsonUtil.getJsonValue(subnetInstanceReq, "networkType")
+ if (isBlank(networkType)) {
+ msg = "Input networkType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("networkType", networkType.toUpperCase())
+ }
+
+ //requestParameters, subscriptionServiceType is 5G
+ String subscriptionServiceType = jsonUtil.getJsonValue(subnetInstanceReq, "subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+ String jobId = UUID.randomUUID().toString()
+ execution.setVariable("jobId", jobId)
+
+ String sliceParams = jsonUtil.getJsonValue(subnetInstanceReq, "additionalProperties")
+ execution.setVariable("sliceParams", sliceParams)
+
+ } catch(BpmnError e) {
+ throw e
+ } catch(Exception ex) {
+ msg = "Exception in ModifySliceSubnet.preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * create operation status in request db
+ *
+ * Init the Operation Status
+ */
+ def prepareInitOperationStatus = { DelegateExecution execution ->
+ logger.debug(Prefix + "prepareInitOperationStatus Start")
+
+ String serviceId = execution.getVariable("serviceInstanceID")
+ String jobId = execution.getVariable("jobId")
+ String nsiId = execution.getVariable("nsiId")
+ logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
+
+ ResourceOperationStatus initStatus = new ResourceOperationStatus()
+ initStatus.setServiceId(serviceId)
+ initStatus.setOperationId(jobId)
+ initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setOperType("Modify")
+ requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
+
+ logger.debug(Prefix + "prepareInitOperationStatus Exit")
+ }
+
+
+
+ /**
+ * return sync response
+ */
+ def sendSyncResponse = { DelegateExecution execution ->
+ logger.debug(Prefix + "sendSyncResponse Start")
+ try {
+ String jobId = execution.getVariable("jobId")
+ String modifySyncResponse = """{"jobId": "${jobId}","status": "processing"}"""
+ .trim().replaceAll(" ", "")
+ logger.debug("sendSyncResponse to APIH:" + "\n" + modifySyncResponse)
+ sendWorkflowResponse(execution, 202, modifySyncResponse)
+
+ execution.setVariable("sentSyncResponse", true)
+ } catch (Exception ex) {
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug(Prefix + "sendSyncResponse Exit")
+ }
}