summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2021-11-26 16:28:01 -0500
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2021-11-26 16:52:57 -0500
commit18cc4f0fb16e1f03072222268eb2c5661d29bc23 (patch)
tree1e297144eb8bd6b8d237f37b171bb2799a27440d /bpmn
parent63947de885b4736461e8810faaad0ee15899fd8b (diff)
Add service composition building blocks
Issue-ID: SO-3811 Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca> Change-Id: I1f3eb0b6ae0e6ac1ce90dbd10d3737bb195c673b
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateChildServiceBB.bpmn135
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteChildServiceBB.bpmn135
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBB.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/DeleteChildServiceBB.java42
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/ServiceCompositionConstants.java32
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBBTest.java145
7 files changed, 587 insertions, 1 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
index 641cd35027..cb4bd81918 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java
@@ -36,5 +36,7 @@ public enum ResourceKey {
INSTANCE_GROUP_ID,
PNF,
VNF_INSTANCE_NAME,
- VF_MODULE_INSTANCE_NAME
+ VF_MODULE_INSTANCE_NAME,
+ CHILD_SERVICE_INSTANCE_ID,
+ CHILD_SERVICE_INSTANCE_NAME
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateChildServiceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateChildServiceBB.bpmn
new file mode 100644
index 0000000000..b681b999b1
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateChildServiceBB.bpmn
@@ -0,0 +1,135 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1qv87sb" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.6.0">
+ <bpmn:process id="CreateChildServiceBB" name="CreateChildServiceBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_14q7e7i</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_0il9cjn">
+ <bpmn:incoming>SequenceFlow_143mdyp</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_14q7e7i" sourceRef="StartEvent_1" targetRef="Task_1axdixm" />
+ <bpmn:sequenceFlow id="SequenceFlow_0n5pwwk" sourceRef="Task_1axdixm" targetRef="Task_0892y22" />
+ <bpmn:sequenceFlow id="SequenceFlow_0x6xxb8" sourceRef="Task_0892y22" targetRef="Task_1olljx2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0jahgui" sourceRef="Task_1olljx2" targetRef="ExclusiveGateway_1otl9mn" />
+ <bpmn:sequenceFlow id="SequenceFlow_143mdyp" sourceRef="Task_1oyb4b5" targetRef="EndEvent_0il9cjn" />
+ <bpmn:receiveTask id="Task_1olljx2" name="Wait for Completion" messageRef="Message_0kfkpsv">
+ <bpmn:incoming>SequenceFlow_0x6xxb8</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0jahgui</bpmn:outgoing>
+ </bpmn:receiveTask>
+ <bpmn:boundaryEvent id="IntermediateThrowEvent_1gh5vds" name="Timeout" attachedToRef="Task_1olljx2">
+ <bpmn:outgoing>SequenceFlow_0hmy1qr</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_13keqs7">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5H</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:endEvent id="EndEvent_11rdhm9">
+ <bpmn:incoming>SequenceFlow_0hmy1qr</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_12rxrrg" errorRef="Error_1d6c5q3" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0hmy1qr" sourceRef="IntermediateThrowEvent_1gh5vds" targetRef="EndEvent_11rdhm9" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1otl9mn" name="Child Request Status" default="SequenceFlow_052tga4">
+ <bpmn:incoming>SequenceFlow_0jahgui</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0zfixj7</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_052tga4</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0zfixj7" name="Completed" sourceRef="ExclusiveGateway_1otl9mn" targetRef="Task_1oyb4b5">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("CHILD_SVC_REQ_STATUS")=="COMPLETED"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_052tga4" name="Failed" sourceRef="ExclusiveGateway_1otl9mn" targetRef="Task_0jc8k6m" />
+ <bpmn:serviceTask id="Task_1axdixm" name="Build Create Request" camunda:expression="${CreateChildServiceBB.buildRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_14q7e7i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0n5pwwk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_0892y22" name="Send Request" camunda:expression="${CreateChildServiceBB.sendRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0n5pwwk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0x6xxb8</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_0jc8k6m" name="Handle Failure" camunda:expression="${CreateChildServiceBB.handleFailure(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_052tga4</bpmn:incoming>
+ </bpmn:serviceTask>
+ <bpmn:task id="Task_1oyb4b5" name="Update AAI">
+ <bpmn:incoming>SequenceFlow_0zfixj7</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_143mdyp</bpmn:outgoing>
+ </bpmn:task>
+ </bpmn:process>
+ <bpmn:error id="Error_1d6c5q3" name="MSO Workflow Exception" errorCode="MSOWorkflowException" camunda:errorMessage="Child service creation timeout reached" />
+ <bpmn:message id="Message_0kfkpsv" name="ChildServiceRequest" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateChildServiceBB">
+ <bpmndi:BPMNEdge id="SequenceFlow_052tga4_di" bpmnElement="SequenceFlow_052tga4">
+ <di:waypoint x="900" y="145" />
+ <di:waypoint x="900" y="230" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="905" y="173" width="30" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0zfixj7_di" bpmnElement="SequenceFlow_0zfixj7">
+ <di:waypoint x="925" y="120" />
+ <di:waypoint x="1040" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="957" y="102" width="54" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hmy1qr_di" bpmnElement="SequenceFlow_0hmy1qr">
+ <di:waypoint x="730" y="178" />
+ <di:waypoint x="730" y="252" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_143mdyp_di" bpmnElement="SequenceFlow_143mdyp">
+ <di:waypoint x="1140" y="120" />
+ <di:waypoint x="1232" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0jahgui_di" bpmnElement="SequenceFlow_0jahgui">
+ <di:waypoint x="750" y="120" />
+ <di:waypoint x="875" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0x6xxb8_di" bpmnElement="SequenceFlow_0x6xxb8">
+ <di:waypoint x="570" y="120" />
+ <di:waypoint x="650" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0n5pwwk_di" bpmnElement="SequenceFlow_0n5pwwk">
+ <di:waypoint x="380" y="120" />
+ <di:waypoint x="470" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_14q7e7i_di" bpmnElement="SequenceFlow_14q7e7i">
+ <di:waypoint x="178" y="120" />
+ <di:waypoint x="280" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="142" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0il9cjn_di" bpmnElement="EndEvent_0il9cjn">
+ <dc:Bounds x="1232" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ReceiveTask_1bptt2c_di" bpmnElement="Task_1olljx2">
+ <dc:Bounds x="650" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_03unhuu_di" bpmnElement="EndEvent_11rdhm9">
+ <dc:Bounds x="712" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1otl9mn_di" bpmnElement="ExclusiveGateway_1otl9mn" isMarkerVisible="true">
+ <dc:Bounds x="875" y="95" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="866" y="65" width="70" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0t3ilvf_di" bpmnElement="Task_1axdixm">
+ <dc:Bounds x="280" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0hbcben_di" bpmnElement="Task_0892y22">
+ <dc:Bounds x="470" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1j024ya_di" bpmnElement="Task_0jc8k6m">
+ <dc:Bounds x="850" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_0g07oag_di" bpmnElement="IntermediateThrowEvent_1gh5vds">
+ <dc:Bounds x="712" y="142" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="750" y="173" width="40" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Task_1hukudm_di" bpmnElement="Task_1oyb4b5">
+ <dc:Bounds x="1040" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteChildServiceBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteChildServiceBB.bpmn
new file mode 100644
index 0000000000..cfa55d2101
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteChildServiceBB.bpmn
@@ -0,0 +1,135 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0n06ztl" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.6.0">
+ <bpmn:process id="DeleteChildServiceBB" name="DeleteChildServiceBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1m5641e">
+ <bpmn:outgoing>SequenceFlow_01wirq3</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:receiveTask id="ReceiveTask_0otx1r1" name="Wait for Completion" messageRef="Message_0xg6jua">
+ <bpmn:incoming>SequenceFlow_14d89qf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ufwh0a</bpmn:outgoing>
+ </bpmn:receiveTask>
+ <bpmn:endEvent id="EndEvent_02vkobe">
+ <bpmn:incoming>SequenceFlow_0o2ukb9</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_05rpxbj" errorRef="Error_1d6c5q3" />
+ </bpmn:endEvent>
+ <bpmn:boundaryEvent id="BoundaryEvent_1f4g2g1" name="Timeout" attachedToRef="ReceiveTask_0otx1r1">
+ <bpmn:outgoing>SequenceFlow_0o2ukb9</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_01na1b7">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5H</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_01wirq3" sourceRef="StartEvent_1m5641e" targetRef="Task_01gqeuu" />
+ <bpmn:sequenceFlow id="SequenceFlow_0q6aqsk" sourceRef="Task_01gqeuu" targetRef="Task_16o0qkj" />
+ <bpmn:sequenceFlow id="SequenceFlow_14d89qf" sourceRef="Task_16o0qkj" targetRef="ReceiveTask_0otx1r1" />
+ <bpmn:sequenceFlow id="SequenceFlow_0o2ukb9" sourceRef="BoundaryEvent_1f4g2g1" targetRef="EndEvent_02vkobe" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1mxv8h6" name="Child Request Status" default="SequenceFlow_12rysg7">
+ <bpmn:incoming>SequenceFlow_1ufwh0a</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0v4loyx</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_12rysg7</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:task id="Task_1gohsu4" name="Update AAI">
+ <bpmn:incoming>SequenceFlow_0v4loyx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_096kfnj</bpmn:outgoing>
+ </bpmn:task>
+ <bpmn:endEvent id="EndEvent_0fh7ikt">
+ <bpmn:incoming>SequenceFlow_096kfnj</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0v4loyx" name="Completed" sourceRef="ExclusiveGateway_1mxv8h6" targetRef="Task_1gohsu4">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("CHILD_SVC_REQ_STATUS")=="COMPLETED"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_12rysg7" name="Failed" sourceRef="ExclusiveGateway_1mxv8h6" targetRef="Task_073m8fr" />
+ <bpmn:sequenceFlow id="SequenceFlow_096kfnj" sourceRef="Task_1gohsu4" targetRef="EndEvent_0fh7ikt" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ufwh0a" sourceRef="ReceiveTask_0otx1r1" targetRef="ExclusiveGateway_1mxv8h6" />
+ <bpmn:serviceTask id="Task_01gqeuu" name="Build Delete Request" camunda:expression="${DeleteChildServiceBB.buildRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_01wirq3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0q6aqsk</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_16o0qkj" name="Send Request" camunda:expression="${DeleteChildServiceBB.sendRequest(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0q6aqsk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_14d89qf</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="Task_073m8fr" name="Handle Failure" camunda:expression="${DeleteChildServiceBB.handleFailure(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_12rysg7</bpmn:incoming>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmn:error id="Error_1d6c5q3" name="MSO Workflow Exception" errorCode="MSOWorkflowException" camunda:errorMessage="Child service deletion timeout reached" />
+ <bpmn:message id="Message_0xg6jua" name="ChildServiceRequest" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteChildServiceBB">
+ <bpmndi:BPMNShape id="StartEvent_1m5641e_di" bpmnElement="StartEvent_1m5641e">
+ <dc:Bounds x="152" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ReceiveTask_0otx1r1_di" bpmnElement="ReceiveTask_0otx1r1">
+ <dc:Bounds x="660" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_02vkobe_di" bpmnElement="EndEvent_02vkobe">
+ <dc:Bounds x="722" y="252" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_1f4g2g1_di" bpmnElement="BoundaryEvent_1f4g2g1">
+ <dc:Bounds x="722" y="142" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="760" y="173" width="40" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_01wirq3_di" bpmnElement="SequenceFlow_01wirq3">
+ <di:waypoint x="188" y="120" />
+ <di:waypoint x="290" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0q6aqsk_di" bpmnElement="SequenceFlow_0q6aqsk">
+ <di:waypoint x="390" y="120" />
+ <di:waypoint x="480" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_14d89qf_di" bpmnElement="SequenceFlow_14d89qf">
+ <di:waypoint x="580" y="120" />
+ <di:waypoint x="660" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0o2ukb9_di" bpmnElement="SequenceFlow_0o2ukb9">
+ <di:waypoint x="740" y="178" />
+ <di:waypoint x="740" y="252" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1mxv8h6_di" bpmnElement="ExclusiveGateway_1mxv8h6" isMarkerVisible="true">
+ <dc:Bounds x="885" y="95" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="875" y="65" width="70" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Task_1gohsu4_di" bpmnElement="Task_1gohsu4">
+ <dc:Bounds x="1050" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0fh7ikt_di" bpmnElement="EndEvent_0fh7ikt">
+ <dc:Bounds x="1242" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0v4loyx_di" bpmnElement="SequenceFlow_0v4loyx">
+ <di:waypoint x="935" y="120" />
+ <di:waypoint x="1050" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="966" y="102" width="54" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12rysg7_di" bpmnElement="SequenceFlow_12rysg7">
+ <di:waypoint x="910" y="145" />
+ <di:waypoint x="910" y="230" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="925" y="173" width="30" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_096kfnj_di" bpmnElement="SequenceFlow_096kfnj">
+ <di:waypoint x="1150" y="120" />
+ <di:waypoint x="1242" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ufwh0a_di" bpmnElement="SequenceFlow_1ufwh0a">
+ <di:waypoint x="760" y="120" />
+ <di:waypoint x="885" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0aqgcg6_di" bpmnElement="Task_01gqeuu">
+ <dc:Bounds x="290" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0o8psus_di" bpmnElement="Task_16o0qkj">
+ <dc:Bounds x="480" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0hkopiv_di" bpmnElement="Task_073m8fr">
+ <dc:Bounds x="860" y="230" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBB.java
new file mode 100644
index 0000000000..3672df4dba
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBB.java
@@ -0,0 +1,95 @@
+/*-
+ * Copyright (C) 2021 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.bpmn.infrastructure.service.composition;
+
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_ERROR;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_PAYLOAD;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_ID;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_INSTANCE_ID;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_CORRELATION_ID;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.ApiHandlerClient;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreateChildServiceBB {
+
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ @Autowired
+ protected ExceptionBuilder exceptionBuilder;
+
+ @Autowired
+ private ApiHandlerClient apiHandlerClient;
+
+ public void buildRequest(final BuildingBlockExecution buildingBlockExecution) {
+ try {
+ log.info("Building Create Service Request");
+ Map<ResourceKey, String> lookupMap = buildingBlockExecution.getLookupMap();
+ String childSvcInstanceName = lookupMap.get(ResourceKey.CHILD_SERVICE_INSTANCE_NAME);
+ Objects.requireNonNull(childSvcInstanceName, "Child service instance name is required");
+
+ ServiceInstancesRequest sir = ChildServiceRequestBuilder
+ .getInstance(buildingBlockExecution, childSvcInstanceName)
+ .setParentRequestId(
+ buildingBlockExecution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId())
+ .setCorrelationId(UUID.randomUUID().toString()).build();
+ buildingBlockExecution.setVariable(CHILD_SVC_REQ_PAYLOAD, sir);
+ } catch (Exception e) {
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 10002, e.getMessage(),
+ ONAPComponents.SO);
+ }
+ }
+
+ public void sendRequest(final BuildingBlockExecution buildingBlockExecution) throws Exception {
+ try {
+ buildingBlockExecution.getLookupMap();
+ ServiceInstancesRequest sir = buildingBlockExecution.getVariable(CHILD_SVC_REQ_PAYLOAD);
+ log.info("Sending Create Service Request: \n{}", sir.toString());
+ buildingBlockExecution.setVariable(CHILD_SVC_REQ_CORRELATION_ID,
+ sir.getRequestDetails().getRequestInfo().getCorrelator());
+
+ ServiceInstancesResponse response = apiHandlerClient.createServiceInstance(sir);
+ buildingBlockExecution.setVariable(CHILD_SVC_REQ_ID, response.getRequestReferences().getRequestId());
+ buildingBlockExecution.setVariable(CHILD_SVC_INSTANCE_ID, response.getRequestReferences().getInstanceId());
+ } catch (Exception e) {
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 10003, e.getMessage(),
+ ONAPComponents.SO);
+ }
+ }
+
+ public void handleFailure(final BuildingBlockExecution buildingBlockExecution) {
+ Map<ResourceKey, String> lookupMap = buildingBlockExecution.getLookupMap();
+ String childSvcInstanceName = lookupMap.get(ResourceKey.CHILD_SERVICE_INSTANCE_NAME);
+ String childErrorMessage = buildingBlockExecution.getVariable(CHILD_SVC_REQ_ERROR);
+ String errorMessage =
+ String.format("Failed creating child service %s %s", childSvcInstanceName, childErrorMessage);
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 10001, errorMessage, ONAPComponents.SO);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/DeleteChildServiceBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/DeleteChildServiceBB.java
new file mode 100644
index 0000000000..a3f70c8f5b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/DeleteChildServiceBB.java
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (C) 2021 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.bpmn.infrastructure.service.composition;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class DeleteChildServiceBB {
+
+ private final Logger log = LoggerFactory.getLogger(this.getClass());
+
+ public void buildRequest(final BuildingBlockExecution buildingBlockExecution) {
+ log.info("Building Delete Service Request");
+ }
+
+ public void sendRequest(final BuildingBlockExecution buildingBlockExecution) {
+ log.info("Sending Delete Service Request");
+ }
+
+ public void handleFailure(final BuildingBlockExecution buildingBlockExecution, final String responsePayload) {
+ // log error
+ // build workflowException with proper message
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/ServiceCompositionConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/ServiceCompositionConstants.java
new file mode 100644
index 0000000000..6b209bdcef
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/composition/ServiceCompositionConstants.java
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (C) 2021 Bell Canada. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.so.bpmn.infrastructure.service.composition;
+
+public class ServiceCompositionConstants {
+
+ public static final String CHILD_SVC_REQ_PAYLOAD = "childServiceRequestPayload";
+ public static final String CHILD_SVC_REQ_ID = "childServiceRequestId";
+ public static final String CHILD_SVC_INSTANCE_ID = "childServiceInstanceId";
+ public static final String IS_CHILD_PROCESS = "isChildProcess";
+ public static final String CHILD_SVC_REQ_CORRELATION_ID = "childServiceRequestCorrelationId";
+ public static final String CHILD_SVC_REQ_TIMEOUT = "childServiceRequestTimeout";
+ public static final String CHILD_SVC_REQ_STATUS = "CHILD_SVC_REQ_STATUS";
+ public static final String CHILD_SVC_REQ_ERROR = "CHILD_SVC_REQ_ERROR";
+ public static final String CHILD_SVC_REQ_MESSAGE_NAME = "ChildServiceRequest";
+ public static final String PARENT_CORRELATION_ID = "parentCorrelationId";
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBBTest.java
new file mode 100644
index 0000000000..6392d25998
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/composition/CreateChildServiceBBTest.java
@@ -0,0 +1,145 @@
+package org.onap.so.bpmn.infrastructure.service.composition;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.MockControllerBB;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.ApiHandlerClient;
+import org.onap.so.client.orchestration.ApiHandlerClientException;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
+import org.onap.so.serviceinstancebeans.RequestReferences;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.mock.mockito.MockBean;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_INSTANCE_ID;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_ID;
+import static org.onap.so.bpmn.infrastructure.service.composition.ServiceCompositionConstants.CHILD_SVC_REQ_PAYLOAD;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {CreateChildServiceBB.class, MockControllerBB.class, ExceptionBuilder.class})
+public class CreateChildServiceBBTest {
+
+ @Autowired
+ private CreateChildServiceBB createChildServiceBB;
+
+ @MockBean
+ private BuildingBlockExecution execution;
+
+ @MockBean
+ private ApiHandlerClient apiHandlerClient;
+
+ @MockBean
+ private ExceptionBuilder exceptionBuilder;
+
+ @Before
+ public void setUp() throws IOException, ApiHandlerClientException {
+ String incomingRequest =
+ "{\"requestDetails\":{\"subscriberInfo\":{\"globalSubscriberId\":\"ubuntu-customer\"},\"requestInfo\":{\"suppressRollback\":false,\"instanceName\":\"LcmDemo\",\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"requestorId\":\"portal\",\"source\":\"postman\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"123\",\"tenantId\":\"e2710e84063b421fab08189818761d55\",\"cloudOwner\":\"cloudOwner\"},\"requestParameters\":{\"subscriptionServiceType\":\"ubuntu\",\"userParams\":[{\"Homing_Solution\":\"none\"},{\"service\":{\"instanceParams\":[],\"resources\":{\"vnfs\":[{\"modelInfo\":{\"modelName\":\"UbuntuSriovVF\",\"modelVersionId\":\"5b5d07f0-7449-4eec-95eb-531ddef18240\",\"modelInvariantUuid\":\"9ed17b82-11f3-44cc-a86f-32739360617e\",\"modelVersion\":\"1.0\",\"modelCustomizationId\":\"ae139d3d-b2ae-462c-b09d-c85bdc2e3073\",\"modelInstanceName\":\"UbuntuSriovVF0\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"123\",\"tenantId\":\"e2710e84063b421fab08189818761d55\",\"cloudOwner\":\"cloudOwner\"},\"platform\":{\"platformName\":\"openstack\"},\"lineOfBusiness\":{\"lineOfBusinessName\":\"wireless\"},\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"instanceName\":\"vnf-instanceName\",\"instanceParams\":[{\"vnf-name\":\"vnf-vnf-name\",\"vnf_name\":\"UbuntuVNFName\"}],\"vfModules\":[{\"modelInfo\":{\"modelName\":\"Ubuntusriovvf..base..module-0\",\"modelVersionId\":\"f4ef24dd-7a4e-4eef-83b7-c58f2f3e36e4\",\"modelInvariantUuid\":\"719aab1e-c551-46e0-87e8-a78dcd7891da\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"dea421a8-c1b8-4044-8ca1-58c30de3b315\"},\"instanceName\":\"lcm-demo-network-1\",\"instanceParams\":[{\"name\":\"lcm-demo-network-1\",\"cidr\":\"10.10.10.0/24\"}]},{\"modelInfo\":{\"modelName\":\"Ubuntusriovvf..ubuntu-vf-module..module-1\",\"modelVersionId\":\"112f2de4-4f09-4567-9de1-2d271cb6e164\",\"modelInvariantUuid\":\"ba6d2e11-4e82-4bb8-9d52-a2962a263a09\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"7bc2649e-b96b-44ec-adfe-4a6167f3034e\"},\"instanceName\":\"lcm-demo-ubuntu-1\",\"instanceParams\":[{\"name\":\"lcm-demo-ubuntu-1\",\"network_mgmt\":\"networkMgmt\",\"key_name\":\"demo\",\"network_name\":\"lcm-demo-network-1\",\"image_name\":\"imageName\",\"flavor_name\":\"m1.small\"}]}]}],\"services\":[{\"instanceParams\":[],\"resources\":{\"vnfs\":[{\"modelInfo\":{\"modelName\":\"UbuntuSriovVF\",\"modelVersionId\":\"5b5d07f0-7449-4eec-95eb-531ddef18240\",\"modelInvariantUuid\":\"9ed17b82-11f3-44cc-a86f-32739360617e\",\"modelVersion\":\"1.0\",\"modelCustomizationId\":\"ae139d3d-b2ae-462c-b09d-c85bdc2e3073\",\"modelInstanceName\":\"UbuntuSriovVF0\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"123\",\"tenantId\":\"e2710e84063b421fab08189818761d55\",\"cloudOwner\":\"cloudOwner\"},\"platform\":{\"platformName\":\"openstack\"},\"lineOfBusiness\":{\"lineOfBusinessName\":\"wireless\"},\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"instanceName\":\"vnf-instanceName\",\"instanceParams\":[{\"vnf-name\":\"vnf-vnf-name\",\"vnf_name\":\"UbuntuVNFName\"}],\"vfModules\":[{\"modelInfo\":{\"modelName\":\"Ubuntusriovvf..base..module-0\",\"modelVersionId\":\"f4ef24dd-7a4e-4eef-83b7-c58f2f3e36e4\",\"modelInvariantUuid\":\"719aab1e-c551-46e0-87e8-a78dcd7891da\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"dea421a8-c1b8-4044-8ca1-58c30de3b315\"},\"instanceName\":\"lcm-demo-network-1\",\"instanceParams\":[{\"name\":\"lcm-demo-network-1\",\"cidr\":\"10.10.10.0/24\"}]},{\"modelInfo\":{\"modelName\":\"Ubuntusriovvf..ubuntu-vf-module..module-1\",\"modelVersionId\":\"112f2de4-4f09-4567-9de1-2d271cb6e164\",\"modelInvariantUuid\":\"ba6d2e11-4e82-4bb8-9d52-a2962a263a09\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"7bc2649e-b96b-44ec-adfe-4a6167f3034e\"},\"instanceName\":\"lcm-demo-ubuntu-1\",\"instanceParams\":[{\"name\":\"lcm-demo-ubuntu-1\",\"network_mgmt\":\"networkMgmt\",\"key_name\":\"demo\",\"network_name\":\"lcm-demo-network-1\",\"image_name\":\"imageName\",\"flavor_name\":\"m1.small\"}]}]}]},\"modelInfo\":{\"modelVersion\":\"2.0\",\"modelVersionId\":\"5bc2b6b3-c9bb-49a1-89c8-4dac5b236d52\",\"modelInvariantId\":\"a316f8fa-c886-483f-801b-6663e35b836c\",\"modelCustomizationId\":\"cs1-svc-modelCustomizationId\",\"modelName\":\"GuilinLcmSVC\",\"modelType\":\"service\"},\"instanceName\":\"service1-instanceName\"},{\"instanceParams\":[],\"resources\":{\"vnfs\":[{\"modelInfo\":{\"modelName\":\"UbuntuSriovVF\",\"modelVersionId\":\"5b5d07f0-7449-4eec-95eb-531ddef18240\",\"modelInvariantUuid\":\"9ed17b82-11f3-44cc-a86f-32739360617e\",\"modelVersion\":\"1.0\",\"modelCustomizationId\":\"ae139d3d-b2ae-462c-b09d-c85bdc2e3073\",\"modelInstanceName\":\"UbuntuSriovVF0\"},\"cloudConfiguration\":{\"lcpCloudRegionId\":\"123\",\"tenantId\":\"e2710e84063b421fab08189818761d55\",\"cloudOwner\":\"cloudOwner\"},\"platform\":{\"platformName\":\"openstack\"},\"lineOfBusiness\":{\"lineOfBusinessName\":\"wireless\"},\"productFamilyId\":\"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"instanceName\":\"vnf-instanceName\",\"instanceParams\":[{\"vnf-name\":\"vnf-vnf-name\",\"vnf_name\":\"UbuntuVNFName\"}],\"vfModules\":[{\"modelInfo\":{\"modelName\":\"Ubuntusriovvf..base..module-0\",\"modelVersionId\":\"f4ef24dd-7a4e-4eef-83b7-c58f2f3e36e4\",\"modelInvariantUuid\":\"719aab1e-c551-46e0-87e8-a78dcd7891da\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"dea421a8-c1b8-4044-8ca1-58c30de3b315\"},\"instanceName\":\"lcm-demo-network-1\",\"instanceParams\":[{\"name\":\"lcm-demo-network-1\",\"cidr\":\"10.10.10.0/24\"}]},{\"modelInfo\":{\"modelName\":\"Ubuntusriovvf..ubuntu-vf-module..module-1\",\"modelVersionId\":\"112f2de4-4f09-4567-9de1-2d271cb6e164\",\"modelInvariantUuid\":\"ba6d2e11-4e82-4bb8-9d52-a2962a263a09\",\"modelVersion\":\"1\",\"modelCustomizationId\":\"7bc2649e-b96b-44ec-adfe-4a6167f3034e\"},\"instanceName\":\"lcm-demo-ubuntu-1\",\"instanceParams\":[{\"name\":\"lcm-demo-ubuntu-1\",\"network_mgmt\":\"networkMgmt\",\"key_name\":\"demo\",\"network_name\":\"lcm-demo-network-1\",\"image_name\":\"imageName\",\"flavor_name\":\"m1.small\"}]}]}]},\"modelInfo\":{\"modelVersion\":\"2.0\",\"modelVersionId\":\"5bc2b6b3-c9bb-49a1-89c8-4dac5b236d52\",\"modelInvariantId\":\"a316f8fa-c886-483f-801b-6663e35b836c\",\"modelCustomizationId\":\"cs1-svc-modelCustomizationId\",\"modelName\":\"GuilinLcmSVC\",\"modelType\":\"service\"},\"instanceName\":\"service2-instanceName\"}]},\"modelInfo\":{\"modelVersion\":\"2.0\",\"modelVersionId\":\"5bc2b6b3-c9bb-49a1-89c8-4dac5b236d52\",\"modelInvariantId\":\"a316f8fa-c886-483f-801b-6663e35b836c\",\"modelName\":\"GuilinLcmSVC\",\"modelType\":\"service\"}}}],\"aLaCarte\":false},\"project\":{\"projectName\":\"Project-UbuntuDemo\"},\"owningEntity\":{\"owningEntityId\":\"33a8b609-1cfe-4d19-8dc2-5b95b921de1e\",\"owningEntityName\":\"demo\"},\"modelInfo\":{\"modelVersion\":\"2.0\",\"modelVersionId\":\"5bc2b6b3-c9bb-49a1-89c8-4dac5b236d52\",\"modelInvariantId\":\"a316f8fa-c886-483f-801b-6663e35b836c\",\"modelName\":\"GuilinLcmSVC\",\"modelType\":\"service\"}}}";
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ ServiceInstancesRequest request = mapper.readValue(incomingRequest, ServiceInstancesRequest.class);
+ RequestContext context = new RequestContext();
+ RequestParameters parameters = new RequestParameters();
+ parameters.setUserParams(request.getRequestDetails().getRequestParameters().getUserParams());
+ context.setRequestParameters(parameters);
+ context.setProductFamilyId("FamilyId");
+ context.setSource("source");
+ context.setRequestorId("RequestOrId");
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setCloudOwner("CloudOwner");
+ cloudRegion.setLcpCloudRegionId("my-region-id");
+ cloudRegion.setTenantId("tenant-id");
+
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("GlobalCustomerId");
+ customer.setSubscriberName("SubscriberName");
+
+ ServiceInstance serviceInstance = new ServiceInstance();
+ OwningEntity owningEntity = new OwningEntity();
+ owningEntity.setOwningEntityId("owningEntityId");
+ owningEntity.setOwningEntityName("owningEntityName");
+ serviceInstance.setOwningEntity(owningEntity);
+
+ Project project = new Project();
+ project.setProjectName("projectName");
+ serviceInstance.setProject(project);
+
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+
+ GeneralBuildingBlock gbb = new GeneralBuildingBlock();
+ gbb.setCloudRegion(cloudRegion);
+ gbb.setCustomer(customer);
+ gbb.setRequestContext(context);
+ gbb.setServiceInstance(serviceInstance);
+
+ Map<ResourceKey, String> map = new HashMap<>();
+ map.put(ResourceKey.CHILD_SERVICE_INSTANCE_NAME, "service1-instanceName");
+
+ when(execution.getGeneralBuildingBlock()).thenReturn(gbb);
+ when(execution.getLookupMap()).thenReturn(map);
+
+ ServiceInstancesResponse response = new ServiceInstancesResponse();
+ response.setRequestReferences(new RequestReferences());
+ response.getRequestReferences().setInstanceId("instanceId");
+ response.getRequestReferences().setRequestId("requestId");
+
+ when(apiHandlerClient.createServiceInstance(any())).thenReturn(response);
+ }
+
+ @Test
+ public void buildRequestTest() {
+ createChildServiceBB.buildRequest(execution);
+ }
+
+ @Test
+ public void sendRequestTest() throws Exception {
+ ServiceInstancesRequest sir = new ServiceInstancesRequest();
+ RequestDetails details = new RequestDetails();
+ details.setRequestInfo(new RequestInfo());
+ details.getRequestInfo().setCorrelator("correlator");
+ sir.setRequestDetails(details);
+
+ when(execution.getVariable(CHILD_SVC_REQ_PAYLOAD)).thenReturn(sir);
+ createChildServiceBB.sendRequest(execution);
+ verify(execution).setVariable(CHILD_SVC_REQ_ID, "requestId");
+ verify(execution).setVariable(CHILD_SVC_INSTANCE_ID, "instanceId");
+ verify(execution).setVariable(CHILD_SVC_REQ_CORRELATION_ID, "correlator");
+ }
+
+ @Test
+ public void handleFailureTest() {
+ createChildServiceBB.handleFailure(execution);
+ verify(exceptionBuilder).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), anyInt(),
+ anyString(), any(ONAPComponentsList.class));
+ }
+}