diff options
Diffstat (limited to 'bpmn')
14 files changed, 111 insertions, 77 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index d5183ff5bb..f1eab6601b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -982,22 +982,7 @@ class CatalogDbUtils { vfModuleModelJson.put("modelInfo", vfModuleModelInfo) String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type") vfModuleModelJson.put("vfModuleType", vfModuleType) - switch(catalogUtilsVersion) { - case "v1": - //TODO this does not work, isBase is not a integer. - Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase") - if (isBase.intValue() == 1) { - vfModuleModelJson.put("isBase", "true") - } - else { - vfModuleModelJson.put("isBase", "false") - } - break - default: - boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase") - vfModuleModelJson.put("isBase", isBase) - break - } + vfModuleModelJson.put("isBase", jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")) String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label") vfModuleModelJson.put("vfModuleLabel", vfModuleLabel) Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount") diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn index cf284e8ed9..0a067483ff 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignVnfBB.bpmn @@ -4,9 +4,9 @@ <bpmn:startEvent id="Start_AssignVnfBB"> <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> </bpmn:startEvent> - <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyAssign" name=" SDNC Assign (vnf) " camunda:expression="${SDNCAssignTasks.assignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_14mpqit</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ks8kmt</bpmn:outgoing> + <bpmn:serviceTask id="Task_SDNCAdapterVnfTopologyAssign" name=" SDNC Create Request (vnf) " camunda:expression="${SDNCAssignTasks.assignVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1samncw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1qkhm79</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="End_AssignVnfBB"> <bpmn:incoming>SequenceFlow_0csh9dc</bpmn:incoming> @@ -16,10 +16,9 @@ <bpmn:outgoing>SequenceFlow_1jwsja5</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_AssignVnfBB" targetRef="Task_CreateVnf" /> - <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SDNCAdapterVnfTopologyAssign" targetRef="Task_UpdateVnfOrchestrationStatusAssigned" /> <bpmn:sequenceFlow id="SequenceFlow_0csh9dc" sourceRef="Task_UpdateVnfOrchestrationStatusAssigned" targetRef="End_AssignVnfBB" /> <bpmn:serviceTask id="Task_UpdateVnfOrchestrationStatusAssigned" name=" AAI Update (vnf) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1vw20wu</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0csh9dc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="Task_createInstanceGroups" name=" AAI Create (instance grp) " camunda:expression="${AssignVnf.createInstanceGroups(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -28,11 +27,9 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1jwsja5" sourceRef="Task_CreateVnf" targetRef="Task_createPlatform" /> <bpmn:sequenceFlow id="SequenceFlow_1nle8kc" sourceRef="Task_createInstanceGroups" targetRef="ExclusiveGateway_02tchpp" /> - <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming") == false}]]></bpmn:conditionExpression> - </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_11jum90" name="no" sourceRef="ExclusiveGateway_02tchpp" targetRef="ExclusiveGateway_1blf52g" /> <bpmn:sequenceFlow id="SequenceFlow_1uiok7v" name="yes" sourceRef="ExclusiveGateway_02tchpp" targetRef="Task_callHoming"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming") == true}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("callHoming")}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0v8d14a" sourceRef="Task_callHoming" targetRef="ExclusiveGateway_1blf52g" /> <bpmn:callActivity id="Task_callHoming" name="Call Homing" calledElement="HomingBB"> @@ -40,6 +37,7 @@ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> <camunda:in source="mso-request-id" target="mso-request-id" /> <camunda:out source="generalBuildingBlock" target="gBBInput" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1uiok7v</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0v8d14a</bpmn:outgoing> @@ -65,8 +63,7 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1i52a7x" sourceRef="StartEvent_1c3cyuv" targetRef="EndEvent_1bywujf" /> </bpmn:subProcess> - <bpmn:sequenceFlow id="SequenceFlow_14mpqit" sourceRef="ExclusiveGateway_1blf52g" targetRef="Task_SDNCAdapterVnfTopologyAssign" /> - <bpmn:inclusiveGateway id="ExclusiveGateway_02tchpp" name="Call Homing?"> + <bpmn:inclusiveGateway id="ExclusiveGateway_02tchpp" name="Call Homing?" default="SequenceFlow_11jum90"> <bpmn:incoming>SequenceFlow_1nle8kc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_11jum90</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_1uiok7v</bpmn:outgoing> @@ -74,8 +71,19 @@ <bpmn:inclusiveGateway id="ExclusiveGateway_1blf52g"> <bpmn:incoming>SequenceFlow_11jum90</bpmn:incoming> <bpmn:incoming>SequenceFlow_0v8d14a</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_14mpqit</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1samncw</bpmn:outgoing> </bpmn:inclusiveGateway> + <bpmn:callActivity id="CallActivity_sdncAssign" name="SDNC Assign (vnf)" calledElement="SDNCHandler"> + <bpmn:extensionElements> + <camunda:in source="SDNCRequest" target="SDNCRequest" /> + <camunda:out source="SDNCResponse" target="SDNCResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1qkhm79</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vw20wu</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1samncw" sourceRef="ExclusiveGateway_1blf52g" targetRef="Task_SDNCAdapterVnfTopologyAssign" /> + <bpmn:sequenceFlow id="SequenceFlow_1qkhm79" sourceRef="Task_SDNCAdapterVnfTopologyAssign" targetRef="CallActivity_sdncAssign" /> + <bpmn:sequenceFlow id="SequenceFlow_1vw20wu" sourceRef="CallActivity_sdncAssign" targetRef="Task_UpdateVnfOrchestrationStatusAssigned" /> </bpmn:process> <bpmn:error id="Error_0rgauy1" name="gDelegateError" errorCode="7000" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -90,9 +98,9 @@ <dc:Bounds x="930" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_AssignVnfBB"> - <dc:Bounds x="1229" y="116" width="36" height="36" /> + <dc:Bounds x="1323" y="116" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1238" y="156" width="18" height="12" /> + <dc:Bounds x="1296" y="156" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="Task_CreateVnf"> @@ -105,22 +113,15 @@ <dc:Bounds x="83" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt"> - <di:waypoint xsi:type="dc:Point" x="1030" y="134" /> - <di:waypoint xsi:type="dc:Point" x="1056" y="134" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="998" y="113" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0csh9dc_di" bpmnElement="SequenceFlow_0csh9dc"> - <di:waypoint xsi:type="dc:Point" x="1156" y="134" /> - <di:waypoint xsi:type="dc:Point" x="1229" y="134" /> + <di:waypoint xsi:type="dc:Point" x="1303" y="134" /> + <di:waypoint xsi:type="dc:Point" x="1323" y="134" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1147.5" y="113" width="90" height="12" /> + <dc:Bounds x="1268" y="113" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0s6d1be_di" bpmnElement="Task_UpdateVnfOrchestrationStatusAssigned"> - <dc:Bounds x="1056" y="94" width="100" height="80" /> + <dc:Bounds x="1203" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0wjy7za_di" bpmnElement="Task_createInstanceGroups"> <dc:Bounds x="534" y="94" width="100" height="80" /> @@ -188,38 +189,31 @@ <dc:Bounds x="404" y="94" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_19596dp_di" bpmnElement="SubProcess_19596dp" isExpanded="true"> - <dc:Bounds x="249" y="267" width="231" height="135" /> + <dc:Bounds x="673" y="239" width="231" height="135" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1c3cyuv_di" bpmnElement="StartEvent_1c3cyuv"> - <dc:Bounds x="286" y="323" width="36" height="36" /> + <dc:Bounds x="710" y="295" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="259" y="359" width="0" height="12" /> + <dc:Bounds x="638" y="331" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1bywujf_di" bpmnElement="EndEvent_1bywujf"> - <dc:Bounds x="422" y="323" width="36" height="36" /> + <dc:Bounds x="846" y="295" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="395" y="359" width="0" height="12" /> + <dc:Bounds x="774" y="331" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1i52a7x_di" bpmnElement="SequenceFlow_1i52a7x"> - <di:waypoint xsi:type="dc:Point" x="322" y="341" /> - <di:waypoint xsi:type="dc:Point" x="422" y="341" /> + <di:waypoint xsi:type="dc:Point" x="746" y="313" /> + <di:waypoint xsi:type="dc:Point" x="846" y="313" /> <bpmndi:BPMNLabel> - <dc:Bounds x="372" y="320" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14mpqit_di" bpmnElement="SequenceFlow_14mpqit"> - <di:waypoint xsi:type="dc:Point" x="899" y="134" /> - <di:waypoint xsi:type="dc:Point" x="930" y="134" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="914.5" y="113" width="0" height="12" /> + <dc:Bounds x="751" y="292" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="InclusiveGateway_0x0c3kk_di" bpmnElement="ExclusiveGateway_02tchpp"> <dc:Bounds x="679" y="109" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="731" y="128" width="67" height="13" /> + <dc:Bounds x="732" y="128" width="64" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="InclusiveGateway_0ijggth_di" bpmnElement="ExclusiveGateway_1blf52g"> @@ -228,6 +222,30 @@ <dc:Bounds x="896" y="163" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_12uxg1m_di" bpmnElement="CallActivity_sdncAssign"> + <dc:Bounds x="1060" y="94" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1samncw_di" bpmnElement="SequenceFlow_1samncw"> + <di:waypoint xsi:type="dc:Point" x="899" y="134" /> + <di:waypoint xsi:type="dc:Point" x="930" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="914.5" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qkhm79_di" bpmnElement="SequenceFlow_1qkhm79"> + <di:waypoint xsi:type="dc:Point" x="1030" y="134" /> + <di:waypoint xsi:type="dc:Point" x="1060" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1045" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vw20wu_di" bpmnElement="SequenceFlow_1vw20wu"> + <di:waypoint xsi:type="dc:Point" x="1160" y="134" /> + <di:waypoint xsi:type="dc:Point" x="1203" y="134" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1181.5" y="113" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java index 3fb8faa6c8..f675440ead 100644 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java +++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignVnfBBTest.java @@ -35,11 +35,11 @@ public class AssignVnfBBTest extends BaseBPMNTest { @Test public void sunnyDayAssignVnfBBTest() throws InterruptedException, IOException { variables.put("callHoming", true); - mockSubprocess("ReceiveWorkflowMessage", "Mocked ReceiveWorkflowMessage", "GenericStub"); + mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub"); ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignVnfBB", variables); assertThat(pi).isNotNull(); assertThat(pi).isStarted().hasPassedInOrder("Start_AssignVnfBB", "Task_CreateVnf", "Task_createPlatform", "Task_createLineOfBusiness", "Task_createInstanceGroups", - "Task_callHoming", "Task_SDNCAdapterVnfTopologyAssign", "Task_UpdateVnfOrchestrationStatusAssigned", + "Task_callHoming", "Task_SDNCAdapterVnfTopologyAssign","CallActivity_sdncAssign", "Task_UpdateVnfOrchestrationStatusAssigned", "End_AssignVnfBB"); assertThat(pi).isEnded(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index 727cb5cf4e..66479be973 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -145,7 +145,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -339,7 +339,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String serviceInstanceId = resourceInputObj.getServiceInstanceId() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index b66ba89800..cf781933f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -171,7 +171,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -371,7 +371,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String serviceInstanceId = resourceInputObj.getServiceInstanceId() @@ -404,7 +404,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String serviceInstanceId = resourceInputObj.getServiceInstanceId() diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index 7d0927e498..6b89387a82 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -247,6 +247,9 @@ public class SniroHomingV2 { if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution info.put("serviceName", modelInfo.getServiceType()); } + if(modelInfo.getServiceRole() != null){ + info.put("serviceRole", modelInfo.getServiceRole()); + } info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance())); }else{ throw new BpmnError(UNPROCESSABLE, SERVICE_MISSING_DATA + MODEL_VERSION_ID + ", " + MODEL_INVARIANT_ID); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java index ec79b2825a..30f38fc2ed 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; @@ -38,6 +39,8 @@ import org.onap.so.client.orchestration.SDNCNetworkResources; import org.onap.so.client.orchestration.SDNCServiceInstanceResources; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -79,8 +82,11 @@ public class SDNCAssignTasks { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); Customer customer = gBBInput.getCustomer(); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - String response = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming())); - execution.setVariable("SDNCResponse", response); + GenericResourceApiVnfOperationInformation req = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming())); + SDNCRequest sdncRequest = new SDNCRequest(); + sdncRequest.setSDNCPayload(req); + sdncRequest.setTopology(SDNCTopology.VNF); + execution.setVariable("SDNCRequest", sdncRequest); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java index f8a9390398..b30fc932c0 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java @@ -48,12 +48,11 @@ public class SDNCVnfResources { @Autowired private SDNCClient sdncClient; - public String assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, + public GenericResourceApiVnfOperationInformation assignVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing) throws MapperException, BadResponseException { - GenericResourceApiVnfOperationInformation sdncReq = sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, + return sdncRM.reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, cloudRegion, requestContext, homing); - return sdncClient.post(sdncReq, SDNCTopology.VNF); } public String activateVnf(GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index c96c38dab1..f8b1298dd8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -306,6 +306,7 @@ public class TestDataSetup{ modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceRole("testServiceRole" + serviceInstanceCounter); serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); serviceInstance.setProject(buildProject()); @@ -381,6 +382,24 @@ public class TestDataSetup{ collection.setInstanceGroup(instanceGroup); + + return instanceGroup; + } + + public InstanceGroup setInstanceGroupVnf() { + InstanceGroup instanceGroup = buildInstanceGroup(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getInstanceGroups().add(instanceGroup); + lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroup.getId()); + return instanceGroup; } @@ -700,4 +719,4 @@ public class TestDataSetup{ subnet.setNeutronSubnetId("testNeutronSubnetId"); return subnet; } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java index dcfc20c3ae..24ae88b98c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.sdnc.tasks; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -34,6 +35,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -46,6 +48,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.sdnc.beans.SDNCRequest; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; public class SDNCAssignTasksTest extends BaseTaskTest{ @@ -102,13 +106,14 @@ public class SDNCAssignTasksTest extends BaseTaskTest{ @Test public void assignVnfTest() throws Exception { - doReturn("response").when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + doReturn(new GenericResourceApiVnfOperationInformation()).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); execution.setVariable("generalBuildingBlock", gBBInput); sdncAssignTasks.assignVnf(execution); verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false); - assertTrue(execution.getVariable("SDNCResponse").equals("response")); + SDNCRequest sdncRequest = execution.getVariable("SDNCRequest"); + assertEquals(SDNCTopology.VNF,sdncRequest.getTopology()); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java index bb8fca4719..3329842924 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java @@ -88,11 +88,10 @@ public class SDNCVnfResourcesTest extends TestDataSetup{ @Test public void assignVnfTest() throws MapperException, BadResponseException { doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); - doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); - verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json index 55aa2ef58c..dc2d99216f 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -1,6 +1,6 @@ { "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, "licenseInfo" : {"licenseDemands":[]} }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json index 6977224ffa..61f9496f05 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3AR.json @@ -1,6 +1,6 @@ { "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testAllottedModelName1","modelVersionId":"testAllottedModelUuid1","modelVersion":"testAllottedModelVersion1","modelInvariantId":"testAllottedModelInvariantUuid1"},"resourceModuleName":"testAllottedModelInstanceName1","serviceResourceId":"testAllottedResourceId1"},{"resourceModelInfo":{"modelName":"testAllottedModelName2","modelVersionId":"testAllottedModelUuid2","modelVersion":"testAllottedModelVersion2","modelInvariantId":"testAllottedModelInvariantUuid2"},"resourceModuleName":"testAllottedModelInstanceName2","serviceResourceId":"testAllottedResourceId2"},{"resourceModelInfo":{"modelName":"testAllottedModelName3","modelVersionId":"testAllottedModelUuid3","modelVersion":"testAllottedModelVersion3","modelInvariantId":"testAllottedModelInvariantUuid3"},"resourceModuleName":"testAllottedModelInstanceName3","serviceResourceId":"testAllottedResourceId3"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, "licenseInfo" : {"licenseDemands":[]} }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json index c72831b79f..a7da6da7cc 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -1,6 +1,6 @@ { "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, - "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceRole":"testServiceRole1","serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, "licenseInfo" : {"licenseDemands":[]} }
\ No newline at end of file |