diff options
Diffstat (limited to 'bpmn')
26 files changed, 1644 insertions, 538 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 603e11d458..6d5eb63b0d 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -1587,9 +1587,10 @@ public class BBInputSetup implements JavaDelegate { Vnfs vnfs = null; VfModules vfModules = null; Networks networks = null; + CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration(); - CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources); - gBB.setCloudRegion(cloudRegion); + CloudRegion cloudRegion = setCloudConfiguration(gBB, cloudConfiguration); + BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setService(service) .setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build(); @@ -1602,6 +1603,11 @@ public class BBInputSetup implements JavaDelegate { vnfs = findVnfsByKey(key, resources); } + // Vnf level cloud configuration takes precedence over service level cloud configuration. + if (vnfs.getCloudConfiguration() != null) { + setCloudConfiguration(gBB, vnfs.getCloudConfiguration()); + } + String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); // This stores the vnf id in request db to be retrieved later when // working on a vf module or volume group @@ -1638,6 +1644,21 @@ public class BBInputSetup implements JavaDelegate { vfModules = getVfModulesByKey(key, resources); } + String vfModulesName = vfModules.getInstanceName(); + String vfModulesModelCustId = vfModules.getModelInfo().getModelCustomizationId(); + // Get the Vnf associated with vfModule + Optional<org.onap.so.serviceinstancebeans.Vnfs> parentVnf = resources.getVnfs().stream() + .filter(aVnf -> aVnf.getCloudConfiguration() != null) + .filter(aVnf -> aVnf.getVfModules().stream() + .anyMatch(aVfModules -> aVfModules.getInstanceName().equals(vfModulesName) && aVfModules + .getModelInfo().getModelCustomizationId().equals(vfModulesModelCustId))) + .findAny(); + + // Get the cloud configuration from this Vnf + if (parentVnf.isPresent()) { + cloudRegion = setCloudConfiguration(gBB, parentVnf.get().getCloudConfiguration()); + } + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, getVnfId(executeBB, lookupKeyMap)); parameter.setModelInfo(vfModules.getModelInfo()); @@ -1668,6 +1689,16 @@ public class BBInputSetup implements JavaDelegate { networks = findNetworksByKey(key, resources); String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); if (networks != null) { + // If service level cloud configuration is not provided then get it from networks. + if (cloudConfiguration == null) { + Optional<org.onap.so.serviceinstancebeans.Networks> netWithCloudConfig = resources.getNetworks() + .stream().filter(aNetwork -> aNetwork.getCloudConfiguration() != null).findAny(); + if (netWithCloudConfig.isPresent()) { + setCloudConfiguration(gBB, netWithCloudConfig.get().getCloudConfiguration()); + } else { + logger.debug("Could not find any cloud configuration for this request."); + } + } parameter.setInstanceName(networks.getInstanceName()); parameter.setModelInfo(networks.getModelInfo()); parameter.setInstanceParams(networks.getInstanceParams()); @@ -1693,6 +1724,24 @@ public class BBInputSetup implements JavaDelegate { return gBB; } + /** + * setCloudConfiguration - set cloud info on a building block. + * + * @param gBB + * @param cloudConfiguration + * @return CloudRegion + * @throws Exception + */ + private CloudRegion setCloudConfiguration(GeneralBuildingBlock gBB, CloudConfiguration cloudConfiguration) + throws Exception { + org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); + Tenant tenant = getTenant(cloudConfiguration, aaiCloudRegion); + gBB.setTenant(tenant); + CloudRegion cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); + gBB.setCloudRegion(cloudRegion); + return cloudRegion; + } + protected Networks findNetworksByKey(String key, Resources resources) { for (Networks networks : resources.getNetworks()) { if (networks.getModelInfo().getModelCustomizationId().equalsIgnoreCase(key)) { @@ -1743,39 +1792,6 @@ public class BBInputSetup implements JavaDelegate { throw new ResourceNotFoundException("Could not find vnf with key: " + key + " in userparams"); } - protected CloudRegion getCloudRegionFromMacroRequest(CloudConfiguration cloudConfiguration, Resources resources) { - if (cloudConfiguration == null) { - for (Vnfs vnfs : resources.getVnfs()) { - if (cloudConfiguration == null) { - cloudConfiguration = vnfs.getCloudConfiguration(); - } else { - break; - } - for (VfModules vfModules : vnfs.getVfModules()) { - if (cloudConfiguration == null) { - cloudConfiguration = vfModules.getCloudConfiguration(); - } else { - break; - } - } - } - for (Networks networks : resources.getNetworks()) { - if (cloudConfiguration == null) { - cloudConfiguration = networks.getCloudConfiguration(); - } else { - break; - } - } - } - if (cloudConfiguration != null) { - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration); - return mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion); - } else { - logger.debug("Could not find any cloud configuration for this request."); - return null; - } - } - protected String getVnfId(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap) { String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID); if (vnfId == null) { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index b561055468..d405cff8bb 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -2282,45 +2282,6 @@ public class BBInputSetupTest { } @Test - public void testgetGBBMacroCloudConfiguration() throws Exception { - org.onap.so.serviceinstancebeans.Service serviceMacro = mapper.readValue( - new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class); - CloudConfiguration cloudConfig = null; - org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion(); - aaiCloudRegion.setCloudOwner("test-owner-name"); - Resources resources = serviceMacro.getResources(); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class)); - CloudRegion expected = new CloudRegion(); - expected.setLcpCloudRegionId("mdt1"); - expected.setCloudOwner("test-owner-name"); - expected.setTenantId("88a6ca3ee0394ade9403f075db23167e"); - - CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); - assertThat(actual, sameBeanAs(expected)); - - serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroVnfs.json"), - org.onap.so.serviceinstancebeans.Service.class); - resources = serviceMacro.getResources(); - - actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); - assertThat(actual, sameBeanAs(expected)); - - serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNetworks.json"), - org.onap.so.serviceinstancebeans.Service.class); - resources = serviceMacro.getResources(); - - actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); - assertThat(actual, sameBeanAs(expected)); - - serviceMacro = mapper.readValue(new File(RESOURCE_PATH + "ServiceMacroNoCloudConfig.json"), - org.onap.so.serviceinstancebeans.Service.class); - resources = serviceMacro.getResources(); - - actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); - assertNull(actual); - } - - @Test public void testgetGBBMacroWithEmptyUserParams() throws Exception { String resourceId = "123"; String vnfType = "vnfType"; diff --git a/bpmn/pom.xml b/bpmn/pom.xml index 6a61ed1df3..806dc1cd83 100644 --- a/bpmn/pom.xml +++ b/bpmn/pom.xml @@ -20,6 +20,7 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <sdnc.northbound.version>1.5.2</sdnc.northbound.version> + <logback-core.version>1.2.10</logback-core.version> </properties> <modules> <module>MSOCoreBPMN</module> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn new file mode 100644 index 0000000000..59bb404936 --- /dev/null +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpgradeVfModuleBB.bpmn @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1jxlg2g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0"> + <bpmn:process id="UpgradeVfModuleBB" name="UpgradeVfModuleBB" isExecutable="true"> + <bpmn:startEvent id="UpgradeVfModuleBB_Start"> + <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="QueryVfModule" name=" SDNC Get (vf module) " camunda:expression="${SDNCQueryTasks.queryVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1s4rpyp</bpmn:incoming> + <bpmn:outgoing>Flow_0gbxjjk</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="UpgradeVfModuleBB_End"> + <bpmn:incoming>SequenceFlow_1vbwdaw</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="QueryVnf" name=" SDNC Get (vnf) " camunda:expression="${SDNCQueryTasks.queryVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1xr6chl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1s4rpyp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="UpdateVfModuleStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusCreatedVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0rds4rj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1vbwdaw</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_15do1tu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0rds4rj</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="CreateNetworkPolicies" name="AAI Create (network policies)" camunda:expression="${AAICreateTasks.createNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>Flow_1c9ox62</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xqhep5</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="UpdateVnfIpv4OamAddress" name="AAI Update (VNF) " camunda:expression="${AAIUpdateTasks.updateIpv4OamAddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0xqhep5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yo6mvv</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1yo6mvv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1i03uy2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="UpdateVfModuleContrailServiceInstanceFqdn" name="AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateContrailServiceInstanceFqdnVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_1i03uy2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15do1tu</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="CnfAdapter" name="Cnf Adapter" camunda:expression="${CnfAdapterUpgradeTasks.upgradeInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>Flow_0gbxjjk</bpmn:incoming> + <bpmn:outgoing>Flow_1il4743</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:subProcess id="Activity_10eqhmz" name="Inventory Error Handling" triggeredByEvent="true"> + <bpmn:endEvent id="Event_108oetk"> + <bpmn:incoming>Flow_03q6ty9</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="Activity_1p8hxyt" name="Process Error" camunda:expression="${ExceptionBuilder.processInventoryException(execution)}"> + <bpmn:incoming>Flow_1sqy91r</bpmn:incoming> + <bpmn:outgoing>Flow_03q6ty9</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_03q6ty9" sourceRef="Activity_1p8hxyt" targetRef="Event_108oetk" /> + <bpmn:sequenceFlow id="Flow_1sqy91r" sourceRef="Event_1pengt4" targetRef="Activity_1p8hxyt" /> + <bpmn:startEvent id="Event_1pengt4"> + <bpmn:outgoing>Flow_1sqy91r</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0sq3chy" errorRef="Error_0t7oivz" /> + </bpmn:startEvent> + </bpmn:subProcess> + <bpmn:callActivity id="UpdateCnfAai" name="Update Cnf Data in AAI" calledElement="UpdateCnfAai"> + <bpmn:extensionElements> + <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="heatStackId" target="heatStackId" /> + <camunda:out source="heatStackId" target="heatStackId" /> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1il4743</bpmn:incoming> + <bpmn:outgoing>Flow_0piytnn</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1xr6chl" sourceRef="UpgradeVfModuleBB_Start" targetRef="QueryVnf" /> + <bpmn:sequenceFlow id="SequenceFlow_1s4rpyp" sourceRef="QueryVnf" targetRef="QueryVfModule" /> + <bpmn:sequenceFlow id="SequenceFlow_1vbwdaw" sourceRef="UpdateVfModuleStatus" targetRef="UpgradeVfModuleBB_End" /> + <bpmn:sequenceFlow id="SequenceFlow_0rds4rj" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" /> + <bpmn:sequenceFlow id="SequenceFlow_15do1tu" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" /> + <bpmn:sequenceFlow id="SequenceFlow_0xqhep5" sourceRef="CreateNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" /> + <bpmn:sequenceFlow id="SequenceFlow_1yo6mvv" sourceRef="UpdateVnfIpv4OamAddress" targetRef="UpdateVnfManagementV6Address" /> + <bpmn:sequenceFlow id="SequenceFlow_1i03uy2" sourceRef="UpdateVnfManagementV6Address" targetRef="UpdateVfModuleContrailServiceInstanceFqdn" /> + <bpmn:sequenceFlow id="Flow_1il4743" sourceRef="CnfAdapter" targetRef="UpdateCnfAai" /> + <bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI"> + <bpmn:incoming>Flow_0piytnn</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1c2sbij" name="AAI" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="Flow_0gbxjjk" sourceRef="QueryVfModule" targetRef="CnfAdapter" /> + <bpmn:sequenceFlow id="Flow_0piytnn" sourceRef="UpdateCnfAai" targetRef="aaiThrow" /> + <bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI"> + <bpmn:outgoing>Flow_1c9ox62</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_0dycelb" name="AAI" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="Flow_1c9ox62" sourceRef="aaiCatch" targetRef="CreateNetworkPolicies" /> + </bpmn:process> + <bpmn:error id="Error_0t7oivz" name="AAIInventoryFailure" errorCode="AAIInventoryFailure" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UpgradeVfModuleBB"> + <bpmndi:BPMNEdge id="Flow_1c9ox62_di" bpmnElement="Flow_1c9ox62"> + <di:waypoint x="208" y="372" /> + <di:waypoint x="300" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0piytnn_di" bpmnElement="Flow_0piytnn"> + <di:waypoint x="970" y="120" /> + <di:waypoint x="1062" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0gbxjjk_di" bpmnElement="Flow_0gbxjjk"> + <di:waypoint x="570" y="120" /> + <di:waypoint x="680" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1il4743_di" bpmnElement="Flow_1il4743"> + <di:waypoint x="780" y="120" /> + <di:waypoint x="870" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1i03uy2_di" bpmnElement="SequenceFlow_1i03uy2"> + <di:waypoint x="722" y="372" /> + <di:waypoint x="770" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yo6mvv_di" bpmnElement="SequenceFlow_1yo6mvv"> + <di:waypoint x="553" y="372" /> + <di:waypoint x="622" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xqhep5_di" bpmnElement="SequenceFlow_0xqhep5"> + <di:waypoint x="400" y="372" /> + <di:waypoint x="453" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_15do1tu_di" bpmnElement="SequenceFlow_15do1tu"> + <di:waypoint x="870" y="372" /> + <di:waypoint x="935" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0rds4rj_di" bpmnElement="SequenceFlow_0rds4rj"> + <di:waypoint x="1035" y="372" /> + <di:waypoint x="1100" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vbwdaw_di" bpmnElement="SequenceFlow_1vbwdaw"> + <di:waypoint x="1200" y="372" /> + <di:waypoint x="1241" y="372" /> + <di:waypoint x="1241" y="372" /> + <di:waypoint x="1276" y="372" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1s4rpyp_di" bpmnElement="SequenceFlow_1s4rpyp"> + <di:waypoint x="389" y="120" /> + <di:waypoint x="470" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> + <di:waypoint x="188" y="120" /> + <di:waypoint x="289" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CreateVfModuleBB_Start_di" bpmnElement="UpgradeVfModuleBB_Start"> + <dc:Bounds x="152" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="QueryVfModule_di" bpmnElement="QueryVfModule"> + <dc:Bounds x="470" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CreateVfModuleBB_End_di" bpmnElement="UpgradeVfModuleBB_End"> + <dc:Bounds x="1276" y="354" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="QueryVnf_di" bpmnElement="QueryVnf"> + <dc:Bounds x="289" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="UpdateVfModuleStatus_di" bpmnElement="UpdateVfModuleStatus"> + <dc:Bounds x="1100" y="332" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="UpdateVfModuleHeatStackId_di" bpmnElement="UpdateVfModuleHeatStackId"> + <dc:Bounds x="935" y="332" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CreateNetworkPolicies_di" bpmnElement="CreateNetworkPolicies"> + <dc:Bounds x="300" y="332" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="UpdateVnfIpv4OamAddress_di" bpmnElement="UpdateVnfIpv4OamAddress"> + <dc:Bounds x="453" y="332" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="UpdateVnfManagementV6Address_di" bpmnElement="UpdateVnfManagementV6Address"> + <dc:Bounds x="622" y="332" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="UpdateVfModuleContrailServiceInstanceFqdn_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> + <dc:Bounds x="770" y="332" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CnfAdapter_di" bpmnElement="CnfAdapter"> + <dc:Bounds x="680" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_10eqhmz_di" bpmnElement="Activity_10eqhmz" isExpanded="true"> + <dc:Bounds x="216" y="494" width="340" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_1sqy91r_di" bpmnElement="Flow_1sqy91r"> + <di:waypoint x="292" y="584" /> + <di:waypoint x="336" y="584" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_03q6ty9_di" bpmnElement="Flow_03q6ty9"> + <di:waypoint x="436" y="584" /> + <di:waypoint x="488" y="584" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_108oetk_di" bpmnElement="Event_108oetk"> + <dc:Bounds x="488" y="566" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1p8hxyt_di" bpmnElement="Activity_1p8hxyt"> + <dc:Bounds x="336" y="544" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="UpdateCnfAai_di" bpmnElement="UpdateCnfAai"> + <dc:Bounds x="870" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="aaiThrow_di" bpmnElement="aaiThrow"> + <dc:Bounds x="1062" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1051" y="148" width="57" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="aaiCatch_di" bpmnElement="aaiCatch"> + <dc:Bounds x="172" y="354" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="162" y="394" width="57" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_13ssqoq_di" bpmnElement="Event_1pengt4"> + <dc:Bounds x="256" y="566" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml index 846af27b96..b287594a12 100644 --- a/bpmn/so-bpmn-infrastructure-common/pom.xml +++ b/bpmn/so-bpmn-infrastructure-common/pom.xml @@ -229,6 +229,7 @@ <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> + <version>${logback-core.version}</version> </dependency> <dependency> <groupId>org.slf4j</groupId> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy index d0fe1e9469..e54193470d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.apache.commons.lang3.StringUtils.isBlank import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.Gson import com.google.gson.reflect.TypeToken @@ -27,6 +28,15 @@ import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.logging.filter.base.ErrorCode +import javax.ws.rs.NotFoundException +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aaiclient.client.aai.AAIResourcesClient +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.beans.nsmf.* import org.onap.so.beans.nsmf.oof.SubnetType import org.onap.so.bpmn.common.scripts.* @@ -160,8 +170,10 @@ class DoActivateSliceService extends AbstractServiceTaskProcessor { actDeActNssi.setNssiId(nssInstance.nssiId) actDeActNssi.setSnssaiList(Arrays.asList(customerInfo.snssai)) + String sliceProfileId = getRelatedSliceProfileId(execution, customerInfo.globalSubscriberId, customerInfo.subscriptionServiceType, nssInstance.nssiId, customerInfo.snssai, "slice-profile") + actDeActNssi.setSliceProfileId(sliceProfileId) - nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setEsrInfo(esrInfo) nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setActDeActNssi(actDeActNssi) execution.setVariable("nbiRequest", nbiRequest) @@ -176,6 +188,48 @@ class DoActivateSliceService extends AbstractServiceTaskProcessor { logger.debug("***** Exit processDecomposition *****") } + private String getRelatedSliceProfileId(DelegateExecution execution, String globalSubscriberId, String subscriptionServiceType, String instanceId, String snssai, String role) { + logger.debug("${Prefix} - Get Related Slice Profile") + if( isBlank(role) || isBlank(instanceId)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Role and instanceId are mandatory") + } + + String nssiId; + AAIResourcesClient client = getAAIClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId)) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}") + } + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + if(si.isPresent()) { + List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship() + for (Relationship relationship : relationshipList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo.toLowerCase() == "service-instance") { + String relatioshipurl = relationship.getRelatedLink() + String serviceInstanceId = + relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) + uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + if (!client.exists(uri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}") + } + AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class) + if (serviceInstance.isPresent()) { + ServiceInstance instance = serviceInstance.get() + if (role.equalsIgnoreCase(instance.getServiceRole()) && snssai.equalsIgnoreCase(instance.getEnvironmentContext())) { + nssiId = instance.getServiceInstanceId() + } + } + } + } + } + return nssiId + logger.debug("${Prefix} - Exit Get Related Slice Profile instances") + } + /** * send Create Request NSSMF * @param execution diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy index 9800428c68..a11270465a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy @@ -369,7 +369,6 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { modifySliceParams.addProperty("snssaiList", snssaiList) modifySliceParams.addProperty("sliceProfileId", sliceProfileId) modifySliceParams.addProperty("nsiInfo", nsiInfo) - modifySliceParams.addProperty("scriptName", scriptName) execution.setVariable("modifySliceParams", modifySliceParams.toString()) //create operation status in request db @@ -639,15 +638,15 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANServiceInstance.setServiceType(execution.getVariable("sst") as String) ANServiceInstance.setOrchestrationStatus(serviceStatus) String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList") as String - ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) + ANServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0)) ANServiceInstance.setServiceRole(serviceRole) List<String> snssaiList = jsonUtil.StringArrayToList(execution.getVariable("snssaiList") as String) String snssai = snssaiList.get(0) - ANServiceInstance.setEnvironmentContext(snssai) String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("modelUuid") as String ANServiceInstance.setModelInvariantId(modelInvariantUuid) ANServiceInstance.setModelVersionId(modelUuid) + ANServiceInstance.setEnvironmentContext(execution.getVariable("networkType")) //Network Type ANServiceInstance.setWorkloadContext("AN") String serviceFunctionAn = jsonUtil.getJsonValue(execution.getVariable("sliceProfile") as String, "resourceSharingLevel") ANServiceInstance.setServiceFunction(serviceFunctionAn) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy index 2e0f3cfd66..4681713fd7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineCreate.groovy @@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils import static org.apache.commons.lang3.StringUtils.isBlank +import static org.apache.commons.lang3.StringUtils.isNotBlank class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor { @@ -333,6 +334,7 @@ class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor { String epA = jsonUtil.getJsonValue(linkStr, "transportEndpointA") String epB = jsonUtil.getJsonValue(linkStr, "transportEndpointB") + String epBProtect = jsonUtil.getJsonValue(linkStr, "transportEndpointBProtection") String modelInvariantId = execution.getVariable("modelInvariantUuid") String modelVersionId = execution.getVariable("modelUuid") @@ -340,6 +342,9 @@ class DoCloudLeasedLineCreate extends AbstractServiceTaskProcessor { resource.setLinkId(linkId) resource.setLinkName(epA) resource.setLinkName2(epB) + if (isNotBlank(epBProtect)) { + resource.setSegmentId(epBProtect) + } resource.setLinkType("TsciConnectionLink") resource.setInMaint(false) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy index 5c9877840d..bfd5ac81d3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCloudLeasedLineModify.groovy @@ -109,6 +109,14 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor { "transportNetworks", "transportNetworks", true) logger.debug("transportNetworks: " + execution.getVariable("transportNetworks")) + serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr, + "modifyAction", "modifyAction"); + if (isNotBlank(execution.getVariable("modifyAction"))) { + logger.debug("modifyAction: " + execution.getVariable("modifyAction")) + } else { + logger.debug("modifyAction is not set") + } + if (isBlank(serviceIntentUtils.setExecVarFromJsonIfExists(execution, additionalPropJsonStr, "enableSdnc", "enableSdnc"))) { serviceIntentUtils.setEnableSdncConfig(execution) @@ -266,12 +274,16 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor { void updateTsciNetworks(DelegateExecution execution) { try { + if (modifyBandwidthGlobal(execution)) { + String netStr = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks")).get(0) + int maxBw = getMaxBwFromNetworkJsonStr(execution, netStr) + updateNetworkPolicyGlobal(execution, maxBw) + return + } List<String> networkStrList = jsonUtil.StringArrayToList(execution.getVariable("transportNetworks")) for (String networkStr : networkStrList) { - updateLogicalLinksInNetwork(execution, networkStr) - updateNetworkPolicy(execution, networkStr) + updateTsciNetwork(execution, networkStr) } - } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -280,6 +292,20 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor { } } + boolean modifyBandwidthGlobal(DelegateExecution execution) { + String modifyAction = execution.getVariable("modifyAction") + if (isNotBlank(modifyAction) && modifyAction.equals("bandwidth")) { + return true + } + + return false + } + + void updateTsciNetwork(DelegateExecution execution, String networkStr) { + updateLogicalLinksInNetwork(execution, networkStr) + updateNetworkPolicy(execution, networkStr) + } + int getMaxBwFromNetworkJsonStr(DelegateExecution execution, String networkJsonStr) { int maxBw = 0 try { @@ -327,6 +353,28 @@ public class DoCloudLeasedLineModify extends AbstractServiceTaskProcessor { } } + void updateNetworkPolicyGlobal(DelegateExecution execution, int maxBw) { + try { + List<String> arIdList = execution.getVariable("arIdList") + for (String arId : arIdList) { + Map<String, String> policyMap = execution.getVariable("arPolicyMap") + String policyId = policyMap.get(arId) + if (isBlank(policyId)) { + String msg = String.format("ERROR: updateNetworkPolicy: policyId not found. arId=%s", arId) + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + updatePolicyMaxBandwidthInAAI(execution, policyId, maxBw) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage()) + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } + void updateNetworkPolicy(DelegateExecution execution, String networkJsonStr) { try { int maxBw = getMaxBwFromNetworkJsonStr(execution, networkJsonStr) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index 5476cb5afa..35b4199909 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -117,7 +117,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ String modelUuid = modelInfo.getModelUuid() ss.setModelInvariantId(modelInvariantUuid) ss.setModelVersionId(modelUuid) - String serviceInstanceLocationid = serviceProfile.get("plmnIdList") + String serviceInstanceLocationid = serviceProfile.get("pLMNIdList") ss.setServiceInstanceLocationId(serviceInstanceLocationid) String snssai = serviceProfile.get("sNSSAI") ss.setEnvironmentContext(snssai) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy index b09161d5cd..ea4c29b202 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy @@ -34,6 +34,13 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.common.scripts.OofUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.oof.adapter.beans.payload.OofRequest +import javax.ws.rs.core.Response +import org.onap.logging.filter.base.ONAPComponents import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -48,6 +55,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() RequestDBUtil requestDBUtil = new RequestDBUtil() TnNssmfUtils tnNssmfUtils = new TnNssmfUtils() + OofUtils oofUtils = new OofUtils() JsonSlurper jsonSlurper = new JsonSlurper() ObjectMapper objectMapper = new ObjectMapper() private static final Logger logger = LoggerFactory.getLogger(DoDeallocateTnNssi.class) @@ -92,10 +100,69 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { "enableSdnc", "enableSdnc"))) { tnNssmfUtils.setEnableSdncConfig(execution) } + if (isBlank(additionalPropJsonStr) || + isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution, + additionalPropJsonStr, + "enableOof", "enableOof"))) { + tnNssmfUtils.setEnableOofConfig(execution) + } + String nsiId = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiId") + execution.setVariable("nsiId", nsiId) logger.debug("Finish preProcessRequest") } + void prepareOOFNssiTerminationRequest(DelegateExecution execution) { + logger.debug("Start prepareOOFTnNssiTerminationRequest") + String requestId = execution.getVariable("msoRequestId") + String messageType = "TN_NSSITermination" + String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); + String serviceInstanceId = execution.getVariable("sliceServiceInstanceId") + + String relatedNsiId = execution.getVariable("nsiId") + + String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,serviceInstanceId, "NSSI",messageType,relatedNsiId) + execution.setVariable("oofTnNssiPayload", oofRequest) + logger.debug("Finish prepareOOFTnNssiTerminationRequest") + } + + void performOofNSSITerminationCall(DelegateExecution execution) { + boolean terminateTnNSSI = callOofAdapter(execution,execution.getVariable("oofTnNssiPayload")) + execution.setVariable("terminateTnNSSI", terminateTnNSSI) + } + + /** + * @param execution + * @param oofRequest - Request payload to be sent to adapter + * @return + */ + boolean callOofAdapter(DelegateExecution execution, Object oofRequest) { + logger.debug("Start callOofAdapter") + String requestId = execution.getVariable("msoRequestId") + String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution) + URL requestUrl = new URL(oofAdapterEndpoint) + OofRequest oofPayload = new OofRequest() + oofPayload.setApiPath("/api/oof/terminate/nxi/v1") + oofPayload.setRequestDetails(oofRequest) + String requestJson = objectMapper.writeValueAsString(oofPayload) + logger.debug("Calling OOF adapter : ${requestUrl} with payload : ${requestJson}") + HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(requestJson) + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + if(responseCode < 200 || responseCode >= 300){ + logger.debug("OOF request failed with reason : " + httpResponse) + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + }else { + Map<String,Object> response = objectMapper.readValue(httpResponse.getEntity(),Map.class) + boolean terminateResponse = response.get("terminateResponse") + if(!terminateResponse) { + logger.debug("Terminate response is false because " + response.get("reason")) + } + return terminateResponse + } + } + void preprocessSdncDeallocateTnNssiRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preprocessSdncDeallocateTnNssiRequest(' + 'execution=' + execution.getId() + ')' @@ -174,4 +241,3 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus) } } - diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy index 09bbb81b6b..b1436d5d06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy @@ -20,10 +20,16 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.fasterxml.jackson.core.type.TypeReference import com.fasterxml.jackson.databind.ObjectMapper +import org.json.JSONArray import com.google.gson.JsonArray +import com.google.gson.GsonBuilder import com.google.gson.JsonObject +import com.google.gson.JsonParser import groovy.json.JsonSlurper +import org.onap.so.bpmn.common.scripts.OofUtils +import com.google.gson.Gson import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance @@ -53,6 +59,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { RequestDBUtil requestDBUtil = new RequestDBUtil() JsonSlurper jsonSlurper = new JsonSlurper() ObjectMapper objectMapper = new ObjectMapper() + OofUtils oofUtils = new OofUtils() TnNssmfUtils tnNssmfUtils = new TnNssmfUtils() private static final Logger logger = LoggerFactory.getLogger(TnAllocateNssi.class) @@ -96,7 +103,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { msg = "Input sliceProfile is null" logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { + } + else { execution.setVariable("sliceProfile", sliceProfile) } @@ -105,7 +113,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { msg = "Input transportSliceNetworks is null" logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { + } + else { execution.setVariable("transportSliceNetworks", transportSliceNetworks) } logger.debug("transportSliceNetworks: " + transportSliceNetworks) @@ -115,7 +124,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { msg = "Input nsiInfo is null" logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { + } + else { execution.setVariable("nsiInfo", nsiInfoStr) } @@ -123,6 +133,14 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { "enableSdnc", "enableSdnc"))) { tnNssmfUtils.setEnableSdncConfig(execution) } + + if (isBlank(additionalPropJsonStr) || + isBlank(tnNssmfUtils.setExecVarFromJsonIfExists(execution, + additionalPropJsonStr, + "enableOof", "enableOof"))) { + tnNssmfUtils.setEnableOofConfig(execution) + } + } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -169,6 +187,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { //TN NSST decomposition String tnModelVersion = tnNsstServiceDecomposition.getModelInfo().getModelVersion() String tnModelName = tnNsstServiceDecomposition.getModelInfo().getModelName() + List<ServiceProxy> serviceProxyList = tnNsstServiceDecomposition.getServiceProxy() List<String> nsstInfoList = new ArrayList<>() for (ServiceProxy serviceProxy : serviceProxyList) { @@ -188,7 +207,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String msg = "Exception in TN NSST processDecomposition. There is no NSST associated with TN NSST " logger.info(msg) //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } else { + } + else { execution.setVariable("tnNsstInfoList", nsstInfoList) execution.setVariable("tnModelVersion", tnModelVersion) execution.setVariable("tnModelName", tnModelName) @@ -196,6 +216,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { execution.setVariable("maxIndex", maxIndex) } + execution.setVariable("tnNfSliceProfile", execution.getVariable("sliceProfile")) + execution.setVariable("tnModelName", tnModelName) logger.debug("End processDecomposition") } @@ -205,90 +227,52 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug("get NSSI option OOF Url: " + urlString) //build oof request body + String requestId = execution.getVariable("msoRequestId") - String messageType = "NSISelectionResponse" - Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) + String messageType = "NSSISelectionResponse" + Map<String, Object> profileInfo = (Map<String, Object>) objectMapper.readValue(execution.getVariable("tnNfSliceProfile"), Map.class) String modelUuid = execution.getVariable("modelUuid") String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelName = execution.getVariable("tnModelName") String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); - List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class) - JsonArray capabilitiesList = new JsonArray() - execution.setVariable("nssiSelection_Url", "/api/oof/selection/nsi/v1") + execution.setVariable("nssiSelection_Url", "/api/oof/selection/nssi/v1") execution.setVariable("nssiSelection_messageType", messageType) execution.setVariable("nssiSelection_correlator", requestId) execution.setVariable("nssiSelection_timeout", timeout) - String oofRequest = buildSelectTnNssiRequest(requestId, messageType, modelUuid, modelInvariantUuid, - modelName, profileInfo, nsstInfoList, capabilitiesList, false) + String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, modelUuid, modelInvariantUuid, modelName, profileInfo) execution.setVariable("nssiSelection_oofRequest", oofRequest) logger.debug("Finish prepareOofSelection") } - String buildSelectTnNssiRequest(String requestId, String messageType, String UUID, String invariantUUID, - String name, Map<String, Object> profileInfo, - List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse) { - - def transactionId = requestId - logger.debug("transactionId is: " + transactionId) - String correlator = requestId - String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator - ObjectMapper objectMapper = new ObjectMapper() - String profileJson = objectMapper.writeValueAsString(profileInfo) - String nsstInfoListString = objectMapper.writeValueAsString(nsstInfoList) - //Prepare requestInfo object - JsonObject requestInfo = new JsonObject() - requestInfo.addProperty("transactionId", transactionId) - requestInfo.addProperty("requestId", requestId) - requestInfo.addProperty("callbackUrl", callbackUrl) - requestInfo.addProperty("sourceId", "SO") - requestInfo.addProperty("timeout", 600) - requestInfo.addProperty("numSolutions", 1) - - //Prepare serviceInfo object - JsonObject ranNsstInfo = new JsonObject() - ranNsstInfo.addProperty("UUID", UUID) - ranNsstInfo.addProperty("invariantUUID", invariantUUID) - ranNsstInfo.addProperty("name", name) - - JsonObject json = new JsonObject() - json.add("requestInfo", requestInfo) - json.add("NSTInfo", ranNsstInfo) - json.addProperty("serviceProfile", profileJson) - json.addProperty("NSSTInfo", nsstInfoListString) - json.add("subnetCapabilities", capabilitiesList) - json.addProperty("preferReuse", preferReuse) - - return json.toString() - } - void processOofSelection(DelegateExecution execution) { logger.debug(Prefix + "processOofSelection method start") String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse") String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus") if (requestStatus.equals("completed")) { - List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions")) - boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI") - if (existingNSI) { - def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution") - execution.setVariable("sharedTnNssiSolution", sharedNSISolution) - logger.debug("sharedTnNssiSolution from OOF " + sharedNSISolution) - String tnServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId") - execution.setVariable("tnServiceInstanceId", tnServiceInstanceId) - org.onap.so.bpmn.core.domain.ServiceInstance serviceInstance = new org.onap.so.bpmn.core.domain.ServiceInstance(); - serviceInstance.setInstanceId(tnServiceInstanceId); - ServiceDecomposition serviceDecomposition = execution.getVariable("tnNsstServiceDecomposition") - serviceDecomposition.setServiceInstance(serviceInstance); - execution.setVariable("tnNsstServiceDecomposition", serviceDecomposition) + String solutions = jsonUtil.getJsonValue(oofResponse, "solutions") + JsonParser parser = new JsonParser() + JsonArray solution = parser.parse(solutions) as JsonArray + if (solution.size() >= 1) { + JsonObject sol = solution.get(0) as JsonObject + String tnNfNssiId = sol.get("NSSIId").getAsString() + String invariantUuid = sol.get("invariantUUID").getAsString() + String uuid = sol.get("UUID").getAsString() + String nssiName = sol.get("NSSIName").getAsString() + execution.setVariable("TnServiceInstanceId", tnNfNssiId) + execution.setVariable("TNNFInvariantUUID", invariantUuid) + execution.setVariable("TNNFUUID", uuid) + execution.setVariable("servicename", nssiName) + logger.debug("TnServiceInstanceId from OOF " + tnNfNssiId) execution.setVariable("isOofTnNssiSelected", true) - } else { - def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles") - execution.setVariable("tnConstituentSliceProfiles", sliceProfiles) + } + else { + logger.debug("No solutions returned from OOF .. Create new TN NF NSSI") execution.setVariable("isOofTnNssiSelected", false) - logger.debug("tnConstituentSliceProfiles list from OOF " + sliceProfiles) } - } else { + } + else { String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage") logger.error("received failed status from oof " + statusMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a failed Async Response from OOF : " + statusMessage) @@ -297,6 +281,77 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { logger.debug(Prefix + "processOofSelection method finished") } + void prepareModifyTnNssiInputs(DelegateExecution execution) { + logger.debug(Prefix + "prepareModifyTnNssiInputs method start") + String jobId = UUID.randomUUID().toString() + execution.setVariable("modifyTnNssiJobId", jobId) + String additionalPropJsonStr = execution.getVariable("sliceParams") + String sliceProfile = execution.getVariable("sliceProfile") + String snssaiList = jsonUtil.getJsonValue(sliceProfile, "snssaiList") + String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId") + String nsiInfo = jsonUtil.getJsonValue(additionalPropJsonStr, "nsiInfo") + String scriptName = jsonUtil.getJsonValue(additionalPropJsonStr, "scriptName") + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + String serviceInstanceID = execution.getVariable("TnServiceInstanceId") + String servicename = execution.getVariable("servicename") + String transportSliceNetworks = jsonUtil.getJsonValue(additionalPropJsonStr, "transportSliceNetworks") + + JsonObject modifySliceParams = new JsonObject() + modifySliceParams.addProperty("nsiInfo", nsiInfo) + modifySliceParams.addProperty("serviceInstanceID", serviceInstanceID) + modifySliceParams.addProperty("servicename", servicename) + modifySliceParams.addProperty("sliceProfile", sliceProfile) + modifySliceParams.addProperty("sliceProfileId", sliceProfileId) + modifySliceParams.addProperty("modelInvariantUuid", modelInvariantUuid) + modifySliceParams.addProperty("modelUuid", modelUuid) + modifySliceParams.addProperty("scriptName", scriptName) + modifySliceParams.addProperty("snssaiList", snssaiList) + modifySliceParams.addProperty("transportSliceNetworks", transportSliceNetworks) + + execution.setVariable("modifySliceParams", modifySliceParams.toString()) + + logger.debug(Prefix + "prepareModifyTnNssiInputs method finished") + } + + def createModifyNssiQueryJobStatus = { DelegateExecution execution -> + logger.debug(Prefix + "createModifyNssiQueryJobStatus method start") + JsonObject esrInfo = new JsonObject() + esrInfo.addProperty("networkType", "tn") + esrInfo.addProperty("vendor", "ONAP_internal") + + execution.setVariable("esrInfo", esrInfo.toString()) + + JsonObject serviceInfo = new JsonObject() + serviceInfo.addProperty("nssiId", execution.getVariable("TnServiceInstanceId") as String) + serviceInfo.addProperty("nsiId", execution.getVariable("nsiId") as String) + serviceInfo.addProperty("nssiName", execution.getVariable("servicename") as String) + serviceInfo.addProperty("sST", execution.getVariable("sst") as String) + serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("pLMNIdList"))) + serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId") as String) + serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType") as String) + serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("modelInvariantUuid") as String) + serviceInfo.addProperty("serviceUuid", execution.getVariable("modelUuid") as String) + execution.setVariable("serviceInfo", serviceInfo.toString()) + execution.setVariable("responseId", "") + } + + def processModifyJobStatusRsp = { DelegateExecution execution -> + logger.debug(Prefix + "processJobStatusRsp method start") + String jobResponse = execution.getVariable("jobResponse") + logger.debug("Job status response " + jobResponse) + String status = jsonUtil.getJsonValue(jobResponse, "status") + String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId") + if (status.equalsIgnoreCase("finished")) { + logger.debug("Job successfully completed ... proceeding with flow for nssi : " + nssi) + } + else { + String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription") + logger.error("received failed status from job status query for nssi : " + nssi + " with status description : " + statusDescription) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "received failed status from job status query for nssi : " + nssi + " with status description : " + statusDescription) + } + } + void updateAAIOrchStatus(DelegateExecution execution) { logger.debug("Start updateAAIOrchStatus") String sliceServiceInstanceId = execution.getVariable("sliceServiceInstanceId") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy index d6e94efea1..d1e2b11676 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy @@ -382,6 +382,18 @@ class TnNssmfUtils { execution.setVariable("enableSdnc", enableSdnc) } + void setEnableOofConfig(DelegateExecution execution) { + String enableOof = UrnPropertiesReader.getVariable( + "mso.workflow.TnNssmf.enableOOFNetworkConfig") + if (isBlank(enableOof)) { + logger.debug("mso.workflow.TnNssmf.enableOOFNetworkConfig is undefined, so use default value (true)") + enableOof = "true" + } + logger.debug("setEnableOofConfig: enableOof=" + enableOof) + + execution.setVariable("enableOof", enableOof) + } + String setExecVarFromJsonIfExists(DelegateExecution execution, String jsonStr, String jsonKey, String varName) { return setExecVarFromJsonStr(execution, jsonStr, jsonKey, varName, false) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy index 6ea2be8e55..b7cddd2d5a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateTnNssiTest.groovy @@ -31,9 +31,12 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types +import org.onap.so.beans.nsmf.oof.TemplateInfo import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.common.scripts.OofUtils import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertEquals import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.* @@ -166,4 +169,55 @@ class DoAllocateTnNssiTest extends MsoGroovyTest { }""" return expect.replaceAll("\\\\s+", "") } + + @Test + void testPrepareOofSelection() { + when(mockExecution.getVariable("msoRequestId")).thenReturn("10dad82d-4bd9-467a-b113-5f8ea7eaae3c") + when(mockExecution.getVariable("modelUuid")).thenReturn("e2eb2fe3-92a7-447b-8582-077db5cd0862") + when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("22e6ce80-a55f-4171-a457-a7ecb1865669") + when(mockExecution.getVariable("tnModelName")).thenReturn("Tn_ONAP_internal_BH") + when(mockExecution.getVariable("mso.adapters.oof.timeout")).thenReturn("") + TnAllocateNssi obj = spy(TnAllocateNssi.class) + OofUtils oofUtils = spy(OofUtils.class) + String requestId = "10dad82d-4bd9-467a-b113-5f8ea7eaae3c" + String nsstInfo = "\"{\"UUID\":\"e2eb2fe3-92a7-447b-8582-077db5cd0862\",\"invariantUUID\":\"22e6ce80-a55f-4171-a457-a7ecb1865669\",\"name\":\"Tn_ONAP_internal_BH\"}" + String messageType = "NSSISelectionResponse" + String sliceProfile = "{\"maxBandwidth\":3000,\"sliceProfileId\":\"ab9af40f13f721b5f13539d87484098\",\"latency\":10,\"snssaiList\":[\"001-100001\"],\"pLMNIdList\":[\"460-00\",\"460-01\"],\"perfReq\":{},\"coverageAreaTAList\":[],\"resourceSharingLevel\":\"shared\"}}" + Integer timeout = 600 + + when(oofUtils.buildSelectNSSIRequest(requestId, nsstInfo as TemplateInfo, messageType, sliceProfile, timeout)).thenReturn(""" + { + "apiPath": "/api/oof/selection/nssi/v1", + "requestDetails": "{\\"requestInfo\\":{\\"transactionId\\":\\"10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"requestId\\":\\"10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"callbackUrl\\":\\"http://so-oof-adapter.onap:8090/so/adapters/oof/callback/v1/NSSISelectionResponse/10dad82d-4bd9-467a-b113-5f8ea7eaae3c\\",\\"sourceId\\":\\"SO\\",\\"timeout\\":600,\\"numSolutions\\":1},\\"NSSTInfo\\":{\\"UUID\\":\\"e2eb2fe3-92a7-447b-8582-077db5cd0862\\",\\"invariantUUID\\":\\"22e6ce80-a55f-4171-a457-a7ecb1865669\\",\\"name\\":\\"Tn_ONAP_internal_BH\\"},\\"sliceProfile\\":{\\"maxBandwidth\\":3000,\\"sliceProfileId\\":\\"ab9af40f13f721b5f13539d87484098\\",\\"latency\\":10,\\"snssaiList\\":[\\"001-100001\\"],\\"pLMNIdList\\":[\\"460-00\\",\\"460-01\\"],\\"perfReq\\":{},\\"coverageAreaTAList\\":[],\\"resourceSharingLevel\\":\\"shared\\"}}" + }""".replaceAll("\\\\s+", "")) + obj.prepareOofSelection(mockExecution) + verify(mockExecution, times(1)).setVariable(eq("nssiSelection_oofRequest"), captor.capture()) + String nssiSelection_oofRequest = captor.getValue() + assertNotNull(nssiSelection_oofRequest) + } + + @Test + void testprocessOofSelection() { + when(mockExecution.getVariable("nssiSelection_oofRequest")).thenReturn(""" + { + "requestId": "a727643a-bf89-4fd9-b33c-b7bdda18c2b7", + "transactionId": "a727643a-bf89-4fd9-b33c-b7bdda18c2b7", + "requestStatus": "completed", + "statusMessage": "", + "solutions": [ + { + "UUID": "e2eb2fe3-92a7-447b-8582-077db5cd0862", + "invariantUUID": "22e6ce80-a55f-4171-a457-a7ecb1865669", + "NSSIName": "nssi_tnservice12", + "NSSIId": "fe26a924-3845-4001-b84e-a439a27a88c0" + } + ] + }""".replaceAll("\\\\s+", "")) + TnAllocateNssi obj = spy(TnAllocateNssi.class) + ArrayList<String> solution = new ArrayList<>() + assertEquals(1, solution.size()) + verify(mockExecution, times(1)).setVariable(eq("isOofTnNssiSelected"), captor.capture()) + String isOofTnNssiSelected = captor.getValue() + assertEquals("true", isOofTnNssiSelected) + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy index 31bd3b56f5..2bb2270928 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssiTest.groovy @@ -32,8 +32,10 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.common.scripts.OofUtils import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertTrue import static org.mockito.ArgumentMatchers.eq import static org.mockito.Mockito.* @@ -135,4 +137,41 @@ class DoDeallocateTnNssiTest extends MsoGroovyTest { obj.deleteServiceInstance(mockExecution) Mockito.verify(client, times(1)).delete(serviceInstanceUri) } + + @Test + void testPrepareOOFNssiTerminationRequest() { + when(mockExecution.getVariable("msoRequestId")).thenReturn("4c614769-f58a-4556-8ad9-dcd903077c82") + when(mockExecution.getVariable("sliceServiceInstanceId")).thenReturn("5ad89cf9-0569-4a93-9306-d8324321e2be") + when(mockExecution.getVariable("nsiId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.oof.timeout")).thenReturn("") + DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class) + OofUtils oofUtils = spy(OofUtils.class) + when(oofUtils.buildTerminateNxiRequest()).thenReturn(""" + { + "apiPath": "/api/oof/terminate/nxi/v1", + "requestDetails": "{\"type\":\"NSSI\",\"NxIId\":\"f78c1531-55a7-4dfa-8a12-1e2544c9b248\",\"requestInfo\":{\"transactionId\":\"863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"requestId\":\"863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"callbackUrl\":\"http://so-oof-adapter.onap:8090/so/adapters/oof/callback/v1/TN_NSSITermination/863fb189-33d8-455f-9d3f-bf3f6a2e4509\",\"sourceId\":\"SO\",\"timeout\":600,\"addtnlArgs\":{\"serviceInstanceId\":\"fe6f0901-292d-4493-bcad-485793605781\"}}}" + }""".replaceAll("\\\\s+", "")) + obj.prepareOOFNssiTerminationRequest(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("oofTnNssiPayload"), captor.capture()) + String oofTnNssiPayload = captor.getValue() + assertNotNull(oofTnNssiPayload) + } + + @Test + void testPerformOofNSSITerminationCall() { + when(mockExecution.getVariable("oofTnNssiPayload")).thenReturn(""" + { + "reason": "", + "requestId": "e0a026a9-dd6d-4800-ab27-0fdd8f5f64f5", + "requestStatus": "success", + "terminateResponse": true, + "transactionId": "e0a026a9-dd6d-4800-ab27-0fdd8f5f64f5" + }""".replaceAll("\\\\s+", "")) + DoDeallocateTnNssi obj = spy(DoDeallocateTnNssi.class) + when(obj.callOofAdapter()).thenReturn(true) + obj.performOofNSSITerminationCall(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("terminateTnNSSI"), captor.capture()) + String terminateTnNSSI = captor.getValue() + assertTrue(terminateTnNSSI) + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn index 85aa7c2bf5..374ce4c459 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateAccessNSSI.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_05od9yd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.0"> +<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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_05od9yd" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0"> <bpmn:process id="DoAllocateAccessNSSI" name="DoAllocateAccessNSSI" isExecutable="true"> <bpmn:startEvent id="StartEvent_1" name="Start"> <bpmn:outgoing>Flow_163f3sq</bpmn:outgoing> @@ -19,7 +19,7 @@ def nss = new DoAllocateAccessNSSI() nss.getSubnetCapabilities(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="Activity_11vdo22" name="Prepare Resource Operation Status Update" scriptFormat="groovy"> - <bpmn:incoming>Flow_1gxbsoi</bpmn:incoming> + <bpmn:incoming>Flow_0833cha</bpmn:incoming> <bpmn:outgoing>Flow_1xw4abx</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def nss = new DoAllocateAccessNSSI() @@ -50,7 +50,7 @@ nss.prepareOperationStatusUpdate(execution)</bpmn:script> <bpmn:endEvent id="Event_0vh1hs2"> <bpmn:incoming>Flow_0ll5x3u</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_0833cha" sourceRef="Event_05jtdqp" targetRef="Activity_0vf28ld" /> + <bpmn:sequenceFlow id="Flow_0833cha" sourceRef="Event_05jtdqp" targetRef="Activity_11vdo22" /> <bpmn:sequenceFlow id="Flow_1xw4abx" sourceRef="Activity_11vdo22" targetRef="Activity_1nfx154" /> <bpmn:sequenceFlow id="Flow_0ll5x3u" sourceRef="Activity_1nfx154" targetRef="Event_0vh1hs2" /> <bpmn:sequenceFlow id="Flow_1x3y2tg" sourceRef="Event_18r5xkz" targetRef="Activity_03dgcg5" /> @@ -80,7 +80,7 @@ nss.prepareTnMhRequest(execution)</bpmn:script> <bpmn:linkEventDefinition id="LinkEventDefinition_05sogjc" name="OperationStatusUpdate" /> </bpmn:intermediateCatchEvent> <bpmn:intermediateThrowEvent id="Event_0u9308h" name="Go to start operation status update"> - <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming> + <bpmn:incoming>Flow_06qv0en</bpmn:incoming> <bpmn:linkEventDefinition id="LinkEventDefinition_1o9trjv" name="OperationStatusUpdate" /> </bpmn:intermediateThrowEvent> <bpmn:intermediateCatchEvent id="Event_18r5xkz" name="start TN allocate"> @@ -432,14 +432,7 @@ nss.updateAaiWithRANInstances(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="Flow_0ikdlkf" sourceRef="Activity_118je0o" targetRef="Activity_0pa8al6" /> <bpmn:sequenceFlow id="Flow_1exjm0h" sourceRef="Activity_0pa8al6" targetRef="Gateway_1832fz7" /> - <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Event_0u9308h" /> - <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships" scriptFormat="groovy"> - <bpmn:incoming>Flow_0833cha</bpmn:incoming> - <bpmn:outgoing>Flow_1gxbsoi</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def nss = new DoAllocateAccessNSSI() -nss.updateAairelationships(execution)</bpmn:script> - </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Activity_1pjf5mm" /> <bpmn:subProcess id="Activity_0bcs8g1" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> <bpmn:startEvent id="Event_077lf7i"> <bpmn:outgoing>Flow_18rrdsq</bpmn:outgoing> @@ -510,7 +503,6 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> </bpmn:callActivity> <bpmn:sequenceFlow id="Flow_1k3vqxg" sourceRef="Activity_08i0hzk" targetRef="Activity_1aweui4" /> <bpmn:sequenceFlow id="Flow_083bb3k" sourceRef="Gateway_1cmraqs" targetRef="Activity_0fdm3in" /> - <bpmn:sequenceFlow id="Flow_1gxbsoi" sourceRef="Activity_0vf28ld" targetRef="Activity_11vdo22" /> <bpmn:intermediateThrowEvent id="Event_0lx9qhs" name="Goto start RANNF Allocate"> <bpmn:incoming>Flow_0rb4j9r</bpmn:incoming> <bpmn:linkEventDefinition id="LinkEventDefinition_0s0j5kx" name="startRANNFAllocate" /> @@ -561,11 +553,37 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmn:sequenceFlow id="Flow_1ryf352" name="No" sourceRef="Gateway_0rm6svp" targetRef="Event_0f7ueve"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("IsRANNfAlonePresent" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:scriptTask id="Activity_1pjf5mm" name="update AAI relationships" scriptFormat="groovy"> + <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming> + <bpmn:outgoing>Flow_06qv0en</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def nss = new DoAllocateAccessNSSI() +nss.updateAairelationships(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_06qv0en" sourceRef="Activity_1pjf5mm" targetRef="Event_0u9308h" /> </bpmn:process> <bpmn:message id="Message_1r7nv8u" name="WorkflowMessage" /> <bpmn:error id="Error_047rteq" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateAccessNSSI"> + <bpmndi:BPMNEdge id="Flow_1ryf352_di" bpmnElement="Flow_1ryf352"> + <di:waypoint x="1270" y="843" /> + <di:waypoint x="1270" y="865" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1278" y="851" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_15uux8j_di" bpmnElement="Flow_15uux8j"> + <di:waypoint x="1295" y="818" /> + <di:waypoint x="1392" y="818" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1335" y="800" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1tx240t_di" bpmnElement="Flow_1tx240t"> + <di:waypoint x="1140" y="818" /> + <di:waypoint x="1245" y="818" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1f0furp_di" bpmnElement="Flow_1f0furp"> <di:waypoint x="790" y="120" /> <di:waypoint x="875" y="120" /> @@ -584,14 +602,24 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="970" y="102" width="17" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_024x74t_di" bpmnElement="Flow_024x74t"> + <di:waypoint x="1350" y="1042" /> + <di:waypoint x="1350" y="1100" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1358" y="1068" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0d40k12_di" bpmnElement="Flow_0d40k12"> + <di:waypoint x="1375" y="1017" /> + <di:waypoint x="1452" y="1017" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1406" y="999" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1eo3bed_di" bpmnElement="Flow_1eo3bed"> <di:waypoint x="228" y="819" /> <di:waypoint x="300" y="819" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1gxbsoi_di" bpmnElement="Flow_1gxbsoi"> - <di:waypoint x="430" y="1440" /> - <di:waypoint x="490" y="1440" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_083bb3k_di" bpmnElement="Flow_083bb3k"> <di:waypoint x="790" y="554" /> <di:waypoint x="790" y="660" /> @@ -604,7 +632,15 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0bd6dhi_di" bpmnElement="Flow_0bd6dhi"> <di:waypoint x="1620" y="1260" /> - <di:waypoint x="1722" y="1260" /> + <di:waypoint x="1690" y="1260" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1exjm0h_di" bpmnElement="Flow_1exjm0h"> + <di:waypoint x="1300" y="1017" /> + <di:waypoint x="1325" y="1017" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0ikdlkf_di" bpmnElement="Flow_0ikdlkf"> + <di:waypoint x="1170" y="1017" /> + <di:waypoint x="1200" y="1017" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fdetmo_di" bpmnElement="Flow_0fdetmo"> <di:waypoint x="1260" y="1260" /> @@ -691,6 +727,14 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <di:waypoint x="410" y="1260" /> <di:waypoint x="480" y="1260" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_05yqmnj_di" bpmnElement="Flow_05yqmnj"> + <di:waypoint x="1030" y="1017" /> + <di:waypoint x="1070" y="1017" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1pbiznt_di" bpmnElement="Flow_1pbiznt"> + <di:waypoint x="880" y="1017" /> + <di:waypoint x="930" y="1017" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0kn30g3_di" bpmnElement="Flow_0kn30g3"> <di:waypoint x="853" y="818" /> <di:waypoint x="910" y="818" /> @@ -765,64 +809,20 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <di:waypoint x="310" y="1260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0ll5x3u_di" bpmnElement="Flow_0ll5x3u"> - <di:waypoint x="760" y="1440" /> - <di:waypoint x="862" y="1440" /> + <di:waypoint x="580" y="1440" /> + <di:waypoint x="672" y="1440" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1xw4abx_di" bpmnElement="Flow_1xw4abx"> - <di:waypoint x="590" y="1440" /> - <di:waypoint x="660" y="1440" /> + <di:waypoint x="400" y="1440" /> + <di:waypoint x="480" y="1440" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0833cha_di" bpmnElement="Flow_0833cha"> <di:waypoint x="228" y="1440" /> - <di:waypoint x="330" y="1440" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1tx240t_di" bpmnElement="Flow_1tx240t"> - <di:waypoint x="1140" y="818" /> - <di:waypoint x="1245" y="818" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_15uux8j_di" bpmnElement="Flow_15uux8j"> - <di:waypoint x="1295" y="818" /> - <di:waypoint x="1392" y="818" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1335" y="800" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0d40k12_di" bpmnElement="Flow_0d40k12"> - <di:waypoint x="1375" y="1017" /> - <di:waypoint x="1452" y="1017" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1406" y="999" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1pbiznt_di" bpmnElement="Flow_1pbiznt"> - <di:waypoint x="880" y="1017" /> - <di:waypoint x="930" y="1017" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_05yqmnj_di" bpmnElement="Flow_05yqmnj"> - <di:waypoint x="1030" y="1017" /> - <di:waypoint x="1070" y="1017" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0ikdlkf_di" bpmnElement="Flow_0ikdlkf"> - <di:waypoint x="1170" y="1017" /> - <di:waypoint x="1200" y="1017" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1exjm0h_di" bpmnElement="Flow_1exjm0h"> - <di:waypoint x="1300" y="1017" /> - <di:waypoint x="1325" y="1017" /> + <di:waypoint x="300" y="1440" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_024x74t_di" bpmnElement="Flow_024x74t"> - <di:waypoint x="1350" y="1042" /> - <di:waypoint x="1350" y="1100" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1358" y="1068" width="15" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1ryf352_di" bpmnElement="Flow_1ryf352"> - <di:waypoint x="1270" y="843" /> - <di:waypoint x="1270" y="865" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1278" y="851" width="15" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="Flow_06qv0en_di" bpmnElement="Flow_06qv0en"> + <di:waypoint x="1790" y="1260" /> + <di:waypoint x="1852" y="1260" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> <dc:Bounds x="162" y="102" width="36" height="36" /> @@ -836,15 +836,6 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_1gdi5bo_di" bpmnElement="Activity_0vhvubq"> <dc:Bounds x="1030" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_11vdo22_di" bpmnElement="Activity_11vdo22"> - <dc:Bounds x="490" y="1400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1nfx154_di" bpmnElement="Activity_1nfx154"> - <dc:Bounds x="660" y="1400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0vh1hs2_di" bpmnElement="Event_0vh1hs2"> - <dc:Bounds x="862" y="1422" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0icw8wt_di" bpmnElement="Activity_19laorl"> <dc:Bounds x="300" y="779" width="100" height="80" /> </bpmndi:BPMNShape> @@ -860,12 +851,6 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="174" y="1465" width="73" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1ea1h0i_di" bpmnElement="Event_0u9308h"> - <dc:Bounds x="1722" y="1242" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1700" y="1290" width="79" height="40" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1fj3anx_di" bpmnElement="Event_18r5xkz"> <dc:Bounds x="192" y="1242" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -893,6 +878,12 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="1220" y="397" width="79" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_15zn4zi_di" bpmnElement="Event_15zn4zi"> + <dc:Bounds x="1452" y="999" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1438" y="1042" width="67" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1pxd5wf_di" bpmnElement="Activity_1pxd5wf"> <dc:Bounds x="560" y="780" width="100" height="80" /> </bpmndi:BPMNShape> @@ -902,6 +893,12 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="799" y="765" width="62" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0a95zgv_di" bpmnElement="Activity_0a95zgv"> + <dc:Bounds x="780" y="977" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_118je0o_di" bpmnElement="Activity_118je0o"> + <dc:Bounds x="1070" y="977" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0qwruv5_di" bpmnElement="Event_0s8t1ji"> <dc:Bounds x="1572" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -929,6 +926,9 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_0y9xgkl_di" bpmnElement="Activity_0y9xgkl"> <dc:Bounds x="430" y="780" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0vbzhej_di" bpmnElement="Activity_0vbzhej"> + <dc:Bounds x="930" y="977" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0zn4e4n_di" bpmnElement="Activity_0zn4e4n"> <dc:Bounds x="1520" y="1220" width="100" height="80" /> </bpmndi:BPMNShape> @@ -938,6 +938,9 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_06hcbu6_di" bpmnElement="Activity_06hcbu6"> <dc:Bounds x="530" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1xke4xc_di" bpmnElement="Activity_1aweui4"> + <dc:Bounds x="1040" y="778" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1bjike9_di" bpmnElement="Activity_1bjike9"> <dc:Bounds x="530" y="340" width="100" height="80" /> </bpmndi:BPMNShape> @@ -980,59 +983,26 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_0qpy2sg_di" bpmnElement="Activity_0qpy2sg"> <dc:Bounds x="1160" y="1220" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1riw9uv_di" bpmnElement="Activity_0vf28ld"> - <dc:Bounds x="330" y="1400" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1cqde7p_di" bpmnElement="Event_1cqde7p"> - <dc:Bounds x="1392" y="800" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1378" y="843" width="67" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1xke4xc_di" bpmnElement="Activity_1aweui4"> - <dc:Bounds x="1040" y="778" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0rm6svp_di" bpmnElement="Gateway_0rm6svp" isMarkerVisible="true"> - <dc:Bounds x="1245" y="793" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1235" y="763" width="73" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_15zn4zi_di" bpmnElement="Event_15zn4zi"> - <dc:Bounds x="1452" y="999" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1438" y="1042" width="67" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0a95zgv_di" bpmnElement="Activity_0a95zgv"> - <dc:Bounds x="780" y="977" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_118je0o_di" bpmnElement="Activity_118je0o"> - <dc:Bounds x="1070" y="977" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0vbzhej_di" bpmnElement="Activity_0vbzhej"> - <dc:Bounds x="930" y="977" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0pa8al6_di" bpmnElement="Activity_0pa8al6"> <dc:Bounds x="1200" y="977" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1832fz7_di" bpmnElement="Gateway_1832fz7" isMarkerVisible="true"> - <dc:Bounds x="1325" y="992" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1313" y="971" width="74" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="Activity_1pjf5mm_di" bpmnElement="Activity_1pjf5mm"> + <dc:Bounds x="1690" y="1220" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_11t655f_di" bpmnElement="Event_11t655f"> - <dc:Bounds x="1332" y="1100" width="36" height="36" /> + <bpmndi:BPMNShape id="Event_1ea1h0i_di" bpmnElement="Event_0u9308h"> + <dc:Bounds x="1852" y="1242" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1310" y="1148" width="79" height="40" /> + <dc:Bounds x="1830" y="1290" width="79" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0f7ueve_di" bpmnElement="Event_0f7ueve"> - <dc:Bounds x="1252" y="865" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1230" y="913" width="79" height="40" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="Activity_11vdo22_di" bpmnElement="Activity_11vdo22"> + <dc:Bounds x="300" y="1400" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1nfx154_di" bpmnElement="Activity_1nfx154"> + <dc:Bounds x="480" y="1400" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0vh1hs2_di" bpmnElement="Event_0vh1hs2"> + <dc:Bounds x="672" y="1422" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0bcs8g1_di" bpmnElement="Activity_0bcs8g1" isExpanded="true"> <dc:Bounds x="390" y="1530" width="781" height="196" /> @@ -1068,6 +1038,12 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_0p0mwue_di" bpmnElement="Activity_0p0mwue"> <dc:Bounds x="680" y="1594" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1cqde7p_di" bpmnElement="Event_1cqde7p"> + <dc:Bounds x="1392" y="800" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1378" y="843" width="67" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_08i0hzk_di" bpmnElement="Activity_08i0hzk"> <dc:Bounds x="910" y="778" width="100" height="80" /> </bpmndi:BPMNShape> @@ -1083,6 +1059,18 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="180" y="844" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1832fz7_di" bpmnElement="Gateway_1832fz7" isMarkerVisible="true"> + <dc:Bounds x="1325" y="992" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1313" y="971" width="74" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_11t655f_di" bpmnElement="Event_11t655f"> + <dc:Bounds x="1332" y="1100" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1310" y="1148" width="79" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0qnxawk_di" bpmnElement="Gateway_0qnxawk" isMarkerVisible="true"> <dc:Bounds x="875" y="95" width="50" height="50" /> <bpmndi:BPMNLabel> @@ -1095,6 +1083,18 @@ nss.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="860" y="227" width="81" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0rm6svp_di" bpmnElement="Gateway_0rm6svp" isMarkerVisible="true"> + <dc:Bounds x="1245" y="793" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1235" y="763" width="73" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0f7ueve_di" bpmnElement="Event_0f7ueve"> + <dc:Bounds x="1252" y="865" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1230" y="913" width="79" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn index b70569b8ad..694be22517 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn @@ -1,11 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> <bpmn:process id="DoAllocateTransportNSSI" name="DoAllocateTransportNSSI" isExecutable="true"> <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Allocate TN NSSMF Work Flow"> <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing> </bpmn:startEvent> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="OOF TN NSSI Selection"> - <bpmn:outgoing>SequenceFlow_1fk37v7</bpmn:outgoing> + <bpmn:outgoing>Flow_071hnt4</bpmn:outgoing> <bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="OofTnNssiSelect" /> </bpmn:intermediateCatchEvent> <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy"> @@ -22,7 +22,7 @@ css.preProcessRequest(execution)</bpmn:script> def css = new TnAllocateNssi() css.processOofSelection(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Use Existing TN NSSI?" default="SequenceFlow_038lb9m"> + <bpmn:exclusiveGateway id="ExclusiveGateway_0elbczl" name="Use Existing TN NSSI?"> <bpmn:incoming>SequenceFlow_197cm2e</bpmn:incoming> <bpmn:outgoing>SequenceFlow_12t5exy</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_038lb9m</bpmn:outgoing> @@ -73,7 +73,7 @@ runScript.prepareUpdateJobStatus(execution,"INPROGRESS","10","Allocate TN NSSI s </bpmn:scriptTask> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection"> <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming> - <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="TnAllocateNssi" /> + <bpmn:linkEventDefinition id="LinkEventDefinition_0de65en" name="OofTnNssiSelect" /> </bpmn:intermediateThrowEvent> <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0kixzdj</bpmn:incoming> @@ -102,7 +102,7 @@ def runScript = new TnAllocateNssi() runScript.prepareDecomposeService(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_08wim95" name="Prepare OOF TN NSSI Selection" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1fk37v7</bpmn:incoming> + <bpmn:incoming>Flow_0nu9t8e</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0h2oree</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def css = new TnAllocateNssi() @@ -117,7 +117,7 @@ css.prepareOofSelection(execution)</bpmn:script> <bpmn:linkEventDefinition id="LinkEventDefinition_16f2ri9" name="TnAllocateNssi" /> </bpmn:intermediateThrowEvent> <bpmn:endEvent id="EndEvent_1oouvuh" name="End"> - <bpmn:incoming>Flow_0pbq5q0</bpmn:incoming> + <bpmn:incoming>Flow_13ikwvr</bpmn:incoming> </bpmn:endEvent> <bpmn:callActivity id="CallActivity_0cxst1i" name="Call DoCreateTnNssiInstance " calledElement="DoCreateTnNssiInstance"> <bpmn:extensionElements> @@ -146,9 +146,11 @@ css.prepareOofSelection(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_1cv0wop" sourceRef="Activity_187hs2t" targetRef="ScriptTask_1jgtb0y" /> <bpmn:sequenceFlow id="SequenceFlow_197cm2e" sourceRef="ScriptTask_1jgtb0y" targetRef="ExclusiveGateway_0elbczl" /> <bpmn:sequenceFlow id="SequenceFlow_12t5exy" name="No" sourceRef="ExclusiveGateway_0elbczl" targetRef="IntermediateThrowEvent_0ktwpki"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isOofTnNssiSelected") == false)}</bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isOofTnNssiSelected") == false}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="Yes" sourceRef="ExclusiveGateway_0elbczl" targetRef="Activity_07jtiau"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isOofTnNssiSelected") == true}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_038lb9m" name="Yes" sourceRef="ExclusiveGateway_0elbczl" targetRef="Activity_1mh10j4" /> <bpmn:sequenceFlow id="SequenceFlow_1t19ips" sourceRef="CallActivity_1bnkmaz" targetRef="ScriptTask_0l3d1ai" /> <bpmn:sequenceFlow id="SequenceFlow_0mlrlbv" sourceRef="CallActivity_0cxst1i" targetRef="ExclusiveGateway_18eld2o" /> <bpmn:sequenceFlow id="SequenceFlow_1c6ka9h" name="No" sourceRef="ExclusiveGateway_18eld2o" targetRef="EndEvent_0x406rw" /> @@ -160,7 +162,6 @@ css.prepareOofSelection(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_0q7yc2c" sourceRef="ScriptTask_0o2r07o" targetRef="CallActivity_1bnkmaz" /> <bpmn:sequenceFlow id="SequenceFlow_0h2oree" sourceRef="ScriptTask_08wim95" targetRef="Activity_187hs2t" /> <bpmn:sequenceFlow id="SequenceFlow_1bevt3a" sourceRef="IntermediateCatchEvent_0pkvfun" targetRef="CallActivity_0cxst1i" /> - <bpmn:sequenceFlow id="SequenceFlow_1fk37v7" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_08wim95" /> <bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" /> <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming> @@ -171,14 +172,6 @@ def runScript = new TnAllocateNssi() runScript.updateAAIOrchStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" /> - <bpmn:scriptTask id="Activity_1mh10j4" name="Prepare Update Resource Oper Status(finish)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming> - <bpmn:outgoing>Flow_1853sgs</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def runScript = new TnAllocateNssi() -runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI successfully")</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="Flow_1853sgs" sourceRef="Activity_1mh10j4" targetRef="Activity_124z7q2" /> <bpmn:callActivity id="Activity_187hs2t" name="Handle TN NSSI Selection OOF request" calledElement="DoHandleOofRequest"> <bpmn:extensionElements> <camunda:in source="nssiSelection_Url" target="apiPath" /> @@ -192,29 +185,6 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <bpmn:incoming>SequenceFlow_0h2oree</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1cv0wop</bpmn:outgoing> </bpmn:callActivity> - <bpmn:serviceTask id="Activity_124z7q2" name="Update Resource Operation Status"> - <bpmn:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${updateResourceOperationStatus}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="NSSMF_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="NSSMF_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn:extensionElements> - <bpmn:incoming>Flow_1853sgs</bpmn:incoming> - <bpmn:outgoing>Flow_0pbq5q0</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0pbq5q0" sourceRef="Activity_124z7q2" targetRef="EndEvent_1oouvuh" /> <bpmn:serviceTask id="Activity_14an583" name="Update Resource Operation Status"> <bpmn:extensionElements> <camunda:connector> @@ -261,12 +231,125 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <bpmn:outgoing>Flow_06rrcwf</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_06rrcwf" sourceRef="Activity_1xko5pk" targetRef="EndEvent_05h01gx" /> + <bpmn:exclusiveGateway id="Gateway_08t9sts" name="Enable OOF?"> + <bpmn:incoming>Flow_071hnt4</bpmn:incoming> + <bpmn:outgoing>Flow_0nu9t8e</bpmn:outgoing> + <bpmn:outgoing>Flow_0tz6v1f</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0nu9t8e" name="yes" sourceRef="Gateway_08t9sts" targetRef="ScriptTask_08wim95"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("enableOof") == true}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_071hnt4" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="Gateway_08t9sts" /> + <bpmn:sequenceFlow id="Flow_0tz6v1f" name="No" sourceRef="Gateway_08t9sts" targetRef="Event_0uq2hsq" /> + <bpmn:intermediateThrowEvent id="Event_0uq2hsq" name="Goto Allocate TN NSSI"> + <bpmn:incoming>Flow_0tz6v1f</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_0xfqvfe" name="TnAllocateNssi" /> + </bpmn:intermediateThrowEvent> + <bpmn:scriptTask id="Activity_07jtiau" name="prepare Modify Tn NSSI inputs" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_038lb9m</bpmn:incoming> + <bpmn:outgoing>Flow_10etjmr</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new TnAllocateNssi() +css.prepareModifyTnNssiInputs(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Activity_1mw6mcq" name="call DoModifyTransportNSSI" calledElement="DoModifyTransportNSSI"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="TnServiceInstanceId" target="serviceInstanceID" /> + <camunda:in source="nsiId" target="nsiId" /> + <camunda:in source="networkType" target="networkType" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" /> + <camunda:in source="modifyTnNssiJobId" target="jobId" /> + <camunda:in source="modifySliceParams" target="sliceParams" /> + <camunda:in source="servicename" target="servicename" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" /> + <camunda:in source="modelUuid" target="modelUuid" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="transportSliceNetworks" target="transportSliceNetworks" /> + </bpmn:extensionElements> + <bpmn:incoming>Flow_10etjmr</bpmn:incoming> + <bpmn:outgoing>Flow_01bdm61</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="Activity_0wllwek" name="prepare query job status" scriptFormat="groovy"> + <bpmn:incoming>Flow_01bdm61</bpmn:incoming> + <bpmn:outgoing>Flow_0tvh0t6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new TnAllocateNssi() +css.createModifyNssiQueryJobStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_10etjmr" sourceRef="Activity_07jtiau" targetRef="Activity_1mw6mcq" /> + <bpmn:sequenceFlow id="Flow_01bdm61" sourceRef="Activity_1mw6mcq" targetRef="Activity_0wllwek" /> + <bpmn:callActivity id="Activity_0wx2ah5" name="Query Job status" calledElement="QueryJobStatus"> + <bpmn:extensionElements> + <camunda:in source="serviceInfo" target="serviceInfo" /> + <camunda:in source="modifyTnNssiJobId" target="jobId" /> + <camunda:in source="responseId" target="responseId" /> + <camunda:in source="job_timeout" target="timeout" /> + <camunda:out source="responseDescriptor" target="jobResponse" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="esrInfo" target="esrInfo" /> + </bpmn:extensionElements> + <bpmn:incoming>Flow_0tvh0t6</bpmn:incoming> + <bpmn:outgoing>Flow_0rt0mvl</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="Flow_0tvh0t6" sourceRef="Activity_0wllwek" targetRef="Activity_0wx2ah5" /> + <bpmn:scriptTask id="Activity_1hhcncj" name="process Job status response" scriptFormat="groovy"> + <bpmn:incoming>Flow_0rt0mvl</bpmn:incoming> + <bpmn:outgoing>Flow_13ikwvr</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def css = new TnAllocateNssi() +css.processModifyJobStatusRsp(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_0rt0mvl" sourceRef="Activity_0wx2ah5" targetRef="Activity_1hhcncj" /> + <bpmn:sequenceFlow id="Flow_13ikwvr" sourceRef="Activity_1hhcncj" targetRef="EndEvent_1oouvuh" /> </bpmn:process> <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" /> <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateTransportNSSI"> + <bpmndi:BPMNEdge id="Flow_13ikwvr_di" bpmnElement="Flow_13ikwvr"> + <di:waypoint x="1380" y="490" /> + <di:waypoint x="1452" y="490" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0rt0mvl_di" bpmnElement="Flow_0rt0mvl"> + <di:waypoint x="1240" y="490" /> + <di:waypoint x="1280" y="490" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0tvh0t6_di" bpmnElement="Flow_0tvh0t6"> + <di:waypoint x="1110" y="490" /> + <di:waypoint x="1140" y="490" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_01bdm61_di" bpmnElement="Flow_01bdm61"> + <di:waypoint x="960" y="490" /> + <di:waypoint x="1010" y="490" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_10etjmr_di" bpmnElement="Flow_10etjmr"> + <di:waypoint x="800" y="490" /> + <di:waypoint x="860" y="490" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0tz6v1f_di" bpmnElement="Flow_0tz6v1f"> + <di:waypoint x="320" y="355" /> + <di:waypoint x="320" y="440" /> + <di:waypoint x="342" y="440" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="328" y="395" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_071hnt4_di" bpmnElement="Flow_071hnt4"> + <di:waypoint x="214" y="330" /> + <di:waypoint x="295" y="330" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0nu9t8e_di" bpmnElement="Flow_0nu9t8e"> + <di:waypoint x="345" y="330" /> + <di:waypoint x="463" y="330" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="395" y="312" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_06rrcwf_di" bpmnElement="Flow_06rrcwf"> <di:waypoint x="1140" y="680" /> <di:waypoint x="1252" y="680" /> @@ -275,14 +358,6 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <di:waypoint x="750" y="121" /> <di:waypoint x="850" y="121" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0pbq5q0_di" bpmnElement="Flow_0pbq5q0"> - <di:waypoint x="1460" y="500" /> - <di:waypoint x="1562" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1853sgs_di" bpmnElement="Flow_1853sgs"> - <di:waypoint x="1270" y="500" /> - <di:waypoint x="1360" y="500" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj"> <di:waypoint x="770" y="680" /> <di:waypoint x="860" y="680" /> @@ -291,17 +366,13 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <di:waypoint x="1420" y="121" /> <di:waypoint x="1532" y="121" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7"> - <di:waypoint x="214" y="330" /> - <di:waypoint x="320" y="330" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a"> <di:waypoint x="228" y="680" /> <di:waypoint x="320" y="680" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree"> - <di:waypoint x="420" y="330" /> - <di:waypoint x="540" y="330" /> + <di:waypoint x="563" y="330" /> + <di:waypoint x="630" y="330" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c"> <di:waypoint x="950" y="121" /> @@ -338,26 +409,27 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <di:waypoint x="1320" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m"> - <di:waypoint x="1090" y="355" /> - <di:waypoint x="1090" y="500" /> - <di:waypoint x="1170" y="500" /> + <di:waypoint x="970" y="355" /> + <di:waypoint x="970" y="400" /> + <di:waypoint x="740" y="400" /> + <di:waypoint x="740" y="450" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1100" y="413" width="19" height="14" /> + <dc:Bounds x="981" y="368" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy"> - <di:waypoint x="1115" y="330" /> - <di:waypoint x="1292" y="330" /> + <di:waypoint x="995" y="330" /> + <di:waypoint x="1092" y="330" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1183" y="313" width="14" height="14" /> + <dc:Bounds x="1029" y="313" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e"> <di:waypoint x="890" y="330" /> - <di:waypoint x="1065" y="330" /> + <di:waypoint x="945" y="330" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop"> - <di:waypoint x="640" y="330" /> + <di:waypoint x="730" y="330" /> <di:waypoint x="790" y="330" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt"> @@ -387,9 +459,9 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <dc:Bounds x="790" y="290" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true"> - <dc:Bounds x="1065" y="305" width="50" height="50" /> + <dc:Bounds x="945" y="305" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1050" y="276" width="79" height="27" /> + <dc:Bounds x="930" y="276" width="79" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai"> @@ -404,6 +476,15 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw"> <dc:Bounds x="495" y="762" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh"> + <dc:Bounds x="1452" y="472" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1460" y="515" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wllwek_di" bpmnElement="Activity_0wllwek"> + <dc:Bounds x="1010" y="450" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true"> <dc:Bounds x="685" y="1080" width="781" height="196" /> </bpmndi:BPMNShape> @@ -449,7 +530,7 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <dc:Bounds x="850" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_08wim95_di" bpmnElement="ScriptTask_08wim95"> - <dc:Bounds x="320" y="290" width="100" height="80" /> + <dc:Bounds x="463" y="290" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun"> <dc:Bounds x="192" y="662" width="36" height="36" /> @@ -458,15 +539,9 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0ktwpki_di" bpmnElement="IntermediateThrowEvent_0ktwpki"> - <dc:Bounds x="1292" y="312" width="36" height="36" /> + <dc:Bounds x="1092" y="312" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1280" y="353" width="84" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1oouvuh_di" bpmnElement="EndEvent_1oouvuh"> - <dc:Bounds x="1562" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1570" y="525" width="20" height="14" /> + <dc:Bounds x="1080" y="353" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0cxst1i_di" bpmnElement="CallActivity_0cxst1i"> @@ -475,14 +550,8 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8"> <dc:Bounds x="670" y="640" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1mh10j4_di" bpmnElement="Activity_1mh10j4"> - <dc:Bounds x="1170" y="460" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_187hs2t_di" bpmnElement="Activity_187hs2t"> - <dc:Bounds x="540" y="290" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_124z7q2_di" bpmnElement="Activity_124z7q2"> - <dc:Bounds x="1360" y="460" width="100" height="80" /> + <dc:Bounds x="630" y="290" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_14an583_di" bpmnElement="Activity_14an583"> <dc:Bounds x="650" y="81" width="100" height="80" /> @@ -490,6 +559,30 @@ runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI s <bpmndi:BPMNShape id="Activity_1xko5pk_di" bpmnElement="Activity_1xko5pk"> <dc:Bounds x="1040" y="640" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_08t9sts_di" bpmnElement="Gateway_08t9sts" isMarkerVisible="true"> + <dc:Bounds x="295" y="305" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="290" y="275" width="68" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0ltl0tk_di" bpmnElement="Event_0uq2hsq"> + <dc:Bounds x="342" y="422" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="318" y="465" width="84" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_07jtiau_di" bpmnElement="Activity_07jtiau"> + <dc:Bounds x="700" y="450" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1mw6mcq_di" bpmnElement="Activity_1mw6mcq"> + <dc:Bounds x="860" y="450" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0wx2ah5_di" bpmnElement="Activity_0wx2ah5"> + <dc:Bounds x="1140" y="450" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1hhcncj_di" bpmnElement="Activity_1hhcncj"> + <dc:Bounds x="1280" y="450" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn index ae81364f90..15aa7e1eb5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_17amn3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.10.0"> +<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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_17amn3o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0"> <bpmn:process id="DoDeallocateAccessNSSI" name="DoDeallocateAccessNSSI" isExecutable="true"> <bpmn:startEvent id="Event_0seox25" name="Start"> <bpmn:outgoing>Flow_14g5p2j</bpmn:outgoing> @@ -623,13 +623,14 @@ deallocator.deleteRanNfSliceProfileInAAI(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="Activity_03zg1pp" name="Delete TN Slice profiles" scriptFormat="groovy"> <bpmn:incoming>Flow_12wqmdr</bpmn:incoming> - <bpmn:outgoing>Flow_15ok12u</bpmn:outgoing> + <bpmn:outgoing>Flow_0kuminm</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def deallocator = new DoDeAllocateAccessNSSI() deallocator.deleteTNSliceProfileInAAI(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="Activity_1ri9jrn" name="Delete RAN NSSI" scriptFormat="groovy"> - <bpmn:incoming>Flow_183aijy</bpmn:incoming> + <bpmn:incoming>Flow_0kuminm</bpmn:incoming> + <bpmn:incoming>Flow_0e6ug2u</bpmn:incoming> <bpmn:outgoing>Flow_1nh3x4j</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def deallocator = new DoDeAllocateAccessNSSI() @@ -693,23 +694,53 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <bpmn:exclusiveGateway id="Gateway_11aiy0x" name="Is TN present?" default="Flow_12wqmdr"> <bpmn:incoming>Flow_0412ven</bpmn:incoming> <bpmn:outgoing>Flow_12wqmdr</bpmn:outgoing> - <bpmn:outgoing>Flow_0r8ldai</bpmn:outgoing> + <bpmn:outgoing>Flow_0e6ug2u</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_12wqmdr" name="Yes" sourceRef="Gateway_11aiy0x" targetRef="Activity_03zg1pp" /> - <bpmn:sequenceFlow id="Flow_0r8ldai" name="No" sourceRef="Gateway_11aiy0x" targetRef="Gateway_187nc60"> + <bpmn:sequenceFlow id="Flow_0kuminm" sourceRef="Activity_03zg1pp" targetRef="Activity_1ri9jrn" /> + <bpmn:sequenceFlow id="Flow_0e6ug2u" sourceRef="Gateway_11aiy0x" targetRef="Activity_1ri9jrn"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("IsRANNfAlonePresent" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_183aijy" sourceRef="Gateway_187nc60" targetRef="Activity_1ri9jrn" /> - <bpmn:parallelGateway id="Gateway_187nc60"> - <bpmn:incoming>Flow_0r8ldai</bpmn:incoming> - <bpmn:incoming>Flow_15ok12u</bpmn:incoming> - <bpmn:outgoing>Flow_183aijy</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:sequenceFlow id="Flow_15ok12u" sourceRef="Activity_03zg1pp" targetRef="Gateway_187nc60" /> </bpmn:process> <bpmn:error id="Error_0i5gql0" name="DeallocateWorkflowError" errorCode="2500" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateAccessNSSI"> + <bpmndi:BPMNEdge id="Flow_12wqmdr_di" bpmnElement="Flow_12wqmdr"> + <di:waypoint x="460" y="1135" /> + <di:waypoint x="460" y="1260" /> + <di:waypoint x="570" y="1260" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="466" y="1199" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1scubfn_di" bpmnElement="Flow_1scubfn"> + <di:waypoint x="2460" y="435" /> + <di:waypoint x="2460" y="482" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2468" y="456" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_01ssl7f_di" bpmnElement="Flow_01ssl7f"> + <di:waypoint x="2485" y="410" /> + <di:waypoint x="2552" y="410" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2510" y="392" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1yewqtt_di" bpmnElement="Flow_1yewqtt"> + <di:waypoint x="2260" y="265" /> + <di:waypoint x="2260" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2268" y="271" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0b3qqvw_di" bpmnElement="Flow_0b3qqvw"> + <di:waypoint x="2285" y="240" /> + <di:waypoint x="2362" y="240" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2315" y="222" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0x71rer_di" bpmnElement="Flow_0x71rer"> <di:waypoint x="1275" y="650" /> <di:waypoint x="1320" y="650" /> @@ -976,58 +1007,15 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <di:waypoint x="238" y="410" /> <di:waypoint x="290" y="410" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0b3qqvw_di" bpmnElement="Flow_0b3qqvw"> - <di:waypoint x="2285" y="240" /> - <di:waypoint x="2362" y="240" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2315" y="222" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1yewqtt_di" bpmnElement="Flow_1yewqtt"> - <di:waypoint x="2260" y="265" /> - <di:waypoint x="2260" y="282" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2268" y="271" width="15" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_01ssl7f_di" bpmnElement="Flow_01ssl7f"> - <di:waypoint x="2485" y="410" /> - <di:waypoint x="2552" y="410" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2510" y="392" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1scubfn_di" bpmnElement="Flow_1scubfn"> - <di:waypoint x="2460" y="435" /> - <di:waypoint x="2460" y="482" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2468" y="456" width="15" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_12wqmdr_di" bpmnElement="Flow_12wqmdr"> - <di:waypoint x="460" y="1135" /> - <di:waypoint x="460" y="1260" /> - <di:waypoint x="520" y="1260" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="466" y="1199" width="18" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="Flow_0kuminm_di" bpmnElement="Flow_0kuminm"> + <di:waypoint x="670" y="1260" /> + <di:waypoint x="790" y="1260" /> + <di:waypoint x="790" y="1150" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0r8ldai_di" bpmnElement="Flow_0r8ldai"> + <bpmndi:BPMNEdge id="Flow_0e6ug2u_di" bpmnElement="Flow_0e6ug2u"> <di:waypoint x="485" y="1110" /> - <di:waypoint x="655" y="1110" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="589" y="1092" width="15" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_183aijy_di" bpmnElement="Flow_183aijy"> - <di:waypoint x="705" y="1110" /> <di:waypoint x="740" y="1110" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_15ok12u_di" bpmnElement="Flow_15ok12u"> - <di:waypoint x="620" y="1260" /> - <di:waypoint x="680" y="1260" /> - <di:waypoint x="680" y="1135" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_0seox25_di" bpmnElement="Event_0seox25"> <dc:Bounds x="202" y="392" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -1046,6 +1034,12 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <bpmndi:BPMNShape id="Gateway_1ypyzn3_di" bpmnElement="Gateway_1ypyzn3" isMarkerVisible="true"> <dc:Bounds x="1265" y="385" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1dvx4n9_di" bpmnElement="Event_0vthuwp"> + <dc:Bounds x="2552" y="392" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2530" y="438" width="81" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1ekryu8_di" bpmnElement="Event_0opsm2p"> <dc:Bounds x="202" y="862" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -1067,6 +1061,12 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_1h4jup8_di" bpmnElement="Activity_0gzrekf"> <dc:Bounds x="1100" y="370" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_18fpd51_di" bpmnElement="Event_18fpd51"> + <dc:Bounds x="2362" y="222" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2340" y="268" width="81" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0m43umg_di" bpmnElement="Activity_1v1ra2k"> <dc:Bounds x="2280" y="370" width="100" height="80" /> </bpmndi:BPMNShape> @@ -1112,59 +1112,8 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_1i9b3oi_di" bpmnElement="Activity_114fx71"> <dc:Bounds x="1330" y="840" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_18fpd51_di" bpmnElement="Event_18fpd51"> - <dc:Bounds x="2362" y="222" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2340" y="268" width="81" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1dvx4n9_di" bpmnElement="Event_0vthuwp"> - <dc:Bounds x="2552" y="392" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2530" y="438" width="81" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0jjou51_di" bpmnElement="Gateway_0jjou51" isMarkerVisible="true"> - <dc:Bounds x="2235" y="215" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2224" y="185" width="73" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_05q1nj2_di" bpmnElement="Event_05q1nj2"> - <dc:Bounds x="2242" y="282" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2218" y="328" width="90" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0qsknv5_di" bpmnElement="Gateway_0qsknv5" isMarkerVisible="true"> - <dc:Bounds x="2435" y="385" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2423" y="361" width="73" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0y39bzp_di" bpmnElement="Event_0y39bzp"> - <dc:Bounds x="2442" y="482" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2418" y="528" width="90" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0r4899a_di" bpmnElement="Activity_0qho4pw"> - <dc:Bounds x="290" y="1070" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_11aiy0x_di" bpmnElement="Gateway_11aiy0x" isMarkerVisible="true"> - <dc:Bounds x="435" y="1085" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="424" y="1055" width="73" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0b0pl0x_di" bpmnElement="Activity_03zg1pp"> - <dc:Bounds x="520" y="1220" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0dreslj_di" bpmnElement="Activity_1ri9jrn"> - <dc:Bounds x="740" y="1070" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_10923hr_di" bpmnElement="Gateway_187nc60"> - <dc:Bounds x="655" y="1085" width="50" height="50" /> + <dc:Bounds x="570" y="1220" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0qbd3cz_di" bpmnElement="Activity_0qbd3cz" isExpanded="true"> <dc:Bounds x="820" y="1310" width="770" height="170" /> @@ -1331,6 +1280,12 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <dc:Bounds x="189" y="1135" width="62" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0r4899a_di" bpmnElement="Activity_0qho4pw"> + <dc:Bounds x="290" y="1070" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0dreslj_di" bpmnElement="Activity_1ri9jrn"> + <dc:Bounds x="740" y="1070" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_01s2lve_di" bpmnElement="Activity_0umktii"> <dc:Bounds x="1400" y="200" width="100" height="80" /> </bpmndi:BPMNShape> @@ -1343,6 +1298,36 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <bpmndi:BPMNShape id="Event_1m6hsxq_di" bpmnElement="Event_161u9s2"> <dc:Bounds x="1822" y="82" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0jjou51_di" bpmnElement="Gateway_0jjou51" isMarkerVisible="true"> + <dc:Bounds x="2235" y="215" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2224" y="185" width="73" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_05q1nj2_di" bpmnElement="Event_05q1nj2"> + <dc:Bounds x="2242" y="282" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2218" y="328" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0qsknv5_di" bpmnElement="Gateway_0qsknv5" isMarkerVisible="true"> + <dc:Bounds x="2435" y="385" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2423" y="361" width="73" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0y39bzp_di" bpmnElement="Event_0y39bzp"> + <dc:Bounds x="2442" y="482" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2418" y="528" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_11aiy0x_di" bpmnElement="Gateway_11aiy0x" isMarkerVisible="true"> + <dc:Bounds x="435" y="1085" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="423.5" y="1061" width="73" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn index 1dd362bf4b..48978500e3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.9.0"> <bpmn:process id="DoDeallocateTransportNSSI" name="DoDeallocateTransportNSSI" isExecutable="true"> <bpmn:startEvent id="StartEvent_1nbljfd" name="Create Deallocate TN NSSMF Work Flow"> <bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing> @@ -26,7 +26,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:incoming>Flow_0ca4l8d</bpmn:incoming> </bpmn:endEvent> <bpmn:scriptTask id="ScriptTask_1ssh2l9" name="Prepare Update Resource Oper Status((finish)" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming> + <bpmn:incoming>Flow_14tkuoh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoDeallocateTnNssi() @@ -69,7 +69,7 @@ runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script> <bpmn:scriptTask id="Activity_013rjwc" name="Delete Service Instance (TN NSSI) in AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming> <bpmn:incoming>Flow_0dirb5b</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jygjln</bpmn:outgoing> + <bpmn:outgoing>Flow_14pzrs9</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoDeallocateTnNssi() runScript.deleteServiceInstance(execution)</bpmn:script> @@ -77,13 +77,11 @@ runScript.deleteServiceInstance(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_1jdb2oq" sourceRef="Activity_0phv8e5" targetRef="Activity_013rjwc" /> <bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_03s744c</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_07e12rt</bpmn:outgoing> + <bpmn:outgoing>Flow_1xxj5g6</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoDeallocateTnNssi() runScript.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_1spi9lo" /> - <bpmn:sequenceFlow id="SequenceFlow_1jygjln" sourceRef="Activity_013rjwc" targetRef="ScriptTask_1ssh2l9" /> <bpmn:serviceTask id="Activity_0rgeefb" name="Update Resource Operation Status"> <bpmn:extensionElements> <camunda:connector> @@ -108,7 +106,7 @@ runScript.preProcessRequest(execution)</bpmn:script> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_0ca4l8d" sourceRef="Activity_0rgeefb" targetRef="EndEvent_05h01gx" /> <bpmn:exclusiveGateway id="Gateway_1spi9lo" name="Enable SDNC?"> - <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming> + <bpmn:incoming>Flow_08so17j</bpmn:incoming> <bpmn:outgoing>Flow_0sj0mtu</bpmn:outgoing> <bpmn:outgoing>Flow_0dirb5b</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -116,119 +114,281 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_0dirb5b" name="No" sourceRef="Gateway_1spi9lo" targetRef="Activity_013rjwc" /> + <bpmn:exclusiveGateway id="Gateway_0evcwr8" name="Enable OOF?" default="Flow_0buil9w"> + <bpmn:incoming>Flow_1xxj5g6</bpmn:incoming> + <bpmn:outgoing>Flow_0elnhnt</bpmn:outgoing> + <bpmn:outgoing>Flow_0buil9w</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:exclusiveGateway id="Gateway_0m3yrzp" name="Terminate Tn NSSI?" default="Flow_1oxjcb2"> + <bpmn:incoming>Flow_18xmkvl</bpmn:incoming> + <bpmn:outgoing>Flow_1oxjcb2</bpmn:outgoing> + <bpmn:outgoing>Flow_083usqs</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_1xxj5g6" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_0evcwr8" /> + <bpmn:scriptTask id="Activity_0tw406b" name="Prepare OOF Terminate TN NSSI" scriptFormat="groovy"> + <bpmn:incoming>Flow_0elnhnt</bpmn:incoming> + <bpmn:outgoing>Flow_1yadxwl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def deallocator = new DoDeallocateTnNssi() +deallocator.prepareOOFNssiTerminationRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Activity_0ztykbe" name="Call OOF flow for TN termination" scriptFormat="groovy"> + <bpmn:incoming>Flow_1yadxwl</bpmn:incoming> + <bpmn:outgoing>Flow_18xmkvl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def deallocator = new DoDeallocateTnNssi() +deallocator.performOofNSSITerminationCall(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_0elnhnt" name="Yes" sourceRef="Gateway_0evcwr8" targetRef="Activity_0tw406b"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("enableOof") == true}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1yadxwl" sourceRef="Activity_0tw406b" targetRef="Activity_0ztykbe" /> + <bpmn:intermediateCatchEvent id="Event_0ypmuow" name="Start operation status update"> + <bpmn:outgoing>Flow_14tkuoh</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_0sxzf9o" name="OperationStatusUpdate" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="Flow_14tkuoh" sourceRef="Event_0ypmuow" targetRef="ScriptTask_1ssh2l9" /> + <bpmn:intermediateThrowEvent id="Event_0c3sko9" name="Go to start operation status update"> + <bpmn:incoming>Flow_14pzrs9</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1qixrye" name="OperationStatusUpdate" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="Flow_14pzrs9" sourceRef="Activity_013rjwc" targetRef="Event_0c3sko9" /> + <bpmn:intermediateThrowEvent id="Event_0l28lqi" name="Go to start operation status update"> + <bpmn:incoming>Flow_1oxjcb2</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_0rexbo3" name="OperationStatusUpdate" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="Flow_18xmkvl" sourceRef="Activity_0ztykbe" targetRef="Gateway_0m3yrzp" /> + <bpmn:sequenceFlow id="Flow_1oxjcb2" name="No" sourceRef="Gateway_0m3yrzp" targetRef="Event_0l28lqi" /> + <bpmn:intermediateThrowEvent id="Event_01bin3l" name="Go to deallocate TN nssi"> + <bpmn:incoming>Flow_083usqs</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_1tnxmki" name="DeAllocateTnNSSI" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="Flow_083usqs" name="Yes" sourceRef="Gateway_0m3yrzp" targetRef="Event_01bin3l"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("terminateTnNSSI") == true}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:intermediateCatchEvent id="Event_0a5fzwt" name="Start deallocate TN nssi"> + <bpmn:outgoing>Flow_08so17j</bpmn:outgoing> + <bpmn:linkEventDefinition id="LinkEventDefinition_11dpw4b" name="DeAllocateTnNSSI" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="Flow_08so17j" sourceRef="Event_0a5fzwt" targetRef="Gateway_1spi9lo" /> + <bpmn:intermediateThrowEvent id="Event_06m6kud" name="Go to deallocate TN nssi"> + <bpmn:incoming>Flow_0buil9w</bpmn:incoming> + <bpmn:linkEventDefinition id="LinkEventDefinition_02jveqm" name="DeAllocateTnNSSI" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="Flow_0buil9w" name="No" sourceRef="Gateway_0evcwr8" targetRef="Event_06m6kud" /> </bpmn:process> <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" /> <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateTransportNSSI"> - <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d"> - <di:waypoint x="1030" y="410" /> - <di:waypoint x="1152" y="410" /> + <bpmndi:BPMNEdge id="Flow_0dirb5b_di" bpmnElement="Flow_0dirb5b"> + <di:waypoint x="350" y="496" /> + <di:waypoint x="350" y="680" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="353" y="511" width="15" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln"> - <di:waypoint x="530" y="410" /> - <di:waypoint x="660" y="410" /> + <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu"> + <di:waypoint x="375" y="471" /> + <di:waypoint x="439" y="471" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="400" y="453" width="18" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt"> - <di:waypoint x="385" y="121" /> - <di:waypoint x="455" y="121" /> + <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d"> + <di:waypoint x="570" y="910" /> + <di:waypoint x="662" y="910" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq"> - <di:waypoint x="1130" y="121" /> - <di:waypoint x="1220" y="121" /> - <di:waypoint x="1220" y="260" /> - <di:waypoint x="480" y="260" /> - <di:waypoint x="480" y="370" /> + <di:waypoint x="1000" y="471" /> + <di:waypoint x="1090" y="471" /> + <di:waypoint x="1090" y="610" /> + <di:waypoint x="350" y="610" /> + <di:waypoint x="350" y="680" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs"> - <di:waypoint x="910" y="121" /> - <di:waypoint x="1009" y="121" /> + <di:waypoint x="780" y="471" /> + <di:waypoint x="879" y="471" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye"> - <di:waypoint x="690" y="121" /> - <di:waypoint x="789" y="121" /> + <di:waypoint x="560" y="471" /> + <di:waypoint x="659" y="471" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> - <di:waypoint x="760" y="410" /> - <di:waypoint x="930" y="410" /> + <di:waypoint x="400" y="910" /> + <di:waypoint x="470" y="910" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c"> - <di:waypoint x="214" y="121" /> - <di:waypoint x="285" y="121" /> + <di:waypoint x="208" y="140" /> + <di:waypoint x="280" y="140" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu"> - <di:waypoint x="505" y="121" /> - <di:waypoint x="569" y="121" /> + <bpmndi:BPMNEdge id="Flow_1xxj5g6_di" bpmnElement="Flow_1xxj5g6"> + <di:waypoint x="380" y="140" /> + <di:waypoint x="445" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0elnhnt_di" bpmnElement="Flow_0elnhnt"> + <di:waypoint x="495" y="140" /> + <di:waypoint x="570" y="140" /> <bpmndi:BPMNLabel> - <dc:Bounds x="529" y="103" width="19" height="14" /> + <dc:Bounds x="524" y="122" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0dirb5b_di" bpmnElement="Flow_0dirb5b"> - <di:waypoint x="480" y="146" /> - <di:waypoint x="480" y="370" /> + <bpmndi:BPMNEdge id="Flow_1yadxwl_di" bpmnElement="Flow_1yadxwl"> + <di:waypoint x="670" y="140" /> + <di:waypoint x="750" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_14tkuoh_di" bpmnElement="Flow_14tkuoh"> + <di:waypoint x="208" y="910" /> + <di:waypoint x="300" y="910" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_14pzrs9_di" bpmnElement="Flow_14pzrs9"> + <di:waypoint x="400" y="720" /> + <di:waypoint x="502" y="720" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_18xmkvl_di" bpmnElement="Flow_18xmkvl"> + <di:waypoint x="850" y="140" /> + <di:waypoint x="921" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1oxjcb2_di" bpmnElement="Flow_1oxjcb2"> + <di:waypoint x="946" y="165" /> + <di:waypoint x="946" y="260" /> + <di:waypoint x="1062" y="260" /> <bpmndi:BPMNLabel> - <dc:Bounds x="483" y="166" width="14" height="14" /> + <dc:Bounds x="954" y="210" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd"> - <dc:Bounds x="178" y="103" width="36" height="36" /> + <bpmndi:BPMNEdge id="Flow_083usqs_di" bpmnElement="Flow_083usqs"> + <di:waypoint x="971" y="140" /> + <di:waypoint x="1062" y="140" /> <bpmndi:BPMNLabel> - <dc:Bounds x="166" y="146" width="70" height="53" /> + <dc:Bounds x="1008" y="122" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_08so17j_di" bpmnElement="Flow_08so17j"> + <di:waypoint x="208" y="471" /> + <di:waypoint x="325" y="471" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0buil9w_di" bpmnElement="Flow_0buil9w"> + <di:waypoint x="470" y="165" /> + <di:waypoint x="470" y="250" /> + <di:waypoint x="532" y="250" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="478" y="205" width="15" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_0ypmuow_di" bpmnElement="Event_0ypmuow"> + <dc:Bounds x="172" y="892" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="154" y="935" width="73" height="27" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> - <dc:Bounds x="660" y="370" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc"> - <dc:Bounds x="430" y="370" width="100" height="80" /> + <dc:Bounds x="300" y="680" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> + <dc:Bounds x="300" y="870" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb"> - <dc:Bounds x="930" y="370" width="100" height="80" /> + <dc:Bounds x="470" y="870" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> - <dc:Bounds x="1152" y="392" width="36" height="36" /> + <dc:Bounds x="662" y="892" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1160" y="435" width="20" height="14" /> + <dc:Bounds x="670" y="935" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy"> - <dc:Bounds x="569" y="74" width="121" height="94" /> + <bpmndi:BPMNShape id="Event_0c3sko9_di" bpmnElement="Event_0c3sko9"> + <dc:Bounds x="502" y="702" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="480" y="750" width="79" height="40" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true"> - <dc:Bounds x="455" y="96" width="50" height="50" /> + <bpmndi:BPMNShape id="Event_0a5fzwt_di" bpmnElement="Event_0a5fzwt"> + <dc:Bounds x="172" y="453" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="496" width="77" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0evcwr8_di" bpmnElement="Gateway_0evcwr8" isMarkerVisible="true"> + <dc:Bounds x="445" y="115" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="437" y="92" width="68" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_06m6kud_di" bpmnElement="Event_06m6kud"> + <dc:Bounds x="532" y="232" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="443" y="73" width="75" height="14" /> + <dc:Bounds x="509" y="280" width="81" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge"> + <dc:Bounds x="280" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd"> + <dc:Bounds x="172" y="122" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="165" width="70" height="53" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy"> + <dc:Bounds x="439" y="424" width="121" height="94" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb"> - <dc:Bounds x="789" y="74" width="121" height="94" /> + <dc:Bounds x="659" y="424" width="121" height="94" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5"> - <dc:Bounds x="1009" y="74" width="121" height="94" /> + <dc:Bounds x="879" y="424" width="121" height="94" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true"> + <dc:Bounds x="325" y="446" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="313" y="423" width="75" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_01bin3l_di" bpmnElement="Event_01bin3l"> + <dc:Bounds x="1062" y="122" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1039" y="170" width="81" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0l28lqi_di" bpmnElement="Event_0l28lqi"> + <dc:Bounds x="1062" y="242" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1040" y="290" width="79" height="40" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0m3yrzp_di" bpmnElement="Gateway_0m3yrzp" isMarkerVisible="true"> + <dc:Bounds x="921" y="115" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="915" y="85" width="64" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0ztykbe_di" bpmnElement="Activity_0ztykbe"> + <dc:Bounds x="750" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0tw406b_di" bpmnElement="Activity_0tw406b"> + <dc:Bounds x="570" y="100" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true"> - <dc:Bounds x="685" y="1080" width="781" height="196" /> + <dc:Bounds x="555" y="1430" width="781" height="196" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz"> - <di:waypoint x="1079" y="1184" /> - <di:waypoint x="1353" y="1184" /> + <di:waypoint x="949" y="1534" /> + <di:waypoint x="1223" y="1534" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s"> - <di:waypoint x="751" y="1184" /> - <di:waypoint x="979" y="1184" /> + <di:waypoint x="621" y="1534" /> + <di:waypoint x="849" y="1534" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56"> - <dc:Bounds x="715" y="1166" width="36" height="36" /> + <dc:Bounds x="585" y="1516" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026"> - <dc:Bounds x="1353" y="1166" width="36" height="36" /> + <dc:Bounds x="1223" y="1516" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw"> - <dc:Bounds x="979" y="1144" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge"> - <dc:Bounds x="285" y="81" width="100" height="80" /> + <dc:Bounds x="849" y="1494" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java new file mode 100644 index 0000000000..2eebde0687 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterUpgradeTasks.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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.adapter.cnf.tasks; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +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.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.cnf.CnfAdapterClient; +import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceRequest; +import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceResponse; +import org.onap.so.client.adapter.vnf.mapper.AttributeNameValue; +import org.onap.so.client.adapter.vnf.mapper.Attributes; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.openstack.utils.MsoMulticloudUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Component +public class CnfAdapterUpgradeTasks { + private static final Logger logger = LoggerFactory.getLogger(CnfAdapterUpgradeTasks.class); + + public static final String SDNCQUERY_RESPONSE = "SDNCQueryResponse_"; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private CnfAdapterClient cnfAdapterClient; + @Autowired + private VnfAdapterVfModuleObjectMapper vfModuleMapper; + + private ObjectMapper mapper = new ObjectMapper(); + + /** + * This method is used for updating the request for an Instance in Multicloud K8s Plugin. + * + * @param execution + * @return + */ + public void upgradeInstance(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + ServiceInstance serviceInstance = + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0); + GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + RequestContext requestContext = gBBInput.getRequestContext(); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId()); + String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId()); + Map<String, Object> paramsMap = vfModuleMapper.buildVfModuleParamsMap(requestContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + Map<String, String> sdncDirectives = getSdncDirectives(paramsMap); + UpgradeInstanceRequest upgradeInstanceRequest = + upgradeInstanceRequest(vfModule, cloudRegion, sdncDirectives); + UpgradeInstanceResponse response = cnfAdapterClient.upgradeVfModule(upgradeInstanceRequest); + execution.setVariable("heatStackId", response.getId()); + } catch (Exception ex) { + logger.error("Exception occurred", ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + protected Map<String, String> getSdncDirectives(Map<String, Object> paramsMap) + throws JsonParseException, JsonMappingException, IOException { + Map<String, String> sdncDirectivesMap = new HashMap<>(); + String sdncDirectivesString = (String) paramsMap.get(MsoMulticloudUtils.SDNC_DIRECTIVES); + Attributes sdncDirectives = mapper.readValue(sdncDirectivesString, Attributes.class); + for (AttributeNameValue nameVal : sdncDirectives.getAttributes()) { + sdncDirectivesMap.put(nameVal.getAttributeName(), (String) nameVal.getAttributeValue()); + } + return sdncDirectivesMap; + } + + protected UpgradeInstanceRequest upgradeInstanceRequest(VfModule vfModule, CloudRegion cloudRegion, + Map<String, String> sdncDirectives) { + + UpgradeInstanceRequest request = new UpgradeInstanceRequest(); + + request.setModelInvariantId(vfModule.getModelInfoVfModule().getModelInvariantUUID()); + request.setModelCustomizationId(vfModule.getModelInfoVfModule().getModelCustomizationUUID()); + request.setCloudRegion(cloudRegion.getLcpCloudRegionId()); + request.setVfModuleUUID(vfModule.getVfModuleId()); + request.setProfileName(sdncDirectives.get("k8s-rb-profile-name")); + request.setLabels(sdncDirectives); + if (sdncDirectives.containsKey("k8s-rb-instance-status-check")) + request.setStatusCheck(sdncDirectives.get("k8s-rb-instance-status-check").equalsIgnoreCase("true")); + request.setOverrideValues(sdncDirectives); + return request; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java index 920369784e..377d0bbf06 100755 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java @@ -55,6 +55,7 @@ public class ExecuteBuildingBlockBuilder { private static final String VFMODULE = "VfModule"; private static final String NETWORK = "Network"; private static final String HEALTH_CHECK = "HealthCheckBB"; + private static final String UPGRADE_CNF = "UpgradeVfModuleBB"; protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, List<Resource> originalResourceList, String requestId, String apiVersion, String resourceId, @@ -124,6 +125,10 @@ public class ExecuteBuildingBlockBuilder { && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope())) { addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false); + } else if ((orchFlow.getFlowName().equalsIgnoreCase(UPGRADE_CNF)) + && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope())) { + addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.VNF, orchFlow, requestId, apiVersion, + resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, false); } else if (orchFlow.getFlowName().contains(PNF) || (orchFlow.getFlowName().contains(CONTROLLER) && (PNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { addBuildingBlockToExecuteBBList(flowsToExecute, resource, WorkflowType.PNF, orchFlow, requestId, apiVersion, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 10cea171ce..ef32ac5cbb 100755 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -40,6 +40,7 @@ import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConst import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPDATE_INSTANCE; import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.HEALTH_CHECK; import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPGRADE_CNF; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; @@ -303,6 +304,9 @@ public class WorkflowAction { } else if (resourceType == WorkflowType.VNF && HEALTH_CHECK.equalsIgnoreCase(requestAction)) { vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(), workflowResourceIds.getVnfId(), aaiResourceIds); + } else if (resourceType == WorkflowType.VNF && UPGRADE_CNF.equalsIgnoreCase(requestAction)) { + vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(), + workflowResourceIds.getVnfId(), aaiResourceIds); } else { buildAndThrowException(execution, "Current Macro Request is not supported"); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java index a41613982d..093bab66bf 100755 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java @@ -52,5 +52,6 @@ public final class WorkflowActionConstants { public static final String VOLUMEGROUP = "VolumeGroup"; public static final String HEALTH_CHECK = "healthCheck"; public static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; + public static final String UPGRADE_CNF = "upgradeCnf"; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java index da36a6f040..e8122e7784 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/CnfAdapterClient.java @@ -27,6 +27,8 @@ import javax.ws.rs.core.UriBuilder; import org.apache.http.HttpStatus; import org.onap.so.client.adapter.cnf.entities.InstanceRequest; import org.onap.so.client.adapter.cnf.entities.InstanceResponse; +import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceResponse; +import org.onap.so.client.adapter.cnf.entities.UpgradeInstanceRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -115,6 +117,25 @@ public class CnfAdapterClient { } } + @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000)) + public UpgradeInstanceResponse upgradeVfModule(UpgradeInstanceRequest request) throws CnfAdapterClientException { + try { + String uri = "http://so-cnf-adapter:8090"; + String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/instance/{instanceID}/upgrade").build() + .toString(); + HttpEntity<?> entity = getHttpEntity(request); + ResponseEntity<UpgradeInstanceResponse> result = + restTemplate.exchange(endpoint, HttpMethod.POST, entity, UpgradeInstanceResponse.class); + return result.getBody(); + } catch (HttpClientErrorException e) { + logger.error("Error Calling CNF Adapter, e"); + if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { + throw new EntityNotFoundException(e.getResponseBodyAsString()); + } + throw e; + } + } + protected HttpHeaders getHttpHeaders() { HttpHeaders headers = new HttpHeaders(); List<MediaType> acceptableMediaTypes = new ArrayList<>(); @@ -135,4 +156,8 @@ public class CnfAdapterClient { return new HttpEntity<>(request, headers); } + protected HttpEntity<?> getHttpEntity(UpgradeInstanceRequest request) { + HttpHeaders headers = getHttpHeaders(); + return new HttpEntity<>(request, headers); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceRequest.java new file mode 100644 index 0000000000..ef516d4967 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceRequest.java @@ -0,0 +1,100 @@ + +package org.onap.so.client.adapter.cnf.entities; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public class UpgradeInstanceRequest { + + @JsonProperty("modelInvariantId") + private String modelInvariantId; + + @JsonProperty("modelCustomizationId") + private String modelCustomizationId; + + @JsonProperty("k8sRBProfileName") + private String profileName; + + @JsonProperty("k8sRBInstanceStatusCheck") + private Boolean statusCheck = false; + + @JsonProperty("cloudRegionId") + private String cloudRegion; + + @JsonProperty("vfModuleUUID") + private String vfModuleUUID; + + @JsonProperty("labels") + private Map<String, String> labels; + + @JsonProperty("override-values") + private Map<String, String> overrideValues; + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public String getProfileName() { + return profileName; + } + + public void setProfileName(String profileName) { + this.profileName = profileName; + } + + public Boolean getStatusCheck() { + return statusCheck; + } + + public void setStatusCheck(Boolean statusCheck) { + this.statusCheck = statusCheck; + } + + public String getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(String cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public Map<String, String> getLabels() { + return labels; + } + + public void setLabels(Map<String, String> labels) { + this.labels = labels; + } + + public String getVfModuleUUID() { + return vfModuleUUID; + } + + public void setVfModuleUUID(String vfModuleUUID) { + this.vfModuleUUID = vfModuleUUID; + } + + public Map<String, String> getOverrideValues() { + return overrideValues; + } + + public void setOverrideValues(Map<String, String> overrideValues) { + this.overrideValues = overrideValues; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceResponse.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceResponse.java new file mode 100644 index 0000000000..6498279870 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/UpgradeInstanceResponse.java @@ -0,0 +1,78 @@ + +package org.onap.so.client.adapter.cnf.entities; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({"id", "request", "namespace", "release-name", "resources"}) +public class UpgradeInstanceResponse { + + @JsonProperty("id") + private String id; + + @JsonProperty("request") + private InstanceRequest request; + + @JsonProperty("namespace") + private String namespace; + + @JsonProperty("release-name") + private String releaseName; + + @JsonProperty("resources") + private List<Resource> resources = null; + + @JsonProperty("id") + public String getId() { + return id; + } + + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + @JsonProperty("request") + public InstanceRequest getRequest() { + return request; + } + + @JsonProperty("request") + public void setRequest(InstanceRequest request) { + this.request = request; + } + + @JsonProperty("namespace") + public String getNamespace() { + return namespace; + } + + @JsonProperty("namespace") + public void setNamespace(String namespace) { + this.namespace = namespace; + } + + @JsonProperty("resources") + public List<Resource> getResources() { + return resources; + } + + @JsonProperty("resources") + public void setResources(List<Resource> resources) { + this.resources = resources; + } + + @JsonProperty("release-name") + public String getReleaseName() { + return releaseName; + } + + @JsonProperty("release-name") + public void setReleaseName(String releaseName) { + this.releaseName = releaseName; + } + +} |