diff options
Diffstat (limited to 'bpmn')
14 files changed, 47 insertions, 424 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index c7fcc5c5d3..35e68bb79f 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Intel Corp. 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. diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 7c5ffca4ab..8ce633845b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 Intel Corp. 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. @@ -82,20 +82,20 @@ class OofUtils { //ServiceInstance Info ServiceInstance serviceInstance = decomposition.getServiceInstance() def serviceInstanceId = "" - def serviceInstanceName = "" + def serviceName = "" serviceInstanceId = execution.getVariable("serviceInstanceId") - serviceInstanceName = execution.getVariable("serviceInstanceName") + serviceName = execution.getVariable("subscriptionServiceType") if (serviceInstanceId == null || serviceInstanceId == "null") { utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null") + "obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null") } - if (serviceInstanceName == null || serviceInstanceName == "null") { - utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled) + if (serviceName == null || serviceName == "null") { + utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null") + "obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null") } //Model Info ModelInfo model = decomposition.getModelInfo() @@ -144,24 +144,12 @@ class OofUtils { utils.log("DEBUG", "Allotted Resource: " + resource.toString(), isDebugEnabled) def serviceResourceId = resource.getResourceId() - def resourceModuleName = resource.getNfFunction() - utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, - isDebugEnabled) - def resourceModelInvariantId = "no-resourceModelInvariantId" - def resourceModelVersionId = "no-resourceModelVersionId" - - List modelIdLst = execution.getVariable("homingModelIds") - utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled) - for (Map modelId : modelIdLst ) - if (resourceModuleName == modelId.resourceModuleName) { - resourceModelInvariantId = modelId.resourceModelInvariantId - resourceModelVersionId = modelId.resourceModelVersionId - } - - def resourceModelName = "" //Optional - def resourceModelVersion = "" //Optional - def resourceModelType = "" //Optional - def tenantId = "" //Optional + def resourceModelInvariantId = resource.getModelInfo().getModelInvariantUuid() + def resourceModelVersionId = resource.getModelInfo().getModelUuid() + def resourceModelName = resource.getModelInfo().getModelName() + def resourceModelVersion = resource.getModelInfo().getModelVersion() + def resourceModelType = resource.getModelInfo().getModelType() + def tenantId = execution.getVariable("tenantId") def requiredCandidatesJson = "" requiredCandidatesJson = createCandidateJson( @@ -171,7 +159,7 @@ class OofUtils { String demand = " {\n" + - " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"resourceModuleName\": \"${resourceModelName}\",\n" + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + " \"tenantId\": \"${tenantId}\",\n" + " \"resourceModelInfo\": {\n" + @@ -191,21 +179,18 @@ class OofUtils { isDebugEnabled) ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() def serviceResourceId = vnfResource.getResourceId() - def resourceModuleName = vnfResource.getNfFunction() - utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, - isDebugEnabled) def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() def resourceModelName = vnfResourceModelInfo.getModelName() def resourceModelVersion = vnfResourceModelInfo.getModelVersion() def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() def resourceModelType = vnfResourceModelInfo.getModelType() - def tenantId = "" //Optional + def tenantId = execution.getVariable("tenantId") def requiredCandidatesJson = "" String placementDemand = " {\n" + - " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"resourceModuleName\": \"${resourceModelName}\",\n" + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + " \"tenantId\": \"${tenantId}\",\n" + " \"resourceModelInfo\": {\n" + @@ -297,7 +282,7 @@ class OofUtils { " },\n" + " \"serviceInfo\": {\n" + " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + - " \"serviceName\": \"${serviceInstanceName}\",\n" + + " \"serviceName\": \"${serviceName}\",\n" + " \"modelInfo\": {\n" + " \"modelType\": \"${modelType}\",\n" + " \"modelInvariantId\": \"${modelInvariantId}\",\n" + diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java index bbdaa94581..17ede2f2ff 100644 --- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java @@ -51,7 +51,8 @@ public class RESTClientTest { private String jsonResponseAsString; @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090)); + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); + @Before public void before() throws Exception { @@ -62,7 +63,7 @@ public class RESTClientTest { jsonResponse = new JSONObject(); jsonResponse.put("response", "responseValue"); jsonResponseAsString = jsonResponse.toString(); - restClient = new RESTClient("http://localhost:28090/example", "localhost", 28090); + restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example", "localhost", wireMockRule.port()); } @Test @@ -79,9 +80,9 @@ public class RESTClientTest { assertEquals(1, restClient.getParameters().size()); restClient.addAuthorizationHeader("token"); assertEquals("[token]", restClient.getHeaders().get("Authorization").toString()); - assertEquals("http://localhost:28090/example", restClient.getURL()); - restClient = new RESTClient("http://localhost:28090/example1"); - assertEquals("http://localhost:28090/example1", restClient.getURL()); + assertEquals("http://localhost:" + wireMockRule.port() + "/example", restClient.getURL()); + restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example1"); + assertEquals("http://localhost:" + wireMockRule.port() + "/example1", restClient.getURL()); } @Test diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn deleted file mode 100644 index cb4be0279e..0000000000 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn +++ /dev/null @@ -1,92 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> - <bpmn2:process id="AssignNetwork1802BB" name="AssignNetwork1802BB" isExecutable="true"> - <bpmn2:startEvent id="AssignNetworkBB_start" name="Start Flow"> - <bpmn2:outgoing>SequenceFlow_11op1ih</bpmn2:outgoing> - </bpmn2:startEvent> - <bpmn2:serviceTask id="ServiceTask_get_cloud_region" name="Process cloud region by version " camunda:expression="${AssignNetworkBBUtils.getCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_11op1ih</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:serviceTask id="ServiceTask_assign_network_sdnc" name="Assign Network (SDNC)" camunda:expression="${SDNCAssignTasks.assignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0do51t8</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="ServiceTask_get_cloud_region" targetRef="ServiceTask_assign_network_sdnc" /> - <bpmn2:sequenceFlow id="SequenceFlow_0do51t8" sourceRef="ServiceTask_assign_network_sdnc" targetRef="ServiceTask_assign_network_aai" /> - <bpmn2:serviceTask id="ServiceTask_assign_network_aai" name="Assign Network (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_0do51t8</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0ln3hj3</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:endEvent id="AssignNetworkBB_end" name="End Flow"> - <bpmn2:incoming>SequenceFlow_0ln3hj3</bpmn2:incoming> - </bpmn2:endEvent> - <bpmn2:sequenceFlow id="SequenceFlow_0ln3hj3" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" /> - <bpmn2:sequenceFlow id="SequenceFlow_11op1ih" sourceRef="AssignNetworkBB_start" targetRef="ServiceTask_get_cloud_region" /> - <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text> -</bpmn2:textAnnotation> - <bpmn2:association id="Association_1rsqd3z" sourceRef="ServiceTask_get_cloud_region" targetRef="TextAnnotation_0dnksb2" /> - </bpmn2:process> - <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignNetwork1802BB"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="AssignNetworkBB_start"> - <dc:Bounds x="1167" y="246" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1160" y="287" width="49" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1wo7ke9_di" bpmnElement="ServiceTask_get_cloud_region"> - <dc:Bounds x="1298" y="224" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1ofnl0p_di" bpmnElement="ServiceTask_assign_network_sdnc"> - <dc:Bounds x="1449" y="229" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_53" bpmnElement="SequenceFlow_32"> - <di:waypoint xsi:type="dc:Point" x="1398" y="264" /> - <di:waypoint xsi:type="dc:Point" x="1446" y="264" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1422" y="249" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0do51t8_di" bpmnElement="SequenceFlow_0do51t8"> - <di:waypoint xsi:type="dc:Point" x="1499" y="309" /> - <di:waypoint xsi:type="dc:Point" x="1499" y="378" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1514" y="343.5" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="TextAnnotation_0dnksb2_di" bpmnElement="TextAnnotation_0dnksb2"> - <dc:Bounds x="1393" y="153" width="212" height="30" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Association_1rsqd3z_di" bpmnElement="Association_1rsqd3z"> - <di:waypoint xsi:type="dc:Point" x="1397" y="233" /> - <di:waypoint xsi:type="dc:Point" x="1475" y="183" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_18yks1p_di" bpmnElement="ServiceTask_assign_network_aai"> - <dc:Bounds x="1449" y="378" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_083u1a5_di" bpmnElement="AssignNetworkBB_end"> - <dc:Bounds x="1481" y="512" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1476" y="552" width="45" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ln3hj3_di" bpmnElement="SequenceFlow_0ln3hj3"> - <di:waypoint xsi:type="dc:Point" x="1499" y="458" /> - <di:waypoint xsi:type="dc:Point" x="1499" y="512" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1514" y="475" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_11op1ih_di" bpmnElement="SequenceFlow_11op1ih"> - <di:waypoint xsi:type="dc:Point" x="1203" y="264" /> - <di:waypoint xsi:type="dc:Point" x="1298" y="264" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1205.5" y="249" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn index 79cbe68a3a..57c342455d 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn @@ -23,13 +23,13 @@ <bpmn2:incoming>SequenceFlow_0do51t8</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0ln3hj3</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:exclusiveGateway id="networkFoundByName_ExclusiveGateway" name="skip if network found by name or to be created by SDNC" default="SequenceFlow_0gkr871"> + <bpmn2:exclusiveGateway id="networkFoundByName_ExclusiveGateway" name="skip if network found by name" default="SequenceFlow_0gkr871"> <bpmn2:incoming>SequenceFlow_11op1ih</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_017131q</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_0gkr871</bpmn2:outgoing> </bpmn2:exclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_017131q" name="Yes" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_get_cloud_region"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{AssignNetwork.skipNetworkCreationInAAI(execution.getVariable("gBuildingBlockExecution")) == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{AssignNetwork.networkFoundByName(execution.getVariable("gBuildingBlockExecution")) == true}]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0gkr871" name="No" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_put_network_in_AAI" /> <bpmn2:endEvent id="AssignNetworkBB_end" name="End Flow"> @@ -111,7 +111,7 @@ <bpmndi:BPMNShape id="ExclusiveGateway_19hvq7h_di" bpmnElement="networkFoundByName_ExclusiveGateway" isMarkerVisible="true"> <dc:Bounds x="838" y="-112" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="821" y="-176" width="83" height="24" /> + <dc:Bounds x="833" y="-169" width="85" height="48" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_017131q_di" bpmnElement="SequenceFlow_017131q"> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn deleted file mode 100644 index 212e735dd1..0000000000 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn +++ /dev/null @@ -1,80 +0,0 @@ -<?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="1.8.2"> - <bpmn:process id="UnassignNetwork1802BB" name="UnassignNetwork1802BB" isExecutable="true"> - <bpmn:startEvent id="Start_UnassignNetworkBB" name="start"> - <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:serviceTask id="Task_SNDCUnAssign" name="Call SDNC Adapter Topology UnAssign" camunda:expression="${SDNCUnassignTasks.unassignNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0le4vrj</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ks8kmt</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:endEvent id="End_UnassignNetworkBB" name="end"> - <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_VfModuleRelatioship" /> - <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SNDCUnAssign" targetRef="End_UnassignNetworkBB" /> - <bpmn:serviceTask id="Task_VfModuleRelatioship" name="Veriyf 'vf-module' relationship exists" camunda:expression="${UnassignNetworkBB.checkRelationshipRelatedTo(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")), "vf-module")}"> - <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0mxe1a7</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0mxe1a7" sourceRef="Task_VfModuleRelatioship" targetRef="Task_GetCloudRegionVersion" /> - <bpmn:sequenceFlow id="SequenceFlow_0le4vrj" sourceRef="Task_GetCloudRegionVersion" targetRef="Task_SNDCUnAssign" /> - <bpmn:serviceTask id="Task_GetCloudRegionVersion" name="Get Sdnc Cloud Region Version" camunda:expression="${UnassignNetworkBB.getCloudSdncRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_0mxe1a7</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0le4vrj</bpmn:outgoing> - </bpmn:serviceTask> - </bpmn:process> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignNetwork1802BB"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_UnassignNetworkBB"> - <dc:Bounds x="288" y="119" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="295" y="155" width="22" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0m0ikey_di" bpmnElement="Task_SNDCUnAssign"> - <dc:Bounds x="665" y="97" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_UnassignNetworkBB"> - <dc:Bounds x="817" y="119" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="826" y="159" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2"> - <di:waypoint xsi:type="dc:Point" x="324" y="137" /> - <di:waypoint xsi:type="dc:Point" x="375" y="137" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="304.5" y="122" width="90" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt"> - <di:waypoint xsi:type="dc:Point" x="765" y="137" /> - <di:waypoint xsi:type="dc:Point" x="817" y="137" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="791" y="122" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_194x6el_di" bpmnElement="Task_VfModuleRelatioship"> - <dc:Bounds x="375" y="97" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0mxe1a7_di" bpmnElement="SequenceFlow_0mxe1a7"> - <di:waypoint xsi:type="dc:Point" x="475" y="137" /> - <di:waypoint xsi:type="dc:Point" x="524" y="137" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="500" y="122" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0le4vrj_di" bpmnElement="SequenceFlow_0le4vrj"> - <di:waypoint xsi:type="dc:Point" x="624" y="137" /> - <di:waypoint xsi:type="dc:Point" x="665" y="137" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="645" y="122" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1ev9w69_di" bpmnElement="Task_GetCloudRegionVersion"> - <dc:Bounds x="524" y="97" width="100" height="80" /> - </bpmndi:BPMNShape> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java deleted file mode 100644 index 14cac8343e..0000000000 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.bpmn.subprocess; - -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doThrow; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.camunda.bpm.engine.test.Deployment; -import org.junit.Test; -import org.onap.so.bpmn.BaseBPMNTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; - - -public class AssignNetwork1802BBTest extends BaseBPMNTest{ - @Test - @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"}) - public void sunnyDayAssignNetwork_Test() throws InterruptedException { - - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetwork1802BB",variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","ServiceTask_assign_network_aai","AssignNetworkBB_end"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayAssignNetwork_Test() throws Exception { - - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class)); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetwork1802BB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("AssignNetworkBB_start", "ServiceTask_get_cloud_region", "ServiceTask_assign_network_sdnc", "ServiceTask_assign_network_aai") - .hasNotPassed("AssignNetworkBB_end"); - assertThat(pi).isEnded(); - } -} diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java deleted file mode 100644 index 2c5381de09..0000000000 --- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. 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. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.bpmn.subprocess; - -import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doThrow; - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.camunda.bpm.engine.runtime.ProcessInstance; -import org.junit.Test; -import org.onap.so.bpmn.BaseBPMNTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; - -public class UnassignNetwork1802BBTest extends BaseBPMNTest { - @Test - public void sunnyDayAssignNetwork_Test() throws InterruptedException { - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB",variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB"); - assertThat(pi).isEnded(); - } - - @Test - public void rainyDayAssignNetwork_Test() throws Exception { - doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB).checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module")); - ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB", variables); - assertThat(pi).isNotNull(); - assertThat(pi).isStarted() - .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship") - .hasNotPassed("End_UnassignNetworkBB"); - assertThat(pi).isEnded(); - } -}
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy index 3702862a04..589bbe9c4f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -140,9 +140,9 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - ServiceInstance si = wrapper.asBean(ServiceInstance.class) - execution.setVariable("model-invariant-id-original", si.getModelInvariantId()) - execution.setVariable("model-version-id-original", si.getModelVersionId()) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId()) + execution.setVariable("model-version-id-original", si.get().getModelVersionId()) }catch(BpmnError e) { throw e; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 4939173d65..913970b051 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -319,8 +319,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - ServiceInstance si = wrapper.asBean(ServiceInstance.class) - execution.setVariable("serviceInstanceName", si.getServiceInstanceName()) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName()) }catch(BpmnError e) { throw e; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index c7e3eb437c..a79483f6e9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -310,11 +310,11 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK)) if(uriList.isEmpty){ - ServiceInstance si = wrapper.asBean(ServiceInstance.class) - String orchestrationStatus = si.getOrchestrationStatus() - String serviceType = si.getServiceType() + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + String orchestrationStatus = si.get().getOrchestrationStatus() + String serviceType = si.get().getServiceType() execution.setVariable("serviceType", serviceType) - execution.setVariable("serviceRole", si.getServiceRole()) + execution.setVariable("serviceRole", si.get().getServiceRole()) if("TRANSPORT".equalsIgnoreCase(serviceType)){ if("PendingDelete".equals(orchestrationStatus)){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index ac8e506e1f..20ced72002 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -177,10 +177,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) - ServiceInstance si = wrapper.asBean(ServiceInstance.class) - execution.setVariable("serviceInstanceName", si.getServiceInstanceName()) - execution.setVariable("model-invariant-id-original", si.getModelInvariantId()) - execution.setVariable("model-version-id-original", si.getModelVersionId()) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName()) + execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId()) + execution.setVariable("model-version-id-original", si.get().getModelVersionId()) JSONObject ob = new JSONObject(wrapper.getJson()) JSONArray ar = ob.getJSONObject("relationship-list").getJSONArray("relationship") diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java index 06c65020f5..7c9e000a44 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java @@ -21,10 +21,8 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; @@ -35,30 +33,9 @@ public class AssignNetwork { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AssignNetwork.class); - @Autowired - private ExceptionBuilder exceptionUtil; + @Autowired private ExtractPojosForBB extractPojosForBB; - - /** - * Check if there are collection(s) - * @param execution - * @return boolean - */ - public boolean hasCollection(BuildingBlockExecution execution) { - boolean hasCollection = false; - try { - ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, - execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - if (serviceInstance.getCollection() != null){ - hasCollection = true; - msoLogger.debug("there are collections to create"); - } - } catch (Exception ex) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - return hasCollection; - } /** * Check if network was found by name @@ -80,14 +57,4 @@ public class AssignNetwork { } return networkFound; } - - /** - * BPMN access method. Return flag if BPMN flow should skip AAI interaction - * @param execution - * @return TRUE if network collection was NOT present OR network WAS found by name - */ - public boolean skipNetworkCreationInAAI(BuildingBlockExecution execution) { - - return !hasCollection(execution) || networkFoundByName(execution); - } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java index a206140014..6e5bd314d8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java @@ -25,7 +25,6 @@ import org.junit.Before; import org.junit.Test; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -36,80 +35,33 @@ public class AssignNetworkTest extends BaseTaskTest { @Autowired private AssignNetwork assignNetwork; - private ServiceInstance serviceInstance; private L3Network network; @Before public void before() { - serviceInstance = setServiceInstance(); network = setL3Network(); } @Test - public void hasCollectionTest() throws Exception { - setServiceInstance(); - //collection present by default base test setup - boolean hasCollection = assignNetwork.hasCollection(execution); - assertEquals(true, hasCollection); - - boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); - assertEquals(false, skip); - } - - @Test - public void hasNoCollectionTest() throws Exception { - //clear collection + public void networkNotFoundTest() throws Exception { + //network status to PRECREATED - when it was NOT found by name try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); - } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); - } - serviceInstance.setCollection(null); - boolean hasCollection = assignNetwork.hasCollection(execution); - assertEquals(false, hasCollection); - - boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); - assertEquals(true, skip); - } - - @Test - public void hasNoCollectionNoNetworkTest() throws Exception { - //clear collection and updated network status to PRECREATED - when it was NOT found by name - try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); } - serviceInstance.setCollection(null); + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); - boolean hasCollection = assignNetwork.hasCollection(execution); boolean networkFound = assignNetwork.networkFoundByName(execution); - assertEquals(false, hasCollection); assertEquals(false, networkFound); - - boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); - assertEquals(true, skip); } @Test - public void hasNetworkNoCollectionTest() throws Exception { - //clear collection and updated network status to INVENTORIED - when it was found by name + public void networkFoundTest() throws Exception { try { - serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); } catch(BBObjectNotFoundException e) { - serviceInstance = setServiceInstance(); } - serviceInstance.setCollection(null); - network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); - boolean hasCollection = assignNetwork.hasCollection(execution); boolean networkFound = assignNetwork.networkFoundByName(execution); - assertEquals(false, hasCollection); assertEquals(true, networkFound); - - boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); - assertEquals(true, skip); } - } |