summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsanket12345 <SX00562924@techmahindra.com>2021-08-25 16:13:09 +0530
committersanket12345 <SX00562924@techmahindra.com>2021-08-25 16:13:19 +0530
commit08e1502c1820a027f7412593023e9588cf4d37c8 (patch)
treeb5f094cc36bf21bdefc02c446fc5fb5b2bece138
parent11b71ce0c8520c4f20e00805bfadf2672a537d0e (diff)
Implement Building Blocks for CNF AAI update
Code changes to implement Building Blocks for CNF AAI update and delete Issue-ID: SO-3717 Signed-off-by: sanket12345 <SX00562924@techmahindra.com> Change-Id: I93b555800a24048f6ecf4e7e786e4bdefa6952fc
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn48
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn102
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateCnfAai.bpmn102
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java72
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateResponse.java36
6 files changed, 384 insertions, 57 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
index a32e9e8f62..49358c7c23 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true">
<bpmn:startEvent id="CreateVfModuleBB_Start">
<bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing>
@@ -47,7 +47,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1vbwdaw" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" />
<bpmn:serviceTask id="CreateNetworkPolicies" name="AAI Create (network policies)" camunda:expression="${AAICreateTasks.createNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>Flow_10aq7a8</bpmn:incoming>
- <bpmn:incoming>Flow_1il4743</bpmn:incoming>
+ <bpmn:incoming>Flow_1xlm2ij</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0xqhep5</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0xqhep5" sourceRef="CreateNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
@@ -107,11 +107,31 @@
<bpmn:sequenceFlow id="Flow_03q6ty9" sourceRef="Activity_1p8hxyt" targetRef="Event_108oetk" />
</bpmn:subProcess>
<bpmn:sequenceFlow id="Flow_10aq7a8" sourceRef="ServiceTask_00d84m7" targetRef="CreateNetworkPolicies" />
- <bpmn:sequenceFlow id="Flow_1il4743" sourceRef="CnfAdapter" targetRef="CreateNetworkPolicies" />
+ <bpmn:sequenceFlow id="Flow_1il4743" sourceRef="CnfAdapter" targetRef="UpdateCnfAai" />
+ <bpmn:sequenceFlow id="Flow_1xlm2ij" sourceRef="UpdateCnfAai" targetRef="CreateNetworkPolicies" />
+ <bpmn:callActivity id="UpdateCnfAai" name="Update Cnf Data in AAI" calledElement="UpdateCnfAai">
+ <bpmn:extensionElements>
+ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="heatStackId" target="heatStackId" />
+ <camunda:out source="heatStackId" target="heatStackId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1il4743</bpmn:incoming>
+ <bpmn:outgoing>Flow_1xlm2ij</bpmn:outgoing>
+ </bpmn:callActivity>
</bpmn:process>
<bpmn:error id="Error_0t7oivz" name="AAIInventoryFailure" errorCode="AAIInventoryFailure" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVfModuleBB">
+ <bpmndi:BPMNEdge id="Flow_1il4743_di" bpmnElement="Flow_1il4743">
+ <di:waypoint x="646" y="250" />
+ <di:waypoint x="424" y="250" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_10aq7a8_di" bpmnElement="Flow_10aq7a8">
+ <di:waypoint x="646" y="366" />
+ <di:waypoint x="374" y="366" />
+ <di:waypoint x="374" y="428" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0uetprw_di" bpmnElement="SequenceFlow_0uetprw">
<di:waypoint x="1009" y="146" />
<di:waypoint x="1009" y="326" />
@@ -212,15 +232,10 @@
<dc:Bounds x="156" y="91" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_10aq7a8_di" bpmnElement="Flow_10aq7a8">
- <di:waypoint x="646" y="366" />
- <di:waypoint x="374" y="366" />
- <di:waypoint x="374" y="428" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1il4743_di" bpmnElement="Flow_1il4743">
- <di:waypoint x="646" y="250" />
- <di:waypoint x="200" y="250" />
- <di:waypoint x="200" y="468" />
+ <bpmndi:BPMNEdge id="Flow_1xlm2ij_di" bpmnElement="Flow_1xlm2ij">
+ <di:waypoint x="324" y="250" />
+ <di:waypoint x="190" y="250" />
+ <di:waypoint x="190" y="468" />
<di:waypoint x="324" y="468" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="CreateVfModuleBB_Start">
@@ -271,15 +286,18 @@
<bpmndi:BPMNShape id="ServiceTask_00d84m7_di" bpmnElement="ServiceTask_00d84m7">
<dc:Bounds x="646" y="326" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0tag50w_di" bpmnElement="CnfAdapter">
- <dc:Bounds x="646" y="210" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1g3vemz_di" bpmnElement="CheckIfIsHelm" isMarkerVisible="true">
<dc:Bounds x="671" y="81" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="655" y="48" width="82" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0tag50w_di" bpmnElement="CnfAdapter">
+ <dc:Bounds x="646" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_08npiny_di" bpmnElement="UpdateCnfAai">
+ <dc:Bounds x="324" y="210" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_10eqhmz_di" bpmnElement="Activity_10eqhmz" isExpanded="true">
<dc:Bounds x="240" y="590" width="340" height="180" />
</bpmndi:BPMNShape>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
index 36d1708a45..128d2fff7f 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true">
<bpmn:startEvent id="DeleteVfModuleBB_Start">
<bpmn:outgoing>Flow_069drgn</bpmn:outgoing>
@@ -58,7 +58,7 @@
</bpmn:serviceTask>
<bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI">
<bpmn:incoming>Flow_0plbl7p</bpmn:incoming>
- <bpmn:incoming>Flow_1ktykz6</bpmn:incoming>
+ <bpmn:incoming>Flow_1sj2wbe</bpmn:incoming>
<bpmn:linkEventDefinition name="AAI" />
</bpmn:intermediateThrowEvent>
<bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI">
@@ -96,7 +96,7 @@
<bpmn:incoming>Flow_10r76pp</bpmn:incoming>
<bpmn:outgoing>Flow_1ktykz6</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:sequenceFlow id="Flow_1ktykz6" sourceRef="Activity_1aqardy" targetRef="aaiThrow" />
+ <bpmn:sequenceFlow id="Flow_1ktykz6" sourceRef="Activity_1aqardy" targetRef="UpdateCnfAai" />
<bpmn:exclusiveGateway id="CheckIfIsHelm" name="Check if is helm">
<bpmn:incoming>Flow_069drgn</bpmn:incoming>
<bpmn:outgoing>Flow_10r76pp</bpmn:outgoing>
@@ -108,12 +108,50 @@
<bpmn:sequenceFlow id="Flow_0yz0t7z" sourceRef="DeleteVfModuleVnfAdapter" targetRef="VnfAdapter" />
<bpmn:sequenceFlow id="Flow_069drgn" sourceRef="DeleteVfModuleBB_Start" targetRef="CheckIfIsHelm" />
<bpmn:sequenceFlow id="Flow_1c15ua4" name="No" sourceRef="CheckIfIsHelm" targetRef="DeleteVfModuleVnfAdapter" />
+ <bpmn:callActivity id="UpdateCnfAai" name="Update Cnf Data in AAI" calledElement="UpdateCnfAai">
+ <bpmn:extensionElements>
+ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="heatStackId" target="heatStackId" />
+ <camunda:out source="heatStackId" target="heatStackId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1ktykz6</bpmn:incoming>
+ <bpmn:outgoing>Flow_1sj2wbe</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_1sj2wbe" sourceRef="UpdateCnfAai" targetRef="aaiThrow" />
</bpmn:process>
<bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" />
<bpmn:escalation id="Escalation_130je8j" name="audit" escalationCode="audit1" />
<bpmn:error id="Error_1le3oui" name="AAIInventoryFailure" errorCode="AAIInventoryFailure" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB">
+ <bpmndi:BPMNEdge id="Flow_1c15ua4_di" bpmnElement="Flow_1c15ua4">
+ <di:waypoint x="305" y="254" />
+ <di:waypoint x="400" y="254" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="345" y="236" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_069drgn_di" bpmnElement="Flow_069drgn">
+ <di:waypoint x="195" y="254" />
+ <di:waypoint x="255" y="254" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0yz0t7z_di" bpmnElement="Flow_0yz0t7z">
+ <di:waypoint x="500" y="254" />
+ <di:waypoint x="580" y="254" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_10r76pp_di" bpmnElement="Flow_10r76pp">
+ <di:waypoint x="280" y="229" />
+ <di:waypoint x="280" y="120" />
+ <di:waypoint x="400" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="256" y="162" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1ktykz6_di" bpmnElement="Flow_1ktykz6">
+ <di:waypoint x="500" y="120" />
+ <di:waypoint x="740" y="120" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0hlvlw2_di" bpmnElement="Flow_0hlvlw2">
<di:waypoint x="680" y="254" />
<di:waypoint x="760" y="254" />
@@ -172,40 +210,20 @@
<dc:Bounds x="848" y="493" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1ktykz6_di" bpmnElement="Flow_1ktykz6">
- <di:waypoint x="680" y="120" />
+ <bpmndi:BPMNEdge id="Flow_1sj2wbe_di" bpmnElement="Flow_1sj2wbe">
+ <di:waypoint x="840" y="120" />
<di:waypoint x="1080" y="120" />
<di:waypoint x="1080" y="236" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_10r76pp_di" bpmnElement="Flow_10r76pp">
- <di:waypoint x="280" y="229" />
- <di:waypoint x="280" y="120" />
- <di:waypoint x="580" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="256" y="162" width="18" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_0yz0t7z_di" bpmnElement="Flow_0yz0t7z">
- <di:waypoint x="500" y="254" />
- <di:waypoint x="580" y="254" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_069drgn_di" bpmnElement="Flow_069drgn">
- <di:waypoint x="195" y="254" />
- <di:waypoint x="255" y="254" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1c15ua4_di" bpmnElement="Flow_1c15ua4">
- <di:waypoint x="305" y="254" />
- <di:waypoint x="400" y="254" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="345" y="236" width="15" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start">
<dc:Bounds x="159" y="236" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="132" y="302" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter">
+ <dc:Bounds x="400" y="214" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus">
<dc:Bounds x="930" y="438" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -215,6 +233,9 @@
<dc:Bounds x="1241" y="530" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter">
+ <dc:Bounds x="580" y="214" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId">
<dc:Bounds x="800" y="438" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -248,20 +269,8 @@
<bpmndi:BPMNShape id="ServiceTask_08ulmzc_di" bpmnElement="ServiceTask_08ulmzc">
<dc:Bounds x="760" y="214" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Gateway_0s4azdf_di" bpmnElement="CheckIfIsHelm" isMarkerVisible="true">
- <dc:Bounds x="255" y="229" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="240" y="289" width="79" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter">
- <dc:Bounds x="400" y="214" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter">
- <dc:Bounds x="580" y="214" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1aqardy_di" bpmnElement="Activity_1aqardy">
- <dc:Bounds x="580" y="80" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_1wkyyas_di" bpmnElement="UpdateCnfAai">
+ <dc:Bounds x="740" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1thbmzc_di" bpmnElement="Activity_1thbmzc" isExpanded="true">
<dc:Bounds x="280" y="620" width="340" height="180" />
@@ -283,6 +292,15 @@
<bpmndi:BPMNShape id="Activity_025387k_di" bpmnElement="Activity_025387k">
<dc:Bounds x="400" y="670" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1aqardy_di" bpmnElement="Activity_1aqardy">
+ <dc:Bounds x="400" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Gateway_0s4azdf_di" bpmnElement="CheckIfIsHelm" isMarkerVisible="true">
+ <dc:Bounds x="255" y="229" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="240" y="289" width="79" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateCnfAai.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateCnfAai.bpmn
new file mode 100644
index 0000000000..01187b06b0
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateCnfAai.bpmn
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0fq2csp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+ <bpmn:process id="UpdateCnfAai" name="UpdateCnfAai" isExecutable="true">
+ <bpmn:startEvent id="UpdateCnfAai_start" name="UpdateCnfAai_start">
+ <bpmn:outgoing>Flow_17d9zpo</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="Activity_0tu6gf2" name="Prepare for Cnf AAI Update Call" camunda:expression="${CnfAdapterCreateTasks.prepareForCnfUpdateOrDelete(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_17d9zpo</bpmn:incoming>
+ <bpmn:outgoing>Flow_01esiz5</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:callActivity id="Activity_0gpndy6" name="Call CNFAdapterAsync" calledElement="CNFAdapterAsyncCall">
+ <bpmn:extensionElements>
+ <camunda:in source="apiPath" target="apiPath" />
+ <camunda:in source="cnfRequestPayload" target="cnfRequestPayload" />
+ <camunda:in source="correlator" target="correlator" />
+ <camunda:in source="timeout" target="timeout" />
+ <camunda:in source="messageType" target="messageType" />
+ <camunda:in source="true" target="isDebugLogEnabled" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="asyncCallbackResponse" target="asyncCallbackResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_01esiz5</bpmn:incoming>
+ <bpmn:outgoing>Flow_0tm9une</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:serviceTask id="Activity_0npavuq" name="Process Response" camunda:expression="${CnfAdapterCreateTasks.processCnfUpdateOrDeleteAsyncResponse(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>Flow_0tm9une</bpmn:incoming>
+ <bpmn:outgoing>Flow_09shgs4</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="Flow_01esiz5" sourceRef="Activity_0tu6gf2" targetRef="Activity_0gpndy6" />
+ <bpmn:sequenceFlow id="Flow_0tm9une" sourceRef="Activity_0gpndy6" targetRef="Activity_0npavuq" />
+ <bpmn:endEvent id="UpdateCnfAai_end" name="UpdateCnfAai_end">
+ <bpmn:incoming>Flow_09shgs4</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_09shgs4" sourceRef="Activity_0npavuq" targetRef="UpdateCnfAai_end" />
+ <bpmn:sequenceFlow id="Flow_17d9zpo" sourceRef="UpdateCnfAai_start" targetRef="Activity_0tu6gf2" />
+ <bpmn:subProcess id="Activity_09xxfqs" name="Error Handling&#10;&#10;" triggeredByEvent="true">
+ <bpmn:startEvent id="Event_1t2fty4">
+ <bpmn:outgoing>Flow_1js1xt1</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1cxu4n4" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1xa7ebu">
+ <bpmn:incoming>Flow_1js1xt1</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_149n8uo" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_1js1xt1" sourceRef="Event_1t2fty4" targetRef="Event_1xa7ebu" />
+ </bpmn:subProcess>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UpdateCnfAai">
+ <bpmndi:BPMNEdge id="Flow_01esiz5_di" bpmnElement="Flow_01esiz5">
+ <di:waypoint x="410" y="120" />
+ <di:waypoint x="500" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0tm9une_di" bpmnElement="Flow_0tm9une">
+ <di:waypoint x="600" y="120" />
+ <di:waypoint x="660" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_09shgs4_di" bpmnElement="Flow_09shgs4">
+ <di:waypoint x="760" y="120" />
+ <di:waypoint x="842" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_17d9zpo_di" bpmnElement="Flow_17d9zpo">
+ <di:waypoint x="258" y="120" />
+ <di:waypoint x="310" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Activity_0tu6gf2_di" bpmnElement="Activity_0tu6gf2">
+ <dc:Bounds x="310" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_0gv6qf0_di" bpmnElement="UpdateCnfAai_end">
+ <dc:Bounds x="842" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="820" y="145" width="81" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="UpdateCnfAai_start">
+ <dc:Bounds x="222" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="195" y="145" width="90" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0gpndy6_di" bpmnElement="Activity_0gpndy6">
+ <dc:Bounds x="500" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0npavuq_di" bpmnElement="Activity_0npavuq">
+ <dc:Bounds x="660" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_09xxfqs_di" bpmnElement="Activity_09xxfqs" isExpanded="true">
+ <dc:Bounds x="360" y="250" width="460" height="135" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Flow_1js1xt1_di" bpmnElement="Flow_1js1xt1">
+ <di:waypoint x="478" y="324" />
+ <di:waypoint x="712" y="324" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_1t2fty4_di" bpmnElement="Event_1t2fty4">
+ <dc:Bounds x="442" y="306" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1xa7ebu_di" bpmnElement="Event_1xa7ebu">
+ <dc:Bounds x="712" y="306" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
index f49cf48ff5..2dda26718f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
@@ -35,6 +35,8 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.adapter.cnf.CnfAdapterClient;
+import org.onap.so.client.adapter.cnf.entities.CnfAaiUpdateRequest;
+import org.onap.so.client.adapter.cnf.entities.CnfAaiUpdateResponse;
import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
import org.onap.so.client.adapter.vnf.mapper.AttributeNameValue;
@@ -47,6 +49,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -54,6 +57,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class CnfAdapterCreateTasks {
private static final Logger logger = LoggerFactory.getLogger(CnfAdapterCreateTasks.class);
public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_";
+ private static final String CNF_ADAPTER_MESSAGE_TYPE = "CNFCallback";
+ private static final String CNF_ADAPTER_CALLBACK_TIMEOUT = "PT30M";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -122,4 +127,80 @@ public class CnfAdapterCreateTasks {
return request;
}
+ public void prepareForCnfUpdateOrDelete(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ String heatStackId = execution.getVariable("heatStackId");
+
+ logger.debug("heatStackId: {}", heatStackId);
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ String requestId = execution.getVariable("mso-request-id");
+
+ String callbackUrl =
+ "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/" + CNF_ADAPTER_MESSAGE_TYPE + "/" + requestId;
+
+ CnfAaiUpdateRequest aaiRequest = createCnfAaiUpdateRequest(heatStackId, cloudRegion, callbackUrl);
+ logger.debug("aaiRequest: {}", aaiRequest);
+
+ String cnfRequestPayload = "";
+ try {
+ cnfRequestPayload = mapper.writeValueAsString(aaiRequest);
+ } catch (JsonProcessingException e) {
+ logger.error("Exception occurred", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+
+ // Prepare values to pass in execution variable for CNF Adapter async Handling
+ execution.setVariable("messageType", CNF_ADAPTER_MESSAGE_TYPE);
+ execution.setVariable("correlator", requestId);
+ execution.setVariable("timeout", CNF_ADAPTER_CALLBACK_TIMEOUT);
+
+ String currentFlow = execution.getFlowToBeCalled();
+ logger.debug("currentFlow: {}", currentFlow);
+
+ String apiPath = "http://so-cnf-adapter:8090";
+ if ("CreateVfModuleBB".equals(currentFlow)) {
+ apiPath = apiPath + "/api/cnf-adapter/v1/aai-update/";
+ } else if ("DeleteVfModuleBB".equals(currentFlow)) {
+ apiPath = apiPath + "/api/cnf-adapter/v1/aai-delete/";
+ }
+
+ // Set variables in execution variable\
+ execution.setVariable("apiPath", apiPath);
+ execution.setVariable("cnfRequestPayload", cnfRequestPayload);
+ }
+
+ public void processCnfUpdateOrDeleteAsyncResponse(BuildingBlockExecution execution) {
+
+ String asyncResponse = execution.getVariable("asyncCallbackResponse");
+
+ CnfAaiUpdateResponse response = new CnfAaiUpdateResponse();
+
+ logger.debug("asyncResponse: {}", asyncResponse);
+
+ try {
+ response = mapper.readValue(asyncResponse, CnfAaiUpdateResponse.class);
+ } catch (JsonProcessingException e) {
+ logger.error("Error in parsing Cnf AAI update Response");
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+
+ if (!"COMPLETED".equalsIgnoreCase(response.getStatus())) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, new RuntimeException("Cannot update in AAI"));
+ }
+ }
+
+ protected CnfAaiUpdateRequest createCnfAaiUpdateRequest(String heatStackId, CloudRegion cloudRegion,
+ String callbackUrl) {
+ CnfAaiUpdateRequest request = new CnfAaiUpdateRequest();
+ request.setCallbackUrl(callbackUrl);
+ request.setCloudOwner(cloudRegion.getCloudOwner());
+ request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
+ request.setTenantId(cloudRegion.getTenantId());
+ request.setInstanceId(heatStackId);
+
+ return request;
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java
new file mode 100644
index 0000000000..4cc675f4e9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java
@@ -0,0 +1,72 @@
+package org.onap.so.client.adapter.cnf.entities;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonIgnoreProperties(value = "true")
+public class CnfAaiUpdateRequest {
+
+ @JsonProperty("instanceId")
+ private String instanceId;
+
+ @JsonProperty("cloudRegion")
+ private String cloudRegion;
+
+ @JsonProperty("cloudOwner")
+ private String cloudOwner;
+
+ @JsonProperty("tenantId")
+ private String tenantId;
+
+ @JsonProperty("callbackUrl")
+ private String callbackUrl;
+
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ public void setInstanceId(String instanceId) {
+ this.instanceId = instanceId;
+ }
+
+ public String getCloudRegion() {
+ return cloudRegion;
+ }
+
+ public void setCloudRegion(String cloudRegion) {
+ this.cloudRegion = cloudRegion;
+ }
+
+ public String getCloudOwner() {
+ return cloudOwner;
+ }
+
+ public void setCloudOwner(String cloudOwner) {
+ this.cloudOwner = cloudOwner;
+ }
+
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ public void setTenantId(String tenantId) {
+ this.tenantId = tenantId;
+ }
+
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ public void setCallbackUrl(String callbackUrl) {
+ this.callbackUrl = callbackUrl;
+ }
+
+ @Override
+ public String toString() {
+ return "CnfAaiUpdateRequest [instanceId=" + instanceId + ", cloudRegion=" + cloudRegion + ", cloudOwner="
+ + cloudOwner + ", tenantId=" + tenantId + ", callbackUrl=" + callbackUrl + "]";
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateResponse.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateResponse.java
new file mode 100644
index 0000000000..79d27abc35
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateResponse.java
@@ -0,0 +1,36 @@
+package org.onap.so.client.adapter.cnf.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+public class CnfAaiUpdateResponse {
+
+ @JsonProperty("status")
+ private String status;
+
+ @JsonProperty("statusMessage")
+ private String statusMessage;
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
+
+ public void setStatusMessage(String statusMessage) {
+ this.statusMessage = statusMessage;
+ }
+
+ @Override
+ public String toString() {
+ return "CnfAaiUpdateResponse [status=" + status + ", statusMessage=" + statusMessage + "]";
+ }
+
+}