summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2019-06-06 08:15:33 +0000
committerGerrit Code Review <gerrit@onap.org>2019-06-06 08:15:33 +0000
commitc06246b9fdeaaebac1a0edde5921c9848c08bc33 (patch)
tree3d5b7c9f8b9832ce3eb89879e66c5fcf8c3ccc93
parentac23d73b587dfc352f83d54aadd4e5199f5c3555 (diff)
parente4fad24b687b054e7039c491b46f0fd013edd1c0 (diff)
Merge "Added post process to AAI in HandlePNF" into dublin
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/HandlePNF.groovy38
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/HandlePNF.bpmn66
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 = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${msoUtils.xmlEscape(operType)}</operType>
+ <operationId>${msoUtils.xmlEscape(operationId)}</operationId>
+ <progress>${msoUtils.xmlEscape(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEscape(serviceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEscape(status)}</status>
+ <statusDescription>${msoUtils.xmlEscape(statusDescription)}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+ 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)</bpmn:script>
<bpmn:endEvent id="EndEvent_0pigsdfk3" name="end PNF hadler">
<bpmn:incoming>SequenceFlow_02fi1yn</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1la8oih" sourceRef="PostProcessPNFDiscovery" targetRef="Task_1r8h7of" />
+ <bpmn:sequenceFlow id="SequenceFlow_1la8oih" sourceRef="PostProcessPNFDiscovery" targetRef="Task_1kxmpj3" />
<bpmn:callActivity id="Task_0657l04" name="invoke pnf handler" calledElement="CreateAndActivatePnfResource">
<bpmn:extensionElements>
<camunda:in source="pnfCorrelationId" target="pnfCorrelationId" />
@@ -27,13 +27,6 @@ handlePNF.preProcessRequest(execution)</bpmn:script>
<bpmn:incoming>SequenceFlow_1apj1fn</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0pujwl4</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:scriptTask id="PostProcessPNFDiscovery" name="Post Process Request" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_0pujwl4</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1la8oih</bpmn:outgoing>
- <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
-def handlePNF = new HandlePNF()
-handlePNF.postProcessRequest(execution)</bpmn:script>
- </bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_12q67gd" sourceRef="Task_13sx2bp_activate" targetRef="Task_0kv28gm" />
<bpmn:sequenceFlow id="SequenceFlow_1apj1fn" sourceRef="Task_0kv28gm" targetRef="Task_0657l04" />
<bpmn:serviceTask id="Task_0kv28gm" name="Generate PNF uuid" camunda:delegateExpression="${GeneratePnfUuidDelegate}">
@@ -42,12 +35,42 @@ handlePNF.postProcessRequest(execution)</bpmn:script>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_02fi1yn" sourceRef="Task_1r8h7of" targetRef="EndEvent_0pigsdfk3" />
<bpmn:scriptTask id="Task_1r8h7of" name="Send Sync Response" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1la8oih</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ud44f8</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_02fi1yn</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def handlePNF = new HandlePNF()
handlePNF.sendSyncResponse(execution)</bpmn:script>
</bpmn:scriptTask>
+ <bpmn:scriptTask id="PostProcessPNFDiscovery" name="Post Process Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0pujwl4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1la8oih</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def handlePNF = new HandlePNF()
+handlePNF.postProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1ud44f8" sourceRef="Task_1kxmpj3" targetRef="Task_1r8h7of" />
+ <bpmn:serviceTask id="Task_1kxmpj3" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_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">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1la8oih</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ud44f8</bpmn:outgoing>
+ </bpmn:serviceTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HandlePNF">
@@ -69,21 +92,18 @@ handlePNF.sendSyncResponse(execution)</bpmn:script>
<di:waypoint x="156" y="324" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0pigdk3_di" bpmnElement="EndEvent_0pigsdfk3">
- <dc:Bounds x="543" y="306" width="36" height="36" />
+ <dc:Bounds x="626" y="306" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="524" y="349" width="78" height="14" />
+ <dc:Bounds x="607" y="349" width="78" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1la8oih_di" bpmnElement="SequenceFlow_1la8oih">
<di:waypoint x="256" y="324" />
- <di:waypoint x="353" y="324" />
+ <di:waypoint x="303" y="324" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1sxp6qj_di" bpmnElement="Task_0657l04">
<dc:Bounds x="-19" y="284" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_0qqb00i_di" bpmnElement="PostProcessPNFDiscovery">
- <dc:Bounds x="156" y="284" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_12q67gd_di" bpmnElement="SequenceFlow_12q67gd">
<di:waypoint x="-241" y="324" />
<di:waypoint x="-176" y="324" />
@@ -96,11 +116,21 @@ handlePNF.sendSyncResponse(execution)</bpmn:script>
<dc:Bounds x="-176" y="284" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02fi1yn_di" bpmnElement="SequenceFlow_02fi1yn">
- <di:waypoint x="453" y="324" />
- <di:waypoint x="543" y="324" />
+ <di:waypoint x="536" y="324" />
+ <di:waypoint x="626" y="324" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1yqlrg7_di" bpmnElement="Task_1r8h7of">
- <dc:Bounds x="353" y="284" width="100" height="80" />
+ <dc:Bounds x="436" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0qqb00i_di" bpmnElement="PostProcessPNFDiscovery">
+ <dc:Bounds x="156" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ud44f8_di" bpmnElement="SequenceFlow_1ud44f8">
+ <di:waypoint x="403" y="324" />
+ <di:waypoint x="436" y="324" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0fkkgnl_di" bpmnElement="Task_1kxmpj3">
+ <dc:Bounds x="303" y="284" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>