aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy67
1 files changed, 38 insertions, 29 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index 6b98782527..adc2b695ef 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -20,9 +20,10 @@
package org.openecomp.mso.bpmn.infrastructure.scripts
import static org.apache.commons.lang3.StringUtils.*
+
import org.openecomp.mso.bpmn.core.RollbackData
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.springframework.web.util.UriUtils
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -55,7 +56,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
* @param - execution
*
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED DoCreateVnf PreProcessRequest Process*** ", isDebugEnabled)
@@ -201,9 +202,9 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl)
logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled)
- VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition")
-
+ VnfResource vnfResource = (VnfResource) execution.getVariable((String)"vnfResourceDecomposition")
String nfRole = vnfResource.getNfRole()
+
execution.setVariable("DoCVNF_nfRole", nfRole)
logDebug("NF Role is: " + nfRole, isDebugEnabled)
@@ -235,37 +236,45 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}
utils.log("DEBUG", "*** COMPLETED DoCreateVnf PreProcessRequest Process ***", isDebugEnabled)
}
-
- public void prepareCreateGenericVnf (Execution execution) {
+ private Object getVariableEnforced(DelegateExecution execution, String name){
+ Object enforced = execution.getVariable(name)
+ if(!enforced){
+ return "";
+ }
+ return enforced;
+ }
+
+ public void prepareCreateGenericVnf (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED DoCreateVnf PrepareCreateGenericVnf Process *** ", isDebugEnabled)
try {
//Get Vnf Info
- String vnfId = execution.getVariable("DoCVNF_vnfId")
- def vnfName = execution.getVariable("DoCVNF_vnfName")
+ String vnfId = getVariableEnforced(execution, "DoCVNF_vnfId")
+ String vnfName = getVariableEnforced(execution, "DoCVNF_vnfName")
if (vnfName == null) {
vnfName = "sdncGenerated"
utils.log("DEBUG", "Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName, isDebugEnabled)
}
- def vnfType = execution.getVariable("DoCVNF_vnfType")
- def serviceId = execution.getVariable("DoCVNF_serviceId")
- def orchStatus = execution.getVariable("DoCVNF_orchStatus")
- def modelInvariantId = execution.getVariable("DoCVNF_modelInvariantId")
- def modelVersionId = execution.getVariable("DoCVNF_modelVersionId")
- def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId")
+ String vnfType = getVariableEnforced(execution, "DoCVNF_vnfType")
+ utils.log("DEBUG", "WE ARE HERE:" + vnfType, isDebugEnabled)
+ String serviceId = getVariableEnforced(execution, "DoCVNF_serviceId")
+ String orchStatus = getVariableEnforced(execution, "DoCVNF_orchStatus")
+ String modelInvariantId = getVariableEnforced(execution, "DoCVNF_modelInvariantId")
+ String modelVersionId = getVariableEnforced(execution, "DoCVNF_modelVersionId")
+ String modelCustomizationId = getVariableEnforced(execution, "DoCVNF_modelCustomizationId")
// TODO: 1702 Variable
- def equipmentRole = execution.getVariable("DoCVNF_equipmentRole")
- def nfType = execution.getVariable("DoCVNF_nfType")
- def nfRole = execution.getVariable("DoCVNF_nfRole")
- def nfFunction = execution.getVariable("DoCVNF_nfFunction")
- def nfNamingCode = execution.getVariable("DoCVNF_nfNamingCode")
-
+ String equipmentRole = getVariableEnforced(execution, "DoCVNF_equipmentRole")
+ String nfType = getVariableEnforced(execution, "DoCVNF_nfType")
+ String nfRole = getVariableEnforced(execution, "DoCVNF_nfRole")
+ String nfFunction = getVariableEnforced(execution, "DoCVNF_nfFunction")
+ String nfNamingCode = getVariableEnforced(execution, "DoCVNF_nfNamingCode")
+
//Get Service Instance Info
- def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId")
- String siRelatedLink = execution.getVariable("GENGS_siResourceLink")
+ String serviceInstanceId = getVariableEnforced(execution, "DoCVNF_serviceInstanceId")
+ String siRelatedLink = getVariableEnforced(execution, "GENGS_siResourceLink")
int custStart = siRelatedLink.indexOf("customer/")
int custEnd = siRelatedLink.indexOf("/service-subscriptions")
@@ -324,7 +333,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
utils.log("DEBUG", "*** COMPLETED DoCreateVnf PrepareCreateGenericVnf Process ***", isDebugEnabled)
}
- public void postProcessCreateGenericVnf (Execution execution) {
+ public void postProcessCreateGenericVnf (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
@@ -344,7 +353,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
}
- public void preProcessSDNCAssignRequest(Execution execution){
+ public void preProcessSDNCAssignRequest(DelegateExecution execution){
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
@@ -370,7 +379,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
}
- public void preProcessSDNCActivateRequest(Execution execution) {
+ public void preProcessSDNCActivateRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
'execution=' + execution.getId() +
')'
@@ -395,7 +404,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled)
}
- public String buildSDNCRequest(Execution execution, String svcInstId, String action){
+ public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){
String uuid = execution.getVariable('testReqId') // for junits
if(uuid==null){
@@ -477,7 +486,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
return sdncRequest
}
- public void validateSDNCResponse(Execution execution, String response, String method){
+ public void validateSDNCResponse(DelegateExecution execution, String response, String method){
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
@@ -523,7 +532,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
}
- public void preProcessSDNCGetRequest(Execution execution){
+ public void preProcessSDNCGetRequest(DelegateExecution execution){
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
utils.log("DEBUG", " ======== STARTED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled)
@@ -596,7 +605,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void prepUpdateAAIGenericVnf(Execution execution) {
+ public void prepUpdateAAIGenericVnf(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' +
'execution=' + execution.getId() +
')'