diff options
Diffstat (limited to 'bpmn')
58 files changed, 2670 insertions, 1143 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 a38eb8c3a7..b29b95a3b1 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 @@ -1252,7 +1252,7 @@ public class BBInputSetup implements JavaDelegate { || requestAction.equalsIgnoreCase("activateFabricConfiguration") || requestAction.equalsIgnoreCase("recreateInstance") || requestAction.equalsIgnoreCase("replaceInstance") - || requestAction.equalsIgnoreCase("upgradeInstance")) { + || requestAction.equalsIgnoreCase("upgradeInstance") || requestAction.equalsIgnoreCase("healthCheck")) { return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction, requestDetails.getCloudConfiguration()); } @@ -1566,6 +1566,9 @@ public class BBInputSetup implements JavaDelegate { break; } } + } else if (bbName.equals("HealthCheckBB") + && (VNF).equalsIgnoreCase(executeBB.getBuildingBlock().getBpmnScope())) { + this.setisHelmforHealthCheckBB(service, serviceInstance, gBB); } if (executeBB.getWorkflowResourceIds() != null) { parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId()); @@ -1586,9 +1589,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(); @@ -1601,6 +1605,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 @@ -1637,6 +1646,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()); @@ -1667,6 +1691,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()); @@ -1692,6 +1726,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)) { @@ -1742,39 +1794,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) { @@ -2114,6 +2133,28 @@ public class BBInputSetup implements JavaDelegate { return collection; } + private void setisHelmforHealthCheckBB(Service service, ServiceInstance serviceInstance, GeneralBuildingBlock gBB) { + for (GenericVnf vnf : serviceInstance.getVnfs()) { + for (VfModule vfModule : vnf.getVfModules()) { + String vnfModelCustomizationUUID = + this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID); + this.mapCatalogVnf(vnf, vnfModelInfo, service); + String vfModuleCustomizationUUID = this.bbInputSetupUtils + .getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()).getModelCustomizationId(); + ModelInfo vfModuleModelInfo = new ModelInfo(); + vfModuleModelInfo.setModelCustomizationId(vfModuleCustomizationUUID); + this.mapCatalogVfModule(vfModule, vfModuleModelInfo, service, vnfModelCustomizationUUID); + if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null + && vfModule.getModelInfoVfModule().getModelName().contains("helm")) { + gBB.getRequestContext().setIsHelm(true); + break; + } + } + } + } + protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) { for (AAIResourceUri aaiResourceUri : list) { l3Networks.add(this.mapL3Network(aaiResourceUri)); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java index e8c88e00d7..4148a60433 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsForService.java @@ -20,7 +20,7 @@ package org.onap.so.client.cds; -import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyParamsToObject; +import static org.onap.so.client.cds.ConfigureInstanceParamsUtil.applyJsonParamsToObject; import com.google.gson.JsonObject; import java.util.List; import java.util.Map; @@ -49,7 +49,7 @@ public class ConfigureInstanceParamsForService { Optional<Service> service = extractServiceFromUserParameters.getServiceFromRequestUserParams(userParamsFromRequest); - service.map(Service::getInstanceParams).ifPresent(p -> applyParamsToObject(p, jsonObject)); + service.map(Service::getInstanceParams).ifPresent(p -> applyJsonParamsToObject(p, jsonObject)); } catch (Exception e) { throw new PayloadGenerationException("Failed to resolve instance parameters", e); } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java index 117fd74498..7e9c885496 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/ConfigureInstanceParamsUtil.java @@ -20,15 +20,23 @@ package org.onap.so.client.cds; +import com.google.gson.Gson; import com.google.gson.JsonObject; import java.util.List; import java.util.Map; public final class ConfigureInstanceParamsUtil { + private static final Gson gson = new Gson(); + public static void applyParamsToObject(List<Map<String, String>> instanceParamsList, JsonObject jsonObject) { instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream()) .forEachOrdered(entry -> jsonObject.addProperty(entry.getKey(), entry.getValue())); } + public static void applyJsonParamsToObject(List<Map<String, Object>> instanceParamsList, JsonObject jsonObject) { + instanceParamsList.stream().flatMap(instanceParamsMap -> instanceParamsMap.entrySet().stream()) + .forEachOrdered(entry -> jsonObject.add(entry.getKey(), gson.toJsonTree(entry.getValue()))); + } + } 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 61a920ead8..7f066af080 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 @@ -2288,45 +2288,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/HealthCheckBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HealthCheckBB.bpmn index 8272bd3750..fad2e5506c 100755 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HealthCheckBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/HealthCheckBB.bpmn @@ -1,30 +1,29 @@ <?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:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1bvx7yi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.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: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" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0gwymqy" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.7.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.14.0"> <bpmn:process id="HealthCheckBB" name="HealthCheckBB" isExecutable="true"> - <bpmn:startEvent id="StartEvent_1" name="HealthCheckBB_start"> - <bpmn:outgoing>Flow_0gd6hy6</bpmn:outgoing> + <bpmn:startEvent id="Event_0rgusxn" name="HealthCheckBB_start"> + <bpmn:outgoing>Flow_0udh4cd</bpmn:outgoing> </bpmn:startEvent> - <bpmn:endEvent id="Event_1dklvvk" name="HealthCheckBB_end"> - <bpmn:incoming>Flow_0xiyno7</bpmn:incoming> + <bpmn:endEvent id="Event_0o1nl3y" name="HealthCheckBB_end"> + <bpmn:incoming>Flow_0n17e0q</bpmn:incoming> + <bpmn:incoming>Flow_131rwms</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_0gd6hy6" sourceRef="StartEvent_1" targetRef="Activity_11hkwkn" /> - <bpmn:subProcess id="Activity_1pto2qh" name="Error Handling " triggeredByEvent="true"> - <bpmn:startEvent id="Event_0929aqj"> - <bpmn:outgoing>Flow_05rbrsm</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0k0ly65" /> + <bpmn:subProcess id="Activity_0tw4ak3" name="Error Handling " triggeredByEvent="true"> + <bpmn:startEvent id="Event_1v6jbfd"> + <bpmn:outgoing>Flow_03ogqmx</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1xw7dq4" /> </bpmn:startEvent> - <bpmn:endEvent id="Event_1s698ql"> - <bpmn:incoming>Flow_05rbrsm</bpmn:incoming> - <bpmn:terminateEventDefinition id="TerminateEventDefinition_0mn6xgi" /> + <bpmn:endEvent id="Event_0wwzune"> + <bpmn:incoming>Flow_03ogqmx</bpmn:incoming> + <bpmn:terminateEventDefinition id="TerminateEventDefinition_0c07ott" /> </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_05rbrsm" sourceRef="Event_0929aqj" targetRef="Event_1s698ql" /> + <bpmn:sequenceFlow id="Flow_03ogqmx" sourceRef="Event_1v6jbfd" targetRef="Event_0wwzune" /> </bpmn:subProcess> - <bpmn:serviceTask id="Activity_11hkwkn" name="Prepare Cnf Adapter request" camunda:expression="${CnfHealthCheckTasks.prepareCnfAdaperRequest(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>Flow_0gd6hy6</bpmn:incoming> - <bpmn:outgoing>Flow_1aqdd5k</bpmn:outgoing> + <bpmn:serviceTask id="Activity_0pnb21p" name="Prepare Cnf Adapter request" camunda:expression="${CnfHealthCheckTasks.prepareCnfAdaperRequest(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>Flow_0jxw1lb</bpmn:incoming> + <bpmn:outgoing>Flow_0uoe9ga</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1aqdd5k" sourceRef="Activity_11hkwkn" targetRef="Activity_08mgs1k" /> - <bpmn:callActivity id="Activity_08mgs1k" name="Call CNFAdapterAsyncCall" calledElement="CNFAdapterAsyncCall"> + <bpmn:callActivity id="Activity_07txikn" name="Call CNFAdapterAsyncCall" calledElement="CNFAdapterAsyncCall"> <bpmn:extensionElements> <camunda:in source="apiPath" target="apiPath" /> <camunda:in source="cnfRequestPayload" target="cnfRequestPayload" /> @@ -35,67 +34,100 @@ <camunda:in source="messageType" target="messageType" /> <camunda:in source="true" target="isDebugLogEnabled" /> </bpmn:extensionElements> - <bpmn:incoming>Flow_1aqdd5k</bpmn:incoming> - <bpmn:outgoing>Flow_1jeui7e</bpmn:outgoing> + <bpmn:incoming>Flow_0uoe9ga</bpmn:incoming> + <bpmn:outgoing>Flow_0t6f6l8</bpmn:outgoing> </bpmn:callActivity> - <bpmn:serviceTask id="Activity_0w4hy3d" name="Process Response" camunda:expression="${CnfHealthCheckTasks.processAsyncResponse(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>Flow_1jeui7e</bpmn:incoming> - <bpmn:outgoing>Flow_0xiyno7</bpmn:outgoing> + <bpmn:serviceTask id="Activity_1qd7k3z" name="Process Response" camunda:expression="${CnfHealthCheckTasks.processAsyncResponse(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>Flow_0t6f6l8</bpmn:incoming> + <bpmn:outgoing>Flow_0n17e0q</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0xiyno7" sourceRef="Activity_0w4hy3d" targetRef="Event_1dklvvk" /> - <bpmn:sequenceFlow id="Flow_1jeui7e" sourceRef="Activity_08mgs1k" targetRef="Activity_0w4hy3d" /> + <bpmn:exclusiveGateway id="Gateway_07e5xls" name="Check If Is Helm" default="Flow_131rwms"> + <bpmn:incoming>Flow_0udh4cd</bpmn:incoming> + <bpmn:outgoing>Flow_131rwms</bpmn:outgoing> + <bpmn:outgoing>Flow_0jxw1lb</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0udh4cd" sourceRef="Event_0rgusxn" targetRef="Gateway_07e5xls" /> + <bpmn:sequenceFlow id="Flow_0n17e0q" sourceRef="Activity_1qd7k3z" targetRef="Event_0o1nl3y" /> + <bpmn:sequenceFlow id="Flow_131rwms" name="No Helm" sourceRef="Gateway_07e5xls" targetRef="Event_0o1nl3y" /> + <bpmn:sequenceFlow id="Flow_0jxw1lb" name="Yes Helm" sourceRef="Gateway_07e5xls" targetRef="Activity_0pnb21p"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isHelm")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_0uoe9ga" sourceRef="Activity_0pnb21p" targetRef="Activity_07txikn" /> + <bpmn:sequenceFlow id="Flow_0t6f6l8" sourceRef="Activity_07txikn" targetRef="Activity_1qd7k3z" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="HealthCheckBB"> - <bpmndi:BPMNEdge id="Flow_1jeui7e_di" bpmnElement="Flow_1jeui7e"> - <di:waypoint x="600" y="120" /> - <di:waypoint x="680" y="120" /> + <bpmndi:BPMNEdge id="Flow_0udh4cd_di" bpmnElement="Flow_0udh4cd"> + <di:waypoint x="218" y="150" /> + <di:waypoint x="245" y="150" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0xiyno7_di" bpmnElement="Flow_0xiyno7"> - <di:waypoint x="780" y="120" /> - <di:waypoint x="842" y="120" /> + <bpmndi:BPMNEdge id="Flow_0n17e0q_di" bpmnElement="Flow_0n17e0q"> + <di:waypoint x="780" y="150" /> + <di:waypoint x="870" y="150" /> + <di:waypoint x="870" y="202" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1aqdd5k_di" bpmnElement="Flow_1aqdd5k"> - <di:waypoint x="400" y="120" /> - <di:waypoint x="500" y="120" /> + <bpmndi:BPMNEdge id="Flow_131rwms_di" bpmnElement="Flow_131rwms"> + <di:waypoint x="270" y="175" /> + <di:waypoint x="270" y="220" /> + <di:waypoint x="852" y="220" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="264" y="195" width="43" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0jxw1lb_di" bpmnElement="Flow_0jxw1lb"> + <di:waypoint x="295" y="150" /> + <di:waypoint x="350" y="150" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="299" y="132" width="47" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0gd6hy6_di" bpmnElement="Flow_0gd6hy6"> - <di:waypoint x="218" y="120" /> - <di:waypoint x="300" y="120" /> + <bpmndi:BPMNEdge id="Flow_0uoe9ga_di" bpmnElement="Flow_0uoe9ga"> + <di:waypoint x="450" y="150" /> + <di:waypoint x="500" y="150" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Event_1dklvvk_di" bpmnElement="Event_1dklvvk"> - <dc:Bounds x="842" y="102" width="36" height="36" /> + <bpmndi:BPMNEdge id="Flow_0t6f6l8_di" bpmnElement="Flow_0t6f6l8"> + <di:waypoint x="600" y="150" /> + <di:waypoint x="680" y="150" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_0rgusxn_di" bpmnElement="Event_0rgusxn"> + <dc:Bounds x="182" y="132" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="820" y="145" width="85" height="27" /> + <dc:Bounds x="156" y="175" width="90" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="182" y="102" width="36" height="36" /> + <bpmndi:BPMNShape id="Event_0o1nl3y_di" bpmnElement="Event_0o1nl3y"> + <dc:Bounds x="852" y="202" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="156" y="145" width="90" height="27" /> + <dc:Bounds x="831" y="245" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_11hkwkn_di" bpmnElement="Activity_11hkwkn"> - <dc:Bounds x="300" y="80" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0pnb21p_di" bpmnElement="Activity_0pnb21p"> + <dc:Bounds x="350" y="110" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_07txikn_di" bpmnElement="Activity_07txikn"> + <dc:Bounds x="500" y="110" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0f7poou_di" bpmnElement="Activity_08mgs1k"> - <dc:Bounds x="500" y="80" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_1qd7k3z_di" bpmnElement="Activity_1qd7k3z"> + <dc:Bounds x="680" y="110" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0w4hy3d_di" bpmnElement="Activity_0w4hy3d"> - <dc:Bounds x="680" y="80" width="100" height="80" /> + <bpmndi:BPMNShape id="Gateway_07e5xls_di" bpmnElement="Gateway_07e5xls" isMarkerVisible="true"> + <dc:Bounds x="245" y="125" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="230" y="95" width="81" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1pto2qh_di" bpmnElement="Activity_1pto2qh" isExpanded="true"> - <dc:Bounds x="280" y="250" width="460" height="135" /> + <bpmndi:BPMNShape id="Activity_0tw4ak3_di" bpmnElement="Activity_0tw4ak3" isExpanded="true"> + <dc:Bounds x="280" y="280" width="460" height="135" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_05rbrsm_di" bpmnElement="Flow_05rbrsm"> - <di:waypoint x="398" y="324" /> - <di:waypoint x="632" y="324" /> + <bpmndi:BPMNEdge id="Flow_03ogqmx_di" bpmnElement="Flow_03ogqmx"> + <di:waypoint x="398" y="354" /> + <di:waypoint x="632" y="354" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Event_0929aqj_di" bpmnElement="Event_0929aqj"> - <dc:Bounds x="362" y="306" width="36" height="36" /> + <bpmndi:BPMNShape id="Event_1v6jbfd_di" bpmnElement="Event_1v6jbfd"> + <dc:Bounds x="362" y="336" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1s698ql_di" bpmnElement="Event_1s698ql"> - <dc:Bounds x="632" y="306" width="36" height="36" /> + <bpmndi:BPMNShape id="Event_0wwzune_di" bpmnElement="Event_0wwzune"> + <dc:Bounds x="632" y="336" width="36" height="36" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> 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/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy index f17bfc2938..eb7e89ce54 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy @@ -254,7 +254,7 @@ else{ //TNFH slice profile instance creation TNFH_sliceProfileInstance.setServiceInstanceId(TNFH_sliceProfileInstanceId) - sliceInstanceName = "sliceprofile _ "+TNFH_sliceProfileId + sliceInstanceName = "sliceprofile_"+TNFH_sliceProfileId TNFH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName) serviceType = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "sST") TNFH_sliceProfileInstance.setServiceType(serviceType) @@ -271,7 +271,7 @@ else{ //TNMH slice profile instance creation TNMH_sliceProfileInstance.setServiceInstanceId(TNMH_sliceProfileInstanceId) - sliceInstanceName = "sliceprofile _ "+TNMH_sliceProfileId + sliceInstanceName = "sliceprofile_"+TNMH_sliceProfileId TNMH_sliceProfileInstance.setServiceInstanceName(sliceInstanceName) serviceType = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "sST") TNMH_sliceProfileInstance.setServiceType(serviceType) @@ -327,7 +327,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe result.setExpDataRateDL(profile.get("expDataRateDL")) result.setExpDataRateUL(profile.get("expDataRateUL")) result.setSurvivalTime(profile.get("survivalTime")) - result.setMaxNumberOfPDUSession(profile.get("maxNumberOfPDUSession")) + result.setMaxNumberOfPDUSession(profile.get("maxNumberofPDUSession")) result.setAreaTrafficCapDL(profile.get("areaTrafficCapDL")) result.setAreaTrafficCapUL(profile.get("areaTrafficCapUL")) result.setOverallUserDensity(profile.get("overallUserDensity")) 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 ed1c2b24d5..54fa2abdd1 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 @@ -576,7 +575,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANServiceInstance.setServiceRole(serviceRole) List<String> snssaiList = execution.getVariable("snssaiList") String snssai = snssaiList.get(0) - //ANServiceInstance.setEnvironmentContext(snssai) + //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") //domain Type @@ -639,22 +642,23 @@ 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) logger.debug("completed AN service instance build " + ANServiceInstance.toString()) //create RAN NF NSSI ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId") as String) - sliceInstanceName = "nssi_"+execution.getVariable("ANNF_modelName") + String ANNF_nssiInstanceId = UUID.randomUUID().toString() + sliceInstanceName = "nssi_an_nf_" + ANNF_nssiInstanceId ANNFServiceInstance.setServiceInstanceName(sliceInstanceName) ANNFServiceInstance.setServiceType(execution.getVariable("sst") as String) ANNFServiceInstance.setOrchestrationStatus(serviceStatus) @@ -663,7 +667,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANNFServiceInstance.setServiceRole(serviceRole) snssaiList = jsonUtil.StringArrayToList(execution.getVariable("snssaiList") as String) snssai = snssaiList.get(0) - ANNFServiceInstance.setEnvironmentContext(snssai) + ANNFServiceInstance.setEnvironmentContext(execution.getVariable("networkType") as String) ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid")) ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid")) ANNFServiceInstance.setWorkloadContext("AN_NF") @@ -1032,7 +1036,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { RU_ep.setType(type) RU_ep.setIpAddress("192.168.100.4") RU_ep.setLogicalInterfaceId("1234") - RU_ep.setNextHop("Host1") + RU_ep.setNextHop("networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.1-ltpId-512") RU_ep.setPrefixLength(prefixLength) RU_ep.setAddressFamily(addressFamily) //DU Ingress @@ -1046,7 +1050,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { DU_ep.setType(type) DU_ep.setIpAddress("192.168.100.5") DU_ep.setLogicalInterfaceId("1234") - DU_ep.setNextHop("Host2") + DU_ep.setNextHop("networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512") DU_ep.setPrefixLength(prefixLength) DU_ep.setAddressFamily(addressFamily) //MH RAN end point update @@ -1062,7 +1066,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { DUEG_ep.setLogicalInterfaceId("1234") DUEG_ep.setPrefixLength(prefixLength) DUEG_ep.setAddressFamily(addressFamily) - DUEG_ep.setNextHop("Host3") + DUEG_ep.setNextHop("networkId-providerId-10-clientId-0-topologyId-2-nodeId-10.1.1.1-ltpId-512") //CUIN String CUIN_routeId = UUID.randomUUID().toString() execution.setVariable("tranportEp_ID_CUIN", CUIN_routeId) @@ -1073,7 +1077,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { CUIN_ep.setType(type) CUIN_ep.setIpAddress("192.168.100.6") CUIN_ep.setLogicalInterfaceId("1234") - CUIN_ep.setNextHop("Host4") + CUIN_ep.setNextHop("networkId-providerId-20-clientId-0-topologyId-2-nodeId-10.2.1.2-ltpId-512") CUIN_ep.setPrefixLength(prefixLength) CUIN_ep.setAddressFamily(addressFamily) try { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index bc155c5943..a22819f2e9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -444,6 +444,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ .sST(sliceTaskInfo.getSliceProfile().getSST() ?: sliceParams.getServiceProfile().get("sST") as String) .nssiName(sliceTaskInfo.getSuggestNssiId() ? sliceTaskInfo.getNSSTInfo().getName() : allocateAnNssi.getNssiName()) .nssiId(sliceTaskInfo.getSuggestNssiId()) + .resourceSharingLevel(sliceParams.serviceProfile.get("resourceSharingLevel") as String) .build() nbiRequest.setServiceInfo(serviceInfo) @@ -590,6 +591,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") serviceInfo.nssiName = allocateCnNssi.nssiName + serviceInfo.resourceSharingLevel = sliceParams.serviceProfile.get("resourceSharingLevel") nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -727,6 +729,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.nssiId = sliceTaskInfo.suggestNssiId serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") serviceInfo.nssiName = "nssi_tn" + execution.getVariable("sliceServiceInstanceName") + serviceInfo.resourceSharingLevel = sliceParams.serviceProfile.get("resourceSharingLevel") nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy index a784cbee6e..6981d94324 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy @@ -110,6 +110,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { execution.setVariable("nssiAllocateStatus", jobStatusResponse) if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) { + nssiAllocateResult.setNssiId(jobStatusResponse.getResponseDescriptor().getNssiId()) execution.setVariable("jobFinished", true) } } 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/DoCommonCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy index b07f5c965d..a28dbbf9b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy @@ -742,7 +742,11 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor { Map<String, Object> instanceParamsMap = new HashMap<>() // Supported S-NSSAI - List<String> snssais = (List<String>) currentNSSI['S-NSSAIs'] + def snssaisList = currentNSSI['S-NSSAIs'] + List<String> snssais = new ArrayList<>() + if(snssaisList != null) { + snssais = new ArrayList<String>((List<String>)snssaisList) + } LOGGER.debug("prepareInstanceParams: snssais size = " + snssais.size()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy index 2588d07e50..7571f07081 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.core.type.TypeReference import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.beans.nsmf.EsrInfo @@ -271,24 +272,22 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * @return */ private SubnetType convertServiceCategory(String serviceCategory){ - if("CN NSST".equals(serviceCategory)){ + if(serviceCategory ==~ /CN.*/){ return SubnetType.CN } - if ("AN NF NSST".equals(serviceCategory)){ - return SubnetType.AN_NF - } - if ("AN NSST".equals(serviceCategory)){ + if (serviceCategory ==~ /AN.*/){ return SubnetType.AN } - if ("TN BH NSST".equals(serviceCategory)){ + if (serviceCategory ==~ /TN.*BH.*/){ return SubnetType.TN_BH } - if("TN MH NSST".equals(serviceCategory)){ + if(serviceCategory ==~ /TN.*MH.*/){ return SubnetType.TN_MH } - if("TN FH NSST".equals(serviceCategory)){ + if(serviceCategory ==~ /TN.*FH.*/){ return SubnetType.TN_FH } + return null } @@ -475,7 +474,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ */ void getNSSISelectionCap4AN(DelegateExecution execution) { - def vendor = execution.getVariable("vendor") as String + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + def vendor = sliceParams.anSliceTaskInfo.vendor String strRequest = buildNSSISelectionReq(vendor, NetworkType.ACCESS) @@ -497,7 +499,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ */ void getNSSISelectionCap4TN(DelegateExecution execution) { - def vendor = execution.getVariable("vendor") as String + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + def vendor = sliceParams.tnBHSliceTaskInfo.vendor String strRequest = buildNSSISelectionReq(vendor, NetworkType.TRANSPORT) @@ -518,7 +523,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ */ void getNSSISelectionCap4CN(DelegateExecution execution) { - def vendor = execution.getVariable("vendor") as String + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + def vendor = sliceParams.cnSliceTaskInfo.vendor String strRequest = buildNSSISelectionReq(vendor, NetworkType.CORE) @@ -626,8 +634,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo - Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map - //profileInfo.remove("profileId") + SliceProfileAdapter sliceProfileInfo = nssiNeedHandlerInfo.get("sliceProfile") as SliceProfileAdapter + + Map profileInfo = objectMapper.convertValue(sliceProfileInfo, new TypeReference<Map<String, Object>>() {}); + while (profileInfo.values().remove(null)); String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug( "get NSI option OOF Url: " + urlString) @@ -641,8 +651,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution) execution.setVariable("nssiSelection_timeout", timeout) - String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType, - profileInfo, 600) + String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, messageType, nsstInfo.UUID, + nsstInfo.invariantUUID, nsstInfo.name, profileInfo) execution.setVariable("nssiSelection_oofRequest", oofRequest) logger.debug("Sending request to OOF: " + oofRequest) @@ -672,13 +682,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solution = nsiSolutions.get(0) - - String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel == "shared" //todo - if (isSharable && solution != null) { - processNssiResult(sliceTaskParams, subnetType, solution) + if(nsiSolutions.size()>=1) { + Map<String,Object> solution = nsiSolutions.get(0) as Map + processNssiResult(sliceTaskParams, subnetType, solution) } execution.setVariable("sliceTaskParams", sliceTaskParams) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index dd168519e5..d2ba28256f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -146,6 +146,11 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { ss.setWorkloadContext(domainTypeStr) } + String resourceSharingLevel = jsonUtil.getJsonValue(sliceProfileStr, "resourceSharingLevel") + if (isNotBlank(resourceSharingLevel)) { + ss.setServiceFunction(resourceSharingLevel) + } + AAIResourcesClient client = getAAIClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy index 6fd8080ef0..74a2d980f7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy @@ -40,6 +40,7 @@ import org.onap.so.beans.nsmf.DeAllocateNssi import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NetworkType import org.onap.so.beans.nsmf.ServiceInfo +import org.onap.so.beans.nsmf.oof.SubnetType import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils @@ -333,9 +334,9 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " operationId:" + modificationJobId) ResourceOperationStatus initStatus = new ResourceOperationStatus() - initStatus.setServiceId(serviceId) + initStatus.setServiceId(nsiId) initStatus.setOperationId(modificationJobId) - initStatus.setResourceTemplateUUID(nsiId) + initStatus.setResourceTemplateUUID(serviceId) initStatus.setOperType("Modify-Deallocate") requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus) @@ -347,13 +348,18 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { String responseId = "1" String globalSubscriberId = execution.getVariable("globalSubscriberId") String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String anNssiId = execution.getVariable("anNssiId") JsonObject esrInfo = new JsonObject() esrInfo.addProperty("networkType", networkType) esrInfo.addProperty("vendor", "ONAP_internal") JsonObject serviceInfo = new JsonObject() - serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) + if (networkType.equals(SubnetType.AN.getSubnetType())) { + serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) + } else { + serviceInfo.addProperty("nsiId", anNssiId) + } serviceInfo.addProperty("nssiId", instanceId) serviceInfo.addProperty("globalSubscriberId", globalSubscriberId) serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType) @@ -526,7 +532,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor { Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs") DeAllocateNssi deallocateNssi = new DeAllocateNssi() - deallocateNssi.setNsiId(execution.getVariable("nsiId")) + deallocateNssi.setNsiId(anNssiId) ServiceInstance tnNssi = relatedNssis.get(serviceFunction) String nssiId = tnNssi.getServiceInstanceId() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy index 11058748fd..e563471d2a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy @@ -21,13 +21,13 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper -import com.google.gson.JsonObject +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.aai.domain.yang.v19.AllottedResource -import org.onap.aai.domain.yang.v19.GenericVnf +import org.json.JSONArray +import org.json.JSONObject +import org.onap.aai.domain.yang.v19.ModelVer import org.onap.aai.domain.yang.v19.ServiceInstance import org.onap.aai.domain.yang.v19.SliceProfile -import org.onap.aai.domain.yang.v19.SliceProfiles import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.Relationships @@ -37,22 +37,19 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.logging.filter.base.ONAPComponents import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.ExternalAPIUtil +import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.OofUtils import org.onap.so.bpmn.common.scripts.RequestDBUtil import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient -import org.onap.so.client.HttpClientFactory -import org.onap.so.client.oof.adapter.beans.payload.OofRequest import org.slf4j.Logger import org.slf4j.LoggerFactory import javax.ws.rs.core.Response -import static org.apache.commons.lang3.StringUtils.isBlank -import static org.apache.commons.lang3.StringUtils.isBlank -import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank import static org.onap.so.bpmn.common.scripts.GenericUtils.isBlank class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { @@ -88,7 +85,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { LOGGER.debug("${PREFIX} Start executeTerminateNSSIQuery") String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) - // String urlString = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution) //API Path String apiPath = "/api/oof/terminate/nxi/v1" @@ -102,20 +98,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) String basicAuthValue = utils.encrypt(basicAuth, msokey) - /* if (basicAuthValue != null) { - LOGGER.debug( "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue) - try { - authHeader = utils.getBasicAuth(basicAuthValue, msokey) - execution.setVariable("BasicAuthHeaderValue", authHeader) - } catch (Exception ex) { - LOGGER.error( "Unable to encode username and password string: " + ex) - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string") - } - } else { - LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null") - exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null") - } */ - try { authHeader = utils.getBasicAuth(basicAuthValue, msokey) @@ -177,7 +159,6 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { " \"errorCode\": \"${errorCode}\",\n" + " \"errorMessage\": \"${errorMessage}\"\n" + "}" - //exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") } if (httpResponse.hasEntity()) { @@ -282,71 +263,124 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { } - /** - * Invokes deleteServiceOrder external API + * Prepares ServiceOrderRequest * @param execution */ - void deleteServiceOrder(DelegateExecution execution) { - LOGGER.debug("${PREFIX} Start deleteServiceOrder") + private void prepareServiceOrderRequest(DelegateExecution execution) { + LOGGER.debug("${PREFIX} Start prepareServiceOrderRequest") def currentNSSI = execution.getVariable("currentNSSI") - try { - //url:/nbi/api/v4/serviceOrder/" - def nsmfЕndPoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) - - ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] - - //String url = String.format("${nbiEndpointUrl}/api/v4/serviceOrder/%s", networkServiceInstance.getServiceInstanceId()) - - GenericVnf constituteVnf = (GenericVnf)currentNSSI['constituteVnf'] - - // http://so.onap:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances/de6a0aa2-19f2-41fe-b313-a5a9f159acd7/vnfs/3abbb373-8d33-4977-aa4b-2bfee496b6d5 - String url = String.format("${nsmfЕndPoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId()) + //extAPI path hardcoded for testing purposes, will be updated in next patch + String extAPIPath = "https://nbi.onap:8443/nbi/api/v4" + "/serviceOrder" + execution.setVariable("ExternalAPIURL", extAPIPath) + ObjectMapper objectMapper = new ObjectMapper(); + Map<String, Object> serviceOrder = new LinkedHashMap() + //ExternalId + serviceOrder.put("externalId", "ONAP001") + + //Requested Start Date + String requestedStartDate = utils.generateCurrentTimeInUtc() + String requestedCompletionDate = utils.generateCurrentTimeInUtc() + serviceOrder.put("requestedStartDate", requestedStartDate) + serviceOrder.put("requestedCompletionDate", requestedCompletionDate) + + //RelatedParty Fields + String relatedPartyId = execution.getVariable("globalSubscriberId") + String relatedPartyRole = "ONAPcustomer" + Map<String, String> relatedParty = new LinkedHashMap() + relatedParty.put("id", relatedPartyId) + relatedParty.put("role", relatedPartyRole) + List<Map<String, String>> relatedPartyList = new ArrayList() + relatedPartyList.add(relatedParty) + serviceOrder.put("relatedParty", relatedPartyList) + + Map<String, Object> orderItem = new LinkedHashMap() + //orderItem id + String orderItemId = "1" + orderItem.put("id", orderItemId) + + //order item action will always be delete as we are triggering request for deletion + String orderItemAction = "delete" + orderItem.put("action", orderItemAction) + + // service Details + AAIResourcesClient client = getAAIClient() + ServiceInstance networkServiceInstance = (ServiceInstance)currentNSSI['networkServiceInstance'] //(ServiceInstance) currentNSSI['nssi'] + AAIResourceUri modelVerUrl = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.serviceDesignAndCreation().model(networkServiceInstance.getModelInvariantId()).modelVer(networkServiceInstance.getModelVersionId())) + + Map<String, Object> service = new LinkedHashMap() + // Service id + service.put("id", networkServiceInstance.getServiceInstanceId()) + + //ServiceName + String serviceName = networkServiceInstance.getServiceInstanceName() + service.put("name", serviceName) + + // Service Type + service.put("serviceType", networkServiceInstance.getServiceType()) + //Service State + service.put("serviceState", "active") + + Map<String, String> serviceSpecification = new LinkedHashMap() + String modelUuid = networkServiceInstance.getModelVersionId() + serviceSpecification.put("id", modelUuid) + service.put("serviceSpecification", serviceSpecification) + + orderItem.put("service", service) + List<Map<String, String>> orderItemList = new ArrayList() + orderItemList.add(orderItem) + serviceOrder.put("orderItem", orderItemList) + String jsonServiceOrder = objectMapper.writeValueAsString(serviceOrder) + LOGGER.debug("******* ServiceOrder :: "+jsonServiceOrder) + execution.setVariable("serviceOrderRequest", jsonServiceOrder) + + LOGGER.debug("${PREFIX} End prepareServiceOrderRequest") + } - LOGGER.debug("url = " + url) - currentNSSI['deleteServiceOrderURL'] = url - String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuth = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) + /** + * Invokes deleteServiceOrder external API + * @param execution + */ + void deleteServiceOrder(DelegateExecution execution) { + LOGGER.debug("${PREFIX} Start deleteServiceOrder") - def authHeader = utils.getBasicAuth(basicAuth, msoKey) + def currentNSSI = execution.getVariable("currentNSSI") - def requestDetails = "" + prepareServiceOrderRequest(execution) - String prepareRequestDetailsResponse = prepareRequestDetails(execution) - LOGGER.debug("deleteServiceOrder: prepareRequestDetailsResponse=" + prepareRequestDetailsResponse) + try { + String extAPIPath = execution.getVariable("ExternalAPIURL") + String payload = execution.getVariable("serviceOrderRequest") + LOGGER.debug("externalAPIURL is: " + extAPIPath) + LOGGER.debug("ServiceOrder payload is: " + payload) - String errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode") - LOGGER.debug("deleteServiceOrder: errorCode=" + errorCode) - if(errorCode == null || errorCode.isEmpty()) { // No error - requestDetails = prepareRequestDetailsResponse - } - else { - exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage")) - } + execution.setVariable("ServiceOrderId", "") - String callDeleteServiceOrderResponse = callDeleteServiceOrder(url, authHeader, requestDetails) - errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode") + String callDeleteServiceOrderResponse = callDeleteServiceOrder(execution, extAPIPath, payload) + String errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode") if(errorCode == null || errorCode.isEmpty()) { // No error - String macroOperationId = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "requestReferences.requestId") - String requestSelfLink = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "requestReferences.requestSelfLink") + JSONObject responseObj = new JSONObject(callDeleteServiceOrderResponse) - execution.setVariable("macroOperationId", macroOperationId) - execution.setVariable("requestSelfLink", requestSelfLink) + String serviceOrderId = responseObj.get("id") - currentNSSI['requestSelfLink'] = requestSelfLink + execution.setVariable("ServiceOrderId", serviceOrderId) + LOGGER.info("Delete ServiceOrderid is: " + serviceOrderId) } else { LOGGER.error(jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage")) exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorMessage")) } - } catch (any) { - String msg = "Exception in DoDeallocateCoreNSSI.deleteServiceOrder. " + any.getCause() - LOGGER.error(msg) + + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + String msg = "Exception in ServiceOrder ExtAPI" + ex.getMessage() + LOGGER.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -354,33 +388,38 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { } - String callDeleteServiceOrder(String url, String authHeader, String requestDetailsStr) { + String callDeleteServiceOrder(DelegateExecution execution, String extAPIPath, String payload) { LOGGER.debug("${PREFIX} Start callDeleteServiceOrder") String errorCode = "" String errorMessage = "" String response = "" - LOGGER.debug("callDeleteServiceOrder: url = " + url) - LOGGER.debug("callDeleteServiceOrder: authHeader = " + authHeader) + LOGGER.debug("callDeleteServiceOrder: url = " + extAPIPath) try { - HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) - httpClient.addAdditionalHeader("Authorization", authHeader) - httpClient.addAdditionalHeader("Accept", "application/json") - Response httpResponse = httpClient.delete(requestDetailsStr) + ExternalAPIUtil externalAPIUtil = getExternalAPIUtil() + Response httpResponse = externalAPIUtil.executeExternalAPIPostCall(execution, extAPIPath, payload) - int soResponseCode = httpResponse.getStatus() - LOGGER.debug("callDeleteServiceOrder: soResponseCode = " + soResponseCode) + int responseCode = httpResponse.getStatus() + execution.setVariable("ServiceOrderResponseCode", responseCode) + LOGGER.debug("Delete ServiceOrder response code is: " + responseCode) + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) { + //200 OK 201 CREATED 202 ACCEPTED + LOGGER.debug("Delete ServiceOrder Received a Good Response") - if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) { response = httpResponse.readEntity(String.class) LOGGER.debug("callDeleteServiceInstance: response = " + response) + + execution.setVariable("DeleteServiceOrderResponse", response) + } else { errorCode = 500 - errorMessage = "Response code is " + soResponseCode + errorMessage = "Response code is " + responseCode response = "{\n" + " \"errorCode\": \"${errorCode}\",\n" + @@ -503,18 +542,64 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { void getDeleteServiceOrderProgress(DelegateExecution execution) { LOGGER.debug("${getPrefix()} Start getDeleteServiceOrderProgress") - def currentNSSI = execution.getVariable("currentNSSI") - - String url = currentNSSI['requestSelfLink'] - - String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - - String basicAuth = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution) - - def authHeader = "" - String basicAuthValue = utils.getBasicAuth(basicAuth, msoKey) + String msg + try { + String extAPIPath = execution.getVariable("ExternalAPIURL") + extAPIPath += "/" + execution.getVariable("ServiceOrderId") + LOGGER.debug("externalAPIURL is: " + extAPIPath) + + ExternalAPIUtil externalAPIUtil = getExternalAPIUtil() + Response response = externalAPIUtil.executeExternalAPIGetCall(execution, extAPIPath) + int responseCode = response.getStatus() + execution.setVariable("GetServiceOrderResponseCode", responseCode) + LOGGER.debug("Get ServiceOrder response code is: " + responseCode) + String extApiResponse = response.readEntity(String.class) + JSONObject responseObj = new JSONObject(extApiResponse) + execution.setVariable("GetServiceOrderResponse", extApiResponse) + LOGGER.debug("Get response body is: " + extApiResponse) + //Process Response //200 OK 201 CREATED 202 ACCEPTED + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + { + LOGGER.debug("Get Delete ServiceOrder Received a Good Response") + String orderState = responseObj.get("state") + if("REJECTED".equalsIgnoreCase(orderState)) { + prepareFailedOperationStatusUpdate(execution) + return + } + JSONArray items = responseObj.getJSONArray("orderItem") + JSONObject item = items.get(0) as JSONObject + JSONObject service = item.get("service") as JSONObject + String networkServiceId = service.get("id") + + execution.setVariable("networkServiceId", networkServiceId) + String serviceOrderState = item.get("state") + execution.setVariable("ServiceOrderState", serviceOrderState) + // Get serviceOrder State and process progress + if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState) || "INPROGRESS".equalsIgnoreCase(serviceOrderState) || "IN_PROGRESS".equalsIgnoreCase(serviceOrderState)) { + execution.setVariable("deleteStatus", "processing") + } + else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { + execution.setVariable("deleteStatus", "completed") + } + else if("FAILED".equalsIgnoreCase(serviceOrderState)) { + msg = "ServiceOrder failed" + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + else { + msg = "ServiceOrder failed" + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + LOGGER.debug("NBI serviceOrder state: "+serviceOrderState) + } + else{ + msg = "Get ServiceOrder Received a Bad Response Code. Response Code is: " + responseCode + prepareFailedOperationStatusUpdate(execution) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } - getProgress(execution, url, basicAuthValue, "deleteStatus") + }catch(Exception e){ + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e.getMessage()) + } LOGGER.debug("${getPrefix()} Exit getDeleteServiceOrderProgress") } @@ -574,4 +659,8 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI { String getAction() { return ACTION } + + ExternalAPIUtil getExternalAPIUtil() { + return new ExternalAPIUtilFactory().create() + } } 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..9debd4011b 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,75 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { logger.debug(Prefix + "processOofSelection method finished") } + void prepareModifyTnNssiInputs(DelegateExecution execution) { + logger.debug(Prefix + "prepareModifyTnNssiInputs method start") + 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 e0c2b776fe..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 @@ -377,12 +377,23 @@ class TnNssmfUtils { logger.debug("mso.workflow.TnNssmf.enableSDNCNetworkConfig is undefined, so use default value (true)") enableSdnc = "true" } - enableSdnc = "false" logger.debug("setEnableSdncConfig: enableSdnc=" + enableSdnc) 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/DoDeallocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy index acace8c1c7..9ee9255499 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy @@ -20,31 +20,30 @@ package org.onap.so.bpmn.infrastructure.scripts -import com.fasterxml.jackson.databind.ObjectMapper import org.junit.Before import org.junit.Test import org.mockito.Mockito -import org.onap.aai.domain.yang.v19.* +import org.onap.aai.domain.yang.v19.AllottedResource +import org.onap.aai.domain.yang.v19.AllottedResources +import org.onap.aai.domain.yang.v19.ServiceInstance +import org.onap.aai.domain.yang.v19.SliceProfile import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.Relationships 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.logging.filter.base.ONAPComponents import org.onap.so.bpmn.common.scripts.ExternalAPIUtil -import org.onap.so.bpmn.common.scripts.ExternalAPIUtilFactory import org.onap.so.bpmn.common.scripts.MsoGroovyTest -import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.OofUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.serviceinstancebeans.RequestDetails import javax.ws.rs.core.Response import static org.junit.Assert.assertNotNull import static org.junit.Assert.assertTrue +import static org.mockito.ArgumentMatchers.any import static org.mockito.Mockito.* class DoDeallocateCoreNSSITest extends MsoGroovyTest { @@ -115,11 +114,6 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest { String authHeaderResponse = "auth-header" - /* String authHeaderResponse = "{\n" + - " \"errorCode\": \"401\",\n" + - " \"errorMessage\": \"Bad request\"\n" + - "}" */ - when(spy.getAuthHeader(mockExecution, "auth-value", "mso.msoKey")).thenReturn(authHeaderResponse) AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)) @@ -209,60 +203,32 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest { currentNSSI.put("networkServiceInstance", networkServiceInstance) - when(mockExecution.getVariable("mso.infra.endpoint.url")).thenReturn("http://mso.onap:8088") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("mso.msoKey") - when(mockExecution.getVariable("mso.infra.endpoint.auth")).thenReturn("mso.infra.endpoint.auth") + String externalAPIURL = "https://nbi.onap:8443/nbi/api/v4/serviceOrder" + when(mockExecution.getVariable("ExternalAPIURL")).thenReturn(externalAPIURL) DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) when(spy.getAAIClient()).thenReturn(client) - GenericVnf genericVnf = new GenericVnf() - genericVnf.setServiceId("service-id") - genericVnf.setVnfName("vnf-name") - genericVnf.setModelInvariantId("model-invariant-id") - genericVnf.setModelCustomizationId("model-customization-id") - genericVnf.setVnfName("vnf-name") - genericVnf.setVnfId("vnf-id") - - - currentNSSI.put("constituteVnf", genericVnf) + String serviceOrderRequest = "" - String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), genericVnf.getVnfId()) + when(mockExecution.getVariable("serviceOrderRequest")).thenReturn(serviceOrderRequest) - RequestDetails requestDetails = new RequestDetails() - ObjectMapper mapper = new ObjectMapper() - String requestDetailsStr = mapper.writeValueAsString(requestDetails) - - when(spy.prepareRequestDetails(mockExecution)).thenReturn(requestDetailsStr) - - MsoUtils msoUtilsMock = mock(MsoUtils.class) - String basicAuth = "basicAuth" - when(msoUtilsMock.getBasicAuth(anyString(), anyString())).thenReturn(basicAuth) - - HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class) - when(spy.getHttpClientFactory()).thenReturn(httpClientFactoryMock) Response responseMock = mock(Response.class) - HttpClient httpClientMock = mock(HttpClient.class) - - when(httpClientFactoryMock.newJsonClient(any(), any())).thenReturn(httpClientMock) - - when(httpClientMock.delete(requestDetailsStr)).thenReturn(responseMock) + ExternalAPIUtil externalAPIUtil = mock(ExternalAPIUtil.class) + when(spy.getExternalAPIUtil()).thenReturn(externalAPIUtil) + when(externalAPIUtil.executeExternalAPIPostCall(mockExecution, externalAPIURL, serviceOrderRequest)).thenReturn(responseMock) when(responseMock.getStatus()).thenReturn(200) - when(responseMock.hasEntity()).thenReturn(true) - String macroOperationId = "request-id" - String requestSelfLink = "request-self-link" - String entity = "{\"requestReferences\":{\"requestId\": \"${macroOperationId}\",\"requestSelfLink\":\"${requestSelfLink}\"}}" + String id = UUID.randomUUID().toString() + String entity = "{\"id\":\"${id}\"}" when(responseMock.readEntity(String.class)).thenReturn(entity) spy.deleteServiceOrder(mockExecution) - Mockito.verify(mockExecution,times(1)).setVariable("macroOperationId", macroOperationId) - Mockito.verify(mockExecution,times(1)).setVariable("requestSelfLink", requestSelfLink) + verify(mockExecution,times(1)).setVariable("ServiceOrderId", id) - assertTrue(currentNSSI['requestSelfLink'].equals(requestSelfLink)) } @@ -436,49 +402,44 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest { @Test void testDeleteServiceOrderProgressCompleted() { - executeDeleteServiceOrderProgress("COMPLETE") + executeDeleteServiceOrderProgress("COMPLETED") Mockito.verify(mockExecution,times(1)).setVariable("deleteStatus", "completed") } void executeDeleteServiceOrderProgress(String state) { def currentNSSI = [:] + currentNSSI.put("nssiId","5G-999") - when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) - - String url = "http://nbi.onap:8088/api/v4/serviceOrder/NS-777" + ServiceInstance networkServiceInstance = new ServiceInstance() + networkServiceInstance.setServiceInstanceId("NS-777") + networkServiceInstance.setServiceRole("Network Service") - currentNSSI['requestSelfLink'] = url + when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI) - DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) + currentNSSI.put("networkServiceInstance", networkServiceInstance) - /*ExternalAPIUtilFactory externalAPIUtilFactoryMock = mock(ExternalAPIUtilFactory.class) - when(spy.getExternalAPIUtilFactory()).thenReturn(externalAPIUtilFactoryMock) + String serviceOrder = UUID.randomUUID().toString() - ExternalAPIUtil externalAPIUtilMock = mock(ExternalAPIUtil.class) + when(mockExecution.getVariable("ServiceOrderId")).thenReturn(serviceOrder) - when(externalAPIUtilFactoryMock.create()).thenReturn(externalAPIUtilMock) */ + String externalAPIURL = "https://nbi.onap:8443/nbi/api/v4/serviceOrder" + when(mockExecution.getVariable("ExternalAPIURL")).thenReturn(externalAPIURL) - MsoUtils msoUtilsMock = mock(MsoUtils.class) - String basicAuth = "basicAuth" - when(msoUtilsMock.getBasicAuth(anyString(), anyString())).thenReturn(basicAuth) + DoDeallocateCoreNSSI spy = spy(DoDeallocateCoreNSSI.class) - HttpClientFactory httpClientFactoryMock = mock(HttpClientFactory.class) - when(spy.getHttpClientFactory()).thenReturn(httpClientFactoryMock) Response responseMock = mock(Response.class) - HttpClient httpClientMock = mock(HttpClient.class) + ExternalAPIUtil externalAPIUtil = mock(ExternalAPIUtil.class) + when(spy.getExternalAPIUtil()).thenReturn(externalAPIUtil) - - when(httpClientFactoryMock.newJsonClient(any(), any())).thenReturn(httpClientMock) - - when(httpClientMock.get()).thenReturn(responseMock) -// when(externalAPIUtilMock.executeExternalAPIGetCall(mockExecution, url)).thenReturn(responseMock) + externalAPIURL += "/" + serviceOrder + when(externalAPIUtil.executeExternalAPIGetCall(mockExecution, externalAPIURL)).thenReturn(responseMock) when(responseMock.getStatus()).thenReturn(200) - when(responseMock.hasEntity()).thenReturn(true) - String entity = "{\"request\":{\"requestStatus\":{\"requestState\":\"${state}\"}},\"state\":\"ACCEPTED\"}" + String id = UUID.randomUUID().toString() + String entity = "{\"state\":\"ACCEPTED\",\"orderItem\":[{\"state\":\"${state}\",\"service\":{\"id\":\"${id}\"}}]}" when(responseMock.readEntity(String.class)).thenReturn(entity) spy.getDeleteServiceOrderProgress(mockExecution) 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..fb03f6fa45 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="jobId" 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..513f715cde 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() @@ -638,7 +639,7 @@ deallocator.deleteANNSSI(execution)</bpmn:script> <bpmn:callActivity id="Activity_0umktii" name="Modify RAN NF NSSI" calledElement="DoModifyRanNfNssi"> <bpmn:extensionElements> <camunda:in source="anNfNssiId" target="serviceInstanceID" /> - <camunda:in source="anNfSliceProfileId" target="SliceProfileId" /> + <camunda:in source="anNfSliceProfileId" target="sliceProfileId" /> <camunda:in source="msoRequestId" target="msoRequestId" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> @@ -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 b0182c1b00..d7f2b85ea0 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, @@ -133,6 +134,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/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java index 0214a3f998..3617512d7b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java @@ -40,6 +40,8 @@ public class Resource implements Serializable { private String cvnfModuleCustomizationId; private String instanceName; private String modelInvariantId; + private String modelVersionId; + private String modelCustomizationId; private int processingPriority; private Resource parent; private List<Resource> children; @@ -140,6 +142,21 @@ public class Resource implements Serializable { this.modelInvariantId = modelInvariantId; } + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } public int getProcessingPriority() { return processingPriority == 0 ? (isBaseVfModule() ? Integer.MIN_VALUE + 1 : 0) : processingPriority; 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 31a7caacda..35e11963a3 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 @@ -42,6 +42,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; @@ -306,6 +307,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/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java index dda217fc79..22d78bb672 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.UUID; import java.util.stream.Collectors; @@ -49,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.BuildingBlockRollback; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; @@ -86,6 +88,9 @@ public class WorkflowActionBBTasks { private static final String VFMODULE = "VfModule"; private static final String CONFIGURATION_PATTERN = "(Ad|De)(.*)FabricConfiguration(.*)"; protected String maxRetries = "mso.rainyDay.maxRetries"; + private static final String ROLLBACK_TO_ASSIGNED = "RollbackToAssigned"; + private static final String UNASSIGN = "Unassign"; + private static final String DELETE = "Delete"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @Autowired @@ -316,94 +321,98 @@ public class WorkflowActionBBTasks { public void rollbackExecutionPath(DelegateExecution execution) { final String action = (String) execution.getVariable(BBConstants.G_ACTION); final String resourceName = (String) execution.getVariable("resourceName"); - if (!(boolean) execution.getVariable("isRollback")) { - List<ExecuteBuildingBlock> flowsToExecute = - (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - - List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = flowsToExecute.stream() - .filter(buildingBlock -> buildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) - .collect(Collectors.toList()); - - List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>(); - int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - int listSize = flowsToExecute.size(); + if ((boolean) execution.getVariable("isRollback")) { + workflowAction.buildAndThrowException(execution, + "Rollback has already been called. Cannot rollback a request that is currently in the rollback state."); + } + List<ExecuteBuildingBlock> flowsToExecute = + (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - for (int i = listSize - 1; i >= 0; i--) { - if (i > currentSequence - 1) { - flowsToExecute.remove(i); - } else { - String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName(); - if (flowName.startsWith("Assign")) { - flowName = flowName.replaceFirst("Assign", "Unassign"); - } else if (flowName.startsWith("Create")) { - flowName = flowName.replaceFirst("Create", "Delete"); - } else if (flowName.startsWith("Activate")) { - flowName = flowName.replaceFirst("Activate", "Deactivate"); - } else if (flowName.startsWith("Add")) { - flowName = flowName.replaceFirst("Add", "Delete"); - } else if (flowName.startsWith("VNF")) { - if (flowName.startsWith("VNFSet")) { - flowName = flowName.replaceFirst("VNFSet", "VNFUnset"); - } else if (flowName.startsWith("VNFLock")) { - flowName = flowName.replaceFirst("VNFLock", "VNFUnlock"); - } else if (flowName.startsWith("VNFStop")) { - flowName = flowName.replaceFirst("VNFStop", "VNFStart"); - } else if (flowName.startsWith("VNFQuiesce")) { - flowName = flowName.replaceFirst("VNFQuiesce", "VNFResume"); - } else { - continue; - } - } else { - continue; + List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = flowsToExecute.stream() + .filter(buildingBlock -> buildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) + .collect(Collectors.toList()); + List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>(); + int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE); + int listSize = flowsToExecute.size(); + List<BuildingBlockRollback> bbRollbackList = catalogDbClient.getBuildingBlockRollbackEntries(); + + for (int i = listSize - 1; i >= 0; i--) { + if (i > currentSequence - 1) { + flowsToExecute.remove(i); + } else { + // filter bbRollbackList for bbrollback, and check if action exists, then filter by action + BuildingBlock bb = flowsToExecute.get(i).getBuildingBlock(); + String flowName = bb.getBpmnFlowName(); + String scope = Objects.toString(bb.getBpmnScope(), ""); + String bbAction = Objects.toString(bb.getBpmnAction(), ""); + ExecuteBuildingBlock currentBB = (ExecuteBuildingBlock) execution.getVariable("buildingBlock"); + + List<BuildingBlockRollback> filteredList = bbRollbackList.stream() + .filter(k -> k.getBuildingBlockName().equals((flowName))).collect(Collectors.toList()); + Optional<BuildingBlockRollback> matchedBBRollback = + "".equals(bbAction) ? filteredList.stream().findFirst() + : filteredList.stream().filter(k -> bbAction.equals(k.getAction())).findFirst(); + if (matchedBBRollback.isPresent()) { + final BuildingBlockRollback buildingBlockRollbackItem = matchedBBRollback.get(); + String rollbackFlow = buildingBlockRollbackItem.getRollbackBuildingBlockName(); + flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(rollbackFlow); + // if we have an action, search the filtered list for the bbrollback that matches the given action. + if (null != buildingBlockRollbackItem.getRollbackAction()) { + logger.info("Setting rollback_action {} for BB: {} action: {}", + buildingBlockRollbackItem.getRollbackAction(), + buildingBlockRollbackItem.getBuildingBlockName(), + buildingBlockRollbackItem.getAction()); + flowsToExecute.get(i).getBuildingBlock() + .setBpmnAction(buildingBlockRollbackItem.getRollbackAction()); } - flowsToExecute.get(i).getBuildingBlock().setBpmnFlowName(flowName); rollbackFlows.add(flowsToExecute.get(i)); } } + } - String handlingCode = (String) execution.getVariable(HANDLINGCODE); - List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows); - if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode) - || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) { - for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) { - if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign") - && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) { - rollbackFlowsFiltered.remove(rollbackFlow); - } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete") - && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration") - && (ROLLBACKTOCREATED.equals(handlingCode) - || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode))) - || (rollbackFlow.getBuildingBlock().getBpmnFlowName() - .contains("FabricConfiguration") - && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) { - rollbackFlowsFiltered.remove(rollbackFlow); - } + String handlingCode = (String) execution.getVariable(HANDLINGCODE); + List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows); + if (ROLLBACK_TO_ASSIGNED.equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode) + || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)) { + for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) { + if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(UNASSIGN) + && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(FABRIC_CONFIGURATION)) { + rollbackFlowsFiltered.remove(rollbackFlow); + } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(DELETE) + && ((!rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(FABRIC_CONFIGURATION) + && (ROLLBACKTOCREATED.equals(handlingCode) + || ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode))) + || (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains(FABRIC_CONFIGURATION) + && ROLLBACKTOCREATEDNOCONFIGURATION.equals(handlingCode)))) { + rollbackFlowsFiltered.remove(rollbackFlow); } } + } - List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList<>(); - if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) { - for (ExecuteBuildingBlock executeBuildingBlock : rollbackFlowsFiltered) { - if (!executeBuildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) { - rollbackFlowsFilteredNonChangeBBs.add(executeBuildingBlock); - } + List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList<>(); + if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) { + for (ExecuteBuildingBlock executeBuildingBlock : rollbackFlowsFiltered) { + if (!executeBuildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) { + rollbackFlowsFilteredNonChangeBBs.add(executeBuildingBlock); } - rollbackFlowsFiltered.clear(); - rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs); - rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs); } - - workflowActionBBFailure.updateRequestErrorStatusMessage(execution); - execution.setVariable("isRollbackNeeded", !rollbackFlows.isEmpty()); - execution.setVariable("flowsToExecute", rollbackFlowsFiltered); - execution.setVariable(HANDLINGCODE, "PreformingRollback"); - execution.setVariable("isRollback", true); - execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0); - execution.setVariable(RETRY_COUNT, 0); - } else { - workflowAction.buildAndThrowException(execution, - "Rollback has already been called. Cannot rollback a request that is currently in the rollback state."); + rollbackFlowsFiltered.clear(); + rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs); + rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs); } + + logger.info("List of BuildingBlocks to execute for rollback"); + rollbackFlowsFiltered.forEach(item -> { + logger.info(item.getBuildingBlock().getBpmnFlowName()); + }); + + workflowActionBBFailure.updateRequestErrorStatusMessage(execution); + execution.setVariable("isRollbackNeeded", !rollbackFlows.isEmpty()); + execution.setVariable("flowsToExecute", rollbackFlowsFiltered); + execution.setVariable(HANDLINGCODE, "PreformingRollback"); + execution.setVariable("isRollback", true); + execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0); + execution.setVariable(RETRY_COUNT, 0); } protected void updateInstanceId(DelegateExecution execution) { 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 7bbc9f3739..7ffd066de5 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 @@ -53,5 +53,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/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java index f16365b742..9d76707e5a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java @@ -42,6 +42,8 @@ import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; @@ -207,6 +209,7 @@ public class ServiceEBBLoader { var serviceResource = new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false, null); serviceResource.setModelInvariantId(serviceInstanceAAI.getModelInvariantId()); + serviceResource.setModelVersionId(serviceInstanceAAI.getModelVersionId()); resourceList.add(serviceResource); traverseServiceInstanceChildService(resourceList, serviceResource, serviceInstanceAAI); traverseServiceInstanceMSOVnfs(resourceList, serviceResource, aaiResourceIds, serviceInstanceMSO); @@ -215,8 +218,15 @@ public class ServiceEBBLoader { for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO .getNetworks()) { aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId())); - resourceList - .add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource)); + Resource networkResource = + new Resource(WorkflowType.NETWORK, network.getNetworkId(), false, serviceResource); + ModelInfoNetwork modelInfoNetwork = network.getModelInfoNetwork(); + if (modelInfoNetwork != null) { + networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID()); + networkResource.setModelVersionId(modelInfoNetwork.getModelUUID()); + networkResource.setModelCustomizationId(modelInfoNetwork.getModelCustomizationUUID()); + } + resourceList.add(networkResource); } } if (serviceInstanceMSO.getCollection() != null) { @@ -261,6 +271,8 @@ public class ServiceEBBLoader { GenericVnf genericVnf = bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()); Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource); vnfResource.setVnfCustomizationId(genericVnf.getModelCustomizationId()); + vnfResource.setModelCustomizationId(genericVnf.getModelCustomizationId()); + vnfResource.setModelVersionId(genericVnf.getModelVersionId()); resourceList.add(vnfResource); traverseVnfModules(resourceList, vnfResource, aaiResourceIds, vnf); if (vnf.getVolumeGroups() != null) { @@ -281,7 +293,13 @@ public class ServiceEBBLoader { } for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) { aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId())); - resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource)); + Resource resource = new Resource(WorkflowType.PNF, pnf.getPnfId(), false, serviceResource); + ModelInfoPnf modelInfo = pnf.getModelInfoPnf(); + if (modelInfo != null) { + resource.setModelVersionId(modelInfo.getModelUuid()); + resource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + } + resourceList.add(resource); } } @@ -494,6 +512,10 @@ public class ServiceEBBLoader { for (VfModule vfModule : vnf.getVfModules()) { aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource); + org.onap.aai.domain.yang.VfModule aaiVfModule = + bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + resource.setModelCustomizationId(aaiVfModule.getModelCustomizationId()); + resource.setModelInvariantId(aaiVfModule.getModelInvariantId()); resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean()); resourceList.add(resource); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java index b8b9c458fa..b56bd905a6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java @@ -38,6 +38,7 @@ import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; +import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.Networks; import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.Service; @@ -93,6 +94,11 @@ public class UserParamsServiceTraversal { List<Resource> resourceList = new ArrayList<>(); Resource serviceResource = new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false, null); + ModelInfo modelInfo = validate.getModelInfo(); + if (modelInfo != null) { + serviceResource.setModelVersionId(modelInfo.getModelVersionId()); + serviceResource.setModelInvariantId(modelInfo.getModelInvariantUuid()); + } resourceList.add(serviceResource); if (validate.getResources().getServices() != null) { setResourceListForChildServices(execution, resourceList, serviceResource, validate); @@ -129,6 +135,11 @@ public class UserParamsServiceTraversal { serviceResource); vnfResource.setProcessingPriority(vnf.getProcessingPriority()); vnfResource.setInstanceName(vnf.getInstanceName()); + ModelInfo modelInfo = vnf.getModelInfo(); + if (modelInfo != null) { + vnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + vnfResource.setModelVersionId(modelInfo.getModelVersionId()); + } resourceList.add(vnfResource); setResourceListForVfModules(execution, resourceList, vnfResource, validate, vnf); } @@ -174,6 +185,11 @@ public class UserParamsServiceTraversal { foundVfModuleOrVG = true; Resource resource = setVfModuleWorkFlowTypeToResourceList(resourceList, vnfResource, vfModuleCustomization, vfModule); + if (vnf.getModelInfo() != null) { + resource.setModelVersionId(vnf.getModelInfo().getModelVersionId()); + } + resource.setVfModuleCustomizationId(vfModuleCustomization.getModelCustomizationUUID()); + resource.setModelCustomizationId(vfModuleCustomization.getModelCustomizationUUID()); setConfigurationWorkFlowTypeToResourceList(resourceList, vnfResource, validate, vnf, vfModule, resource); } } @@ -225,6 +241,11 @@ public class UserParamsServiceTraversal { for (Pnfs pnf : validate.getResources().getPnfs()) { Resource pnfResource = new Resource(WorkflowType.PNF, pnf.getModelInfo().getModelCustomizationId(), false, serviceResource); + ModelInfo modelInfo = pnf.getModelInfo(); + if (modelInfo != null) { + pnfResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + pnfResource.setModelVersionId(modelInfo.getModelVersionId()); + } pnfResource.setProcessingPriority(pnf.getProcessingPriority()); resourceList.add(pnfResource); } @@ -236,6 +257,11 @@ public class UserParamsServiceTraversal { Resource networkResource = new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false, serviceResource); networkResource.setProcessingPriority(network.getProcessingPriority()); + ModelInfo modelInfo = network.getModelInfo(); + if (modelInfo != null) { + networkResource.setModelCustomizationId(modelInfo.getModelCustomizationUuid()); + networkResource.setModelVersionId(modelInfo.getModelVersionId()); + } resourceList.add(networkResource); } if (requestAction.equals(CREATE_INSTANCE)) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java index b950eb41be..3778f64612 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoader.java @@ -40,7 +40,6 @@ 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.bbobjects.VolumeGroup; -import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.client.exception.ExceptionBuilder; @@ -117,6 +116,9 @@ public class VnfEBBLoader { if (vnf.getVnfId().equals(vnfId)) { aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); Resource vnfResource = new Resource(WorkflowType.VNF, vnf.getVnfId(), false, serviceResource); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId()); + vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId()); resourceList.add(vnfResource); processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution); processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource); @@ -131,8 +133,11 @@ public class VnfEBBLoader { for (GenericVnf vnf : serviceInstanceMSO.getVnfs()) { if (vnf.getVnfId().equals(vnfId)) { aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId())); - Resource vnfResource = new Resource(WorkflowType.VNF, - bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(), false, serviceResource); + org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + Resource vnfResource = + new Resource(WorkflowType.VNF, aaiGenericVnf.getModelCustomizationId(), false, serviceResource); + vnfResource.setModelCustomizationId(aaiGenericVnf.getModelCustomizationId()); + vnfResource.setModelVersionId(aaiGenericVnf.getModelVersionId()); resourceList.add(vnfResource); processVfModules(vnf, aaiResourceIds, resourceList, vnfResource, execution); processVolumeGroups(vnf, aaiResourceIds, resourceList, vnfResource); @@ -141,10 +146,10 @@ public class VnfEBBLoader { } } - private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId, - List<Resource> resourceList, Resource vfModuleResource, List<Pair<WorkflowType, String>> aaiResourceIds) { + private void findConfigurationsInsideVfModule(DelegateExecution execution, + org.onap.aai.domain.yang.VfModule aaiVfModule, List<Resource> resourceList, Resource vfModuleResource, + List<Pair<WorkflowType, String>> aaiResourceIds) { try { - org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId); AAIResultWrapper vfModuleWrapper = new AAIResultWrapper( new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiVfModule)); Optional<Relationships> relationshipsOp; @@ -166,11 +171,14 @@ public class VnfEBBLoader { aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId())); Resource vfModuleResource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource); - Optional.ofNullable(vfModule.getModelInfoVfModule()).map(ModelInfoVfModule::getIsBaseBoolean) - .ifPresent(vfModuleResource::setBaseVfModule); + org.onap.aai.domain.yang.VfModule aaiVfModule = + bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId()); + vfModuleResource.setModelInvariantId(aaiVfModule.getModelInvariantId()); + vfModuleResource.setModelCustomizationId(aaiVfModule.getModelCustomizationId()); + vfModuleResource.setBaseVfModule(aaiVfModule.isIsBaseVfModule()); resourceList.add(vfModuleResource); - findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(), resourceList, - vfModuleResource, aaiResourceIds); + findConfigurationsInsideVfModule(execution, aaiVfModule, resourceList, vfModuleResource, + aaiResourceIds); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index ff6c113af3..dc77ea1f0c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -24,12 +24,10 @@ import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; -import org.apache.logging.log4j.util.Strings; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner; import org.onap.so.bpmn.common.listener.flowmanipulator.PreFlowManipulator; -import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.PnfResourceCustomization; import org.onap.so.db.catalog.beans.Service; @@ -40,7 +38,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; @Component public class SkipCDSBuildingBlockListener implements PreFlowManipulator { @@ -76,43 +73,37 @@ public class SkipCDSBuildingBlockListener implements PreFlowManipulator { @Override public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB, BuildingBlockExecution execution) { - String customizationUUID = currentBB.getBuildingBlock().getKey(); + String resourceKey = currentBB.getBuildingBlock().getKey(); + List<Resource> resources = execution.getVariable("resources"); + Resource resource = resources.stream().filter(r -> resourceKey.equals(r.getResourceId())).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Resource not found for key:" + resourceKey)); - if ("SERVICE".equalsIgnoreCase(currentBB.getBuildingBlock().getBpmnScope())) { - String modelUUID = currentBB.getRequestDetails().getModelInfo().getModelUuid(); - Service service = catalogDbClient.getServiceByID(modelUUID); - currentSequenceSkipCheck(execution, service.getSkipPostInstConf()); - } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VNF") - && containsIgnoreCaseAction(currentBB, vnfActions)) { - List<VnfResourceCustomization> vnfResourceCustomizations = - catalogDbClient.getVnfResourceCustomizationByModelUuid( - currentBB.getRequestDetails().getModelInfo().getModelUuid()); - if (!CollectionUtils.isEmpty(vnfResourceCustomizations)) { - VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID, - vnfResourceCustomizations); - if (null != vrc) { - logger.debug("getSkipPostInstConf value: " + vrc.getSkipPostInstConf().booleanValue()); - boolean skipConfigVNF = vrc.getSkipPostInstConf().booleanValue(); - currentSequenceSkipCheck(execution, skipConfigVNF); - } + String scope = currentBB.getBuildingBlock().getBpmnScope(); + if ("SERVICE".equalsIgnoreCase(scope)) { + Service service = catalogDbClient.getServiceByID(resource.getModelVersionId()); + currentSequenceSkipCheck(execution, service.getSkipPostInstConf()); + } else if ("VNF".equalsIgnoreCase(scope) && containsIgnoreCaseAction(currentBB, vnfActions)) { + VnfResourceCustomization vrc = catalogDbClient + .getVnfResourceCustomizationByModelCustomizationUUID(resource.getModelCustomizationId()); + if (vrc != null) { + logger.debug("getSkipPostInstConf value: " + vrc.getSkipPostInstConf()); + boolean skipConfigVNF = vrc.getSkipPostInstConf(); + currentSequenceSkipCheck(execution, skipConfigVNF); } } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("VFModule") && containsIgnoreCaseAction(currentBB, vFModuleAction)) { - - VfModuleCustomization vfc = - catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(customizationUUID); - + VfModuleCustomization vfc = catalogDbClient + .getVfModuleCustomizationByModelCuztomizationUUID(resource.getModelCustomizationId()); if (null != vfc) { logger.debug("getSkipPostInstConf value: " + vfc.getSkipPostInstConf().booleanValue()); boolean skipVfModule = vfc.getSkipPostInstConf(); currentSequenceSkipCheck(execution, skipVfModule); } - } else if (currentBB.getBuildingBlock().getBpmnScope().equalsIgnoreCase("PNF") && containsIgnoreCaseAction(currentBB, pnfActions)) { - PnfResourceCustomization pnfResourceCustomization = - catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(customizationUUID); + PnfResourceCustomization pnfResourceCustomization = catalogDbClient + .getPnfResourceCustomizationByModelCustomizationUUID(resource.getModelCustomizationId()); if (null != pnfResourceCustomization) { logger.debug("getSkipPostInstConf value: " + pnfResourceCustomization.getSkipPostInstConf()); 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; + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index 28d2abc792..7d4267efbb 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -25,13 +25,16 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -42,7 +45,17 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIConfigurationResources; +import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIPnfResources; +import org.onap.so.client.orchestration.AAIServiceInstanceResources; +import org.onap.so.client.orchestration.AAIVfModuleResources; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.db.catalog.beans.OrchestrationStatus; import java.util.HashMap; import static org.junit.Assert.assertEquals; @@ -57,8 +70,29 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -public class AAIUpdateTasksTest extends BaseTaskTest { - +@RunWith(MockitoJUnitRunner.Silent.class) +public class AAIUpdateTasksTest extends TestDataSetup { + + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected AAIServiceInstanceResources aaiServiceInstanceResources; + @Mock + protected AAIPnfResources aaiPnfResources; + @Mock + protected AAIVnfResources aaiVnfResources; + @Mock + protected AAIVfModuleResources aaiVfModuleResources; + @Mock + protected AAIVolumeGroupResources aaiVolumeGroupResources; + @Mock + protected AAINetworkResources aaiNetworkResources; + @Mock + protected AAICollectionResources aaiCollectionResources; + @Mock + protected AAIConfigurationResources aaiConfigurationResources; @InjectMocks private AAIUpdateTasks aaiUpdateTasks = new AAIUpdateTasks(); @@ -99,7 +133,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedServiceTest() throws Exception { + public void updateOrchestrationStatusAssignedServiceTest() { doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); @@ -110,7 +144,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception { + public void updateOrchestrationStatusAssignedServiceExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiServiceInstanceResources) @@ -120,7 +154,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveServiceTest() throws Exception { + public void updateOrchestrationStatusActiveServiceTest() { doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); @@ -131,7 +165,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception { + public void updateOrchestrationStatusActiveServiceExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiServiceInstanceResources) @@ -221,7 +255,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedVnfTest() throws Exception { + public void updateOrchestrationStatusAssignedVnfTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution); @@ -230,7 +264,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception { + public void updateOrchestrationStatusAssignedVnfExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, @@ -240,7 +274,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVnfTest() throws Exception { + public void updateOrchestrationStatusActiveVnfTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution); @@ -249,7 +283,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception { + public void updateOrchestrationStatusActiveVnfExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, @@ -259,7 +293,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignVfModuleTest() throws Exception { + public void updateOrchestrationStatusAssignVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution); @@ -269,7 +303,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusAssignVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); @@ -279,7 +313,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception { + public void updateOrchestrationStatusCreatedVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution); @@ -288,7 +322,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusCreatedVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); @@ -298,7 +332,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception { + public void updateOrchestrationStatusPendingActivatefModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); @@ -309,7 +343,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); @@ -319,7 +353,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception { + public void updateOrchestrationStatusDectivateVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); @@ -330,7 +364,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusDectivateVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); @@ -340,7 +374,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVfModuleTest() throws Exception { + public void updateHeatStackIdVfModuleTest() { execution.setVariable("heatStackId", "newHeatStackId"); doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); @@ -351,18 +385,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVfModuleToNullTest() throws Exception { + public void updateHeatStackIdVfModuleToNullTest() { execution.setVariable("heatStackId", null); doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); aaiUpdateTasks.updateHeatStackIdVfModule(execution); verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf); - assertEquals(vfModule.getHeatStackId(), ""); + assertEquals("", vfModule.getHeatStackId()); } @Test - public void updateHeatStackIdVfModuleExceptionTest() throws Exception { + public void updateHeatStackIdVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf); expectedException.expect(BpmnError.class); @@ -371,7 +405,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception { + public void updateOrchestrationStatusActiveVolumeGroupTest() { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); @@ -382,7 +416,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception { + public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); @@ -390,7 +424,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception { + public void updateOrchestrationStatusCreatedVolumeGroupTest() { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); @@ -401,7 +435,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception { + public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); @@ -409,7 +443,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception { + public void test_updateOrchestrationStatusAssignedVolumeGroup() { doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); @@ -421,7 +455,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception { + public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); @@ -429,7 +463,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVolumeGroupTest() throws Exception { + public void updateHeatStackIdVolumeGroupTest() { execution.setVariable("heatStackId", "newHeatStackId"); doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); @@ -440,18 +474,18 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateHeatStackIdVolumeGroupToNullTest() throws Exception { + public void updateHeatStackIdVolumeGroupToNullTest() { execution.setVariable("heatStackId", null); doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); - assertEquals(volumeGroup.getHeatStackId(), ""); + assertEquals("", volumeGroup.getHeatStackId()); } @Test - public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception { + public void updateHeatStackIdVolumeGroupExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); @@ -459,7 +493,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateNetworkExceptionTest() throws Exception { + public void updateNetworkExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiNetworkResources).updateNetwork(network); @@ -468,21 +502,21 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOstatusActivedNetworkCollectionTest() throws Exception { + public void updateOstatusActivedNetworkCollectionTest() { doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection()); } @Test - public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception { + public void updateOstatusActiveNetworkColectionExceptionTest() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); } @Test - public void updateOrchestrationStatusActivateVfModuleTest() throws Exception { + public void updateOrchestrationStatusActivateVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); @@ -493,7 +527,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception { + public void updateOrchestrationStatusActivateVfModuleExceptionTest() { doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); @@ -642,7 +676,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception { + public void updateOrchestrationStatusDeleteVfModuleTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); @@ -668,7 +702,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception { + public void updateOrchestrationStatusDeactivateFabricConfigurationTest() { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); @@ -680,7 +714,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception { + public void updateOrchestrationStatusActivateFabricConfigurationTest() { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE); @@ -692,7 +726,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusAssignedFabricConfigurationTest() throws Exception { + public void updateOrchestrationStatusAssignedFabricConfigurationTest() { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED); @@ -704,7 +738,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateContrailServiceInstanceFqdnVfModuleTest() throws Exception { + public void updateContrailServiceInstanceFqdnVfModuleTest() { execution.setVariable("contrailServiceInstanceFqdn", "newContrailServiceInstanceFqdn"); doNothing().when(aaiVfModuleResources).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); @@ -715,13 +749,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() throws Exception { + public void updateContrailServiceInstanceFqdnVfModuleNoUpdateTest() { aaiUpdateTasks.updateContrailServiceInstanceFqdnVfModule(execution); verify(aaiVfModuleResources, times(0)).updateContrailServiceInstanceFqdnVfModule(vfModule, genericVnf); } @Test - public void updateIpv4OamAddressVnfTest() throws Exception { + public void updateIpv4OamAddressVnfTest() { execution.setVariable("oamManagementV4Address", "newIpv4OamAddress"); doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); @@ -732,13 +766,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateIpv4OamAddressVnfNoUpdateTest() throws Exception { + public void updateIpv4OamAddressVnfNoUpdateTest() { aaiUpdateTasks.updateIpv4OamAddressVnf(execution); verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf); } @Test - public void updateManagementV6AddressVnfTest() throws Exception { + public void updateManagementV6AddressVnfTest() { execution.setVariable("oamManagementV6Address", "newManagementV6Address"); doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); @@ -749,13 +783,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateManagementV6AddressVnfNoUpdateTest() throws Exception { + public void updateManagementV6AddressVnfNoUpdateTest() { aaiUpdateTasks.updateManagementV6AddressVnf(execution); verify(aaiVnfResources, times(0)).updateObjectVnf(genericVnf); } @Test - public void updateOrchestrationStatusVnfConfigureTest() throws Exception { + public void updateOrchestrationStatusVnfConfigureTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURE); @@ -763,7 +797,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVnfConfiguredTest() throws Exception { + public void updateOrchestrationStatusVnfConfiguredTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGURED); @@ -777,7 +811,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVnfConfigAssignedTest() throws Exception { + public void updateOrchestrationStatusVnfConfigAssignedTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGASSIGNED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-assign"); @@ -786,7 +820,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVnfConfigDeployedTest() throws Exception { + public void updateOrchestrationStatusVnfConfigDeployedTest() { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.CONFIGDEPLOYED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vnf", "config-deploy"); @@ -795,7 +829,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVfModuleConfigDeployedTest() throws Exception { + public void updateOrchestrationStatusVfModuleConfigDeployedTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGDEPLOYED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-deploy"); @@ -804,7 +838,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test - public void updateOrchestrationStatusVfModuleConfigAssignedTest() throws Exception { + public void updateOrchestrationStatusVfModuleConfigAssignedTest() { doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CONFIGASSIGNED); aaiUpdateTasks.updateOrchestrationStatus(execution, "vfmodule", "config-assign"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java index 60bed17447..9e70a66b76 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java @@ -31,11 +31,14 @@ import java.util.Map; import java.util.Optional; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -43,9 +46,20 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.orchestration.NetworkAdapterResources; -public class NetworkAdapterCreateTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterCreateTasksTest extends TestDataSetup { + + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; + @Mock + protected NetworkAdapterResources networkAdapterResources; @InjectMocks private NetworkAdapterCreateTasks networkAdapterCreateTasks = new NetworkAdapterCreateTasks(); @@ -77,7 +91,7 @@ public class NetworkAdapterCreateTasksTest extends BaseTaskTest { } @Test - public void createNetworkTest() throws Exception { + public void createNetworkTest() { String cloudRegionPo = "cloudRegionPo"; CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); execution.setVariable("cloudRegionPo", cloudRegionPo); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java index eb481651f0..6c9ec5932e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java @@ -27,27 +27,36 @@ import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.io.UnsupportedEncodingException; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterDeleteTasksTest extends TestDataSetup { -public class NetworkAdapterDeleteTasksTest extends BaseTaskTest { - + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; @InjectMocks private NetworkAdapterDeleteTasks networkAdapterDeleteTasks = new NetworkAdapterDeleteTasks(); @@ -72,7 +81,7 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest { } @Test - public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException { + public void test_deleteNetwork() { DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); doReturn(deleteNetworkRequest).when(networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); @@ -83,7 +92,7 @@ public class NetworkAdapterDeleteTasksTest extends BaseTaskTest { } @Test - public void test_deleteNetwork_exception() throws UnsupportedEncodingException, NetworkAdapterClientException { + public void test_deleteNetwork_exception() { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(networkAdapterObjectMapper).deleteNetworkRequestMapper( diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java index 10cc09cdcc..cf97fa0b82 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterImplTest.java @@ -5,13 +5,20 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertNotNull; import javax.xml.bind.JAXBException; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.FileUtil; import org.onap.so.adapters.nwrest.CreateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; -public class NetworkAdapterImplTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterImplTest extends TestDataSetup { + @Mock + protected ExtractPojosForBB extractPojosForBB; @InjectMocks private NetworkAdapterImpl networkAdapterImpl = new NetworkAdapterImpl(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java index 64a315ad4d..082d410f96 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java @@ -21,28 +21,22 @@ package org.onap.so.bpmn.infrastructure.adapter.network.tasks; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.io.UnsupportedEncodingException; import java.util.Map; -import java.util.Optional; -import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; -import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; -import org.onap.so.adapters.nwrest.UpdateNetworkResponse; -import org.onap.so.bpmn.BaseTaskTest; -import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; @@ -50,11 +44,16 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; -import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; -public class NetworkAdapterUpdateTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class NetworkAdapterUpdateTasksTest extends TestDataSetup { + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; @InjectMocks private NetworkAdapterUpdateTasks networkAdapterUpdateTasks = new NetworkAdapterUpdateTasks(); @@ -84,7 +83,7 @@ public class NetworkAdapterUpdateTasksTest extends BaseTaskTest { } @Test - public void updateNetworkTest() throws Exception { + public void updateNetworkTest() { String cloudRegionPo = "cloudRegionPo"; UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest(); execution.setVariable("cloudRegionPo", cloudRegionPo); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java index 13f2b81fd9..ef2e742795 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -30,12 +30,15 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -44,9 +47,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; import org.onap.so.db.catalog.beans.OrchestrationStatus; -public class VnfAdapterCreateTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class VnfAdapterCreateTasksTest extends TestDataSetup { + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + @Mock + protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources; @InjectMocks private VnfAdapterCreateTasks vnfAdapterCreateTasks = new VnfAdapterCreateTasks(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java index c680978953..e7b3d3e403 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java @@ -31,12 +31,15 @@ import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; @@ -45,8 +48,22 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; - -public class VnfAdapterDeleteTasksTest extends BaseTaskTest { +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class VnfAdapterDeleteTasksTest extends TestDataSetup { + + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources; + @Mock + protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; @InjectMocks private VnfAdapterDeleteTasks vnfAdapterDeleteTasks = new VnfAdapterDeleteTasks(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java index 16e8c2de7d..51bd77065b 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -30,22 +30,30 @@ import static org.mockito.Mockito.when; import org.camunda.bpm.engine.delegate.BpmnError; import org.junit.Before; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.FileUtil; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; 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.bbobjects.VolumeGroup; 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.exception.BBObjectNotFoundException; -import org.springframework.beans.factory.annotation.Autowired; - -public class VnfAdapterImplTest extends BaseTaskTest { - +import org.onap.so.client.exception.ExceptionBuilder; + +@RunWith(MockitoJUnitRunner.Silent.class) +public class VnfAdapterImplTest extends TestDataSetup { + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ExtractPojosForBB extractPojosForBB; @InjectMocks private VnfAdapterImpl vnfAdapterImpl = new VnfAdapterImpl(); @@ -159,12 +167,12 @@ public class VnfAdapterImplTest extends BaseTaskTest { execution.setVariable("WorkflowResponse", VNF_ADAPTER_REST_DELETE_RESPONSE); vnfAdapterImpl.postProcessVnfAdapter(execution); assertNull(vfModule.getHeatStackId()); - assertEquals(vfModule.getContrailServiceInstanceFqdn(), ""); - assertEquals(execution.getVariable("contrailServiceInstanceFqdn"), ""); - assertEquals(genericVnf.getIpv4OamAddress(), ""); - assertEquals(execution.getVariable("oamManagementV4Address"), ""); - assertEquals(genericVnf.getManagementV6Address(), ""); - assertEquals(execution.getVariable("oamManagementV6Address"), ""); + assertEquals("", vfModule.getContrailServiceInstanceFqdn()); + assertEquals("", execution.getVariable("contrailServiceInstanceFqdn")); + assertEquals("", genericVnf.getIpv4OamAddress()); + assertEquals("", execution.getVariable("oamManagementV4Address")); + assertEquals("", genericVnf.getManagementV6Address()); + assertEquals("", execution.getVariable("oamManagementV6Address")); assertEquals(TEST_CONTRAIL_NETWORK_POLICY_FQDNS, execution.getVariable("contrailNetworkPolicyFqdnList")); } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java index d7d6da209e..ad965373dc 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java @@ -34,13 +34,16 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Optional; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest; import org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf; -import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; @@ -48,14 +51,23 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.db.catalog.client.CatalogDbClient; -public class AppcOrchestratorPreProcessorTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class AppcOrchestratorPreProcessorTest extends TestDataSetup { private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; - + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected AAIVnfResources aaiVnfResources; + @Mock + protected CatalogDbClient catalogDbClient; @InjectMocks private AppcOrchestratorPreProcessor appcOrchestratorPreProcessor = new AppcOrchestratorPreProcessor(); @@ -111,7 +123,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest { } @Test - public void addVmInfoToAppcTaskRequestTest() throws Exception { + public void addVmInfoToAppcTaskRequestTest() { ApplicationControllerTaskRequest appcTaskRequest = new ApplicationControllerTaskRequest(); ApplicationControllerVnf applicationControllerVnf = new ApplicationControllerVnf(); appcTaskRequest.setApplicationControllerVnf(applicationControllerVnf); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java index d2a38cb693..e386dff4a1 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -37,25 +37,43 @@ import java.util.HashMap; import java.util.Map; import java.util.Optional; import org.junit.Test; +import org.junit.runner.RunWith; import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; -import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.appc.ApplicationControllerAction; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.db.catalog.beans.ControllerSelectionReference; import com.fasterxml.jackson.databind.ObjectMapper; +import org.onap.so.db.catalog.client.CatalogDbClient; -public class AppcRunTasksTest extends BaseTaskTest { +@RunWith(MockitoJUnitRunner.Silent.class) +public class AppcRunTasksTest extends TestDataSetup { private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; - + @Mock + protected ExtractPojosForBB extractPojosForBB; + @Mock + protected CatalogDbClient catalogDbClient; + @Mock + protected ExceptionBuilder exceptionUtil; + @Mock + protected ApplicationControllerAction appCClient; + @Mock + protected AAIVnfResources aaiVnfResources; @InjectMocks private AppcRunTasks appcRunTasks = new AppcRunTasks(); @@ -171,7 +189,7 @@ public class AppcRunTasksTest extends BaseTaskTest { } @Test - public void testUserParams() throws Exception { + public void testUserParams() { Map<String, Object> userParams = new HashMap<String, Object>(); userParams.put("existing_software_version", "3.1"); userParams.put("new_software_version", "3.2"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java index cbb746d514..2e4d99f9c6 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -35,6 +35,8 @@ import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import java.util.Arrays; +import java.util.Collections; import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -64,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.db.catalog.beans.BuildingBlockRollback; import org.onap.so.db.catalog.beans.ConfigurationResource; import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; @@ -109,6 +112,11 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { private DelegateExecution mockExecution; @Before + public void initCatalogDBRollbackTable() { + when(catalogDbClient.getBuildingBlockRollbackEntries()).thenReturn(getRollbackBuildingBlockList()); + } + + @Before public void before() throws Exception { execution = new DelegateExecutionFake(); ServiceInstance servInstance = new ServiceInstance(); @@ -614,6 +622,52 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test + public void rollbackExecutionRollbackControllerExecutionBBTest() { + execution.setVariable("isRollback", false); + execution.setVariable("handlingCode", "Rollback"); + execution.setVariable("requestAction", EMPTY_STRING); + execution.setVariable("resourceName", EMPTY_STRING); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB"); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1); + flowsToExecute.add(ebb1); + + BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB"); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2); + flowsToExecute.add(ebb2); + + BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("AssignVnfBB"); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3); + flowsToExecute.add(ebb3); + + BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB"); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4); + flowsToExecute.add(ebb4); + + BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ControllerExecutionBB"); + buildingBlock5.setBpmnScope("vnf"); + buildingBlock5.setBpmnAction("config-assign"); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5); + flowsToExecute.add(ebb5); + + BuildingBlock buildingBlock6 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB"); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock6); + flowsToExecute.add(ebb6); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 5); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + BuildingBlock bb = ebbs.get(0).getBuildingBlock(); + assertEquals("ControllerExecutionBB", bb.getBpmnFlowName()); + assertEquals("vnf", bb.getBpmnScope()); + assertEquals("config-unassign", bb.getBpmnAction()); + assertEquals(0, execution.getVariable("gCurrentSequence")); + assertEquals(5, ebbs.size()); + } + + @Test public void postProcessingExecuteBBActivateVfModuleNotReplaceInstanceTest() throws CloneNotSupportedException { WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); workflowResourceIds.setServiceInstanceId("1"); @@ -1061,4 +1115,40 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { execution.setVariable("homing", false); execution.setVariable("calledHoming", false); } + + private List<BuildingBlockRollback> getRollbackBuildingBlockList() { + List<BuildingBlockRollback> rollbackBBList = Collections.unmodifiableList(Arrays.asList( + new BuildingBlockRollback(1, "ActivateNetworkBB", null, "DeactivateNetworkBB", null), + new BuildingBlockRollback(2, "ActivatePnfBB", null, "DeactivatePnfBB", null), + new BuildingBlockRollback(3, "ActivateServiceInstanceBB", null, "DeactivateServiceInstanceBB", null), + new BuildingBlockRollback(4, "ActivateVfModuleBB", null, "DeactivateVfModuleBB", null), + new BuildingBlockRollback(5, "ActivateVnfBB", null, "DeactivateVnfBB", null), + new BuildingBlockRollback(6, "ActivateVolumeGroupBB", null, "DeactivateVolumeGroupBB", null), + new BuildingBlockRollback(7, "AssignNetworkBB", null, "UnassignNetworkBB", null), + new BuildingBlockRollback(8, "AssignServiceInstanceBB", null, "UnassignServiceInstanceBB", null), + new BuildingBlockRollback(9, "AssignVfModuleBB", null, "UnassignVfModuleBB", null), + new BuildingBlockRollback(10, "AssignVnfBB", null, "UnassignVnfBB", null), + new BuildingBlockRollback(11, "AssignVolumeGroupBB", null, "UnassignVolumeGroupBB", null), + new BuildingBlockRollback(12, "ControllerExecutionBB", "config-assign", "ControllerExecutionBB", + "config-unassign"), + new BuildingBlockRollback(13, "ControllerExecutionBB", "config-deploy", "ControllerExecutionBB", + "config-undeploy"), + new BuildingBlockRollback(14, "ControllerExecutionBB", "service-config-deploy", "ControllerExecutionBB", + "service-config-undeploy"), + new BuildingBlockRollback(15, "CreateNetworkBB", null, "DeleteNetworkBB", null), + new BuildingBlockRollback(16, "CreateNetworkCollectionBB", null, "DeleteNetworkCollectionBB", null), + new BuildingBlockRollback(17, "CreateVfModuleBB", null, "DeleteVfModuleBB", null), + new BuildingBlockRollback(18, "CreateVolumeGroupBB", null, "DeleteVolumeGroupBB", null), + new BuildingBlockRollback(19, "VNFSetInMaintFlagActivity", null, "VNFUnsetInMaintFlagActivity", null), + new BuildingBlockRollback(20, "VNFSetClosedLoopDisabledFlagActivity", null, + "VNFUnsetClosedLoopDisabledFlagActivity", null), + new BuildingBlockRollback(21, "VNFLockActivity", null, "VNFUnlockActivity", null), + new BuildingBlockRollback(22, "VNFStopActivity", null, "VNFStartActivity", null), + new BuildingBlockRollback(23, "VNFQuiesceTrafficActivity", null, "VNFResumeTrafficActivity", null), + new BuildingBlockRollback(24, "EtsiVnfInstantiateBB", null, "EtsiVnfDeleteBB", null), + // AddFabricConfigurationBB this does not seem to be present as a bpmn in Guilin + new BuildingBlockRollback(25, "AddFabricConfigurationBB", null, "DeleteFabricConfigurationBB", null))); + return rollbackBBList; + } + } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java index 52196aae49..a044944f29 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -409,6 +409,10 @@ public class WorkflowActionTest extends BaseTaskTest { serviceInstanceMSO.getVnfs().add(vnf); + VfModule aaiVfModule = new VfModule(); + aaiVfModule.setIsBaseVfModule(false); + + doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any()); doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any()); @@ -932,6 +936,10 @@ public class WorkflowActionTest extends BaseTaskTest { serviceInstanceMSO.getVnfs().add(vnf); serviceInstanceMSO.getPnfs().add(pnf); + VfModule aaiVfModule = new VfModule(); + aaiVfModule.setIsBaseVfModule(false); + + doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any()); doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any()); @@ -1013,6 +1021,10 @@ public class WorkflowActionTest extends BaseTaskTest { serviceInstanceMSO.getVnfs().add(vnf); + VfModule aaiVfModule = new VfModule(); + aaiVfModule.setIsBaseVfModule(false); + + doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any()); doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any()); @@ -1104,6 +1116,11 @@ public class WorkflowActionTest extends BaseTaskTest { serviceInstanceMSO.getVnfs().add(vnf); + org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule(); + aaiVfModule.setIsBaseVfModule(false); + + doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any()); + doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(bbSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, @@ -1151,21 +1168,26 @@ public class WorkflowActionTest extends BaseTaskTest { vfModule2.setVfModuleId("vfModule2"); vnf.getVfModules().add(vfModule2); serviceInstanceMSO.getVnfs().add(vnf); - VfModule vfModuleAAI = new VfModule(); - vfModuleAAI.setVfModuleId("vfModule2"); + VfModule vfModuleAAI1 = new VfModule(); + vfModuleAAI1.setIsBaseVfModule(false); + VfModule vfModuleAAI2 = new VfModule(); + vfModuleAAI2.setIsBaseVfModule(false); + vfModuleAAI2.setVfModuleId("vfModule2"); RelationshipList relationshipList = new RelationshipList(); Relationship relationship = new Relationship(); relationshipList.getRelationship().add(relationship); - vfModuleAAI.setRelationshipList(relationshipList); + vfModuleAAI2.setRelationshipList(relationshipList); Relationships relationships = new Relationships("abc"); Configuration config = new Configuration(); config.setConfigurationId("configId"); Optional<Configuration> configOp = Optional.of(config); Optional<Relationships> relationshipsOp = Optional.of(relationships); + doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(bbSetupUtils).getAAIGenericVnf(vnf.getVnfId()); doReturn(relationshipsOp).when(workflowActionUtils).extractRelationshipsVnfc(isA(Relationships.class)); doReturn(configOp).when(workflowActionUtils).extractRelationshipsConfiguration(isA(Relationships.class)); - doReturn(vfModuleAAI).when(bbSetupUtils).getAAIVfModule("1234", "vfModule2"); + doReturn(vfModuleAAI1).when(bbSetupUtils).getAAIVfModule("1234", "vfModule1"); + doReturn(vfModuleAAI2).when(bbSetupUtils).getAAIVfModule("1234", "vfModule2"); doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java index 9377daea5e..2d41a24ac3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoaderTest.java @@ -243,6 +243,9 @@ public class ServiceEBBLoaderTest extends BaseTaskTest { aaiConfiguration2.setConfigurationId("testConfigurationId2"); aaiConfiguration2.setRelationshipList(relationshipList1); + org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule(); + aaiVfModule.setIsBaseVfModule(true); + try { doReturn(genericVnfAai).when(mockBbInputSetupUtils).getAAIGenericVnf(genericVnf.getVnfId()); doReturn(serviceInstanceAAI).when(mockBbInputSetupUtils).getAAIServiceInstanceById(resourceId); @@ -251,6 +254,7 @@ public class ServiceEBBLoaderTest extends BaseTaskTest { .getConfiguration("testConfigurationId"); doReturn(Optional.of(aaiConfiguration2)).when(mockAaiConfigurationResources) .getConfiguration("testConfigurationId2"); + doReturn(aaiVfModule).when(mockBbInputSetupUtils).getAAIVfModule(any(), any()); serviceEBBLoader.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds); assertEquals(8, resourceCounter.size()); assertTrue(resourceCounter.get(2).isBaseVfModule()); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoaderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoaderTest.java index 78a9628243..2775c6d7b9 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoaderTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VnfEBBLoaderTest.java @@ -47,12 +47,14 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.only; public class VnfEBBLoaderTest { private String serviceId; private String vnfId; + private String vfModuleId; private BBInputSetupUtils bbInputSetupUtils; private BBInputSetup bbInputSetup; private WorkflowActionExtractResourcesAAI workflowActionUtils; @@ -67,6 +69,7 @@ public class VnfEBBLoaderTest { public void setup() { serviceId = "service123"; vnfId = "vnf123"; + vfModuleId = "vfModule123"; serviceInstanceAAI = mock(org.onap.aai.domain.yang.ServiceInstance.class); serviceInstanceMSO = mock(ServiceInstance.class); bbInputSetupUtils = mock(BBInputSetupUtils.class); @@ -95,11 +98,19 @@ public class VnfEBBLoaderTest { GenericVnf genericVnf = mock(GenericVnf.class); doReturn(vnfId).when(genericVnf).getVnfId(); + org.onap.aai.domain.yang.GenericVnf aaiVnf = mock(org.onap.aai.domain.yang.GenericVnf.class); + doReturn(aaiVnf).when(bbInputSetupUtils).getAAIGenericVnf(vnfId); + VfModule vfModule = mock(VfModule.class); + doReturn(vfModuleId).when(vfModule).getVfModuleId(); ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); modelInfoVfModule.setIsBaseBoolean(true); doReturn(modelInfoVfModule).when(vfModule).getModelInfoVfModule(); + org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule(); + aaiVfModule.setIsBaseVfModule(true); + doReturn(aaiVfModule).when(bbInputSetupUtils).getAAIVfModule(vnfId, vfModuleId); + doReturn(serviceInstanceAAI).when(bbInputSetupUtils).getAAIServiceInstanceById(serviceId); doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); doReturn(List.of(genericVnf)).when(serviceInstanceMSO).getVnfs(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java index b23147e351..1fbee2dbc8 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListenerTest.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; +import java.util.UUID; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Before; import org.junit.Test; @@ -34,6 +35,8 @@ import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType; import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.db.catalog.beans.PnfResourceCustomization; @@ -41,7 +44,6 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; @RunWith(MockitoJUnitRunner.Silent.class) @@ -51,25 +53,24 @@ public class SkipCDSBuildingBlockListenerTest { private static final String VNF_SCOPE = "VNF"; private static final String VF_SCOPE = "VFModule"; private static final String PNF_SCOPE = "pnf"; - private static final String TEST_MODELUUID = "123456789"; private static final String VNF_TEST_ACTION = "VnfConfigAssign"; private static final String VFModule_TEST_ACTION = "VfModuleConfigAssign"; private static final String PNFModule_TEST_ACTION = "config-assign"; - private static final String MODELCUSTOMIZATIONUUID = "123456789"; + private static final String SERVICE_MODEL_VERSION_ID = UUID.randomUUID().toString(); + private static final String VNF_MODEL_CUSTOMIZATION_ID = UUID.randomUUID().toString(); + private static final String VF_MODULE_CUSTOMIZATION_ID = UUID.randomUUID().toString(); + private static final String PNF_CUSTOMIZATION_ID = UUID.randomUUID().toString(); private static final String BBNAME = "ControllerExecutionBB"; private static final boolean ISFIRST = true; - private int actual; private List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); - private List<VnfResourceCustomization> vnfResourceCustomization; - private List<VfModuleCustomization> vfModuleCustomization; - private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock(); + private ExecuteBuildingBlock executeBuildingBlock; private RequestDetails reqDetail = new RequestDetails(); private BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(new DelegateExecutionFake()); - private VnfResourceCustomization vnfCust = new VnfResourceCustomization(); - private VfModuleCustomization vfCust = new VfModuleCustomization(); - private PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization(); - private BuildingBlock buildingBlock = new BuildingBlock(); + private VnfResourceCustomization vnfCust; + private VfModuleCustomization vfCust; + private PnfResourceCustomization pnfResourceCustomization; + private BuildingBlock buildingBlock; @InjectMocks private SkipCDSBuildingBlockListener skipCDSBuildingBlockListener; @@ -78,10 +79,27 @@ public class SkipCDSBuildingBlockListenerTest { @Before public void before() { - ModelInfo model = new ModelInfo(); - model.setModelUuid(TEST_MODELUUID); - reqDetail.setModelInfo(model); - executeBuildingBlock.setRequestDetails(reqDetail); + executeBuildingBlock = new ExecuteBuildingBlock(); + buildingBlock = new BuildingBlock(); + + ArrayList<Resource> resources = new ArrayList<>(); + Resource service = new Resource(WorkflowType.SERVICE, SERVICE_MODEL_VERSION_ID, false, null); + service.setModelVersionId(SERVICE_MODEL_VERSION_ID); + resources.add(service); + Resource vnf = new Resource(WorkflowType.VNF, VNF_MODEL_CUSTOMIZATION_ID, false, null); + vnf.setModelCustomizationId(VNF_MODEL_CUSTOMIZATION_ID); + resources.add(vnf); + Resource vfModule = new Resource(WorkflowType.VFMODULE, VF_MODULE_CUSTOMIZATION_ID, false, null); + vfModule.setModelCustomizationId(VF_MODULE_CUSTOMIZATION_ID); + resources.add(vfModule); + Resource pnf = new Resource(WorkflowType.PNF, PNF_CUSTOMIZATION_ID, false, null); + pnf.setModelCustomizationId(PNF_CUSTOMIZATION_ID); + resources.add(pnf); + buildingBlockExecution.setVariable("resources", resources); + + vnfCust = new VnfResourceCustomization(); + vfCust = new VfModuleCustomization(); + pnfResourceCustomization = new PnfResourceCustomization(); } @Test @@ -93,133 +111,83 @@ public class SkipCDSBuildingBlockListenerTest { @Test public void testSkipCDSforService() { - setBuildingBlockAndCurrentSequence(SERVICE_SCOPE, "service-config-assign", 0); - Service service = new Service(); - when(catalogDbClient.getServiceByID(TEST_MODELUUID)).thenReturn(service); + setBuildingBlockAndCurrentSequence(SERVICE_SCOPE, "service-config-assign", SERVICE_MODEL_VERSION_ID, 0); + when(catalogDbClient.getServiceByID(SERVICE_MODEL_VERSION_ID)).thenReturn(new Service()); skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(1, actual); + assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } @Test public void testProcessForVNFToSkipCDSBB() { - // given - setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0); - vnfResourceCustomization = getVnfResourceCustomizationList(true); + setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, VNF_MODEL_CUSTOMIZATION_ID, 0); + when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(VNF_MODEL_CUSTOMIZATION_ID)) + .thenReturn(vnfCust); - when(catalogDbClient.getVnfResourceCustomizationByModelUuid( - executeBuildingBlock.getRequestDetails().getModelInfo().getModelUuid())) - .thenReturn(vnfResourceCustomization); - when(catalogDbClient.findVnfResourceCustomizationInList(executeBuildingBlock.getBuildingBlock().getKey(), - vnfResourceCustomization)).thenReturn(vnfCust); - - // when skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(1, actual); - + assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } @Test public void testProcessForVNFNotToSkipCDSBB() { - // given - setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, 0); - vnfResourceCustomization = getVnfResourceCustomizationList(false); - - when(catalogDbClient.getVnfResourceCustomizationByModelUuid( - executeBuildingBlock.getRequestDetails().getModelInfo().getModelUuid())) - .thenReturn(vnfResourceCustomization); - when(catalogDbClient.findVnfResourceCustomizationInList(executeBuildingBlock.getBuildingBlock().getKey(), - vnfResourceCustomization)).thenReturn(vnfCust); + setBuildingBlockAndCurrentSequence(VNF_SCOPE, VNF_TEST_ACTION, VNF_MODEL_CUSTOMIZATION_ID, 0); + vnfCust.setSkipPostInstConf(false); + when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(VNF_MODEL_CUSTOMIZATION_ID)) + .thenReturn(vnfCust); - // when skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(0, actual); - + assertEquals(0, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } @Test public void testProcessForVFToSkipCDSBB() { - // given - setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0); - vfModuleCustomization = getVfModuleCustomizationList(true); - - when(catalogDbClient - .getVfModuleCustomizationByModelCuztomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) - .thenReturn(vfCust); + setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, VF_MODULE_CUSTOMIZATION_ID, 0); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(VF_MODULE_CUSTOMIZATION_ID)) + .thenReturn(vfCust); - // when skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(1, actual); - + assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } @Test public void testProcessForVFNotToSkipCDSBB() { - // given - setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, 0); - vfModuleCustomization = getVfModuleCustomizationList(false); - + setBuildingBlockAndCurrentSequence(VF_SCOPE, VFModule_TEST_ACTION, VF_MODULE_CUSTOMIZATION_ID, 0); + vfCust.setSkipPostInstConf(false); when(catalogDbClient .getVfModuleCustomizationByModelCuztomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) .thenReturn(vfCust); - // when skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(0, actual); - + assertEquals(0, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } @Test public void testProcessForPNFToSkipCDSBB() { - // given - setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); - pnfResourceCustomization = getPnfResourceCustomization(true); - - when(catalogDbClient - .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) - .thenReturn(pnfResourceCustomization); + setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, PNF_CUSTOMIZATION_ID, 0); + when(catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(PNF_CUSTOMIZATION_ID)) + .thenReturn(pnfResourceCustomization); - // when skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(1, actual); - + assertEquals(1, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } @Test public void testProcessForPNFNotToSkipCDSBB() { - // given - setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, 0); - pnfResourceCustomization = getPnfResourceCustomization(false); - - when(catalogDbClient - .getPnfResourceCustomizationByModelCustomizationUUID(executeBuildingBlock.getBuildingBlock().getKey())) - .thenReturn(pnfResourceCustomization); + setBuildingBlockAndCurrentSequence(PNF_SCOPE, PNFModule_TEST_ACTION, PNF_CUSTOMIZATION_ID, 0); + pnfResourceCustomization.setSkipPostInstConf(false); + when(catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(PNF_CUSTOMIZATION_ID)) + .thenReturn(pnfResourceCustomization); - // when skipCDSBuildingBlockListener.run(flowsToExecute, executeBuildingBlock, buildingBlockExecution); - // then - actual = buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE); - assertEquals(0, actual); - + assertEquals(0, (int) buildingBlockExecution.getVariable(BBConstants.G_CURRENT_SEQUENCE)); } /** @@ -229,37 +197,13 @@ public class SkipCDSBuildingBlockListenerTest { * @param action * @param squence */ - private void setBuildingBlockAndCurrentSequence(String scope, String action, int sequence) { + private void setBuildingBlockAndCurrentSequence(String scope, String action, String key, int sequence) { buildingBlock.setBpmnScope(scope); buildingBlock.setBpmnAction(action); buildingBlock.setBpmnFlowName("ControllerExecutionBB"); - buildingBlock.setKey(MODELCUSTOMIZATIONUUID); + buildingBlock.setKey(key); executeBuildingBlock.setBuildingBlock(buildingBlock); buildingBlockExecution.setVariable(BBConstants.G_CURRENT_SEQUENCE, sequence); - - } - - private List<VnfResourceCustomization> getVnfResourceCustomizationList(boolean setSkippost) { - List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); - vnfCust.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID); - vnfCust.setSkipPostInstConf(setSkippost); - vnfResourceCustomizations.add(vnfCust); - return vnfResourceCustomizations; - } - - private List<VfModuleCustomization> getVfModuleCustomizationList(boolean setSkippost) { - List<VfModuleCustomization> vfModuleCustomizations = new ArrayList<>(); - vfCust.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID); - vfCust.setSkipPostInstConf(setSkippost); - vfModuleCustomizations.add(vfCust); - return vfModuleCustomizations; - } - - private PnfResourceCustomization getPnfResourceCustomization(boolean setSkippost) { - PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization(); - pnfResourceCustomization.setModelCustomizationUUID(MODELCUSTOMIZATIONUUID); - pnfResourceCustomization.setSkipPostInstConf(setSkippost); - return pnfResourceCustomization; } } |