From e4fad24b687b054e7039c491b46f0fd013edd1c0 Mon Sep 17 00:00:00 2001 From: "marios.iakovidis" Date: Wed, 5 Jun 2019 20:21:16 +0300 Subject: Added post process to AAI in HandlePNF Issue-ID: SO-1993 Signed-off-by: MariosIakovidis Change-Id: I6abec916438221669817b49997431b6164ee1a76 --- .../bpmn/infrastructure/scripts/HandlePNF.groovy | 38 +++++++++++++ .../src/main/resources/process/HandlePNF.bpmn | 66 ++++++++++++++++------ 2 files changed, 86 insertions(+), 18 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy index f06d71cec4..cbeb1d3d69 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy @@ -22,8 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.recipe.ResourceInput +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames import org.slf4j.Logger @@ -34,6 +38,8 @@ public class HandlePNF extends AbstractServiceTaskProcessor{ ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + MsoUtils msoUtils = new MsoUtils() + String Prefix="CRESI_" @Override void preProcessRequest(DelegateExecution execution) { @@ -65,7 +71,33 @@ public class HandlePNF extends AbstractServiceTaskProcessor{ void postProcessRequest(DelegateExecution execution) { logger.debug("start postProcess for HandlePNF") + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable("resourceInput"), ResourceInput.class) + String operType = resourceInputObj.getOperationType() + String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String serviceInstanceId = resourceInputObj.getServiceInstanceId() + String operationId = resourceInputObj.getOperationId() + String progress = "100" + String status = "finished" + String statusDescription = "SDCN resource creation and activation completed" + String body = """ + + + + + ${msoUtils.xmlEscape(operType)} + ${msoUtils.xmlEscape(operationId)} + ${msoUtils.xmlEscape(progress)} + ${msoUtils.xmlEscape(resourceCustomizationUuid)} + ${msoUtils.xmlEscape(serviceInstanceId)} + ${msoUtils.xmlEscape(status)} + ${msoUtils.xmlEscape(statusDescription)} + + + """; + logger.debug("body: "+body) + setProgressUpdateVariables(execution, body) logger.debug("exit postProcess for HandlePNF") } @@ -87,4 +119,10 @@ public class HandlePNF extends AbstractServiceTaskProcessor{ } logger.debug(" ***** Exit sendSyncResponse *****") } + + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution) + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn index 257a0dee64..43ebf9810e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn @@ -16,7 +16,7 @@ handlePNF.preProcessRequest(execution) SequenceFlow_02fi1yn - + @@ -27,13 +27,6 @@ handlePNF.preProcessRequest(execution) SequenceFlow_1apj1fn SequenceFlow_0pujwl4 - - SequenceFlow_0pujwl4 - SequenceFlow_1la8oih - import org.onap.so.bpmn.infrastructure.scripts.* -def handlePNF = new HandlePNF() -handlePNF.postProcessRequest(execution) - @@ -42,12 +35,42 @@ handlePNF.postProcessRequest(execution) - SequenceFlow_1la8oih + SequenceFlow_1ud44f8 SequenceFlow_02fi1yn import org.onap.so.bpmn.infrastructure.scripts.* def handlePNF = new HandlePNF() handlePNF.sendSyncResponse(execution) + + SequenceFlow_0pujwl4 + SequenceFlow_1la8oih + import org.onap.so.bpmn.infrastructure.scripts.* +def handlePNF = new HandlePNF() +handlePNF.postProcessRequest(execution) + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic YnBlbDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1la8oih + SequenceFlow_1ud44f8 + @@ -69,21 +92,18 @@ handlePNF.sendSyncResponse(execution) - + - + - + - - - @@ -96,11 +116,21 @@ handlePNF.sendSyncResponse(execution) - - + + - + + + + + + + + + + + -- cgit 1.2.3-korg