import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import static org.apache.commons.lang3.StringUtils.*;
import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils;
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.json.JsonUtils;
+import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources;
/**
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
CatalogDbUtils cutils = new CatalogDbUtils()
+ AAICreateResources aaiCR = new AAICreateResources()
/**
* This method gets and validates the incoming
* @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 CreateVnfInfra PreProcessRequest Process*** ", isDebugEnabled)
utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PreProcessRequest Process ***", isDebugEnabled)
}
- public void sendSyncResponse (Execution execution) {
+ public void sendSyncResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
}
- public void preProcessSDNCAssignRequest(Execution execution){
+ public void preProcessSDNCAssignRequest(DelegateExecution execution){
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled)
}
- public void preProcessSDNCActivateRequest(Execution execution) {
+ public void preProcessSDNCActivateRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' +
'execution=' + execution.getId() +
')'
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){
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)
logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled)
}
- public void prepareCompletionHandlerRequest(Execution execution){
+ public void prepareCompletionHandlerRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process ***", isDebugEnabled)
}
- public void sendErrorResponse(Execution execution){
+ public void sendErrorResponse(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", "*** COMPLETED CreateVnfInfra sendErrorResponse Process ***", isDebugEnabled)
}
- public void prepareFalloutRequest(Execution execution){
+ public void prepareFalloutRequest(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
}
- public void queryCatalogDB (Execution execution) {
+ public void queryCatalogDB (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
vnfModelCustomizationUuid, "v2")
- utils.log("DEBUG", "obtained VNF list: " + vnfs, isDebugEnabled)
- execution.setVariable("CREVI_vnfs", vnfs)
+ utils.log("DEBUG", "obtained VNF list: " + vnfs, isDebugEnabled)
if (vnfs == null) {
utils.log("ERROR", "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, isDebugEnabled)
utils.log("DEBUG", "*** COMPLETED CreateVnfInfra QueryCatalogDb Process ***", isDebugEnabled)
}
+ public void createPlatform (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** START createPlatform *****", isDebugEnabled)
+
+ String request = execution.getVariable("bpmnRequest")
+ String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName")
+ String vnfId = execution.getVariable("CREVI_vnfId")
+
+ utils.log("DEBUG","Platform NAME: " + platformName, isDebugEnabled)
+ utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled)
+
+ if(platformName == null||platformName.equals("")){
+ String msg = "Exception in createPlatform. platformName was not found in the request.";
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }else{
+ utils.log("DEBUG", "platformName was found.", isDebugEnabled)
+ try{
+ AAICreateResources aaiCR = new AAICreateResources()
+ aaiCR.createAAIPlatform(platformName, vnfId)
+ }catch(Exception ex){
+ String msg = "Exception in createPlatform. " + ex.getMessage();
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ utils.log("DEBUG"," *** Exit createPlatform *** ", isDebugEnabled)
+ }
+ public void createLineOfBusiness (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** START createLineOfBusiness *****", isDebugEnabled)
+
+ String request = execution.getVariable("bpmnRequest")
+ String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName")
+ String vnfId = execution.getVariable("CREVI_vnfId")
+
+ utils.log("DEBUG","LineOfBusiness NAME: " + lineOfBusiness, isDebugEnabled)
+ utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled)
+
+ if(lineOfBusiness == null || lineOfBusiness.equals("")){
+ utils.log("DEBUG", "LineOfBusiness was not found. Continuing on with flow...", isDebugEnabled)
+ }else{
+ utils.log("DEBUG", "LineOfBusiness was found.", isDebugEnabled)
+ try{
+ AAICreateResources aaiCR = new AAICreateResources()
+ aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId)
+ }catch(Exception ex){
+ String msg = "Exception in LineOfBusiness. " + ex.getMessage();
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+ utils.log("DEBUG"," *** Exit createLineOfBusiness *** ", isDebugEnabled)
+ }
}