diff options
Diffstat (limited to 'bpmn')
81 files changed, 5408 insertions, 4211 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 4eb9eedad5..c91316ee5c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -50,7 +50,7 @@ import org.onap.so.db.catalog.beans.HomingInstance import org.slf4j.Logger import org.slf4j.LoggerFactory import com.google.gson.JsonObject - +import com.google.gson.JsonParser import com.fasterxml.jackson.databind.ObjectMapper class OofUtils { @@ -596,6 +596,7 @@ String correlator = requestId String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator ObjectMapper objectMapper = new ObjectMapper(); String profileJson = objectMapper.writeValueAsString(profileInfo); +JsonParser parser = new JsonParser() //Prepare requestInfo object JsonObject requestInfo = new JsonObject() @@ -615,9 +616,11 @@ nsstInfo.addProperty("name", name) JsonObject json = new JsonObject() json.add("requestInfo", requestInfo) json.add("NSSTInfo", nsstInfo) -json.addProperty("sliceProfile", profileJson) +json.add("sliceProfile", (JsonObject) parser.parse(profileJson)) + return json.toString() } + /** * Method to create NSI/NSSI termination request * (OOF response will be synchronous in G-Release) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy index 23dfdce753..4e8be5d6e5 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy @@ -144,7 +144,7 @@ class RequestDBUtil { <ns:initResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <operationType>${MsoUtils.xmlEscape(operType)}</operationType> + <operType>${MsoUtils.xmlEscape(operType)}</operType> <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUID)}</resourceTemplateUUIDs> </ns:initResourceOperationStatus> </soapenv:Body> @@ -192,8 +192,9 @@ class RequestDBUtil { <ns:updateResourceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <resourceTemplateUUIDs>${MsoUtils.xmlEscape(resourceTemplateUUID)}</resourceTemplateUUIDs> - <operationType>${MsoUtils.xmlEscape(operType)}</operationType> + <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceTemplateUUID)}</resourceTemplateUUID> + <operType>${MsoUtils.xmlEscape(operType)}</operType> + <resourceInstanceID>${MsoUtils.xmlEscape(resourceInstanceID)}</resourceInstanceID> <jobId>${MsoUtils.xmlEscape(jobId)}</jobId> <status>${MsoUtils.xmlEscape(status)}</status> <progress>${MsoUtils.xmlEscape(progress)}</progress> diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java index d966528f6c..c18680afae 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java @@ -20,23 +20,24 @@ package org.onap.so.bpmn.appc.payload; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.Optional; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic; +import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersQuiesce; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersResumeTraffic; -import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersDistributeTraffic; import org.onap.so.bpmn.appc.payload.beans.ConfigurationParametersUpgrade; +import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficAction; +import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficCheckAction; import org.onap.so.bpmn.appc.payload.beans.HealthCheckAction; import org.onap.so.bpmn.appc.payload.beans.QuiesceTrafficAction; import org.onap.so.bpmn.appc.payload.beans.RequestParametersHealthCheck; import org.onap.so.bpmn.appc.payload.beans.ResumeTrafficAction; -import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficAction; -import org.onap.so.bpmn.appc.payload.beans.DistributeTrafficCheckAction; import org.onap.so.bpmn.appc.payload.beans.SnapshotAction; import org.onap.so.bpmn.appc.payload.beans.StartStopAction; import org.onap.so.bpmn.appc.payload.beans.UpgradeAction; import org.onap.so.bpmn.core.json.JsonUtils; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; public class PayloadClient { @@ -122,6 +123,12 @@ public class PayloadClient { RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck(); requestParams.setHostIpAddress(vnfHostIpAddress); payloadResult.setRequestParameters(requestParams); + + ConfigurationParametersHealthCheck configurationParametersHealthCheck = + new ConfigurationParametersHealthCheck(); + configurationParametersHealthCheck.setVnfName(vnfName); + payloadResult.setConfigurationParameters(configurationParametersHealthCheck); + return Optional.of((mapper.writeValueAsString(payloadResult))); } 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 3f78152a49..d971689f94 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 @@ -640,7 +640,8 @@ public class BBInputSetup implements JavaDelegate { parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID); } } - if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null + if (vfModule != null && vfModule.getModelInfoVfModule() != null + && vfModule.getModelInfoVfModule().getModelName() != null && vfModule.getModelInfoVfModule().getModelName().contains("helm")) { parameter.setIsHelm(true); } @@ -1478,6 +1479,11 @@ public class BBInputSetup implements JavaDelegate { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get()); } } + if (vfModule.getModelInfoVfModule() != null + && vfModule.getModelInfoVfModule().getModelName() != null + && vfModule.getModelInfoVfModule().getModelName().contains("helm")) { + gBB.getRequestContext().setIsHelm(true); + } break; } } @@ -1622,6 +1628,7 @@ public class BBInputSetup implements JavaDelegate { parameter.setInstanceName(vfModules.getInstanceName()); parameter.setInstanceParams(vfModules.getInstanceParams()); this.populateVfModule(parameter); + gBB.getRequestContext().setIsHelm(parameter.getIsHelm()); } } else if (bbName.contains(NETWORK)) { networks = findNetworksByKey(key, resources); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java index afd7f6433c..24f1e055e2 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java @@ -269,10 +269,10 @@ public class BBInputSetupUtils { String cloudRegionId = cloudConfiguration.getLcpCloudRegionId(); String cloudOwner = cloudConfiguration.getCloudOwner(); if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) { - return injectionHelper.getAaiClient() - .get(CloudRegion.class, AAIUriFactory.createResourceUri( + return injectionHelper.getAaiClient().get(CloudRegion.class, + AAIUriFactory.createResourceUri( AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId)) - .depth(Depth.TWO)) + .depth(Depth.ONE).nodesOnly(true)) .orElse(null); } else { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index 692d581b0d..98a14fc0e5 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -22,9 +22,10 @@ package org.onap.so.client.restproperties; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.aaiclient.client.aai.AAIProperties; import org.onap.aaiclient.client.aai.AAIVersion; +import org.onap.so.bpmn.core.UrnPropertiesReader; +import org.onap.so.client.CacheProperties; import org.springframework.stereotype.Component; @Component @@ -33,6 +34,11 @@ public class AAIPropertiesImpl implements AAIProperties { public static final String MSO_MSO_KEY = "mso.msoKey"; public static final String AAI_AUTH = "aai.auth"; public static final String AAI_ENDPOINT = "aai.endpoint"; + public static final String AAI_READ_TIMEOUT = "aai.readTimeout"; + public static final String AAI_ENABLE_CACHING = "aai.caching.enable"; + public static final String AAI_CACHE_MAX_AGE = "aai.caching.maxAge"; + + private UrnPropertiesReader reader; @Override public URL getEndpoint() throws MalformedURLException { @@ -58,4 +64,25 @@ public class AAIPropertiesImpl implements AAIProperties { public String getKey() { return UrnPropertiesReader.getVariable(MSO_MSO_KEY); } + + @Override + public Long getReadTimeout() { + return Long.valueOf(reader.getVariable(AAI_READ_TIMEOUT, "60000")); + } + + @Override + public boolean isCachingEnabled() { + return Boolean.parseBoolean(reader.getVariable(AAI_ENABLE_CACHING, "false")); + } + + @Override + public CacheProperties getCacheProperties() { + return new AAICacheProperties() { + @Override + public Long getMaxAge() { + return Long.valueOf(reader.getVariable(AAI_CACHE_MAX_AGE, "60000")); + } + }; + } + } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java index 2ecf741869..2e16572069 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP - SO * ================================================================================ - * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,7 +66,8 @@ public class PayloadClientTest { @Test public void healthCheckFormatTest() throws Exception { - String payloadResult = "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"}}"; + String payloadResult = + "{\"request-parameters\":{\"host-ip-address\":\"hostIpAddress1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}"; Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "hostIpAddress1"); assertEquals(payloadResult, payloadClient.get()); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index 85774ec23c..188f853a14 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -184,7 +184,7 @@ public class BBInputSetupUtilsTest { AAIUriFactory .createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure() .cloudRegion(cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId())) - .depth(Depth.TWO)); + .depth(Depth.ONE).nodesOnly(true)); assertThat(bbInputSetupUtils.getCloudRegion(cloudConfig), sameBeanAs(expected.get())); } diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index b621853f2b..4f7ceca9b9 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -335,8 +335,11 @@ </dependency> <dependency> <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-cadi-client</artifactId> + </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId> - <version>${aaf.cadi.version}</version> <exclusions> <exclusion> <groupId>javax.servlet</groupId> @@ -348,5 +351,20 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-auth-client</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-misc-env</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-misc-rosetta</artifactId> + <scope>runtime</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn index 9e2c0db6ea..a32e9e8f62 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> <bpmn:process id="CreateVfModuleBB" name="CreateVfModuleBB" isExecutable="true"> <bpmn:startEvent id="CreateVfModuleBB_Start"> <bpmn:outgoing>SequenceFlow_1xr6chl</bpmn:outgoing> @@ -46,7 +46,8 @@ <bpmn:sequenceFlow id="SequenceFlow_0rds4rj" sourceRef="UpdateVfModuleHeatStackId" targetRef="UpdateVfModuleStatus" /> <bpmn:sequenceFlow id="SequenceFlow_1vbwdaw" sourceRef="UpdateVfModuleStatus" targetRef="CreateVfModuleBB_End" /> <bpmn:serviceTask id="CreateNetworkPolicies" name="AAI Create (network policies)" camunda:expression="${AAICreateTasks.createNetworkPolicies(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1yn8o6d</bpmn:incoming> + <bpmn:incoming>Flow_10aq7a8</bpmn:incoming> + <bpmn:incoming>Flow_1il4743</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xqhep5</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0xqhep5" sourceRef="CreateNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" /> @@ -66,16 +67,14 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_15do1tu" sourceRef="UpdateVfModuleContrailServiceInstanceFqdn" targetRef="UpdateVfModuleHeatStackId" /> <bpmn:serviceTask id="ServiceTask_01zrt6x" name=" Create Cloud Variable " camunda:expression="${CreateVFModule.createInventoryVariable(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>SequenceFlow_1mg8eym</bpmn:incoming> <bpmn:incoming>SequenceFlow_0uetprw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1io8r33</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1io8r33" sourceRef="ServiceTask_01zrt6x" targetRef="ServiceTask_00d84m7" /> <bpmn:serviceTask id="ServiceTask_00d84m7" name=" AAI Create (inventory) " camunda:type="external" camunda:topic="InventoryCreate"> <bpmn:incoming>SequenceFlow_1io8r33</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1yn8o6d</bpmn:outgoing> + <bpmn:outgoing>Flow_10aq7a8</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1yn8o6d" sourceRef="ServiceTask_00d84m7" targetRef="CreateNetworkPolicies" /> <bpmn:exclusiveGateway id="CheckIfIsHelm" name="Check If Is Helm"> <bpmn:incoming>SequenceFlow_1ig2ix4</bpmn:incoming> <bpmn:outgoing>YesHelm</bpmn:outgoing> @@ -83,12 +82,11 @@ </bpmn:exclusiveGateway> <bpmn:serviceTask id="CnfAdapter" name="Cnf Adapter" camunda:expression="${CnfAdapterCreateTasks.createInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>YesHelm</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1mg8eym</bpmn:outgoing> + <bpmn:outgoing>Flow_1il4743</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="YesHelm" name="Yes Helm" sourceRef="CheckIfIsHelm" targetRef="CnfAdapter"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isHelm")}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1mg8eym" sourceRef="CnfAdapter" targetRef="ServiceTask_01zrt6x" /> <bpmn:sequenceFlow id="SequenceFlow_1ig2ix4" sourceRef="QueryVfModule" targetRef="CheckIfIsHelm" /> <bpmn:sequenceFlow id="NoHelm" name="No Helm" sourceRef="CheckIfIsHelm" targetRef="CreateVfModule" /> <bpmn:sequenceFlow id="SequenceFlow_0dehck5" sourceRef="CreateVfModule" targetRef="VnfAdapter" /> @@ -108,93 +106,61 @@ <bpmn:sequenceFlow id="Flow_1sqy91r" sourceRef="Event_1pengt4" targetRef="Activity_1p8hxyt" /> <bpmn:sequenceFlow id="Flow_03q6ty9" sourceRef="Activity_1p8hxyt" targetRef="Event_108oetk" /> </bpmn:subProcess> + <bpmn:sequenceFlow id="Flow_10aq7a8" sourceRef="ServiceTask_00d84m7" targetRef="CreateNetworkPolicies" /> + <bpmn:sequenceFlow id="Flow_1il4743" sourceRef="CnfAdapter" targetRef="CreateNetworkPolicies" /> </bpmn:process> <bpmn:error id="Error_0t7oivz" name="AAIInventoryFailure" errorCode="AAIInventoryFailure" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVfModuleBB"> - <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="CreateVfModuleBB_Start"> - <dc:Bounds x="156" y="88" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="77" y="124" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="QueryVfModule"> - <dc:Bounds x="513" y="66" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> - <di:waypoint x="192" y="106" /> - <di:waypoint x="313" y="106" /> + <bpmndi:BPMNEdge id="SequenceFlow_0uetprw_di" bpmnElement="SequenceFlow_0uetprw"> + <di:waypoint x="1009" y="146" /> + <di:waypoint x="1009" y="326" /> <bpmndi:BPMNLabel> - <dc:Bounds x="156" y="91" width="0" height="0" /> + <dc:Bounds x="1024" y="228" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="CreateVfModuleBB_End"> - <dc:Bounds x="1300" y="450" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_0dehck5_di" bpmnElement="SequenceFlow_0dehck5"> + <di:waypoint x="894" y="106" /> + <di:waypoint x="959" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1176" y="446" width="90" height="0" /> + <dc:Bounds x="926.5" y="85" width="0" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="CreateVfModule"> - <dc:Bounds x="794" y="66" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1s4rpyp_di" bpmnElement="SequenceFlow_1s4rpyp"> - <di:waypoint x="413" y="106" /> - <di:waypoint x="513" y="106" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1g7zahc_di" bpmnElement="NoHelm"> + <di:waypoint x="721" y="106" /> + <di:waypoint x="794" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="321" y="91" width="90" height="0" /> + <dc:Bounds x="736" y="85" width="44" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1frb5h2_di" bpmnElement="QueryVnf"> - <dc:Bounds x="313" y="66" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1i1pfzb_di" bpmnElement="VnfAdapter"> - <dc:Bounds x="959" y="66" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0fpfn71_di" bpmnElement="UpdateVfModuleStatus"> - <dc:Bounds x="1124" y="428" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_04k1b85_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="959" y="428" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0rds4rj_di" bpmnElement="SequenceFlow_0rds4rj"> - <di:waypoint x="1059" y="468" /> - <di:waypoint x="1124" y="468" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ig2ix4_di" bpmnElement="SequenceFlow_1ig2ix4"> + <di:waypoint x="613" y="106" /> + <di:waypoint x="671" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="950" y="409" width="90" height="0" /> + <dc:Bounds x="652" y="85" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1vbwdaw_di" bpmnElement="SequenceFlow_1vbwdaw"> - <di:waypoint x="1224" y="468" /> - <di:waypoint x="1265" y="468" /> - <di:waypoint x="1265" y="468" /> - <di:waypoint x="1300" y="468" /> + <bpmndi:BPMNEdge id="SequenceFlow_0q1janp_di" bpmnElement="YesHelm"> + <di:waypoint x="696" y="131" /> + <di:waypoint x="696" y="210" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1138" y="424" width="90" height="0" /> + <dc:Bounds x="688" y="177" width="47" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1v8zx4s_di" bpmnElement="CreateNetworkPolicies"> - <dc:Bounds x="324" y="428" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0xqhep5_di" bpmnElement="SequenceFlow_0xqhep5"> - <di:waypoint x="424" y="468" /> - <di:waypoint x="477" y="468" /> + <bpmndi:BPMNEdge id="SequenceFlow_1io8r33_di" bpmnElement="SequenceFlow_1io8r33"> + <di:waypoint x="959" y="366" /> + <di:waypoint x="746" y="366" /> <bpmndi:BPMNLabel> - <dc:Bounds x="309" y="409" width="90" height="0" /> + <dc:Bounds x="569" y="297" width="90" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_015ayw5_di" bpmnElement="UpdateVnfIpv4OamAddress"> - <dc:Bounds x="477" y="428" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1yo6mvv_di" bpmnElement="SequenceFlow_1yo6mvv"> - <di:waypoint x="577" y="468" /> - <di:waypoint x="646" y="468" /> + <bpmndi:BPMNEdge id="SequenceFlow_15do1tu_di" bpmnElement="SequenceFlow_15do1tu"> + <di:waypoint x="894" y="468" /> + <di:waypoint x="959" y="468" /> <bpmndi:BPMNLabel> - <dc:Bounds x="470" y="409" width="90" height="0" /> + <dc:Bounds x="785" y="399" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0mlfsc9_di" bpmnElement="UpdateVnfManagementV6Address"> - <dc:Bounds x="646" y="428" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1i03uy2_di" bpmnElement="SequenceFlow_1i03uy2"> <di:waypoint x="746" y="468" /> <di:waypoint x="794" y="468" /> @@ -202,93 +168,129 @@ <dc:Bounds x="628" y="409" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0wctnhw_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> - <dc:Bounds x="794" y="428" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_15do1tu_di" bpmnElement="SequenceFlow_15do1tu"> - <di:waypoint x="894" y="468" /> - <di:waypoint x="959" y="468" /> + <bpmndi:BPMNEdge id="SequenceFlow_1yo6mvv_di" bpmnElement="SequenceFlow_1yo6mvv"> + <di:waypoint x="577" y="468" /> + <di:waypoint x="646" y="468" /> <bpmndi:BPMNLabel> - <dc:Bounds x="785" y="399" width="90" height="0" /> + <dc:Bounds x="470" y="409" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_01zrt6x_di" bpmnElement="ServiceTask_01zrt6x"> - <dc:Bounds x="665" y="326" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1io8r33_di" bpmnElement="SequenceFlow_1io8r33"> - <di:waypoint x="665" y="366" /> - <di:waypoint x="563" y="366" /> + <bpmndi:BPMNEdge id="SequenceFlow_0xqhep5_di" bpmnElement="SequenceFlow_0xqhep5"> + <di:waypoint x="424" y="468" /> + <di:waypoint x="477" y="468" /> <bpmndi:BPMNLabel> - <dc:Bounds x="569" y="297" width="90" height="20" /> + <dc:Bounds x="309" y="409" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_00d84m7_di" bpmnElement="ServiceTask_00d84m7"> - <dc:Bounds x="463" y="326" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1yn8o6d_di" bpmnElement="SequenceFlow_1yn8o6d"> - <di:waypoint x="463" y="366" /> - <di:waypoint x="255" y="366" /> - <di:waypoint x="255" y="463" /> - <di:waypoint x="324" y="463" /> + <bpmndi:BPMNEdge id="SequenceFlow_1vbwdaw_di" bpmnElement="SequenceFlow_1vbwdaw"> + <di:waypoint x="1224" y="468" /> + <di:waypoint x="1265" y="468" /> + <di:waypoint x="1265" y="468" /> + <di:waypoint x="1300" y="468" /> <bpmndi:BPMNLabel> - <dc:Bounds x="225" y="361" width="90" height="20" /> + <dc:Bounds x="1138" y="424" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_1g3vemz_di" bpmnElement="CheckIfIsHelm" isMarkerVisible="true"> - <dc:Bounds x="690.2114427860697" y="81.35572139303483" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="673" y="48" width="84" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0tag50w_di" bpmnElement="CnfAdapter"> - <dc:Bounds x="665" y="166" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0q1janp_di" bpmnElement="YesHelm"> - <di:waypoint x="715" y="131" /> - <di:waypoint x="715" y="166" /> + <bpmndi:BPMNEdge id="SequenceFlow_0rds4rj_di" bpmnElement="SequenceFlow_0rds4rj"> + <di:waypoint x="1059" y="468" /> + <di:waypoint x="1124" y="468" /> <bpmndi:BPMNLabel> - <dc:Bounds x="730" y="136" width="0" height="12" /> + <dc:Bounds x="950" y="409" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1mg8eym_di" bpmnElement="SequenceFlow_1mg8eym"> - <di:waypoint x="715" y="246" /> - <di:waypoint x="715" y="326" /> + <bpmndi:BPMNEdge id="SequenceFlow_1s4rpyp_di" bpmnElement="SequenceFlow_1s4rpyp"> + <di:waypoint x="413" y="106" /> + <di:waypoint x="513" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="846" y="291.5" width="0" height="12" /> + <dc:Bounds x="321" y="91" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ig2ix4_di" bpmnElement="SequenceFlow_1ig2ix4"> - <di:waypoint x="613" y="106" /> - <di:waypoint x="691" y="106" /> + <bpmndi:BPMNEdge id="SequenceFlow_1xr6chl_di" bpmnElement="SequenceFlow_1xr6chl"> + <di:waypoint x="192" y="106" /> + <di:waypoint x="313" y="106" /> <bpmndi:BPMNLabel> - <dc:Bounds x="652" y="85" width="0" height="12" /> + <dc:Bounds x="156" y="91" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1g7zahc_di" bpmnElement="NoHelm"> - <di:waypoint x="740" y="106" /> - <di:waypoint x="794" y="106" /> + <bpmndi:BPMNEdge id="Flow_10aq7a8_di" bpmnElement="Flow_10aq7a8"> + <di:waypoint x="646" y="366" /> + <di:waypoint x="374" y="366" /> + <di:waypoint x="374" y="428" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1il4743_di" bpmnElement="Flow_1il4743"> + <di:waypoint x="646" y="250" /> + <di:waypoint x="200" y="250" /> + <di:waypoint x="200" y="468" /> + <di:waypoint x="324" y="468" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_0kxwniy_di" bpmnElement="CreateVfModuleBB_Start"> + <dc:Bounds x="156" y="88" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="767" y="85" width="0" height="12" /> + <dc:Bounds x="77" y="124" width="0" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0dehck5_di" bpmnElement="SequenceFlow_0dehck5"> - <di:waypoint x="894" y="106" /> - <di:waypoint x="959" y="106" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_13t22km_di" bpmnElement="QueryVfModule"> + <dc:Bounds x="513" y="66" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0qdq7wj_di" bpmnElement="CreateVfModuleBB_End"> + <dc:Bounds x="1300" y="450" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="926.5" y="85" width="0" height="12" /> + <dc:Bounds x="1176" y="446" width="90" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uetprw_di" bpmnElement="SequenceFlow_0uetprw"> - <di:waypoint x="1009" y="146" /> - <di:waypoint x="1009" y="366" /> - <di:waypoint x="765" y="366" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1dgenhy_di" bpmnElement="CreateVfModule"> + <dc:Bounds x="794" y="66" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1frb5h2_di" bpmnElement="QueryVnf"> + <dc:Bounds x="313" y="66" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1i1pfzb_di" bpmnElement="VnfAdapter"> + <dc:Bounds x="959" y="66" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0fpfn71_di" bpmnElement="UpdateVfModuleStatus"> + <dc:Bounds x="1124" y="428" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_04k1b85_di" bpmnElement="UpdateVfModuleHeatStackId"> + <dc:Bounds x="959" y="428" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1v8zx4s_di" bpmnElement="CreateNetworkPolicies"> + <dc:Bounds x="324" y="428" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_015ayw5_di" bpmnElement="UpdateVnfIpv4OamAddress"> + <dc:Bounds x="477" y="428" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0mlfsc9_di" bpmnElement="UpdateVnfManagementV6Address"> + <dc:Bounds x="646" y="428" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0wctnhw_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> + <dc:Bounds x="794" y="428" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_01zrt6x_di" bpmnElement="ServiceTask_01zrt6x"> + <dc:Bounds x="959" y="326" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_00d84m7_di" bpmnElement="ServiceTask_00d84m7"> + <dc:Bounds x="646" y="326" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0tag50w_di" bpmnElement="CnfAdapter"> + <dc:Bounds x="646" y="210" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1g3vemz_di" bpmnElement="CheckIfIsHelm" isMarkerVisible="true"> + <dc:Bounds x="671" y="81" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1024" y="228" width="0" height="12" /> + <dc:Bounds x="655" y="48" width="82" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_10eqhmz_di" bpmnElement="Activity_10eqhmz" isExpanded="true"> <dc:Bounds x="240" y="590" width="340" height="180" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_03q6ty9_di" bpmnElement="Flow_03q6ty9"> + <di:waypoint x="460" y="680" /> + <di:waypoint x="512" y="680" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1sqy91r_di" bpmnElement="Flow_1sqy91r"> + <di:waypoint x="316" y="680" /> + <di:waypoint x="360" y="680" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_108oetk_di" bpmnElement="Event_108oetk"> <dc:Bounds x="512" y="662" width="36" height="36" /> </bpmndi:BPMNShape> @@ -298,14 +300,6 @@ <bpmndi:BPMNShape id="Activity_1p8hxyt_di" bpmnElement="Activity_1p8hxyt"> <dc:Bounds x="360" y="640" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_1sqy91r_di" bpmnElement="Flow_1sqy91r"> - <di:waypoint x="316" y="680" /> - <di:waypoint x="360" y="680" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_03q6ty9_di" bpmnElement="Flow_03q6ty9"> - <di:waypoint x="460" y="680" /> - <di:waypoint x="512" y="680" /> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index fba1139117..36d1708a45 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -1,18 +1,17 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> <bpmn:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true"> <bpmn:startEvent id="DeleteVfModuleBB_Start"> - <bpmn:outgoing>Flow_02lmh6f</bpmn:outgoing> + <bpmn:outgoing>Flow_069drgn</bpmn:outgoing> </bpmn:startEvent> <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Prepare Request" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn:incoming>Flow_02lmh6f</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_08tvhtf</bpmn:outgoing> + <bpmn:incoming>Flow_1c15ua4</bpmn:incoming> + <bpmn:outgoing>Flow_0yz0t7z</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_01vfwtp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_09l7pcg</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_08tvhtf" sourceRef="DeleteVfModuleVnfAdapter" targetRef="VnfAdapter" /> <bpmn:endEvent id="DeleteVfModuleBB_End"> <bpmn:incoming>SequenceFlow_09l7pcg</bpmn:incoming> </bpmn:endEvent> @@ -28,7 +27,7 @@ <camunda:out source="contrailNetworkPolicyFqdnList" target="contrailNetworkPolicyFqdnList" /> <camunda:out source="contrailServiceInstanceFqdn" target="contrailServiceInstanceFqdn" /> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming> + <bpmn:incoming>Flow_0yz0t7z</bpmn:incoming> <bpmn:outgoing>Flow_0hlvlw2</bpmn:outgoing> </bpmn:callActivity> <bpmn:serviceTask id="UpdateVfModuleHeatStackId" name=" AAI Update (vf module) " camunda:expression="${AAIUpdateTasks.updateHeatStackIdVfModule(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -59,6 +58,7 @@ </bpmn:serviceTask> <bpmn:intermediateThrowEvent id="aaiThrow" name="Update AAI"> <bpmn:incoming>Flow_0plbl7p</bpmn:incoming> + <bpmn:incoming>Flow_1ktykz6</bpmn:incoming> <bpmn:linkEventDefinition name="AAI" /> </bpmn:intermediateThrowEvent> <bpmn:intermediateCatchEvent id="aaiCatch" name="Update AAI"> @@ -77,7 +77,6 @@ <bpmn:sequenceFlow id="Flow_0n2pqrr" sourceRef="aaiCatch" targetRef="DeleteNetworkPolicies" /> <bpmn:sequenceFlow id="Flow_0plbl7p" sourceRef="ServiceTask_0itw3by" targetRef="aaiThrow" /> <bpmn:sequenceFlow id="Flow_0hlvlw2" sourceRef="VnfAdapter" targetRef="ServiceTask_08ulmzc" /> - <bpmn:sequenceFlow id="Flow_02lmh6f" sourceRef="DeleteVfModuleBB_Start" targetRef="DeleteVfModuleVnfAdapter" /> <bpmn:subProcess id="Activity_1thbmzc" name="Inventory Error Handling" triggeredByEvent="true"> <bpmn:endEvent id="Event_00dlrto"> <bpmn:incoming>Flow_0yqo5xu</bpmn:incoming> @@ -93,155 +92,197 @@ <bpmn:sequenceFlow id="Flow_0qyhv7c" sourceRef="Event_0dfwcfl" targetRef="Activity_025387k" /> <bpmn:sequenceFlow id="Flow_0yqo5xu" sourceRef="Activity_025387k" targetRef="Event_00dlrto" /> </bpmn:subProcess> + <bpmn:serviceTask id="Activity_1aqardy" name="Cnf Adapter" camunda:expression="${CnfAdapterDeleteTasks.deleteInstance(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>Flow_10r76pp</bpmn:incoming> + <bpmn:outgoing>Flow_1ktykz6</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1ktykz6" sourceRef="Activity_1aqardy" targetRef="aaiThrow" /> + <bpmn:exclusiveGateway id="CheckIfIsHelm" name="Check if is helm"> + <bpmn:incoming>Flow_069drgn</bpmn:incoming> + <bpmn:outgoing>Flow_10r76pp</bpmn:outgoing> + <bpmn:outgoing>Flow_1c15ua4</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_10r76pp" name="Yes" sourceRef="CheckIfIsHelm" targetRef="Activity_1aqardy"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isHelm")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_0yz0t7z" sourceRef="DeleteVfModuleVnfAdapter" targetRef="VnfAdapter" /> + <bpmn:sequenceFlow id="Flow_069drgn" sourceRef="DeleteVfModuleBB_Start" targetRef="CheckIfIsHelm" /> + <bpmn:sequenceFlow id="Flow_1c15ua4" name="No" sourceRef="CheckIfIsHelm" targetRef="DeleteVfModuleVnfAdapter" /> </bpmn:process> <bpmn:error id="Error_0jjnve8" name="Error_3k24na6" errorCode="AAIInventoryFailure" /> <bpmn:escalation id="Escalation_130je8j" name="audit" escalationCode="audit1" /> <bpmn:error id="Error_1le3oui" name="AAIInventoryFailure" errorCode="AAIInventoryFailure" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start"> - <dc:Bounds x="159" y="106" width="36" height="36" /> + <bpmndi:BPMNEdge id="Flow_0hlvlw2_di" bpmnElement="Flow_0hlvlw2"> + <di:waypoint x="680" y="254" /> + <di:waypoint x="760" y="254" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0plbl7p_di" bpmnElement="Flow_0plbl7p"> + <di:waypoint x="1010" y="254" /> + <di:waypoint x="1062" y="254" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0n2pqrr_di" bpmnElement="Flow_0n2pqrr"> + <di:waypoint x="195" y="478" /> + <di:waypoint x="270" y="478" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1i9ft2r_di" bpmnElement="SequenceFlow_1i9ft2r"> + <di:waypoint x="860" y="254" /> + <di:waypoint x="910" y="254" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z"> + <di:waypoint x="770" y="478" /> + <di:waypoint x="800" y="478" /> <bpmndi:BPMNLabel> - <dc:Bounds x="132" y="302" width="90" height="12" /> + <dc:Bounds x="722" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter"> - <dc:Bounds x="290" y="84" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> - <dc:Bounds x="930" y="308" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf"> - <di:waypoint x="390" y="124" /> - <di:waypoint x="435" y="124" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc"> + <di:waypoint x="640" y="478" /> + <di:waypoint x="670" y="478" /> <bpmndi:BPMNLabel> - <dc:Bounds x="959" y="331" width="90" height="12" /> + <dc:Bounds x="598" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> - <dc:Bounds x="1142" y="330" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b"> + <di:waypoint x="500" y="478" /> + <di:waypoint x="540" y="478" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1241" y="530" width="90" height="0" /> + <dc:Bounds x="473" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> - <dc:Bounds x="435" y="84" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> - <dc:Bounds x="800" y="308" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> - <di:waypoint x="900" y="348" /> - <di:waypoint x="930" y="348" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk"> + <di:waypoint x="370" y="478" /> + <di:waypoint x="400" y="478" /> <bpmndi:BPMNLabel> - <dc:Bounds x="848" y="493" width="90" height="0" /> + <dc:Bounds x="345" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg"> - <di:waypoint x="1030" y="348" /> - <di:waypoint x="1142" y="348" /> + <di:waypoint x="1030" y="478" /> + <di:waypoint x="1142" y="478" /> <bpmndi:BPMNLabel> <dc:Bounds x="1092.5" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk"> - <di:waypoint x="370" y="348" /> - <di:waypoint x="400" y="348" /> + <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp"> + <di:waypoint x="900" y="478" /> + <di:waypoint x="930" y="478" /> <bpmndi:BPMNLabel> - <dc:Bounds x="345" y="493" width="90" height="0" /> + <dc:Bounds x="848" y="493" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies"> - <dc:Bounds x="270" y="308" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address"> - <dc:Bounds x="540" y="308" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b"> - <di:waypoint x="500" y="348" /> - <di:waypoint x="540" y="348" /> + <bpmndi:BPMNEdge id="Flow_1ktykz6_di" bpmnElement="Flow_1ktykz6"> + <di:waypoint x="680" y="120" /> + <di:waypoint x="1080" y="120" /> + <di:waypoint x="1080" y="236" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_10r76pp_di" bpmnElement="Flow_10r76pp"> + <di:waypoint x="280" y="229" /> + <di:waypoint x="280" y="120" /> + <di:waypoint x="580" y="120" /> <bpmndi:BPMNLabel> - <dc:Bounds x="473" y="493" width="90" height="0" /> + <dc:Bounds x="256" y="162" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress"> - <dc:Bounds x="400" y="308" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc"> - <di:waypoint x="640" y="348" /> - <di:waypoint x="670" y="348" /> + <bpmndi:BPMNEdge id="Flow_0yz0t7z_di" bpmnElement="Flow_0yz0t7z"> + <di:waypoint x="500" y="254" /> + <di:waypoint x="580" y="254" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_069drgn_di" bpmnElement="Flow_069drgn"> + <di:waypoint x="195" y="254" /> + <di:waypoint x="255" y="254" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1c15ua4_di" bpmnElement="Flow_1c15ua4"> + <di:waypoint x="305" y="254" /> + <di:waypoint x="400" y="254" /> <bpmndi:BPMNLabel> - <dc:Bounds x="598" y="493" width="90" height="0" /> + <dc:Bounds x="345" y="236" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z"> - <di:waypoint x="770" y="348" /> - <di:waypoint x="800" y="348" /> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start"> + <dc:Bounds x="159" y="236" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="722" y="493" width="90" height="0" /> + <dc:Bounds x="132" y="302" width="90" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus"> + <dc:Bounds x="930" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End"> + <dc:Bounds x="1142" y="460" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1241" y="530" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId"> + <dc:Bounds x="800" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies"> + <dc:Bounds x="270" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address"> + <dc:Bounds x="540" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress"> + <dc:Bounds x="400" y="438" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn"> - <dc:Bounds x="670" y="308" width="100" height="80" /> + <dc:Bounds x="670" y="438" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1sftyjz_di" bpmnElement="aaiThrow"> - <dc:Bounds x="1062" y="106" width="36" height="36" /> + <dc:Bounds x="1062" y="236" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1053" y="145" width="57" height="14" /> + <dc:Bounds x="1051" y="282" width="57" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_13y483m_di" bpmnElement="aaiCatch"> - <dc:Bounds x="159" y="330" width="36" height="36" /> + <dc:Bounds x="159" y="460" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="149" y="370" width="57" height="14" /> + <dc:Bounds x="149" y="500" width="57" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0itw3by_di" bpmnElement="ServiceTask_0itw3by"> - <dc:Bounds x="740" y="84" width="100" height="80" /> + <dc:Bounds x="910" y="214" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_08ulmzc_di" bpmnElement="ServiceTask_08ulmzc"> - <dc:Bounds x="590" y="84" width="100" height="80" /> + <dc:Bounds x="760" y="214" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0s4azdf_di" bpmnElement="CheckIfIsHelm" isMarkerVisible="true"> + <dc:Bounds x="255" y="229" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="240" y="289" width="79" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter"> + <dc:Bounds x="400" y="214" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter"> + <dc:Bounds x="580" y="214" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1aqardy_di" bpmnElement="Activity_1aqardy"> + <dc:Bounds x="580" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1i9ft2r_di" bpmnElement="SequenceFlow_1i9ft2r"> - <di:waypoint x="690" y="124" /> - <di:waypoint x="740" y="124" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0n2pqrr_di" bpmnElement="Flow_0n2pqrr"> - <di:waypoint x="195" y="348" /> - <di:waypoint x="270" y="348" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0plbl7p_di" bpmnElement="Flow_0plbl7p"> - <di:waypoint x="840" y="124" /> - <di:waypoint x="1062" y="124" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0hlvlw2_di" bpmnElement="Flow_0hlvlw2"> - <di:waypoint x="535" y="124" /> - <di:waypoint x="590" y="124" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_02lmh6f_di" bpmnElement="Flow_02lmh6f"> - <di:waypoint x="195" y="124" /> - <di:waypoint x="290" y="124" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Activity_1thbmzc_di" bpmnElement="Activity_1thbmzc" isExpanded="true"> - <dc:Bounds x="280" y="490" width="340" height="180" /> + <dc:Bounds x="280" y="620" width="340" height="180" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_0yqo5xu_di" bpmnElement="Flow_0yqo5xu"> + <di:waypoint x="500" y="710" /> + <di:waypoint x="552" y="710" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0qyhv7c_di" bpmnElement="Flow_0qyhv7c"> + <di:waypoint x="356" y="710" /> + <di:waypoint x="400" y="710" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_00dlrto_di" bpmnElement="Event_00dlrto"> - <dc:Bounds x="552" y="562" width="36" height="36" /> + <dc:Bounds x="552" y="692" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0dfwcfl_di" bpmnElement="Event_0dfwcfl"> - <dc:Bounds x="320" y="562" width="36" height="36" /> + <dc:Bounds x="320" y="692" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_025387k_di" bpmnElement="Activity_025387k"> - <dc:Bounds x="400" y="540" width="100" height="80" /> + <dc:Bounds x="400" y="670" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_0qyhv7c_di" bpmnElement="Flow_0qyhv7c"> - <di:waypoint x="356" y="580" /> - <di:waypoint x="400" y="580" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0yqo5xu_di" bpmnElement="Flow_0yqo5xu"> - <di:waypoint x="500" y="580" /> - <di:waypoint x="552" y="580" /> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn index 443a571312..fd650b9d50 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ExecuteBuildingBlock.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1"> <bpmn:process id="ExecuteBuildingBlock" name="ExecuteBuildingBlock" isExecutable="true"> <bpmn:startEvent id="Start_ExecuteBuildingBlock" name="start"> <bpmn:outgoing>SequenceFlow_0rq4c5r</bpmn:outgoing> @@ -12,6 +12,7 @@ <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" /> <camunda:out source="StatusMessage" target="StatusMessage" /> <camunda:in source="isRollback" target="isRollback" /> + <camunda:in source="isHelm" target="isHelm" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_19wuics</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01h9qmz</bpmn:outgoing> @@ -55,7 +56,7 @@ <bpmn:incoming>SequenceFlow_0ndt8ft</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07a1ytc</bpmn:outgoing> <bpmn:timerEventDefinition> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("RetryDuration")}]]></bpmn:timeDuration> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${execution.getVariable("RetryDuration")}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:intermediateCatchEvent> <bpmn:exclusiveGateway id="ExclusiveGateway_0ey4zpt" name="Retries Left?"> @@ -70,12 +71,12 @@ <bpmn:sequenceFlow id="SequenceFlow_0a62t4c" sourceRef="Task_QueryRainyDayTable" targetRef="ExclusiveGateway_1aonzik" /> <bpmn:sequenceFlow id="SequenceFlow_0h8v45y" name="Rollback or Abort" sourceRef="ExclusiveGateway_1aonzik" targetRef="EndEvent_0mvmk3i" /> <bpmn:sequenceFlow id="SequenceFlow_0fwsjva" name="Retry" sourceRef="ExclusiveGateway_1aonzik" targetRef="ExclusiveGateway_0ey4zpt"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Retry"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Retry"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0ndt8ft" sourceRef="Task_SetRetryTimer" targetRef="IntermediateCatchEvent_RetryTimer" /> <bpmn:sequenceFlow id="SequenceFlow_07a1ytc" sourceRef="IntermediateCatchEvent_RetryTimer" targetRef="EndEvent_1sez2lh" /> <bpmn:sequenceFlow id="SequenceFlow_1wbevp0" name="yes" sourceRef="ExclusiveGateway_0ey4zpt" targetRef="Task_SetRetryTimer"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("retryCount")<execution.getVariable("maxRetries")}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("retryCount")<execution.getVariable("maxRetries")}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:endEvent id="EndEvent_0mvmk3i"> <bpmn:incoming>SequenceFlow_0h8v45y</bpmn:incoming> @@ -106,10 +107,10 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_05le7o3" sourceRef="PauseForManualTaskRainyDay" targetRef="ExclusiveGateway_1aonzik" /> <bpmn:sequenceFlow id="SequenceFlow_1xh5ngw" name="Manual" sourceRef="ExclusiveGateway_1aonzik" targetRef="PauseForManualTaskRainyDay"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Manual"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Manual"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0xyd2zl" name="Skip" sourceRef="ExclusiveGateway_1aonzik" targetRef="Task_setHandlingCodeSuccessOnSkip"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Skip"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Skip"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_setHandlingCodeSuccessOnSkip" name="Set Handling Code to Success" camunda:expression="${ExecuteBuildingBlockRainyDay.setHandlingStatusSuccess(execution)}"> <bpmn:incoming>SequenceFlow_0xyd2zl</bpmn:incoming> @@ -132,12 +133,12 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1ynai9j" sourceRef="Task_setHandlingCodeSuccessOnSkip" targetRef="EndEvent_1py1er4" /> <bpmn:sequenceFlow id="SequenceFlow_1g7oq3t" name="Timeout" sourceRef="ExclusiveGateway_1aonzik" targetRef="Task_QuerySecondaryPolicy"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Timeout"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Timeout"}</bpmn:conditionExpression> </bpmn:sequenceFlow> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_16lmcxp" sourceRef="Task_setHandlingCodeSuccess" targetRef="End_ExecuteBuildingBlock" /> <bpmn:sequenceFlow id="SequenceFlow_1j0vskt" name="Silent Success" sourceRef="CheckOrchestrationStatusValidationResults" targetRef="Task_setHandlingCodeSuccess"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("orchestrationStatusValidationResult").name() == "SILENT_SUCCESS"}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("orchestrationStatusValidationResult").name() == "SILENT_SUCCESS"}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="Task_setHandlingCodeSuccess" name="Set Handling Code To Success" camunda:expression="${ExecuteBuildingBlockRainyDay.setHandlingStatusSuccess(execution)}"> <bpmn:incoming>SequenceFlow_1j0vskt</bpmn:incoming> @@ -164,285 +165,285 @@ <bpmn:error id="Error_0snha16" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ExecuteBuildingBlock"> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ExecuteBuildingBlock"> - <dc:Bounds x="111" y="162" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_12a4hhf_di" bpmnElement="SequenceFlow_12a4hhf"> + <di:waypoint x="1056" y="180" /> + <di:waypoint x="1113" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="119" y="198" width="22" height="12" /> + <dc:Bounds x="989.5" y="159" width="90" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_0n67obl_di" bpmnElement="Call_BBToExecute"> - <dc:Bounds x="749" y="140" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0rq4c5r_di" bpmnElement="SequenceFlow_0rq4c5r"> - <di:waypoint xsi:type="dc:Point" x="147" y="180" /> - <di:waypoint xsi:type="dc:Point" x="184" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19wuics_di" bpmnElement="SequenceFlow_19wuics"> + <di:waypoint x="732" y="180" /> + <di:waypoint x="799" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="120.5" y="165" width="90" height="0" /> + <dc:Bounds x="670.5" y="159" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uzwjrq_di" bpmnElement="SequenceFlow_0uzwjrq"> - <di:waypoint xsi:type="dc:Point" x="284" y="180" /> - <di:waypoint xsi:type="dc:Point" x="321" y="180" /> + <bpmndi:BPMNEdge id="SequenceFlow_1j0vskt_di" bpmnElement="SequenceFlow_1j0vskt"> + <di:waypoint x="533" y="155" /> + <di:waypoint x="533" y="84" /> + <di:waypoint x="1163" y="84" /> + <di:waypoint x="1163" y="140" /> <bpmndi:BPMNLabel> - <dc:Bounds x="257.5" y="165" width="90" height="0" /> + <dc:Bounds x="814" y="63" width="73" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1jcuk3b_di" bpmnElement="Task_BBInputSetup"> - <dc:Bounds x="184" y="140" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0ahsxzi_di" bpmnElement="End_ExecuteBuildingBlock"> - <dc:Bounds x="1221" y="162" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_16lmcxp_di" bpmnElement="SequenceFlow_16lmcxp"> + <di:waypoint x="1213" y="180" /> + <di:waypoint x="1271" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1230" y="202" width="18" height="12" /> + <dc:Bounds x="1147" y="159" width="90" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0je0y25_di" bpmnElement="SequenceFlow_0je0y25"> + <di:waypoint x="471" y="180" /> + <di:waypoint x="508" y="180" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="394.5" y="159" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kdjsnx_di" bpmnElement="Continue"> + <di:waypoint x="558" y="180" /> + <di:waypoint x="632" y="180" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="574" y="159" width="45" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_01h9qmz_di" bpmnElement="SequenceFlow_01h9qmz"> - <di:waypoint xsi:type="dc:Point" x="849" y="180" /> - <di:waypoint xsi:type="dc:Point" x="906" y="180" /> + <di:waypoint x="899" y="180" /> + <di:waypoint x="956" y="180" /> <bpmndi:BPMNLabel> <dc:Bounds x="832.5" y="159" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0ey4zpt_di" bpmnElement="ExclusiveGateway_0ey4zpt" isMarkerVisible="true"> - <dc:Bounds x="695" y="478" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_0uzwjrq_di" bpmnElement="SequenceFlow_0uzwjrq"> + <di:waypoint x="334" y="180" /> + <di:waypoint x="371" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="691" y="453" width="62" height="12" /> + <dc:Bounds x="257.5" y="165" width="90" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="IntermediateCatchEvent_0qjyidb_di" bpmnElement="IntermediateCatchEvent_RetryTimer"> - <dc:Bounds x="939" y="485" width="36" height="36" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0rq4c5r_di" bpmnElement="SequenceFlow_0rq4c5r"> + <di:waypoint x="197" y="180" /> + <di:waypoint x="234" y="180" /> <bpmndi:BPMNLabel> - <dc:Bounds x="930" y="460" width="55" height="12" /> + <dc:Bounds x="120.5" y="165" width="90" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1aonzik_di" bpmnElement="ExclusiveGateway_1aonzik" isMarkerVisible="true"> - <dc:Bounds x="542" y="478" width="50" height="50" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_ExecuteBuildingBlock"> + <dc:Bounds x="161" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="533" y="440" width="68" height="24" /> + <dc:Bounds x="169" y="198" width="23" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1wbevp0_di" bpmnElement="SequenceFlow_1wbevp0"> - <di:waypoint xsi:type="dc:Point" x="745" y="503" /> - <di:waypoint xsi:type="dc:Point" x="810" y="503" /> + <bpmndi:BPMNShape id="CallActivity_0n67obl_di" bpmnElement="Call_BBToExecute"> + <dc:Bounds x="799" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1jcuk3b_di" bpmnElement="Task_BBInputSetup"> + <dc:Bounds x="234" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0ahsxzi_di" bpmnElement="End_ExecuteBuildingBlock"> + <dc:Bounds x="1271" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="763" y="478" width="18" height="12" /> + <dc:Bounds x="1280" y="202" width="19" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0fwsjva_di" bpmnElement="SequenceFlow_0fwsjva"> - <di:waypoint xsi:type="dc:Point" x="592" y="503" /> - <di:waypoint xsi:type="dc:Point" x="695" y="503" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0brnbqx_di" bpmnElement="StatusPolicy"> + <dc:Bounds x="371" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0f8ghh3_di" bpmnElement="CheckOrchestrationStatusValidationResults" isMarkerVisible="true"> + <dc:Bounds x="508" y="155" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="630" y="511" width="27" height="12" /> + <dc:Bounds x="492" y="209" width="87" height="53" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0h8v45y_di" bpmnElement="SequenceFlow_0h8v45y"> - <di:waypoint xsi:type="dc:Point" x="567" y="528" /> - <di:waypoint xsi:type="dc:Point" x="567" y="584" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0tv8zda_di" bpmnElement="SubProcess_0tv8zda" isExpanded="true"> + <dc:Bounds x="221" y="299" width="1020" height="432" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1g7oq3t_di" bpmnElement="SequenceFlow_1g7oq3t"> + <di:waypoint x="633" y="512" /> + <di:waypoint x="720" y="562" /> <bpmndi:BPMNLabel> - <dc:Bounds x="575" y="549" width="84" height="12" /> + <dc:Bounds x="698" y="533" width="41" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1tifgqh_di" bpmnElement="Task_QueryRainyDayTable"> - <dc:Bounds x="399" y="463" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ndt8ft_di" bpmnElement="SequenceFlow_0ndt8ft"> - <di:waypoint xsi:type="dc:Point" x="910" y="503" /> - <di:waypoint xsi:type="dc:Point" x="939" y="503" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ynai9j_di" bpmnElement="SequenceFlow_1ynai9j"> + <di:waypoint x="449" y="629" /> + <di:waypoint x="390" y="629" /> <bpmndi:BPMNLabel> - <dc:Bounds x="925" y="482" width="0" height="0" /> + <dc:Bounds x="370" y="604" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_07a1ytc_di" bpmnElement="SequenceFlow_07a1ytc"> - <di:waypoint xsi:type="dc:Point" x="975" y="503" /> - <di:waypoint xsi:type="dc:Point" x="1013" y="503" /> + <bpmndi:BPMNEdge id="SequenceFlow_0xyd2zl_di" bpmnElement="SequenceFlow_0xyd2zl"> + <di:waypoint x="603" y="514" /> + <di:waypoint x="499" y="589" /> <bpmndi:BPMNLabel> - <dc:Bounds x="994" y="482" width="0" height="0" /> + <dc:Bounds x="556" y="549" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1obvxht_di" bpmnElement="Task_SetRetryTimer"> - <dc:Bounds x="810" y="463" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0kdjsnx_di" bpmnElement="Continue"> - <di:waypoint xsi:type="dc:Point" x="508" y="180" /> - <di:waypoint xsi:type="dc:Point" x="582" y="180" /> + <bpmndi:BPMNEdge id="SequenceFlow_1xh5ngw_di" bpmnElement="SequenceFlow_1xh5ngw"> + <di:waypoint x="603" y="492" /> + <di:waypoint x="512" y="423" /> + <di:waypoint x="512" y="377" /> + <di:waypoint x="567" y="377" /> <bpmndi:BPMNLabel> - <dc:Bounds x="524.6653543307086" y="159" width="43" height="12" /> + <dc:Bounds x="517" y="400" width="37" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0brnbqx_di" bpmnElement="StatusPolicy"> - <dc:Bounds x="321" y="140" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0f8ghh3_di" bpmnElement="CheckOrchestrationStatusValidationResults" isMarkerVisible="true"> - <dc:Bounds x="458" y="155" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_05le7o3_di" bpmnElement="SequenceFlow_05le7o3"> + <di:waypoint x="667" y="377" /> + <di:waypoint x="709" y="377" /> + <di:waypoint x="709" y="421" /> + <di:waypoint x="630" y="491" /> <bpmndi:BPMNLabel> - <dc:Bounds x="442" y="209" width="87" height="48" /> + <dc:Bounds x="674" y="399" width="0" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0je0y25_di" bpmnElement="SequenceFlow_0je0y25"> - <di:waypoint xsi:type="dc:Point" x="421" y="180" /> - <di:waypoint xsi:type="dc:Point" x="458" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9"> + <di:waypoint x="285" y="503" /> + <di:waypoint x="314" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="394.5" y="159" width="90" height="12" /> + <dc:Bounds x="250" y="482" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0a62t4c_di" bpmnElement="SequenceFlow_0a62t4c"> - <di:waypoint xsi:type="dc:Point" x="499" y="503" /> - <di:waypoint xsi:type="dc:Point" x="542" y="503" /> + <bpmndi:BPMNEdge id="SequenceFlow_0vdeqxv_di" bpmnElement="SequenceFlow_0vdeqxv"> + <di:waypoint x="414" y="503" /> + <di:waypoint x="449" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="521" y="482" width="0" height="0" /> + <dc:Bounds x="382" y="482" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="SubProcess_0tv8zda_di" bpmnElement="SubProcess_0tv8zda" isExpanded="true"> - <dc:Bounds x="171" y="299" width="1020" height="432" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0mvmk3i_di" bpmnElement="EndEvent_0mvmk3i"> - <dc:Bounds x="549" y="584" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_12ps9at_di" bpmnElement="SequenceFlow_12ps9at"> + <di:waypoint x="820" y="592" /> + <di:waypoint x="892" y="592" /> <bpmndi:BPMNLabel> - <dc:Bounds x="567" y="624" width="0" height="0" /> + <dc:Bounds x="806" y="571" width="0" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1aww7yx_di" bpmnElement="EndEvent_1sez2lh"> - <dc:Bounds x="1013" y="485" width="36" height="36" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0541bid_di" bpmnElement="SequenceFlow_0541bid"> + <di:waypoint x="770" y="528" /> + <di:waypoint x="770" y="552" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1024" y="525" width="18" height="12" /> + <dc:Bounds x="782" y="529" width="13" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_16lmcxp_di" bpmnElement="SequenceFlow_16lmcxp"> - <di:waypoint xsi:type="dc:Point" x="1163" y="180" /> - <di:waypoint xsi:type="dc:Point" x="1221" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1wbevp0_di" bpmnElement="SequenceFlow_1wbevp0"> + <di:waypoint x="795" y="503" /> + <di:waypoint x="860" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1147" y="159" width="90" height="12" /> + <dc:Bounds x="814" y="478" width="17" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1j0vskt_di" bpmnElement="SequenceFlow_1j0vskt"> - <di:waypoint xsi:type="dc:Point" x="483" y="155" /> - <di:waypoint xsi:type="dc:Point" x="483" y="84" /> - <di:waypoint xsi:type="dc:Point" x="1113" y="84" /> - <di:waypoint xsi:type="dc:Point" x="1113" y="140" /> + <bpmndi:BPMNEdge id="SequenceFlow_07a1ytc_di" bpmnElement="SequenceFlow_07a1ytc"> + <di:waypoint x="1025" y="503" /> + <di:waypoint x="1063" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="764.2235294117647" y="63" width="72" height="12" /> + <dc:Bounds x="994" y="482" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0z9izx5_di" bpmnElement="Task_setHandlingCodeSuccess"> - <dc:Bounds x="1063" y="140" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_19wuics_di" bpmnElement="SequenceFlow_19wuics"> - <di:waypoint xsi:type="dc:Point" x="682" y="180" /> - <di:waypoint xsi:type="dc:Point" x="749" y="180" /> + <bpmndi:BPMNEdge id="SequenceFlow_0ndt8ft_di" bpmnElement="SequenceFlow_0ndt8ft"> + <di:waypoint x="960" y="503" /> + <di:waypoint x="989" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="670.5" y="159" width="90" height="12" /> + <dc:Bounds x="925" y="482" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_12a4hhf_di" bpmnElement="SequenceFlow_12a4hhf"> - <di:waypoint xsi:type="dc:Point" x="1006" y="180" /> - <di:waypoint xsi:type="dc:Point" x="1063" y="180" /> + <bpmndi:BPMNEdge id="SequenceFlow_0fwsjva_di" bpmnElement="SequenceFlow_0fwsjva"> + <di:waypoint x="642" y="503" /> + <di:waypoint x="745" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="989.5" y="159" width="90" height="12" /> + <dc:Bounds x="680" y="511" width="27" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1pf5f6w_di" bpmnElement="Task_PreValidate"> - <dc:Bounds x="582" y="140" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_02w4792_di" bpmnElement="Task_PostValidate"> - <dc:Bounds x="906" y="140" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0541bid_di" bpmnElement="SequenceFlow_0541bid"> - <di:waypoint xsi:type="dc:Point" x="720" y="528" /> - <di:waypoint xsi:type="dc:Point" x="720" y="552" /> + <bpmndi:BPMNEdge id="SequenceFlow_0h8v45y_di" bpmnElement="SequenceFlow_0h8v45y"> + <di:waypoint x="617" y="528" /> + <di:waypoint x="617" y="584" /> <bpmndi:BPMNLabel> - <dc:Bounds x="732" y="529" width="12" height="12" /> + <dc:Bounds x="624" y="549" width="86" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_12ps9at_di" bpmnElement="SequenceFlow_12ps9at"> - <di:waypoint xsi:type="dc:Point" x="770" y="592" /> - <di:waypoint xsi:type="dc:Point" x="842" y="592" /> + <bpmndi:BPMNEdge id="SequenceFlow_0a62t4c_di" bpmnElement="SequenceFlow_0a62t4c"> + <di:waypoint x="549" y="503" /> + <di:waypoint x="592" y="503" /> <bpmndi:BPMNLabel> - <dc:Bounds x="806" y="571" width="0" height="0" /> + <dc:Bounds x="521" y="482" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_05vw85n_di" bpmnElement="EndEvent_0ex9298"> - <dc:Bounds x="842" y="574" width="36" height="36" /> + <bpmndi:BPMNShape id="ServiceTask_1tifgqh_di" bpmnElement="Task_QueryRainyDayTable"> + <dc:Bounds x="449" y="463" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1aonzik_di" bpmnElement="ExclusiveGateway_1aonzik" isMarkerVisible="true"> + <dc:Bounds x="592" y="478" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="852" y="614" width="18" height="12" /> + <dc:Bounds x="582" y="440" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_11f2c91_di" bpmnElement="Task_QuerySecondaryPolicy"> - <dc:Bounds x="670" y="552" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0vdeqxv_di" bpmnElement="SequenceFlow_0vdeqxv"> - <di:waypoint xsi:type="dc:Point" x="364" y="503" /> - <di:waypoint xsi:type="dc:Point" x="399" y="503" /> + <bpmndi:BPMNShape id="IntermediateCatchEvent_0qjyidb_di" bpmnElement="IntermediateCatchEvent_RetryTimer"> + <dc:Bounds x="989" y="485" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="382" y="482" width="0" height="0" /> + <dc:Bounds x="980" y="460" width="56" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g"> - <dc:Bounds x="199" y="485" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0ey4zpt_di" bpmnElement="ExclusiveGateway_0ey4zpt" isMarkerVisible="true"> + <dc:Bounds x="745" y="478" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="127" y="521" width="0" height="0" /> + <dc:Bounds x="741" y="453" width="63" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_09synl9_di" bpmnElement="SequenceFlow_09synl9"> - <di:waypoint xsi:type="dc:Point" x="235" y="503" /> - <di:waypoint xsi:type="dc:Point" x="264" y="503" /> + <bpmndi:BPMNShape id="ServiceTask_1obvxht_di" bpmnElement="Task_SetRetryTimer"> + <dc:Bounds x="860" y="463" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0mvmk3i_di" bpmnElement="EndEvent_0mvmk3i"> + <dc:Bounds x="599" y="584" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="250" y="482" width="0" height="0" /> + <dc:Bounds x="567" y="624" width="0" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_10v49qn_di" bpmnElement="Task_UpdateExtErrorSource"> - <dc:Bounds x="264" y="463" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_05le7o3_di" bpmnElement="SequenceFlow_05le7o3"> - <di:waypoint xsi:type="dc:Point" x="617" y="377" /> - <di:waypoint xsi:type="dc:Point" x="659" y="377" /> - <di:waypoint xsi:type="dc:Point" x="659" y="421" /> - <di:waypoint xsi:type="dc:Point" x="580" y="491" /> + <bpmndi:BPMNShape id="EndEvent_1aww7yx_di" bpmnElement="EndEvent_1sez2lh"> + <dc:Bounds x="1063" y="485" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="674" y="399" width="0" height="0" /> + <dc:Bounds x="1074" y="525" width="19" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1xh5ngw_di" bpmnElement="SequenceFlow_1xh5ngw"> - <di:waypoint xsi:type="dc:Point" x="553" y="492" /> - <di:waypoint xsi:type="dc:Point" x="462" y="423" /> - <di:waypoint xsi:type="dc:Point" x="462" y="377" /> - <di:waypoint xsi:type="dc:Point" x="517" y="377" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_05vw85n_di" bpmnElement="EndEvent_0ex9298"> + <dc:Bounds x="892" y="574" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="468" y="400" width="35" height="12" /> + <dc:Bounds x="902" y="614" width="19" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0xyd2zl_di" bpmnElement="SequenceFlow_0xyd2zl"> - <di:waypoint xsi:type="dc:Point" x="553" y="514" /> - <di:waypoint xsi:type="dc:Point" x="449" y="589" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_11f2c91_di" bpmnElement="Task_QuerySecondaryPolicy"> + <dc:Bounds x="720" y="552" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0tmcs9g_di" bpmnElement="StartEvent_0tmcs9g"> + <dc:Bounds x="249" y="485" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="506" y="549.4997153461163" width="21" height="12" /> + <dc:Bounds x="127" y="521" width="0" height="0" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_10v49qn_di" bpmnElement="Task_UpdateExtErrorSource"> + <dc:Bounds x="314" y="463" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0ohzi8e_di" bpmnElement="Task_setHandlingCodeSuccessOnSkip"> - <dc:Bounds x="399" y="589" width="100" height="80" /> + <dc:Bounds x="449" y="589" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0szwp51_di" bpmnElement="PauseForManualTaskRainyDay"> - <dc:Bounds x="517" y="337" width="100" height="80" /> + <dc:Bounds x="567" y="337" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1py1er4_di" bpmnElement="EndEvent_1py1er4"> - <dc:Bounds x="304" y="611" width="36" height="36" /> + <dc:Bounds x="354" y="611" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="313" y="647" width="18" height="12" /> + <dc:Bounds x="363" y="647" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ynai9j_di" bpmnElement="SequenceFlow_1ynai9j"> - <di:waypoint xsi:type="dc:Point" x="399" y="629" /> - <di:waypoint xsi:type="dc:Point" x="340" y="629" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="370" y="604" width="0" height="0" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1g7oq3t_di" bpmnElement="SequenceFlow_1g7oq3t"> - <di:waypoint xsi:type="dc:Point" x="583" y="512" /> - <di:waypoint xsi:type="dc:Point" x="670" y="562" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="649" y="533" width="39" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0z9izx5_di" bpmnElement="Task_setHandlingCodeSuccess"> + <dc:Bounds x="1113" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1pf5f6w_di" bpmnElement="Task_PreValidate"> + <dc:Bounds x="632" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_02w4792_di" bpmnElement="Task_PostValidate"> + <dc:Bounds x="956" y="140" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy index 36d579c7ab..5c030a9f86 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -20,9 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.isBlank -import java.lang.reflect.Type -import javax.ws.rs.NotFoundException + import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.* @@ -32,9 +30,12 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri 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.ErrorCode -import org.onap.so.beans.nsmf.NSSI +import org.onap.so.beans.nsmf.CustomerInfo +import org.onap.so.beans.nsmf.NetworkType +import org.onap.so.beans.nsmf.NssInstance +import org.onap.so.beans.nsmf.OperationType +import org.onap.so.beans.nsmf.OrchestrationStatusEnum import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -46,8 +47,11 @@ import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken + +import javax.ws.rs.NotFoundException +import java.util.function.Consumer + +import static org.apache.commons.lang3.StringUtils.isBlank /** * This groovy class supports the <class>ActivateSliceService.bpmn</class> process. @@ -66,6 +70,8 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { RequestDBUtil requestDBUtil = new RequestDBUtil() + AAIResourcesClient client = getAAIClient() + private static final Logger logger = LoggerFactory.getLogger(ActivateSliceService.class) void preProcessRequest(DelegateExecution execution) { @@ -75,7 +81,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { try { // check for incoming json message/input - String siRequest = execution.getVariable("bpmnRequest") + String siRequest = Objects.requireNonNull(execution.getVariable("bpmnRequest")) logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") @@ -109,13 +115,20 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) } - String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + String operationId = Objects.requireNonNull(jsonUtil.getJsonValue(siRequest, "operationId")) execution.setVariable("operationId", operationId) - String operationType = execution.getVariable("operationType") - execution.setVariable("operationType", operationType.toUpperCase()) - + String operationType = Objects.requireNonNull(execution.getVariable("operationType")) logger.info("operationType is " + execution.getVariable("operationType") ) + + CustomerInfo customerInfo = CustomerInfo.builder().operationId(operationId) + .operationType(Objects.requireNonNull(OperationType.getOperationType(operationType))) + .globalSubscriberId(globalSubscriberId).serviceInstanceId(serviceInstanceId) + .subscriptionServiceType(subscriptionServiceType) + .build() + + execution.setVariable("customerInfo", customerInfo) + } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -126,14 +139,58 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { logger.debug(Prefix + "preProcessRequest Exit") } + /** + * Init the service Operation Status + */ + def prepareInitServiceOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareActivateServiceOperationStatus Start") + try { + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String serviceId = customerInfo.getServiceInstanceId() + String operationId = customerInfo.getOperationId() + String operationType = customerInfo.getOperationType().getType() + String userId = customerInfo.getGlobalSubscriberId() + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service activation" + + execution.setVariable("e2eserviceInstanceId", serviceId) + //execution.setVariable("operationType", operationType) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + } catch (Exception e) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", + "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + logger.debug(Prefix + "prepareInitServiceOperationStatus Exit") + } + def sendSyncResponse = { DelegateExecution execution -> logger.debug(Prefix + "sendSyncResponse Start") try { - String operationId = execution.getVariable("operationId") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String operationId = customerInfo.getOperationId() + // RESTResponse for API Handler (APIH) Reply Task String Activate5GsliceServiceRestRequest = """{"operationId":"${operationId}"}""".trim() logger.debug(" sendSyncResponse to APIH:" + "\n" + Activate5GsliceServiceRestRequest) + sendWorkflowResponse(execution, 202, Activate5GsliceServiceRestRequest) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { @@ -171,410 +228,289 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { logger.debug(Prefix + "sendSyncError Exit") } + def checkAAIOrchStatusOfE2ESlice = { DelegateExecution execution -> + logger.debug(Prefix + "CheckAAIOrchStatus Start") + execution.setVariable("isContinue", "false") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String msg + String serviceInstanceId = customerInfo.serviceInstanceId + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - def prepareCompletionRequest = { DelegateExecution execution -> - logger.debug(Prefix + "prepareCompletionRequest Start") - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String userId = execution.getVariable("globalSubscriberId") - //String result = execution.getVariable("result") - String result = "finished" - String progress = "100" - String reason = "" - String operationContent = execution.getVariable("operationContent") - String operationType = execution.getVariable("operationType") - - OperationStatus initStatus = new OperationStatus() - initStatus.setServiceId(serviceId) - initStatus.setOperationId(operationId) - initStatus.setOperation(operationType) - initStatus.setUserId(userId) - initStatus.setResult(result) - initStatus.setProgress(progress) - initStatus.setReason(reason) - initStatus.setOperationContent(operationContent) - - requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) - - logger.debug(Prefix + "prepareCompletionRequest Exit") - } - + logger.debug("serviceInstanceId: " + serviceInstanceId) - /** - * Init the service Operation Status - */ - def prepareInitServiceOperationStatus = { DelegateExecution execution -> - logger.debug(Prefix + "prepareActivateServiceOperationStatus Start") + //check the e2e slice status try { - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String userId = execution.getVariable("globalSubscriberId") - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service activation" - - execution.setVariable("e2eserviceInstanceId", serviceId) - execution.setVariable("operationType", operationType) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId)) - OperationStatus initStatus = new OperationStatus() - initStatus.setServiceId(serviceId) - initStatus.setOperationId(operationId) - initStatus.setOperation(operationType) - initStatus.setUserId(userId) - initStatus.setResult(result) - initStatus.setProgress(progress) - initStatus.setReason(reason) - initStatus.setOperationContent(operationContent) + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + ServiceInstance serviceInstance = si.orElseThrow() - requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + boolean isContinue = handleOperation(customerInfo, serviceInstance) + execution.setVariable("isContinue", isContinue) + customerInfo.setSnssai(serviceInstance.getEnvironmentContext()) - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) - execution.setVariable("CVFMI_ErrorResponse", - "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + execution.setVariable("customerInfo", customerInfo) + execution.setVariable("ssInstance", serviceInstance) + execution.setVariable("ssiUri", uri) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + execution.setVariable("isContinue", "false") + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus, " + + "Requested e2eservice does not exist: " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.debug(Prefix + "prepareInitServiceOperationStatus Exit") - } + logger.debug(Prefix + "CheckAAIOrchStatus Exit") + } - private getSNSSIStatusByNsi = { DelegateExecution execution, String NSIServiceId -> + static boolean handleOperation(CustomerInfo customerInfo, ServiceInstance serviceInstance) { + OperationType operationType = customerInfo.operationType + OrchestrationStatusEnum status = OrchestrationStatusEnum.getStatus(Objects.requireNonNull( + serviceInstance.getOrchestrationStatus())) - logger.debug(Prefix + "getSNSSIStatusByNsi Start") - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + return ((OrchestrationStatusEnum.ACTIVATED == status && OperationType.DEACTIVATE == operationType) + || (OrchestrationStatusEnum.DEACTIVATED == status && OperationType.ACTIVATE == operationType)) + } - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIServiceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { + void checkAAIOrchStatusOfAllocates(DelegateExecution execution) { + logger.debug(Prefix + "CheckAAIOrchStatus Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String msg + String serviceInstanceId = customerInfo.serviceInstanceId + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() - for (Relationship relationship : relatedList) { - String relatedTo = relationship.getRelatedTo() - if (relatedTo.toLowerCase() == "allotted-resource") { - //get snssi from allotted resource in list by nsi - List<String> SNSSIList = new ArrayList<>() - List<RelationshipData> relationshipDataList = relationship.getRelationshipData() - for (RelationshipData relationshipData : relationshipDataList) { - if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") { - SNSSIList.add(relationshipData.getRelationshipValue()) - } - } - for (String snssi : SNSSIList) { - AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(snssi)) - if (!client.exists(uri01)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) - Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) - if (nssiSi.isPresent()) { - return nssiSi.get().getOrchestrationStatus() == "deactivated" - } - } + logger.debug("serviceInstanceId: " + serviceInstanceId) - } - } + //check the NSI is exist or the status of NSI is active or de-active + try { - } - logger.debug(Prefix + "getSNSSIStatusByNsi Exit") - } + //get the allotted-resources by e2e slice id + AAIPluralResourceUri uriAllotted = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId) + .allottedResources() + ) + AAIResultWrapper wrapperAllotted = client.get(uriAllotted, NotFoundException.class) + Optional<AllottedResources> allAllotted = wrapperAllotted.asBean(AllottedResources.class) - def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution -> - logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start") - logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ") - String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") - String NSIserviceInstanceId = execution.getVariable("NSIserviceid") - - String globalCustId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String operationType = execution.getVariable("operationType") - - String nssiMap = execution.getVariable("nssiMap") - Type type = new TypeToken<HashMap<String, NSSI>>() {}.getType() - Map<String, NSSI> activateNssiMap = new Gson().fromJson(nssiMap, type) - //update tn/cn/an nssi - for (Map.Entry<String, NSSI> entry : activateNssiMap.entrySet()) { - NSSI nssi = entry.getValue() - String nssiid = nssi.getNssiId() - updateStratus(execution, globalCustId, serviceType, nssiid, operationType) - } - if (operationType.equalsIgnoreCase("activation")) { - //update the s-nssai - updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) - //update the nsi - updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) - } else { - //update the s-nssai - updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) - boolean flag = getSNSSIStatusByNsi(execution, NSIserviceInstanceId) - if (flag) { - //update the nsi - updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) - } else { - logger.error("Service's status update failed") - String msg = "Service's status update failed" - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + AllottedResources allottedResources = allAllotted.get() + List<AllottedResource> AllottedResourceList = allottedResources.getAllottedResource() + if (AllottedResourceList.isEmpty()) { + execution.setVariable("isContinue", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "allottedResources in aai is empty") } + AllottedResource ar = AllottedResourceList.first() + String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink() + String nsiServiceId = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length()) + customerInfo.setNsiId(nsiServiceId) + execution.setVariable("customerInfo", customerInfo) + logger.info("the NSI ID is:" + nsiServiceId) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + logger.info("NSI Service doesnt exist") + execution.setVariable("isContinue", "false") + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit") + logger.debug(Prefix + "CheckAAIOrchStatus Exit") } + void checkAAIOrchStatusOfNSI(DelegateExecution execution) { - def updateStratus = { DelegateExecution execution, String globalCustId, - String serviceType, String serviceId, String operationType -> - logger.debug(Prefix + "updateStratus Start") + logger.debug(Prefix + "CheckAAIOrchStatus Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String msg = "" + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType + String nsiServiceId = customerInfo.getNsiId() + + logger.debug("network slice instance id: " + nsiServiceId) + //check the NSI is exist or the status of NSI is active or de-active try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } + //Query nsi by nsi id + + //get the NSI id by e2e slice id + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(nsiServiceId)) + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - if (operationType.equalsIgnoreCase("activation")) { - if (si.get().getOrchestrationStatus() == "deactivated") { - si.get().setOrchestrationStatus("activated") - client.update(uri, si.get()) - } - } else { - if (si.get().getOrchestrationStatus() == "activated") { - si.get().setOrchestrationStatus("deactivated") - client.update(uri, si.get()) - } - } - + ServiceInstance nsInstance = si.get() + if (!"nsi".equalsIgnoreCase(nsInstance.getServiceRole().toLowerCase())) { + logger.info("the service id" + nsInstance.getServiceInstanceId() + "is " + + nsInstance.getServiceRole()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - } catch (Exception e) { - logger.info("Service is already in active state") - String msg = "Service is already in active state, " + e.getMessage() + execution.setVariable("nsInstance", nsInstance) + execution.setVariable("nsiUri", uri) + boolean isContinue = handleOperation(customerInfo, nsInstance) + execution.setVariable("isContinue", isContinue) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + logger.info("NSI Service doesnt exist") + execution.setVariable("isActivate", "false") + execution.setVariable("isContinue", "false") + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - - logger.debug(Prefix + "updateStratus Exit") + logger.debug(Prefix + "CheckAAIOrchStatus Exit") } - - def prepareActivation = { DelegateExecution execution -> + void prepareActivation(DelegateExecution execution) { logger.debug(Prefix + "prepareActivation Start") - logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ") - String NSIserviceInstanceId = execution.getVariable("NSIserviceid") - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - Map<String, NSSI> nssiMap = new HashMap<>() + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - List<String> activationSequence = new ArrayList<>(Arrays.asList("an", "tn", "cn")) - - def activationCount = activationSequence.size() - - execution.setVariable("activationIndex", "0") + logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ") - execution.setVariable("activationCount", activationCount) + Queue<NssInstance> nssInstances = new LinkedList<>() + ServiceInstance nsInstance = + execution.getVariable("nsInstance") as ServiceInstance try { //get the TN NSSI id by NSI id, active NSSI TN slicing - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIserviceInstanceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - - List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() - for (Relationship relationship : relatedList) { - String relatedTo = relationship.getRelatedTo() - if (relatedTo.toLowerCase() == "service-instance") { - String relatioshipurl = relationship.getRelatedLink() - String nssiserviceid = - relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) - - AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiserviceid)) - if (!client.exists(uri01)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) - Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) - if (nssiSi.isPresent()) { - if (nssiSi.get().getEnvironmentContext().toLowerCase().contains("an") - || nssiSi.get().getEnvironmentContext().toLowerCase().contains("cn") - || nssiSi.get().getEnvironmentContext().toLowerCase().contains("tn")) { - nssiMap.put(nssiSi.get().getEnvironmentContext(), - new NSSI(nssiSi.get().getServiceInstanceId(), - nssiSi.get().getModelInvariantId(), nssiSi.get().getModelVersionId())) - } - } - } + List<Relationship> relatedList = nsInstance.getRelationshipList().getRelationship() + for (Relationship relationship : relatedList) { + String relatedTo = relationship.getRelatedTo() + if (!"service-instance".equalsIgnoreCase(relatedTo)) { + continue } - - + String relatioshipurl = relationship.getRelatedLink() + String nssiserviceid = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, + relatioshipurl.length()) + + AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(nssiserviceid)) + if (!client.exists(nsiUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper01 = client.get(nsiUri, NotFoundException.class) + Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) + nssiSi.ifPresent(new Consumer<ServiceInstance>() { + @Override + void accept(ServiceInstance instance) { + String env = Objects.requireNonNull(instance.getEnvironmentContext()) + NssInstance nssi = NssInstance.builder().nssiId(instance.getServiceInstanceId()) + .modelInvariantId(instance.getModelInvariantId()) + .modelVersionId(instance.getModelVersionId()) + .networkType(NetworkType.fromString(env)) + .operationType(customerInfo.operationType) + .snssai(customerInfo.snssai) + .serviceType(instance.getServiceType()) + .build() + nssInstances.offer(nssi) + } + }) } + execution.setVariable("nssInstances", nssInstances) + execution.setVariable("nssInstanceInfos", nssInstances) } catch (Exception e) { String msg = "Requested service does not exist:" + e.getMessage() logger.info("Service doesnt exist") exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - if (nssiMap.size() > 0) { - execution.setVariable("isNSSIActivate", "true") - String nssiMap01 = mapToJsonStr(nssiMap) - execution.setVariable("nssiMap", nssiMap01) - execution.setVariable("operation_type", "activate") - execution.setVariable("activationCount", nssiMap.size()) - logger.info("the nssiMap01 is :" + nssiMap01) - } else { - execution.setVariable("isNSSIActivate", "false") - } - logger.debug(Prefix + "prepareActivation Exit") } - - private mapToJsonStr = { HashMap<String, NSSI> stringNSSIHashMap -> - HashMap<String, NSSI> map = new HashMap<String, NSSI>() - for (Map.Entry<String, NSSI> child : stringNSSIHashMap.entrySet()) { - map.put(child.getKey(), child.getValue()) + void isOperationFinished(DelegateExecution execution) { + Queue<NssInstance> nssInstances = execution.getVariable("nssInstances") as Queue<NssInstance> + if (nssInstances.isEmpty()) { + execution.setVariable("isOperationFinished", "true") } - return new Gson().toJson(map) } + def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution -> + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start") + logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ") + ServiceInstance ssInstance = execution.getVariable("ssInstance") as ServiceInstance + AAIResourceUri ssUri = execution.getVariable("ssiUri") as AAIResourceUri - def checkAAIOrchStatusofslice = { DelegateExecution execution -> - logger.debug(Prefix + "CheckAAIOrchStatus Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + OperationType operationType = customerInfo.operationType - String msg = "" - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String operationType = execution.getVariable("operationType") + updateStratus(execution, ssInstance, operationType, ssUri) + //update the nsi + ServiceInstance nsInstance = execution.getVariable("nsInstance") as ServiceInstance + AAIResourceUri nsiUri = execution.getVariable("nsiUri") as AAIResourceUri - logger.debug("serviceInstanceId: " + serviceInstanceId) + updateStratus(execution, nsInstance, operationType, nsiUri) - //check the e2e slice status - try { - try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri 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") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - if (si.get().getOrchestrationStatus().toLowerCase() == "activated" && - operationType.equalsIgnoreCase("deactivation")) { - logger.info("Service is in active state") - execution.setVariable("e2eservicestatus", "activated") - execution.setVariable("isContinue", "true") - String snssai = si.get().getEnvironmentContext() - execution.setVariable("snssai", snssai) - } else if (si.get().getOrchestrationStatus().toLowerCase() == "deactivated" && - operationType.equalsIgnoreCase("activation")) { - logger.info("Service is in de-activated state") - execution.setVariable("e2eservicestatus", "deactivated") - execution.setVariable("isContinue", "true") - String snssai = si.get().getEnvironmentContext() - execution.setVariable("snssai", snssai) - } else { - execution.setVariable("isContinue", "false") - } - } - } catch (Exception e) { - msg = "Requested e2eservice does not exist" - logger.info("e2eservice doesnt exist") - execution.setVariable("isContinue", "false") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - //check the NSI is exist or the status of NSI is active or de-active - try { + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit") + } - //get the allotted-resources by e2e slice id - AAIResourcesClient client_allotted = new AAIResourcesClient() - AAIPluralResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId).allottedResources() - ) - if (!client_allotted.exists(uri_allotted)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } - AAIResultWrapper wrapper_allotted = client_allotted.get(uri_allotted, NotFoundException.class) - Optional<AllottedResources> all_allotted = wrapper_allotted.asBean(AllottedResources.class) - - if (all_allotted.isPresent() && all_allotted.get().getAllottedResource()) { - List<AllottedResource> AllottedResourceList = all_allotted.get().getAllottedResource() - AllottedResource ar = AllottedResourceList.first() - String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink() - String nsiserviceid = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length()) - execution.setVariable("NSIserviceid", nsiserviceid) - logger.info("the NSI ID is:" + nsiserviceid) - - //Query nsi by nsi id - try { - //get the NSI id by e2e slice id - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nsiserviceid)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - - if (si.isPresent()) { - if (si.get().getServiceRole().toLowerCase() == "nsi") { - if (si.get().getOrchestrationStatus() == "activated") { - logger.info("NSI services is in activated state") - execution.setVariable("NSIservicestatus", "activated") - } else { - logger.info("NSI services is in deactivated state") - execution.setVariable("NSIservicestatus", "deactivated") - } - } else { - logger.info("the service id" + si.get().getServiceInstanceId() + "is " + - si.get().getServiceRole()) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - } catch (Exception e) { - msg = "Requested NSI service does not exist:" + e.getMessage() - logger.info("NSI service doesnt exist") - execution.setVariable("isContinue", "false") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - } catch (Exception e) { - msg = "Requested service does not exist: " + e.getMessage() - logger.info("NSI Service doesnt exist") - execution.setVariable("isActivate", "false") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + void updateStratus(DelegateExecution execution, ServiceInstance serviceInstance, + OperationType operationType, AAIResourceUri uri) { + + logger.debug(Prefix + "updateStratus Start") + + try { + serviceInstance.setOrchestrationStatus() + if (OperationType.ACTIVATE == operationType) { + serviceInstance.setOrchestrationStatus(OrchestrationStatusEnum.ACTIVATED.getValue()) + } else { + serviceInstance.setOrchestrationStatus(OrchestrationStatusEnum.DEACTIVATED.getValue()) } - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() - logger.info(msg) + client.update(uri, serviceInstance) + } catch (Exception e) { + logger.info("Service is already in active state") + String msg = "Service is already in active state, " + e.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.debug(Prefix + "CheckAAIOrchStatus Exit") + logger.debug(Prefix + "updateStratus Exit") } + def prepareCompletionRequest = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompletionRequest Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String serviceId = customerInfo.getServiceInstanceId() + String operationId = customerInfo.getOperationId() + String userId = customerInfo.getGlobalSubscriberId() + + String result = "finished" + String progress = "100" + String reason = "" + String operationContent = "action finished success" + String operationType = customerInfo.operationType.getType() + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareCompletionRequest Exit") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy index 9100f2773b..e2d9c16328 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AllocateSliceSubnet.groovy @@ -149,16 +149,17 @@ class AllocateSliceSubnet extends AbstractServiceTaskProcessor { def prepareInitOperationStatus = { DelegateExecution execution -> logger.debug(Prefix + "prepareInitOperationStatus Start") - String serviceId = execution.getVariable("dummyServiceId") + String modelUuid = execution.getVariable("modelUuid") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId) + logger.debug("Generated new job for Service Instance serviceId:" + modelUuid + " jobId:" + jobId) ResourceOperationStatus initStatus = new ResourceOperationStatus() - initStatus.setServiceId(serviceId) - initStatus.setOperationId(jobId) - initStatus.setResourceTemplateUUID(nsiId) - initStatus.setOperType("Allocate") + initStatus.setServiceId(nsiId) // set nsiId to this field + initStatus.setOperationId(jobId) // set jobId to this field + initStatus.setResourceTemplateUUID(modelUuid) // set modelUuid to this field + initStatus.setOperType("ALLOCATE") + //initStatus.setResourceInstanceID() // set nssiId to this field requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus) logger.debug(Prefix + "prepareInitOperationStatus Exit") 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 4108ccecff..da9584771c 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 @@ -37,6 +37,7 @@ import java.sql.Timestamp import java.util.List import static org.apache.commons.lang3.StringUtils.isBlank import com.google.gson.JsonObject +import com.google.gson.JsonParser import com.fasterxml.jackson.databind.ObjectMapper import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient @@ -48,14 +49,13 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.T import javax.ws.rs.NotFoundException import org.onap.so.beans.nsmf.AllocateTnNssi import org.onap.so.beans.nsmf.DeAllocateNssi -import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.ServiceInfo import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.aai.domain.yang.ServiceInstance import org.onap.aai.domain.yang.SliceProfile import org.onap.aai.domain.yang.SliceProfiles import org.onap.aai.domain.yang.Relationship - +import com.google.gson.Gson class AnNssmfUtils { @@ -65,12 +65,11 @@ class AnNssmfUtils { JsonUtils jsonUtil = new JsonUtils() public String buildSelectRANNSSIRequest(String requestId, String messageType, String UUID,String invariantUUID, String name, Map<String, Object> profileInfo, List<String> nsstInfoList, JsonArray capabilitiesList, Boolean preferReuse){ - + JsonParser parser = new JsonParser() 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 @@ -91,8 +90,8 @@ class AnNssmfUtils { JsonObject json = new JsonObject() json.add("requestInfo", requestInfo) json.add("NSTInfo", ranNsstInfo) - json.addProperty("serviceProfile", profileJson) - json.addProperty("NSSTInfo", nsstInfoListString) + json.add("serviceProfile", (JsonObject) parser.parse(profileJson)) + //json.add("NSSTInfo", (JsonArray) parser.parse(nsstInfoListString)) json.add("subnetCapabilities", capabilitiesList) json.addProperty("preferReuse", preferReuse) @@ -100,29 +99,33 @@ class AnNssmfUtils { } public String buildCreateTNNSSMFSubnetCapabilityRequest() { - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType("TN") - esrInfo.setVendor("ONAP") + JsonObject esrInfo = new JsonObject() + esrInfo.addProperty("networkType", "tn") + esrInfo.addProperty("vendor", "ONAP_internal") JsonArray subnetTypes = new JsonArray() subnetTypes.add("TN_FH") subnetTypes.add("TN_MH") JsonObject response = new JsonObject() - response.add("subnetCapabilityQuery", subnetTypes) - response.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo)) + JsonObject subnetTypesObj = new JsonObject() + subnetTypesObj.add("subnetTypes", subnetTypes) + response.add("subnetCapabilityQuery", subnetTypesObj) + response.add("esrInfo", esrInfo) return response.toString() } public String buildCreateANNFNSSMFSubnetCapabilityRequest() { - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType("AN") - esrInfo.setVendor("ONAP") + JsonObject esrInfo = new JsonObject() + esrInfo.addProperty("networkType", "an") + esrInfo.addProperty("vendor", "ONAP_internal") JsonArray subnetTypes = new JsonArray() subnetTypes.add("AN_NF") JsonObject response = new JsonObject() - response.add("subnetCapabilityQuery", subnetTypes) - response.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo)) + JsonObject subnetTypesObj = new JsonObject() + subnetTypesObj.add("subnetTypes", subnetTypes) + response.add("subnetCapabilityQuery", subnetTypesObj) + response.add("esrInfo", esrInfo) return response.toString() } public void createDomainWiseSliceProfiles(List<String> ranConstituentSliceProfiles, DelegateExecution execution) { @@ -194,12 +197,15 @@ public void createSliceProfilesInAai(DelegateExecution execution) { ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid) String serviceRole = "slice-profile-instance" ANNF_sliceProfileInstance.setServiceRole(serviceRole) - List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class) + ArrayList<String> snssaiList = execution.getVariable("snssaiList") String snssai = snssaiList.get(0) ANNF_sliceProfileInstance.setEnvironmentContext(snssai) ANNF_sliceProfileInstance.setWorkloadContext("AN-NF") ANNF_sliceProfileInstance.setSliceProfiles(ANNF_SliceProfiles) - logger.debug("completed ANNF sliceprofileinstance build "+ ANNF_sliceProfileInstance.toString()) + String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel") + ANNF_sliceProfileInstance.setServiceFunction(serviceFunctionAnnf) + logger.debug("completed ANNF sliceprofileinstance build : "+ ANNF_sliceProfileInstance.toString()) + //TNFH slice profile instance creation TNFH_sliceProfileInstance.setServiceInstanceId(TNFH_sliceProfileInstanceId) sliceInstanceName = "sliceprofile_"+TNFH_sliceProfileId @@ -213,7 +219,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) { TNFH_sliceProfileInstance.setEnvironmentContext(snssai) TNFH_sliceProfileInstance.setWorkloadContext("TN-FH") TNFH_sliceProfileInstance.setSliceProfiles(TNFH_SliceProfiles) - logger.debug("completed TNFH sliceprofileinstance build "+TNFH_sliceProfileInstance) + String serviceFunctionTnFH = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "resourceSharingLevel") + TNFH_sliceProfileInstance.setServiceFunction(serviceFunctionTnFH) + logger.debug("completed TNFH sliceprofileinstance build : "+TNFH_sliceProfileInstance) + //TNMH slice profile instance creation TNMH_sliceProfileInstance.setServiceInstanceId(TNMH_sliceProfileInstanceId) sliceInstanceName = "sliceprofile_"+TNMH_sliceProfileId @@ -227,7 +236,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) { TNMH_sliceProfileInstance.setEnvironmentContext(snssai) TNMH_sliceProfileInstance.setWorkloadContext("TN-MH") TNMH_sliceProfileInstance.setSliceProfiles(TNMH_SliceProfiles) - logger.debug("completed TNMH sliceprofileinstance build "+TNMH_sliceProfileInstance) + String serviceFunctionTnMH = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "resourceSharingLevel") + TNMH_sliceProfileInstance.setServiceFunction(serviceFunctionTnMH) + logger.debug("completed TNMH sliceprofileinstance build : "+TNMH_sliceProfileInstance) + String msg = "" try { @@ -256,17 +268,15 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe Map<String,Object> profile switch(domainType) { case "AN-NF": - profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, pLMNIdList, cSReliabilityMeanTime, + profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList, cSReliabilityMeanTime, //msgSizeByte, maxNumberofPDUSessions,overallUserDensity,transferIntervalTarget result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) - result.setSNssai(profile.get("sNSSAI")) result.setUeMobilityLevel(profile.get("uEMobilityLevel")) result.setMaxNumberOfUEs(profile.get("maxNumberofUEs")) result.setActivityFactor(profile.get("activityFactor")) result.setCoverageAreaTAList(profile.get("coverageAreaTAList")) - result.setCsAvailability(profile.get("cSAvailabilityTarget")) result.setExpDataRateDL(profile.get("expDataRateDL")) result.setExpDataRateUL(profile.get("expDataRateUL")) result.setSurvivalTime(profile.get("survivalTime")) @@ -276,19 +286,17 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe result.setProfileId(execution.getVariable("ANNF_sliceProfileId")) break case "TN-FH": - profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) //pending fields - maxBandwidth, sST, pLMNIdList + profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) //pending fields - maxBandwidth, sST, plmnIdList result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) - result.setSNssai(profile.get("sNSSAI")) result.setProfileId(execution.getVariable("TNFH_sliceProfileId")) break case "TN-MH": - profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, pLMNIdList + profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)//pending fields - maxBandwidth, sST, plmnIdList result.setJitter(profile.get("jitter")) result.setLatency(profile.get("latency")) result.setResourceSharingLevel(profile.get("resourceSharingLevel")) - result.setSNssai(profile.get("sNSSAI")) result.setProfileId(execution.getVariable("TNMH_sliceProfileId")) break default: @@ -307,13 +315,13 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe String msg AAIResourcesClient client = new AAIResourcesClient() try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(instanceId).relationshipAPI()) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(instanceId)).relationshipAPI() client.create(uri, relationship) } catch (BpmnError e) { throw e } catch (Exception ex) { - msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() + msg = "Exception in AN NSSMF Utils : CreateRelationShipInAAI. " + ex.getMessage() logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -333,18 +341,18 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe } public String buildCreateNSSMFRequest(DelegateExecution execution, String domainType, String action) { - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType("TN") - esrInfo.setVendor("ONAP") - String esrInfoString = objectMapper.writeValueAsString(esrInfo) + JsonObject esrInfo = new JsonObject() + esrInfo.addProperty("networkType", "tn") + esrInfo.addProperty("vendor", "ONAP_internal") JsonObject response = new JsonObject() JsonObject allocateTnNssi = new JsonObject() JsonObject serviceInfo = new JsonObject() JsonArray transportSliceNetworksList = new JsonArray() JsonArray connectionLinksList = new JsonArray() JsonObject connectionLinks = new JsonObject() + Gson jsonConverter = new Gson() if(action.equals("allocate")){ - Map<String, String> endpoints + JsonObject endpoints = new JsonObject() if(domainType.equals("TN_FH")) { serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid")) serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid")) @@ -352,12 +360,10 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName")) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId")) - String sliceProfileString = objectMapper.writeValueAsString(sliceProfile) - allocateTnNssi.addProperty("sliceProfile", sliceProfileString) - endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_RU")) - endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN")) - String endpointsString = objectMapper.writeValueAsString(endpoints) - connectionLinksList.add(endpointsString) + allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) + endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_RU")) + endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN")) + connectionLinksList.add(endpoints) }else if(domainType.equals("TN_MH")) { serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid")) serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid")) @@ -365,46 +371,37 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName")) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId")) - String sliceProfileString = objectMapper.writeValueAsString(sliceProfile) - allocateTnNssi.addProperty("sliceProfile", sliceProfileString) - endpoints.put("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG")) - endpoints.put("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN")) - String endpointsString = objectMapper.writeValueAsString(endpoints) - connectionLinksList.add(endpointsString) + allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) + endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG")) + endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN")) + connectionLinksList.add(endpoints) } //Connection links connectionLinks.add("connectionLinks", connectionLinksList) transportSliceNetworksList.add(connectionLinks) allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList) - allocateTnNssi.addProperty("nssiId", null) - serviceInfo.addProperty("nssiId", null) }else if(action.equals("modify-allocate")) { if(domainType.equals("TN_FH")) { - serviceInfo.addProperty("serviceInvariantUuid", null) - serviceInfo.addProperty("serviceUuid", null) - allocateTnNssi.addProperty("nsstId", null) allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName")) allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId")) allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI")) serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI")) }else if(domainType.equals("TN_MH")) { - serviceInfo.addProperty("serviceInvariantUuid", null) - serviceInfo.addProperty("serviceUuid", null) - allocateTnNssi.addProperty("nsstId", null) allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName")) allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId")) allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI")) serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI")) } } + JsonParser parser = new JsonParser() String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo") - allocateTnNssi.addProperty("nsiInfo", nsiInfo) + allocateTnNssi.add("nsiInfo",(JsonObject) parser.parse(nsiInfo)) allocateTnNssi.addProperty("scriptName", "TN1") serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId")) serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType")) - response.addProperty("esrInfo", esrInfoString) + response.add("esrInfo", esrInfo) response.add("serviceInfo", serviceInfo) response.add("allocateTnNssi", allocateTnNssi) return response.toString() @@ -429,9 +426,9 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId")) } - EsrInfo esrInfo = new EsrInfo() - esrInfo.setVendor("ONAP") - esrInfo.setNetworkType("TN") + JsonObject esrInfo = new JsonObject() + esrInfo.addProperty("networkType", "tn") + esrInfo.addProperty("vendor", "ONAP_internal") JsonObject serviceInfo = new JsonObject() serviceInfo.addProperty("serviceInvariantUuid", null) @@ -441,9 +438,9 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe JsonObject json = new JsonObject() json.add("deAllocateNssi", deAllocateNssi) - json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo)) + json.add("esrInfo", esrInfo) json.add("serviceInfo", serviceInfo) return json.toString() } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy index 8cab146006..d00f349690 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteCommunicationService.groovy @@ -19,6 +19,7 @@ */ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri import static org.apache.commons.lang3.StringUtils.isBlank import javax.ws.rs.NotFoundException @@ -215,11 +216,12 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) - String basicAuthValue = utils.encrypt(basicAuth, msoKey) - String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) +// String basicAuthValue = utils.encrypt(basicAuth, msoKey) +// String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) - httpClient.addAdditionalHeader("Authorization", encodeString) +// httpClient.addAdditionalHeader("Authorization", encodeString) + httpClient.addAdditionalHeader("Authorization", basicAuth) httpClient.addAdditionalHeader("Accept", "application/json") Response httpResponse = httpClient.delete(requestBody) handleNSSMFWFResponse(httpResponse, execution) @@ -318,12 +320,12 @@ class DeleteCommunicationService extends AbstractServiceTaskProcessor { CommunicationServiceProfile csProfile = csProfiles.getCommunicationServiceProfile().get(0) profileId = csProfile ? csProfile.getProfileId() : "" } - resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).communicationServiceProfile(profileId)) - if (!getAAIClient().exists(resourceUri)) { + AAISimpleUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).communicationServiceProfile(profileId)) + if (!getAAIClient().exists(profileUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "communication service profile was not found in aai") } - getAAIClient().delete(resourceUri) + getAAIClient().delete(profileUri) LOGGER.debug("end delete communication service profile from AAI") } catch (any) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy index 4c008a2eb9..8c04675193 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSliceService.groovy @@ -20,6 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri + import static org.apache.commons.lang3.StringUtils.isBlank import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError @@ -176,11 +178,11 @@ class DeleteSliceService extends AbstractServiceTaskProcessor { ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0) profileId = serviceProfile ? serviceProfile.getProfileId() : "" } - resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).serviceProfile(profileId)) - if (!getAAIClient().exists(resourceUri)) { + AAISimpleUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(serviceInstanceId).serviceProfile(profileId)) + if (!getAAIClient().exists(profileUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } - getAAIClient().delete(resourceUri) + getAAIClient().delete(profileUri) } catch (any) { 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 new file mode 100644 index 0000000000..3d9f67653b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy @@ -0,0 +1,273 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2020, CMCC Technologies Co., Ltd. + # + # 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.scripts + +import com.fasterxml.jackson.databind.ObjectMapper +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +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 org.onap.so.beans.nsmf.* +import org.onap.so.beans.nsmf.oof.SubnetType +import org.onap.so.bpmn.common.scripts.* +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceArtifact +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils + +import java.lang.reflect.Type + +/** + * This class supports the DoCreateVnf building block subflow + * with the creation of a generic vnf for + * infrastructure. + * + */ +class DoActivateSliceService extends AbstractServiceTaskProcessor { + + private static final Logger logger = LoggerFactory.getLogger(DoActivateSliceService.class) + + private static final NSSMF_ACTIVATION_URL = "/api/rest/provMns/v1/NSS/%s/activation" + + private static final NSSMF_DEACTIVATION_URL = "/api/rest/provMns/v1/NSS/%s/deactivation" + + private static final NSSMF_QUERY_JOB_STATUS_URL = "/api/rest/provMns/v1/NSS/jobs/%s" + + String Prefix="DoCNSSMF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + ObjectMapper objectMapper = new ObjectMapper() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + logger.debug("STARTED Do sendcommandtoNssmf PreProcessRequest Process") + + /*******************/ + try{ + Queue<NssInstance> nssInstances = execution.getVariable("nssInstances") as Queue<NssInstance> + NssInstance nssInstance = nssInstances.poll() + execution.setVariable("nssInstances", nssInstances) + execution.setVariable("nssInstance", nssInstance) + + logger.info("the end !!") + }catch(BpmnError b){ + logger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + logger.info("the end of catch !!") + logger.debug(" Error Occured in DoSendCommandToNSSMF PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoSendCommandToNSSMF PreProcessRequest") + + } + logger.trace("COMPLETED DoSendCommandToNSSMF PreProcessRequest Process") + } + + void prepareCompose(DelegateExecution execution) { + NssInstance nssInstance = execution.getVariable("nssInstance") as NssInstance + execution.setVariable("nssInstanceId", nssInstance.nssiId) + String serviceModelInfo = """{ + "modelInvariantUuid":"${nssInstance.modelInvariantId}", + "modelUuid":"${nssInstance.modelVersionId}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + /** + * get vendor Info + * @param execution + */ + void processDecomposition(DelegateExecution execution) { + logger.debug("***** processDecomposition *****") + + try { + ServiceDecomposition serviceDecomposition = + execution.getVariable("serviceDecomposition") as ServiceDecomposition + + String vendor = serviceDecomposition.getServiceRole() + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + NssInstance nssInstance = execution.getVariable("nssInstance") as NssInstance + String reqUrl + String actionType + if (OperationType.ACTIVATE == nssInstance.operationType) { + reqUrl = String.format(NSSMF_ACTIVATION_URL, nssInstance.snssai) + actionType = "activate" + } else { + reqUrl = String.format(NSSMF_DEACTIVATION_URL, nssInstance.snssai) + actionType = "deactivate" + } + execution.setVariable("reqUrl", reqUrl) + + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setVendor(vendor) + esrInfo.setNetworkType(nssInstance.networkType) + + ServiceInfo serviceInfo = ServiceInfo.builder() + .nssiId(nssInstance.nssiId) + .subscriptionServiceType(customerInfo.subscriptionServiceType) + .globalSubscriberId(customerInfo.globalSubscriberId) + .nsiId(customerInfo.nsiId) + .serviceInvariantUuid(nssInstance.modelInvariantId) + .serviceUuid(nssInstance.modelVersionId) + .serviceType(nssInstance.serviceType) + .actionType(actionType) + .build() + + ActDeActNssi actDeActNssi = new ActDeActNssi() + actDeActNssi.setNsiId(customerInfo.nsiId) + actDeActNssi.setNssiId(nssInstance.nssiId) + + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setServiceInfo(serviceInfo) + nbiRequest.setActDeActNssi(actDeActNssi) + execution.setVariable("nbiRequest", nbiRequest) + execution.setVariable("esrInfo", esrInfo) + execution.setVariable("serviceInfo", serviceInfo) + + } catch (any) { + String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage() + logger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + logger.debug("***** Exit processDecomposition *****") + } + + /** + * send Create Request NSSMF + * @param execution + */ + void sendCreateRequestNSSMF(DelegateExecution execution) { + NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest + String nssmfRequest = objectMapper.writeValueAsString(nbiRequest) + logger.debug("sendCreateRequestNSSMF: " + nssmfRequest) + + String reqUrl = execution.getVariable("reqUrl") + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, reqUrl, nssmfRequest) + + if (response != null) { + NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class) + execution.setVariable("nssiAllocateResult", nssiResponse) + } + //todo: error + } + + /** + * query nssi allocate status + * @param execution + */ + void queryNSSIStatus(DelegateExecution execution) { + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + EsrInfo esrInfo = execution.getVariable("esrInfo") as EsrInfo + ServiceInfo serviceInfo = execution.getVariable("serviceInfo") as ServiceInfo + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setServiceInfo(serviceInfo) + + NssiResponse nssiAllocateResult = execution.getVariable("nssiAllocateResult") as NssiResponse + String jobId = nssiAllocateResult.getJobId() + + String endpoint = String.format(NSSMF_QUERY_JOB_STATUS_URL, jobId) + + String response = + nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest)) + + logger.debug("nssmf response nssiAllocateStatus:" + response) + + if (response != null) { + JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class) + + execution.setVariable("nssiAllocateStatus", jobStatusResponse) + if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) { + execution.setVariable("jobFinished", true) + } + } + } + + void timeDelay(DelegateExecution execution) { + logger.trace("Enter timeDelay in DoAllocateNSSI()") + try { + Thread.sleep(60000) + + int currentCycle = execution.hasVariable("currentCycle") ? + execution.getVariable("currentCycle") as Integer : 1 + + currentCycle = currentCycle + 1 + if(currentCycle > 60) + { + logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...") + } + execution.setVariable("currentCycle", currentCycle) + } catch(InterruptedException e) { + logger.info("Time Delay exception" + e) + } + logger.trace("Exit timeDelay in DoAllocateNSSI()") + } + + void sendSyncError (DelegateExecution execution) { + logger.trace("start sendSyncError") + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.trace("finished sendSyncError") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy index 05996d3671..ff7b0a3b6d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy @@ -83,6 +83,7 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String actionType = operationType.equals("activateInstance") ? "activate" : "deactivate" execution.setVariable("actionType", actionType) + tnNssmfUtils.setEnableSdncConfig(execution) logger.debug("Finish preProcessRequest") } @@ -116,6 +117,19 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { } + String getOrchStatusBasedOnActionType(String actionType) { + String res = "unknown" + if (actionType.equals("activate")) { + res = "activated" + } else if (actionType.equals("deactivate")) { + res = "deactivated" + } else { + logger.error("ERROR: getOrchStatusBasedOnActionType bad actionType= \n" + actionType) + } + + return res + } + void updateAAIOrchStatus(DelegateExecution execution) { logger.debug("Start updateAAIOrchStatus") String tnNssiId = execution.getVariable("sliceServiceInstanceId") @@ -142,20 +156,17 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String status, String progress, String statusDescription) { - String serviceId = execution.getVariable("sliceServiceInstanceId") + String ssInstanceId = execution.getVariable("sliceServiceInstanceId") + String modelUuid = execution.getVariable("modelUuid") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") String operType = execution.getVariable("actionType") + operType = operType.toUpperCase() + + ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId, + jobId, nsiId, operType, status, progress, statusDescription) - ResourceOperationStatus roStatus = new ResourceOperationStatus() - roStatus.setServiceId(serviceId) - roStatus.setOperationId(jobId) - roStatus.setResourceTemplateUUID(nsiId) - roStatus.setOperType(operType) - roStatus.setProgress(progress) - roStatus.setStatus(status) - roStatus.setStatusDescription(statusDescription) requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus) } 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 fc14da3a7d..33724bd011 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 @@ -31,17 +31,17 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory -import java.sql.Timestamp import java.util.List import static org.apache.commons.lang3.StringUtils.isBlank import com.google.gson.JsonObject +import com.google.gson.Gson import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.JsonArray +import com.google.gson.JsonParser import org.onap.aai.domain.yang.Relationship import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.so.beans.nsmf.AllocateTnNssi -import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.domain.ServiceInstance @@ -185,7 +185,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { List<String> nsstInfoList = new ArrayList<>() for(ServiceProxy serviceProxy : serviceProxyList) { - String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid() + String nsstModelUuid = serviceProxy.getSourceModelUuid() String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid() String name = serviceProxy.getModelInfo().getModelName() String nsstServiceModelInfo = """{ @@ -203,7 +203,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - execution.setVariable("ranNsstInfoList",nsstInfoList) + execution.setVariable("ranNsstInfoList", objectMapper.writeValueAsString(nsstInfoList)) execution.setVariable("ranModelVersion", ranModelVersion) execution.setVariable("ranModelName", ranModelName) execution.setVariable("currentIndex",currentIndex) @@ -255,7 +255,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug( "get NSSI option OOF Url: " + urlString) - + JsonParser parser = new JsonParser() //build oof request body boolean ranNssiPreferReuse = execution.getVariable("ranNssiPreferReuse"); String requestId = execution.getVariable("msoRequestId") @@ -265,7 +265,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelName = execution.getVariable("ranModelName") String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution); - List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("nsstInfoList"), List.class) + List<String> nsstInfoList = objectMapper.readValue(execution.getVariable("ranNsstInfoList"), List.class) JsonArray capabilitiesList = new JsonArray() String FHCapabilities = execution.getVariable("FHCapabilities") String MHCapabilities = execution.getVariable("MHCapabilities") @@ -274,11 +274,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { JsonObject MH = new JsonObject() JsonObject ANNF = new JsonObject() FH.addProperty("domainType", "TN_FH") - FH.addProperty("capabilityDetails", FHCapabilities) + FH.add("capabilityDetails", (JsonObject) parser.parse(FHCapabilities)) MH.addProperty("domainType", "TN_MH") - MH.addProperty("capabilityDetails", MHCapabilities) + MH.add("capabilityDetails", (JsonObject) parser.parse(MHCapabilities)) ANNF.addProperty("domainType", "AN_NF") - ANNF.addProperty("capabilityDetails", FHCapabilities) + ANNF.add("capabilityDetails", (JsonObject) parser.parse(ANNFCapabilities)) capabilitiesList.add(FH) capabilitiesList.add(MH) capabilitiesList.add(ANNF) @@ -302,13 +302,18 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { 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") + String solutions = jsonUtil.getJsonValue(oofResponse, "solutions") + logger.debug("solutions value : "+solutions) + JsonParser parser = new JsonParser() + JsonArray solution = parser.parse(solutions) + JsonObject sol = solution.get(0) + boolean existingNSI = sol.get("existingNSI").getAsBoolean() + logger.debug("existingNSI value : "+existingNSI) if(existingNSI) { - def sharedNSISolution = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution") - execution.setVariable("sharedRanNSSISolution", sharedNSISolution) + JsonObject sharedNSISolution = sol.get("sharedNSISolution").getAsJsonObject() + execution.setVariable("sharedRanNSSISolution", sharedNSISolution.toString()) logger.debug("sharedRanNSSISolution from OOF "+sharedNSISolution) - String RANServiceInstanceId = jsonUtil.getJsonValue(solution.get(0), "sharedNSISolution.NSIId") + String RANServiceInstanceId = sharedNSISolution.get("NSIId").getAsString() execution.setVariable("RANServiceInstanceId", RANServiceInstanceId) ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setInstanceId(RANServiceInstanceId); @@ -317,9 +322,10 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { execution.setVariable("ranNsstServiceDecomposition", serviceDecomposition) execution.setVariable("isRspRanNssi", true) }else { - def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles") - execution.setVariable("RanConstituentSliceProfiles", sliceProfiles) + JsonObject newNSISolution = sol.get("newNSISolution").getAsJsonObject() + JsonArray sliceProfiles = newNSISolution.get("slice_profiles").getAsJsonArray() logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles) + execution.setVariable("RanConstituentSliceProfiles", sliceProfiles.toString()) } }else { String statusMessage = jsonUtil.getJsonValue(oofResponse, "statusMessage") @@ -362,11 +368,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { def createModifyNssiQueryJobStatus = { DelegateExecution execution -> logger.debug(Prefix+"createModifyNssiQueryJobStatus method start") - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType("AN") - esrInfo.setVendor("ONAP") - String esrInfoString = objectMapper.writeValueAsString(esrInfo) - execution.setVariable("esrInfo", esrInfoString) + 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("RANServiceInstanceId")) serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) @@ -491,12 +497,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String oofResponse = execution.getVariable("nfNssiSelection_asyncCallbackResponse") String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus") if(requestStatus.equals("completed")) { - List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions")) + String solutions = jsonUtil.getJsonValue(oofResponse, "solutions") + logger.debug("nssi solutions value : "+solutions) + JsonParser parser = new JsonParser() + JsonArray solution = parser.parse(solutions) if(solution.size()>=1) { - String ranNfNssiId = jsonUtil.getJsonValue(solution.get(0), "NSSIId") - String invariantUuid = jsonUtil.getJsonValue(solution.get(0), "invariantUUID") - String uuid = jsonUtil.getJsonValue(solution.get(0), "UUID") - String nssiName = jsonUtil.getJsonValue(solution.get(0), "NSSIName") + JsonObject sol = solution.get(0) + String ranNfNssiId = sol.get("NSSIId").getAsString() + String invariantUuid = sol.get("invariantUUID").getAsString() + String uuid = sol.get("UUID").getAsString() + String nssiName = sol.get("NSSIName").getAsString() execution.setVariable("RANNFServiceInstanceId", ranNfNssiId) execution.setVariable("RANNFInvariantUUID", invariantUuid) execution.setVariable("RANNFUUID", uuid) @@ -528,7 +538,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processRanNfModifyRsp method start") anNssmfUtils.processRanNfModifyRsp(execution) //create RAN NSSI - org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); //AN instance creation ANServiceInstance.setServiceInstanceId(execution.getVariable("RANServiceInstanceId")) String sliceInstanceName = execution.getVariable("servicename") @@ -568,7 +578,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { def createSdnrRequest = { DelegateExecution execution -> logger.debug(Prefix+"createSdnrRequest method start") String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId") - String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "InstantiateRANSlice", callbackUrl) + String sdnrRequest = buildSdnrAllocateRequest(execution, "allocate", "instantiateRANSlice", callbackUrl) execution.setVariable("createNSSI_sdnrRequest", sdnrRequest) execution.setVariable("createNSSI_timeout", "PT10M") execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId")) @@ -593,8 +603,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { def updateAaiWithRANInstances = { DelegateExecution execution -> logger.debug(Prefix+"updateAaiWithRANInstances method start") //create RAN NSSI - org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new ServiceInstance(); - org.onap.aai.domain.yang.ServiceInstance ANNFServiceInstance = new ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance ANServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); + org.onap.aai.domain.yang.ServiceInstance ANNFServiceInstance = new org.onap.aai.domain.yang.ServiceInstance(); //AN instance creation ANServiceInstance.setServiceInstanceId(execution.getVariable("RANServiceInstanceId")) String sliceInstanceName = execution.getVariable("servicename") @@ -603,15 +613,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANServiceInstance.setServiceType(serviceType) String serviceStatus = "deactivated" ANServiceInstance.setOrchestrationStatus(serviceStatus) - String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList") + String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "pLMNIdList") ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) String serviceRole = "nssi" ANServiceInstance.setServiceRole(serviceRole) - List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class) + List<String> snssaiList = execution.getVariable("snssaiList") String snssai = snssaiList.get(0) ANServiceInstance.setEnvironmentContext(snssai) ANServiceInstance.setWorkloadContext("AN") - + String serviceFunctionAn = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "resourceSharingLevel") + ANServiceInstance.setServiceFunction(serviceFunctionAn) logger.debug("completed AN service instance build "+ ANServiceInstance.toString()) //create RAN NF NSSI ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId")) @@ -619,13 +630,15 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { ANNFServiceInstance.setServiceInstanceName(sliceInstanceName) ANNFServiceInstance.setServiceType(serviceType) ANNFServiceInstance.setOrchestrationStatus(serviceStatus) - serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList") + serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "pLMNIdList") ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid) ANNFServiceInstance.setServiceRole(serviceRole) - snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class) + snssaiList = execution.getVariable("snssaiList") snssai = snssaiList.get(0) ANNFServiceInstance.setEnvironmentContext(snssai) ANNFServiceInstance.setWorkloadContext("AN-NF") + String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel") + ANNFServiceInstance.setServiceFunction(serviceFunctionAnnf) logger.debug("completed AN service instance build "+ ANNFServiceInstance.toString()) String msg = "" @@ -685,23 +698,21 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { } def createFhAllocateNssiJobQuery = { DelegateExecution execution -> - logger.debug(Prefix+"createModifyNssiQueryJobStatus method start") + logger.debug(Prefix+"createFhAllocateNssiJobQuery method start") createTnAllocateNssiJobQuery(execution, "TN_FH") } def createMhAllocateNssiJobQuery = { DelegateExecution execution -> - logger.debug(Prefix+"createModifyNssiQueryJobStatus method start") + logger.debug(Prefix+"createMhAllocateNssiJobQuery method start") createTnAllocateNssiJobQuery(execution, "TN_MH") } private void createTnAllocateNssiJobQuery(DelegateExecution execution, String domainType) { - EsrInfo esrInfo = new EsrInfo() - esrInfo.setNetworkType("TN") - esrInfo.setVendor("ONAP") - String esrInfoString = objectMapper.writeValueAsString(esrInfo) - execution.setVariable("esrInfo", esrInfoString) + 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", null) serviceInfo.addProperty("nsiId", execution.getVariable("nsiId")) String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST") serviceInfo.addProperty("sST", sST) @@ -725,14 +736,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processJobStatusRsp method start") String jobResponse = execution.getVariable("TNFH_jobResponse") logger.debug("Job status response "+jobResponse) - String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status") - String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi") + String status = jsonUtil.getJsonValue(jobResponse, "status") + String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId") if(status.equalsIgnoreCase("finished")) { execution.setVariable("TNFH_NSSI", nssi) logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi) } else { - String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription") + 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) } @@ -742,14 +753,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processJobStatusRsp method start") String jobResponse = execution.getVariable("TNMH_jobResponse") logger.debug("Job status response "+jobResponse) - String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status") - String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi") + String status = jsonUtil.getJsonValue(jobResponse, "status") + String nssi = jsonUtil.getJsonValue(jobResponse, "nssiId") if(status.equalsIgnoreCase("finished")) { execution.setVariable("TNMH_NSSI", nssi) logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi) } else { - String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription") + 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) } @@ -759,13 +770,13 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug(Prefix+"processJobStatusRsp method start") String jobResponse = execution.getVariable("jobResponse") logger.debug("Job status response "+jobResponse) - String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status") - String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi") + 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, "responseDescriptor.statusDescription") + 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) } @@ -853,7 +864,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { updateStatus.setResourceTemplateUUID(nsiId) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Allocate") - updateStatus.setProgress(100) + updateStatus.setProgress("100") updateStatus.setStatus("finished") requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus) @@ -875,7 +886,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { updateStatus.setResourceTemplateUUID(nsiId) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Allocate") - updateStatus.setProgress(0) + updateStatus.setProgress("0") updateStatus.setStatus("failed") requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus) } @@ -883,41 +894,40 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) { String requestId = execution.getVariable("msoRequestId") - Date date = new Date().getTime() - Timestamp time = new Timestamp(date) Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("ANNF_sliceProfileInstanceId")) sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions")) sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL")) sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL")) - String sliceProfileString = objectMapper.writeValueAsString(sliceProfile) + JsonObject response = new JsonObject() JsonObject body = new JsonObject() JsonObject input = new JsonObject() JsonObject commonHeader = new JsonObject() JsonObject payload = new JsonObject() JsonObject payloadInput = new JsonObject() - commonHeader.addProperty("TimeStamp", time.toString()) - commonHeader.addProperty("APIver", "1.0") - commonHeader.addProperty("RequestID", requestId) - commonHeader.addProperty("SubRequestID", "1") - commonHeader.add("RequestTrack", new JsonObject()) - commonHeader.add("Flags", new JsonObject()) - payloadInput.addProperty("sliceProfile", sliceProfileString) + commonHeader.addProperty("TimeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault())) + commonHeader.addProperty("api-ver", "1.0") + commonHeader.addProperty("request-id", requestId) + commonHeader.addProperty("sub-request-id", "1") + commonHeader.add("request-track", new JsonObject()) + commonHeader.add("flags", new JsonObject()) + Gson jsonConverter = new Gson() + payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile)) payloadInput.addProperty("RANNSSIId", execution.getVariable("RANServiceInstanceId")) payloadInput.addProperty("NSIID", execution.getVariable("nsiId")) payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId")) payloadInput.addProperty("callbackURL", callbackUrl) payloadInput.add("additionalproperties", new JsonObject()) payload.add("input", payloadInput) - input.add("CommonHeader", commonHeader) - input.addProperty("Action", action) - input.add("Payload", payload) + input.add("common-header", commonHeader) + input.addProperty("action", action) + input.addProperty("payload", payload.toString()) body.add("input", input) response.add("body", body) response.addProperty("version", "1.0") response.addProperty("rpc-name", rpcName) - response.addProperty("correlation-id", requestId+"-1") + response.addProperty("correlation-id", (requestId+"-1")) response.addProperty("type", "request") return response.toString() } @@ -979,8 +989,15 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { String DUEG_routeId = UUID.randomUUID().toString() execution.setVariable("tranportEp_ID_DUEG", DUEG_routeId) NetworkRoute DUEG_ep = new NetworkRoute() - DU_ep.setRouteId(DUEG_routeId) - DU_ep.setNextHop("Host3") + DUEG_ep.setRouteId(DUEG_routeId) + DUEG_ep.setFunction(function) + DUEG_ep.setRole(role) + DUEG_ep.setType(type) + DUEG_ep.setIpAddress("192.168.100.5") + DUEG_ep.setLogicalInterfaceId("1234") + DUEG_ep.setPrefixLength(prefixLength) + DUEG_ep.setAddressFamily(addressFamily) + DUEG_ep.setNextHop("Host3") //CUIN String CUIN_routeId = UUID.randomUUID().toString() execution.setVariable("tranportEp_ID_CUIN", CUIN_routeId) @@ -1005,9 +1022,9 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("creating DUIN endpoint . ID : "+DUIN_routeId+" node details : "+DU_ep.toString()) networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), DUIN_routeId) client.create(networkRouteUri, DU_ep) - logger.debug("creating DUEG endpoint . ID : "+DUEG_routeId+" node details : "+DU_ep.toString()) + logger.debug("creating DUEG endpoint . ID : "+DUEG_routeId+" node details : "+DUEG_ep.toString()) networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), DUEG_routeId) - client.create(networkRouteUri, DU_ep) + client.create(networkRouteUri, DUEG_ep) logger.debug("creating CUIN endpoint . ID : "+CUIN_routeId+" node details : "+CUIN_ep.toString()) networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), CUIN_routeId) client.create(networkRouteUri, CUIN_ep) @@ -1041,3 +1058,4 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor { } } } + diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy index 64c36e7026..ec97972e5d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy @@ -68,10 +68,7 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { execution.setVariable("coreServiceInstanceId", coreServiceInstanceId) logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: preProcessRequest ****") } - /** - * Query NSST name from CatalogDB - * @param execution - */ + void getNSSTName(DelegateExecution execution){ logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: getNSSTName ****") String nsstModelInvariantUuid = execution.getVariable("modelInvariantUuid") @@ -79,8 +76,8 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution, nsstModelInvariantUuid) logger.debug("***** JSON Response is: "+json) String nsstName = jsonUtil.getJsonValue(json, "serviceResources.modelInfo.modelName") ?: "" - String networkServiceModelInfo = jsonUtil.getJsonValue(json, "serviceResources.serviceProxy.modelInfo") ?: "" - + List serviceProxyList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(json, "serviceResources.serviceProxy")) + String networkServiceModelInfo = serviceProxyList.get(0) execution.setVariable("networkServiceModelInfo", networkServiceModelInfo) logger.debug("***** nsstName is: "+ nsstName) execution.setVariable("nsstName",nsstName) @@ -93,6 +90,7 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { } logger.debug(Prefix+" **** Exit DoAllocateCoreNSSI ::: getNSSTName ****") } + void prepareOOFRequest(DelegateExecution execution){ logger.debug(Prefix+" **** Enter DoAllocateCoreNSSI ::: prepareOOFRequest ****") //API Path @@ -105,8 +103,6 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { //Setting messageType for all Core slice as cn String messageType = "cn" execution.setVariable("NSSI_messageType", messageType) - //Is there any specific timeout we have to set or else we don't need to send - //if blank will be set default value in DoHandleOofRequest String timeout = "PT30M" execution.setVariable("NSSI_timeout", timeout) Map<String, Object> profileInfo = mapper.readValue(execution.getVariable("sliceProfile"), Map.class) @@ -128,6 +124,10 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { String solutions ="" if(requestStatus.equals("completed")) { solutions = jsonUtil.getJsonValue(OOFResponse, "solutions") + List solutionsList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(OOFResponse, "solutions")) + if(solutionsList!=null && !solutionsList.isEmpty() ) { + solutions = solutionsList.get(0) + } } else { String statusMessage = jsonUtil.getJsonValue(OOFResponse, "statusMessage") logger.error("received failed status from oof "+ statusMessage) @@ -139,16 +139,20 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor { void prepareFailedOperationStatusUpdate(DelegateExecution execution){ logger.debug(Prefix + " **** Enter DoAllocateCoreNSSI ::: prepareFailedOperationStatusUpdate ****") - String serviceId = execution.getVariable("nssiId") + String serviceId = execution.getVariable("nsiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - String operationType = execution.getVariable("operationType") + String nssiId = execution.getVariable("nssiId") + String operationType = "ALLOCATE" + logger.debug("serviceId: "+serviceId+" jobId: "+jobId+" nsiId: "+nsiId+" operationType: "+operationType) + String modelUuid= execution.getVariable("modelUuid") ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) + resourceOperationStatus.setJobId(jobId) resourceOperationStatus.setOperationId(jobId) - resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setResourceTemplateUUID(modelUuid) resourceOperationStatus.setOperType(operationType) - resourceOperationStatus.setProgress(0) + resourceOperationStatus.setProgress("0") resourceOperationStatus.setStatus("failed") resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed") requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy index c5a928aaf9..1ca0605ac8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy @@ -64,6 +64,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.http.HttpEntity +import org.onap.aai.domain.yang.NetworkPolicy +import org.onap.aaiclient.client.aai.AAINamespaceConstants import javax.ws.rs.NotFoundException @@ -79,24 +81,26 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { public void preProcessRequest(DelegateExecution execution) { logger.debug(Prefix+ "**** Enter DoAllocateCoreNonSharedSlice::: preProcessRequest ****") String nssiServiceInstanceId= execution.getVariable("serviceInstanceId") + logger.debug("nssiServiceInstanceId: "+nssiServiceInstanceId) execution.setVariable("nssiServiceInstanceId", nssiServiceInstanceId) //Set orchestration-status as created execution.setVariable("orchestrationStatus", "created") //networkServiceName - String networkServiceName = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelName") ?: "" + String networkServiceName = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelInfo.modelName") ?: "" execution.setVariable("networkServiceName", networkServiceName.replaceAll(" Service Proxy", "")) //networkServiceModelUuid - String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelUuid") ?: "" + logger.debug("networkServiceName: "+networkServiceName) + String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "sourceModelUuid") ?: "" execution.setVariable("networkServiceModelUuid", networkServiceModelUuid) - String sliceParams = execution.getVariable("sliceParams") - logger.debug("sliceParams "+sliceParams) - List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints")) - if(bhEndPoints.empty) { - logger.debug("End point info is empty") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty") - }else { - execution.setVariable("bh_endpoint", bhEndPoints.get(0)) - } + String sliceParams = execution.getVariable("sliceParams") + logger.debug("sliceParams "+sliceParams) + List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints")) + if(bhEndPoints.empty) { + logger.debug("End point info is empty") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty") + }else { + execution.setVariable("bh_endpoint", bhEndPoints.get(0)) + } logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice::: preProcessRequest ****") } @@ -139,10 +143,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { si.setWorkloadContext(workloadContext) logger.debug("AAI service Instance Request Payload : "+si.toString()) AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(serviceType).serviceInstance(serviceInstanceId)) - Response response = getAAIClient().create(uri, si) - if(response.getStatus()!=200) { - exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "AAI instance creation failed") - } + getAAIClient().create(uri, si) + execution.setVariable("nssiServiceInstance", si) } catch (BpmnError e) { throw e; @@ -151,12 +153,14 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } + getVnfInstanceName(execution) logger.debug(Prefix+ " Exit DoAllocateCoreNonSharedSlice ::: Enter createNSSIinAAI ****") } public void prepareServiceOrderRequest(DelegateExecution execution) { logger.debug("**** Enter DoAllocateCoreNonSharedSlice ::: prepareServiceOrderRequest ****") - String extAPIPath = UrnPropertiesReader.getVariable("extapi.endpoint", execution) + '/serviceOrder' + //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() @@ -186,10 +190,10 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { // service Details Map<String, Object> service = new LinkedHashMap() //ServiceName - String serviceName= "nsi_"+execution.getVariable("networkServiceName") + String serviceName= "ns_"+execution.getVariable("networkServiceName")+"_"+execution.getVariable("serviceInstanceId") service.put("name", serviceName) // Service Type - service.put("serviceType", execution.getVariable("serviceType")) + service.put("serviceType", execution.getVariable("subscriptionServiceType")) //Service State service.put("serviceState", "active") Map<String, String> serviceSpecification = new LinkedHashMap() @@ -198,7 +202,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { //serviceCharacteristic List List serviceCharacteristicList = new ArrayList() Map<String, Object> serviceCharacteristic = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class); - List serviceCharacteristicListMap = retrieveServiceCharacteristicsAsKeyValue(serviceCharacteristic) + List serviceCharacteristicListMap = retrieveServiceCharacteristicsAsKeyValue(execution, serviceCharacteristic) logger.debug("serviceCharacteristicListMap "+serviceCharacteristicListMap) serviceCharacteristicList.add(serviceCharacteristic) //service.put("serviceCharacteristic", serviceCharacteristicList) @@ -213,10 +217,23 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: prepareServiceOrderRequest****") } - private List retrieveServiceCharacteristicsAsKeyValue(Map serviceCharacteristics) { + private void getVnfInstanceName(DelegateExecution execution) { + //Get NetworkService modelInvariantUuid + String networkServiceModelUuid = execution.getVariable("networkServiceModelUuid") + String json = catalogDbUtils.getServiceResourcesByServiceModelUuid(execution, networkServiceModelUuid, "v2") + logger.debug("json returned: "+json) + logger.debug(("Service Vnfs JSON: "+jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs"))) + List serviceVnfs = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs")) + String networkServiceVnfJson = serviceVnfs.get(0) + String vnfInstanceName = (jsonUtil.getJsonValue(networkServiceVnfJson, "modelInfo.modelInstanceName")).trim() ?: "" + execution.setVariable("vnfInstanceName", vnfInstanceName) + } + + private List retrieveServiceCharacteristicsAsKeyValue(DelegateExecution execution, Map serviceCharacteristics) { logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: retrieveServiceCharacteristicsAsKeyValue ****") List serviceCharacteristicsList = new ArrayList() ObjectMapper mapperObj = new ObjectMapper(); + String vnfInstanceName = execution.getVariable("vnfInstanceName") Map<String, Object> serviceCharacteristicsObject = new LinkedHashMap() for (Map.Entry<String, Integer> entry : serviceCharacteristics.entrySet()) { Map<String, Object> ServiceCharacteristicValueObject = new LinkedHashMap<>() @@ -224,7 +241,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { //For G Release we are sending single value from snssaiList if(entry.getKey().equals("snssaiList")) { List sNssaiValue = entry.getValue() - serviceCharacteristicsObject.put("name", "snssai") + serviceCharacteristicsObject.put("name", vnfInstanceName+"_snssai") ServiceCharacteristicValueObject.put("serviceCharacteristicValue", sNssaiValue.get(0)) serviceCharacteristicsObject.put("value", ServiceCharacteristicValueObject) } @@ -303,18 +320,12 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { JSONObject item = items.get(0) JSONObject service = item.get("service") String networkServiceId = service.get("id") - if (networkServiceId == null || networkServiceId.equals("null")) { - prepareFailedOperationStatusUpdate(execution) - return - } + execution.setVariable("networkServiceId", networkServiceId) String serviceOrderState = item.get("state") execution.setVariable("ServiceOrderState", serviceOrderState) // Get serviceOrder State and process progress - if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState)) { - execution.setVariable("status", "processing") - } - else if("INPROGRESS".equalsIgnoreCase(serviceOrderState)) { + if("ACKNOWLEDGED".equalsIgnoreCase(serviceOrderState) || "INPROGRESS".equalsIgnoreCase(serviceOrderState)) { execution.setVariable("status", "processing") } else if("COMPLETED".equalsIgnoreCase(serviceOrderState)) { @@ -328,6 +339,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { 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 @@ -340,9 +352,6 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: getNBIServiceOrderProgress ****") } - /** - * delay 5 sec - */ public void timeDelay(DelegateExecution execution) { try { logger.debug(Prefix+ " **** DoAllocateCoreNonSharedSlice ::: timeDelay going to sleep for 5 sec") @@ -353,47 +362,42 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { } } - void updateRelationship(DelegateExecution execution) { logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: updateRelationship ****") - String networkServiceInstanceId = execution.getVariable("networkServiceId") String nssiId = execution.getVariable("nssiServiceInstanceId") String globalCustId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") + String serviceType = execution.getVariable("subscriptionServiceType") + logger.debug("networkServiceInstanceId: "+networkServiceInstanceId +" nssiId: "+nssiId +" globalCustId: "+globalCustId+ " serviceType: "+serviceType) try{ //Update NSSI orchestration status nssiServiceInstance ServiceInstance si = execution.getVariable("nssiServiceInstance") + logger.debug("nssiServiceInstance "+si) si.setOrchestrationStatus("activated") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(nssiId)) + logger.debug("uri to call: "+uri) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(networkServiceInstanceId)) try { getAAIClient().update(uri, si) } catch (Exception e) { logger.info("Update OrchestrationStatus in AAI failed") - String msg = "Update OrchestrationStatus in AAI failed, " + e.getMessage() + String msg = "Update OrchestrationStatus in AAI failed, " + e exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - //URI for NSSI AAIResourceUri nssiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nssiId)); - + logger.debug("nssiUri to update RelationShip : "+nssiUri) //URI for Network Service Instance AAIResourceUri networkServiceInstanceUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(networkServiceInstanceId)) - + logger.debug("networkServiceInstanceUri to update RelationShip : "+networkServiceInstanceUri) // Update Relationship in AAI - Response response = getAAIClient().connect(nssiUri, networkServiceInstanceUri, AAIEdgeLabel.COMPOSED_OF); - - if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) { - exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "Set association of NSSI and Network service instance has failed in AAI") - } else { - //end point update - createEndPointsInAai(execution) - execution.setVariable("progress", 100) - execution.setVariable("status", "finished") - execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success") - setResourceOperationStatus(execution) - } + getAAIClient().connect(nssiUri, networkServiceInstanceUri, AAIEdgeLabel.COMPOSED_OF); + //end point update + createEndPointsInAai(execution) + execution.setVariable("progress", "100") + execution.setVariable("status", "finished") + execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success") + setResourceOperationStatus(execution) }catch(Exception ex) { String msg = "Exception while creating relationship " + ex.getMessage() logger.info(msg) @@ -402,78 +406,81 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: updateRelationship ****") } - private void createEndPointsInAai(DelegateExecution execution) { - String type = "endpoint" - String function = "core_EP" - int prefixLength = 24 - String addressFamily = "ipv4" - //BH RAN end point update - String bh_endpoint = execution.getVariable("bhEndPoints") - String bh_routeId = UUID.randomUUID().toString() - execution.setVariable("coreEp_ID_bh", bh_routeId) - String role = "CN" - String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress") - String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId") - String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo") - NetworkRoute bh_ep = new NetworkRoute() - bh_ep.setRouteId(bh_routeId) - bh_ep.setFunction(function) - bh_ep.setRole(role) - bh_ep.setType(type) - bh_ep.setIpAddress(cnIpAddress) - bh_ep.setLogicalInterfaceId(LogicalLinkId) - bh_ep.setNextHop(nextHopInfo) - bh_ep.setPrefixLength(prefixLength) - bh_ep.setAddressFamily(addressFamily) - try { - AAIResourcesClient client = new AAIResourcesClient() - logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString()) - AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId) - client.create(networkRouteUri, bh_ep) - //relationship b/w bh_ep and Core NSSI - def coreNssi = execution.getVariable("NSSIserviceInstanceId") - Relationship relationship = new Relationship() - String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}" - relationship.setRelatedLink(relatedLink) - relationship.setRelatedTo("network-route") - relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf") - try { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, - execution.getVariable("globalSubscriberId"), - execution.getVariable("subscriptionServiceType"), - coreNssi).relationshipAPI() - client.create(uri, relationship) - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - String msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - String msg = "Exception in createEndPointsInAai " + ex.getMessage() - logger.info(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - /** - * prepare ResourceOperation status + * creates EndPoints in AAI * @param execution - * @param operationType */ + private void createEndPointsInAai(DelegateExecution execution) { + String type = "endpoint" + String function = "core_EP" + int prefixLength = 24 + String addressFamily = "ipv4" + //BH end point update + String bh_endpoint = execution.getVariable("bh_endpoint") + String bh_routeId = UUID.randomUUID().toString() + execution.setVariable("coreEp_ID_bh", bh_routeId) + String role = "CN" + String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress") + String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId") + String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo") + NetworkRoute bh_ep = new NetworkRoute() + logger.debug("bh_endpoint: "+bh_endpoint +" "+ "bh_routeId: "+bh_routeId +" "+ "cnIpAddress: "+cnIpAddress +" "+ "role: "+role +" "+ "cnIpAddress: "+cnIpAddress +" "+ "LogicalLinkId: "+LogicalLinkId +" "+ "nextHopInfo: "+nextHopInfo +" "+ "bh_ep: "+bh_ep) + bh_ep.setRouteId(bh_routeId) + bh_ep.setFunction(function) + bh_ep.setRole(role) + bh_ep.setType(type) + bh_ep.setIpAddress(cnIpAddress) + bh_ep.setLogicalInterfaceId(LogicalLinkId) + bh_ep.setNextHop(nextHopInfo) + bh_ep.setPrefixLength(prefixLength) + bh_ep.setAddressFamily(addressFamily) + try { + AAIResourcesClient client = new AAIResourcesClient() + logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString()) + AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId) + client.create(networkRouteUri, bh_ep) + //relationship b/w bh_ep and Core NSSI + def coreNssi = execution.getVariable("nssiServiceInstanceId") + Relationship relationship = new Relationship() + String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}" + relationship.setRelatedLink(relatedLink) + relationship.setRelatedTo("network-route") + relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf") + logger.debug("networkRouteUri: "+networkRouteUri+"relationship: "+relationship) + try { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), + coreNssi).relationshipAPI() + logger.debug("uri: "+uri) + client.create(uri, relationship) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in createRelationShipInAAI. " + ex.getMessage() + logger.debug(msg+": "+ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in createEndPointsInAai " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + private void setResourceOperationStatus(DelegateExecution execution) { logger.debug(Prefix+ " **** Enter DoAllocateCoreNonSharedSlice ::: setResourceOperationStatus ****") - String serviceId = execution.getVariable("nssiId") + String serviceId = execution.getVariable("nsiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - String operationType = execution.getVariable("operationType") + String operationType = "ALLOCATE" ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) resourceOperationStatus.setOperationId(jobId) resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setResourceInstanceID(nssiId) resourceOperationStatus.setOperType(operationType) resourceOperationStatus.setStatus(execution.getVariable("status")) resourceOperationStatus.setProgress(execution.getVariable("progress")) @@ -484,17 +491,21 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { void prepareFailedOperationStatusUpdate(DelegateExecution execution){ logger.debug(Prefix + " **** Enter DoAllocateCoreNonSharedSlice ::: prepareFailedOperationStatusUpdate ****") - String serviceId = execution.getVariable("nssiId") + String serviceId = execution.getVariable("nsiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - String operationType = execution.getVariable("operationType") - + String nssiId = execution.getVariable("nssiId") + String operationType = "ALLOCATE" + //modelUuid + String modelUuid= execution.getVariable("modelUuid") + logger.debug("serviceId: "+serviceId +" "+ "jobId: "+jobId +" "+ "nsiId: "+nsiId +" "+ "operationType: "+operationType) ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) + resourceOperationStatus.setJobId(jobId) resourceOperationStatus.setOperationId(jobId) - resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setResourceTemplateUUID(modelUuid) resourceOperationStatus.setOperType(operationType) - resourceOperationStatus.setProgress(0) + resourceOperationStatus.setProgress("0") resourceOperationStatus.setStatus("failed") resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed") requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy index 5ecfc9a872..b3c99c6e9a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy @@ -115,7 +115,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getNetworkInstanceAssociatedWithNssiId ****") //NSSI Id as service Instance Id to get from Request - String serviceInstanceId = execution.getVariable("serviceInstanceID") + String serviceInstanceId = execution.getVariable("nssiId") String errorMsg = "query Network Service Instance from AAI failed" AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg) @@ -304,14 +304,6 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****") } - - /** - * query AAI - * @param execution - * @param aaiObjectName - * @param instanceId - * @return AAIResultWrapper - */ private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) { logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****") String globalSubscriberId = execution.getVariable("globalSubscriberId") @@ -368,6 +360,8 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { Map vnfMap = vnfList.get(0) ModelInfo vnfModelInfo = vnfMap.get("modelInfo") + vnfModelInfo.setModelCustomizationId(vnfModelInfo.getModelCustomizationUuid()) + vnfModelInfo.setModelVersionId(vnfModelInfo.getModelId()) logger.debug("vnfModelInfo "+vnfModelInfo) //List of VFModules @@ -380,6 +374,8 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { //Traverse VFModules List and add in vfModelInfoList for (vfModule in vfModuleList) { ModelInfo vfModelInfo = vfModule.get("modelInfo") + vfModelInfo.setModelCustomizationId(vfModelInfo.getModelCustomizationUuid()) + vfModelInfo.setModelVersionId(vfModelInfo.getModelId()) logger.debug("vfModelInfo "+vfModelInfo) vfModelInfoList.add(vfModelInfo) } @@ -410,25 +406,31 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { //Individual VFModule List Map<String, Object> vfModuleValues = new LinkedHashMap<>() vfModuleValues.put("modelInfo", vfModuleModelInfo) - vfModuleValues.put("instanceName", vfModuleModelInfo.getModelInstanceName()) + vfModuleValues.put("instanceName", vfModuleModelInfo.getModelName()) //VFModule InstanceParams should be empty or this field should not be there? List<Map<String, Object>> vfModuleInstanceParams = new ArrayList<>() vfModuleValues.put("instanceParams", vfModuleInstanceParams) + vfModules.add(vfModuleValues) } //Vnf intsanceParams Map<String, Object> sliceProfile = mapper.readValue(execution.getVariable("sliceProfile"), Map.class); - List vnfInstanceParamsList = new ArrayList<>() + List<Map<String, Object>> vnfInstanceParamsList = new ArrayList<>() String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution) - vnfInstanceParamsList.add(supportedsNssaiJson) + + Map<String, Object> supportedNssai= new LinkedHashMap<>() + supportedNssai.put("supportedsNssai", supportedsNssaiJson) + vnfInstanceParamsList.add(supportedNssai) Platform platform = new Platform() - platform.setPlatformName(execution.getVariable("platform")) + String platformName = execution.getVariable("platformName") + platform.setPlatformName(platformName) LineOfBusiness lineOfbusiness = new LineOfBusiness() - lineOfbusiness.setLineOfBusinessName(execution.getVariable("lineOfBusiness")) + String lineOfBusinessName = execution.getVariable("lineOfBusinessName") + lineOfbusiness.setLineOfBusinessName(lineOfBusinessName) //Vnf Values Map<String, Object> vnfValues = new LinkedHashMap<>() @@ -438,7 +440,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { vnfValues.put("cloudConfiguration", cloudConfiguration) vnfValues.put("vfModules", vfModules) vnfValues.put("modelInfo", vnfModelInfo) - vnfValues.put("instanceName", execution.getVariable("vnfInstanceName")) + vnfValues.put("instanceName", vnfModelInfo.getModelInstanceName()) vnfValues.put("instanceParams",vnfInstanceParamsList) vnfModelInfoList.add(vnfValues) @@ -496,10 +498,8 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { Map<String, Object> requestDetailsMap = new LinkedHashMap<>() requestDetailsMap.put("requestDetails", requestDetails) String requestPayload = mapper.writeValueAsString(requestDetailsMap) - logger.debug("requestDetails "+requestPayload) execution.setVariable("requestPayload", requestPayload) - logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****") } @@ -508,14 +508,11 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList") Map<String, Object> nSsai= new LinkedHashMap<>() nSsai.put("sNssai", instanceParamsvalues) - String supportedsNssaiJson = mapper.writeValueAsString(nSsai) //SupportedNssai - Map<String, Object> supportedNssai= new LinkedHashMap<>() - supportedNssai.put("supportedNssai", supportedsNssaiJson) - logger.debug("**** supportedsNssaiJson**** "+supportedNssai) + logger.debug("**** supportedsNssaiJson**** "+supportedsNssaiJson) logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****") - return supportedNssai + return supportedsNssaiJson } public void sendPutRequestToSOMacro(DelegateExecution execution) { @@ -523,14 +520,9 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { try { String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId") - String requestBody = execution.getVariable("requestPayload") - - String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution) - String basicAuth = UrnPropertiesReader.getVariable("mso.infra.endpoint.auth", execution) - String basicAuthValue = utils.encrypt(basicAuth, msoKey) - String encodeString = utils.getBasicAuth(basicAuthValue, msoKey) - + String encodeString = "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==" + logger.debug("msoEndpoint: "+msoEndpoint +" "+ "url: "+url +" requestBody: "+requestBody +" "+ "encodeString: "+encodeString) HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) httpClient.addAdditionalHeader("Authorization", encodeString) httpClient.addAdditionalHeader("Accept", "application/json") @@ -546,84 +538,93 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: sendPostRequestToSOMacro ****") } - /** - * Handle SO Response for PUT and prepare update operation status - * @param execution - */ private void handleSOResponse(Response httpResponse, DelegateExecution execution){ logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: handleSOResponse ****") - int soResponseCode = httpResponse.getStatus() logger.debug("soResponseCode : "+soResponseCode) if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) { String soResponse = httpResponse.readEntity(String.class) - String operationId = execution.getVariable("operationId") - def macroOperationId = jsonUtil.getJsonValue(soResponse, "operationId") + logger.debug("soResponse: "+soResponse) + logger.debug("soResponse JsonUtil: "+jsonUtil.getJsonValue(soResponse, "requestReferences.requestId")) + def macroOperationId = jsonUtil.getJsonValue(soResponse, "requestReferences.requestId") + def requestSelfLink = jsonUtil.getJsonValue(soResponse, "requestReferences.requestSelfLink") execution.setVariable("macroOperationId", macroOperationId) + execution.setVariable("requestSelfLink", requestSelfLink) execution.setVariable("isSOTimeOut", "no") execution.setVariable("isSOResponseSucceed","yes") } else { - String serviceName = execution.getVariable("serviceInstanceName") execution.setVariable("isSOResponseSucceed","no") prepareFailedOperationStatusUpdate(execution) } logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: handleSOResponse ****") } - /** - * prepare to call sub process CheckProcessStatus - * @param execution - */ - void prepareCallCheckProcessStatus(DelegateExecution execution){ - logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareCallCheckProcessStatus ****") - def successConditions = new ArrayList<>() - successConditions.add("finished") - execution.setVariable("successConditions", successConditions) - def errorConditions = new ArrayList<>() - errorConditions.add("error") - execution.setVariable("errorConditions", errorConditions) - execution.setVariable("processServiceType", "Network service") - execution.setVariable("subOperationType", "PUT") - execution.setVariable("initProgress", 20) - execution.setVariable("endProgress",90) - execution.setVariable("timeOut", TIMEOUT) - logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareCallCheckProcessStatus ****") + public void getSOPUTProgress(DelegateExecution execution) { + logger.debug(Prefix+ " **** Enter DoAllocateCoreSharedSlice ::: getSOPUTProgress ****") + String url= execution.getVariable("requestSelfLink") + logger.debug("url "+url) + HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO) + //Hardcoding for now, will be updated in next patch + httpClient.addAdditionalHeader("Authorization", "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==") + httpClient.addAdditionalHeader("Accept", "application/json") + Response httpResponse = httpClient.get() + logger.debug("httpResponse "+httpResponse) + int soResponseCode = httpResponse.getStatus() + logger.debug("soResponseCode : "+soResponseCode) + if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) { + String soResponse = httpResponse.readEntity(String.class) + logger.debug("soResponse: "+soResponse) + String requestState= jsonUtil.getJsonValue(soResponse, "request.requestStatus.requestState") + logger.debug("requestState: "+requestState) + execution.setVariable("requestState", requestState) + } else { + execution.setVariable("isSOResponseSucceed","no") + prepareFailedOperationStatusUpdate(execution) + } + logger.debug(Prefix+ " **** Exit DoAllocateCoreSharedSlice ::: getSOPUTProgress ****") + } + + public void timeDelay(DelegateExecution execution) { + try { + logger.debug(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay going to sleep for 5 sec") + Thread.sleep(5000) + logger.debug("**** DoAllocateCoreNonSharedSlice ::: timeDelay wakeup after 5 sec") + } catch(InterruptedException e) { + logger.error(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay exception" + e) + } } void prepareUpdateResourceOperationStatus(DelegateExecution execution) { logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****") //Prepare Update Status for PUT failure and success - if(execution.getVariable("isTimeOut").equals("YES")) { - logger.debug("TIMEOUT - SO PUT Failure") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure") - } else { + if("COMPLETED".equals(execution.getVariable("requestState"))) { execution.setVariable("progress", "100") execution.setVariable("status", "finished") execution.setVariable("operationContent", "AllocteCoreNSSI successful.") - logger.debug("prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}") + logger.debug("Success ,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}") + } else { + logger.debug("SO PUT Failure") + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure") } setResourceOperationStatus(execution) logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****") } - /** - * prepare ResourceOperation status - * @param execution - * @param operationType - */ private void setResourceOperationStatus(DelegateExecution execution) { logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****") String serviceId = execution.getVariable("nssiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") String operationType = execution.getVariable("operationType") + logger.debug("serviceId: "+serviceId +" "+ " jobId: "+jobId +" "+ " nsiId: "+nsiId+" nssiId: "+nssiId+" operationType: "+operationType) ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) resourceOperationStatus.setOperationId(jobId) resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setResourceInstanceID(nssiId) resourceOperationStatus.setOperType(operationType) resourceOperationStatus.setStatus("finished") resourceOperationStatus.setProgress("100") @@ -634,17 +635,19 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor { void prepareFailedOperationStatusUpdate(DelegateExecution execution){ logger.debug(Prefix + " **** Enter DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****") - String serviceId = execution.getVariable("nssiId") + String serviceId = execution.getVariable("nsiId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - String operationType = execution.getVariable("operationType") - + String operationType = "ALLOCATE" + logger.debug("serviceId: "+serviceId +" "+ " jobId: "+jobId +" "+ " nsiId: "+nsiId+" operationType: "+operationType) + String modelUuid= execution.getVariable("modelUuid") ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus() resourceOperationStatus.setServiceId(serviceId) + resourceOperationStatus.setJobId(jobId) resourceOperationStatus.setOperationId(jobId) - resourceOperationStatus.setResourceTemplateUUID(nsiId) + resourceOperationStatus.setResourceTemplateUUID(modelUuid) resourceOperationStatus.setOperType(operationType) - resourceOperationStatus.setProgress(0) + resourceOperationStatus.setProgress("0") resourceOperationStatus.setStatus("failed") resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed") requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus) 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 be691bb313..059a209336 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 @@ -20,6 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.aai.domain.yang.NetworkRoute import org.onap.so.beans.nsmf.ConnectionLink import org.onap.so.beans.nsmf.EndPoint import org.onap.so.beans.nsmf.NsiInfo @@ -125,7 +126,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName") - String serviceType = execution.getVariable("serviceType") + String serviceType = sliceParams.serviceProfile.get("sST") String serviceStatus = "deactivated" String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID String modelUuid = sliceParams.getNSTInfo().UUID @@ -299,7 +300,24 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList) - //todo:... + sliceProfile.setMaxNumberOfUEs(anSliceProfile.maxNumberOfUEs) + sliceProfile.setLatency(anSliceProfile.latency) + sliceProfile.setMaxNumberOfPDUSession(anSliceProfile.maxNumberOfPDUSession) + sliceProfile.setExpDataRateDL(anSliceProfile.expDataRateDL) + sliceProfile.setExpDataRateUL(anSliceProfile.expDataRateUL) + sliceProfile.setAreaTrafficCapDL(anSliceProfile.areaTrafficCapDL) + sliceProfile.setAreaTrafficCapUL(anSliceProfile.areaTrafficCapUL) + sliceProfile.setOverallUserDensity(anSliceProfile.overallUserDensity) + sliceProfile.setActivityFactor(anSliceProfile.activityFactor) + sliceProfile.setUeMobilityLevel(anSliceProfile.ueMobilityLevel) + sliceProfile.setResourceSharingLevel(anSliceProfile.resourceSharingLevel) + sliceProfile.setCsAvailabilityTarget(anSliceProfile.csAvailabilityTarget) + sliceProfile.setCsReliabilityMeanTime(anSliceProfile.csReliabilityMeanTime) + sliceProfile.setExpDataRate(anSliceProfile.expDataRate) + sliceProfile.setMsgSizeByte(anSliceProfile.msgSizeByte) + sliceProfile.setTransferIntervalTarget(anSliceProfile.transferIntervalTarget) + sliceProfile.setSurvivalTime(anSliceProfile.survivalTime) + AAIResourceUri uri = AAIUriFactory.createResourceUri( AAIFluentTypeBuilder.business().customer(globalSubscriberId) .serviceSubscription(subscriptionServiceType) @@ -310,6 +328,57 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.setVariable("sliceTaskParams", sliceParams) } + void createANEndpoint(DelegateExecution execution){ + logger.debug("Enter createANEndpoint in DoAllocateNSIandNSSI()") + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo + + NetworkRoute route = new NetworkRoute() + String routeId = UUID.randomUUID().toString() + route.setRouteId(routeId) + route.setType("endpoint") + route.setRole("an") + route.setFunction("3gppTransportEP") + route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) + route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setAddressFamily("ipv4") + route.setPrefixLength(24) + sliceTaskInfo.setEndPointId(routeId) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(routeId)) + client.create(uri, route) + execution.setVariable("sliceTaskParams", sliceParams) + logger.info("an endpointId:" + sliceParams.anSliceTaskInfo.endPointId) + } + + + void createCNEndpoint(DelegateExecution execution){ + logger.debug("Enter createCNNetworkRoute in DoAllocateNSIandNSSI()") + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo + + NetworkRoute route = new NetworkRoute() + String routeId = UUID.randomUUID().toString() + route.setRouteId(routeId) + route.setType("endpoint") + route.setRole("cn") + route.setFunction("3gppTransportEP") + route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress) + route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo) + route.setAddressFamily("ipv4") + route.setPrefixLength(24) + + sliceTaskInfo.setEndPointId(routeId) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(routeId)) + client.create(uri, route) + + execution.setVariable("cnEndpointId", routeId) + execution.setVariable("sliceTaskParams", sliceParams) + logger.info("cn endpointId:" + sliceParams.cnSliceTaskInfo.endPointId) + } + /** * prepare AllocateAnNssi * @param execution @@ -325,9 +394,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ AllocateAnNssi allocateAnNssi = new AllocateAnNssi() allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2AnProfile() + allocateAnNssi.sliceProfile.sliceProfileId = sliceTaskInfo.sliceInstanceId allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID allocateAnNssi.nssiId = sliceTaskInfo.suggestNssiId - allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + allocateAnNssi.nssiName = "nssi_an" + execution.getVariable("sliceServiceInstanceName") NsiInfo nsiInfo = new NsiInfo() nsiInfo.nsiId = sliceParams.suggestNsiId nsiInfo.nsiName = sliceParams.suggestNsiName @@ -354,6 +424,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.nsiId = sliceParams.suggestNsiId serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") + serviceInfo.nssiName = allocateAnNssi.nssiName nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -421,7 +493,24 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String) - //todo:... + sliceProfile.setMaxNumberOfUEs(cnSliceProfile.maxNumberOfUEs) + sliceProfile.setLatency(cnSliceProfile.latency) + sliceProfile.setMaxNumberOfPDUSession(cnSliceProfile.maxNumberOfPDUSession) + sliceProfile.setExpDataRateDL(cnSliceProfile.expDataRateDL) + sliceProfile.setExpDataRateUL(cnSliceProfile.expDataRateUL) + sliceProfile.setAreaTrafficCapDL(cnSliceProfile.areaTrafficCapDL) + sliceProfile.setAreaTrafficCapUL(cnSliceProfile.areaTrafficCapUL) + sliceProfile.setOverallUserDensity(cnSliceProfile.overallUserDensity) + sliceProfile.setActivityFactor(cnSliceProfile.activityFactor) + sliceProfile.setUeMobilityLevel(cnSliceProfile.ueMobilityLevel) + sliceProfile.setResourceSharingLevel(cnSliceProfile.resourceSharingLevel) + sliceProfile.setCsAvailabilityTarget(cnSliceProfile.csAvailabilityTarget) + sliceProfile.setCsReliabilityMeanTime(cnSliceProfile.csReliabilityMeanTime) + sliceProfile.setExpDataRate(cnSliceProfile.expDataRate) + sliceProfile.setMsgSizeByte(cnSliceProfile.msgSizeByte) + sliceProfile.setTransferIntervalTarget(cnSliceProfile.transferIntervalTarget) + sliceProfile.setSurvivalTime(cnSliceProfile.survivalTime) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() .customer(globalSubscriberId) .serviceSubscription(subscriptionServiceType) @@ -447,8 +536,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ AllocateCnNssi allocateCnNssi = new AllocateCnNssi() allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId - allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + allocateCnNssi.nssiName = "nssi_cn" + execution.getVariable("sliceServiceInstanceName") allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile() + allocateCnNssi.sliceProfile.sliceProfileId = sliceTaskInfo.sliceInstanceId + NsiInfo nsiInfo = new NsiInfo() nsiInfo.nsiId = sliceParams.suggestNsiId nsiInfo.nsiName = sliceParams.suggestNsiName @@ -476,6 +567,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared + serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") + serviceInfo.nssiName = allocateCnNssi.nssiName nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -543,7 +636,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) - //todo:... + sliceProfile.setLatency(tnSliceProfile.latency) + sliceProfile.setMaxBandwidth(tnSliceProfile.maxBandwidth) + sliceProfile.setJitter(tnSliceProfile.jitter) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() .customer(globalSubscriberId) .serviceSubscription(subscriptionServiceType) @@ -604,6 +700,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID serviceInfo.nssiId = sliceTaskInfo.suggestNssiId + serviceInfo.sST = sliceTaskInfo.sliceProfile.sST ?: sliceParams.serviceProfile.get("sST") nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -633,17 +730,21 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String nsiId = sliceParams.getSuggestNsiId() String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId String serviceProfileInstanceId = sliceParams.serviceId + String epId = sliceParams.anSliceTaskInfo.endPointId //nsi id //todo: aai -> nssi -> relationship -> endPointId -> set into tn - String endPointId = getEndpointIdFromAAI(execution, nssiId) - execution.setVariable("endPointIdAn", endPointId) - + //String endPointId = getEndpointIdFromAAI(execution, nssiId) + //execution.setVariable("endPointIdAn", endPointId) updateRelationship(execution, nsiId, nssiId) updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) updateRelationship(execution, sliceProfileInstanceId, nssiId) + updateEPRelationship(execution, nssiId, epId) + + updateEPRelationship(execution, sliceProfileInstanceId, epId) + sliceParams.anSliceTaskInfo.suggestNssiId = nssiId execution.setVariable("sliceTaskParams", sliceParams) } @@ -667,16 +768,21 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String nsiId = sliceParams.getSuggestNsiId() String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId String serviceProfileInstanceId = sliceParams.serviceId + String epId = sliceParams.cnSliceTaskInfo.endPointId //nsi id //todo: aai -> nssi -> relationship -> endPointId -> set into tn - String endPointId = getEndpointIdFromAAI(execution, nssiId) - execution.setVariable("endPointIdCn", endPointId) +// String endPointId = getEndpointIdFromAAI(execution, nssiId) +// execution.setVariable("endPointIdCn", endPointId) updateRelationship(execution, nsiId, nssiId) updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) - updateRelationship(execution,sliceProfileInstanceId, nssiId) + updateRelationship(execution, sliceProfileInstanceId, nssiId) + + updateEPRelationship(execution, nssiId, epId) + + updateEPRelationship(execution, sliceProfileInstanceId, epId) sliceParams.cnSliceTaskInfo.suggestNssiId = nssiId execution.setVariable("sliceTaskParams", sliceParams) @@ -781,7 +887,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ .serviceSubscription(execution.getVariable("subscriptionServiceType")) .serviceInstance(targetId)) - logger.info("Creating relationship, targetInstanceUri: " + targetInstanceUri) + logger.debug("Creating relationship, targetInstanceUri: " + targetInstanceUri) relationship.setRelatedLink(targetInstanceUri.build().toString()) @@ -793,6 +899,30 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ client.create(sourceInstanceUri, relationship) } + /** + * update endpoint relationship + * @param execution + * @param sourceId + * @param targetId + */ + void updateEPRelationship(DelegateExecution execution, String sourceId, String endpointId) { + //relation ship + Relationship relationship = new Relationship() + + AAIResourceUri endpointUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(endpointId)) + + logger.debug("Creating relationship, endpoint Uri: " + endpointUri + ",endpointId: " + endpointId) + + relationship.setRelatedLink(endpointUri.build().toString()) + + AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(sourceId)) + .relationshipAPI() + client.create(sourceInstanceUri, relationship) + } + static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String oStatus) { // create slice profile ServiceInstance rspi = new ServiceInstance() 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 e5c1b56d55..e88b1c747f 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 @@ -62,8 +62,10 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { */ void sendCreateRequestNSSMF(DelegateExecution execution) { NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest - String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL, - objectMapper.writeValueAsString(nbiRequest)) + String nssmfRequest = objectMapper.writeValueAsString(nbiRequest) + logger.debug("sendCreateRequestNSSMF: " + nssmfRequest) + + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL, nssmfRequest) if (response != null) { NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class) @@ -97,6 +99,8 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest)) + logger.debug("nssmf response nssiAllocateStatus:" + response) + if (response != null) { JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class) if (StringUtils.isBlank(nssiId)) { @@ -125,7 +129,6 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { sliceTaskInfo.progress = response.getProgress() sliceTaskInfo.status = response.getStatus().toLowerCase() sliceTaskInfo.statusDescription = response.getStatusDescription() - sliceTaskInfo.endPointId = response.getEndPointId() updateNssiResult(sliceParams, subnetType, sliceTaskInfo) String paramJson = sliceParams.convertToJson() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index ec70bd3780..ccb04d9440 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -100,7 +100,6 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ * todo: role */ String serviceRole = "service-profile" - String serviceType = execution.getVariable("serviceType") String globalSubscriberId = execution.getVariable("globalSubscriberId") String subscriptionServiceType = execution.getVariable("subscriptionServiceType") @@ -111,7 +110,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ ss.setServiceInstanceId(ssInstanceId) String sliceInstanceName = execution.getVariable("serviceInstanceName") ss.setServiceInstanceName(sliceInstanceName) - ss.setServiceType(serviceType) + ss.setServiceType(serviceProfile.get("sST")) String serviceStatus = "deactivated" ss.setOrchestrationStatus(serviceStatus) String modelInvariantUuid = modelInfo.getModelInvariantUuid() 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 9450227467..25a7159264 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 @@ -416,10 +416,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ sliceProfile.remove("domainType") SliceProfileAdapter adapter = objectMapper.readValue(objectMapper.writeValueAsString(sliceProfile), SliceProfileAdapter.class) switch (domainType.toLowerCase()) { - case "tn-bh": + case "tn_bh": sliceParams.tnBHSliceTaskInfo.sliceProfile = adapter break - case "an-nf": + case "an_nf": case "an": sliceParams.anSliceTaskInfo.sliceProfile = adapter break 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 f20bca9837..04f07b66d4 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 @@ -34,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory +import static org.apache.commons.lang3.StringUtils.isBlank + class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class); @@ -61,6 +63,8 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { }""" execution.setVariable("serviceModelInfo", serviceModelInfo) + tnNssmfUtils.setEnableSdncConfig(execution) + logger.trace("Exit preProcessRequest") } @@ -101,7 +105,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { void createServiceInstance(DelegateExecution execution) { - String serviceRole = "TN" + String serviceRole = "nssi" String serviceType = execution.getVariable("subscriptionServiceType") String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String sliceProfileStr = execution.getVariable("sliceProfile") @@ -109,19 +113,23 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance() ss.setServiceInstanceId(ssInstanceId) String sliceInstanceName = execution.getVariable("sliceServiceInstanceName") + if (isBlank(sliceInstanceName)) { + logger.error("ERROR: createServiceInstance: sliceInstanceName is null") + sliceInstanceName = ssInstanceId + } ss.setServiceInstanceName(sliceInstanceName) ss.setServiceType(serviceType) - String serviceStatus = "allocated" + String serviceStatus = "deactivated" ss.setOrchestrationStatus(serviceStatus) String modelInvariantUuid = execution.getVariable("modelInvariantUuid") String modelUuid = execution.getVariable("modelUuid") - //TODO: need valid model ID from the caller, as AAI does not accept invalid IDs - //ss.setModelInvariantId(modelInvariantUuid) - //ss.setModelVersionId(modelUuid) + ss.setModelInvariantId(modelInvariantUuid) + ss.setModelVersionId(modelUuid) String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr) ss.setServiceInstanceLocationId(serviceInstanceLocationid) String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr) - ss.setEnvironmentContext(snssai) + //ss.setEnvironmentContext(snssai) + ss.setEnvironmentContext("tn") ss.setServiceRole(serviceRole) AAIResourcesClient client = getAAIClient() AAIResourceUri uri = diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy index f3bc47e7cf..147e623ece 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy @@ -21,25 +21,26 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.SliceProfiles +import org.onap.aaiclient.client.aai.entities.AAIResultWrapper +import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri +import org.onap.aaiclient.client.aai.entities.uri.AAISimpleUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder -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.NssiResponse -import org.onap.so.beans.nsmf.ServiceInfo +import org.onap.so.beans.nsmf.* +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 import org.onap.so.bpmn.common.scripts.RequestDBUtil -import org.onap.so.bpmn.core.domain.ServiceArtifact import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory +import javax.ws.rs.NotFoundException class DoDeallocateNSSI extends AbstractServiceTaskProcessor { @@ -103,15 +104,13 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") as ServiceDecomposition - ServiceArtifact serviceArtifact = serviceDecomposition ?.getServiceInfo()?.getServiceArtifact()?.get(0) - String content = serviceArtifact.getContent() - String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") - String domainType = jsonUtil.getJsonValue(content, "metadata.domainType") + String vendor = serviceDecomposition ?.getServiceRole() + NetworkType domainType = convertServiceCategory(serviceDecomposition.getServiceCategory()) def currentNSSI = execution.getVariable("currentNSSI") currentNSSI['vendor'] = vendor currentNSSI['domainType'] = domainType - LOGGER.info("processDecomposition, current vendor-domainType:" +String.join("-", vendor, domainType)) + LOGGER.info("processDecomposition, current vendor-domainType:" +String.join("-", vendor, domainType.toString())) } catch (any) { String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage() @@ -120,6 +119,27 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor } LOGGER.debug("*****${PREFIX} Exit processDecomposition *****") } + + + /** + * get subnetType from serviceCategory + * @return + */ + private NetworkType convertServiceCategory(String serviceCategory){ + if(serviceCategory ==~ /CN.*/){ + return SubnetType.CN.getNetworkType() + } + if (serviceCategory ==~ /AN.*NF.*/){ + return SubnetType.AN.getNetworkType() + } + if (serviceCategory ==~ /TN.*BH.*/){ + return SubnetType.TN_BH.getNetworkType() + } + if(serviceCategory ==~ /TN.*MH.*/){ + return SubnetType.TN_MH.getNetworkType() + } + return null + } /** * send deallocate request to nssmf @@ -136,9 +156,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor String scriptName = execution.getVariable("scriptName") String serviceInvariantUuid = currentNSSI['modelInvariantId'] - String serviceUuid = currentNSSI['modelId'] + String serviceUuid = currentNSSI['modelVersionId'] String globalSubscriberId = currentNSSI['globalSubscriberId'] - String subscriptionServiceType = execution.getVariable("serviceType") + String subscriptionServiceType = currentNSSI['serviceType'] DeAllocateNssi deAllocateNssi = new DeAllocateNssi() deAllocateNssi.setNsiId(nsiId) @@ -191,8 +211,6 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor { def currentNSSI = execution.getVariable("currentNSSI") String jobId = currentNSSI['jobId'] - - execution.setVariable("responseId", "3") execution.setVariable("jobId", jobId) } @@ -245,11 +263,11 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor private EsrInfo getEsrInfo(def currentNSSI) { - String domaintype = currentNSSI['domainType'] + NetworkType domainType = currentNSSI['domainType'] String vendor = currentNSSI['vendor'] EsrInfo info = new EsrInfo() - info.setNetworkType(NetworkType.fromString(domaintype)) + info.setNetworkType(domainType) info.setVendor(vendor) return info } @@ -264,17 +282,17 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor def currentNSSI = execution.getVariable("currentNSSI") int currentProgress = currentNSSI["jobProgress"] def proportion = currentNSSI['proportion'] - def statusDes = currentNSSI["statusDescription"] int progress = (currentProgress as int) == 0 ? 0 : (currentProgress as int) / 100 * (proportion as int) def status = currentNSSI['status'] - + + OperationStatus operationStatus = new OperationStatus() operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String) operationStatus.setOperationId(currentNSSI['operationId'] as String) operationStatus.setOperation("DELETE") - operationStatus.setResult(status as String) + operationStatus.setResult("processing") operationStatus.setProgress(progress as String) - operationStatus.setOperationContent(statusDes as String) + operationStatus.setOperationContent(currentNSSI['domainType'].toString() + " " + status.toString()) requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus) LOGGER.debug("update operation, currentProgress=${currentProgress}, proportion=${proportion}, progress = ${progress}" ) } @@ -283,20 +301,20 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor * delete slice profile from aai * @param execution */ - void delSliceProfileFromAAI(DelegateExecution execution) + void delSliceProfileServiceFromAAI(DelegateExecution execution) { LOGGER.debug("*****${PREFIX} start delSliceProfileFromAAI *****") def currentNSSI = execution.getVariable("currentNSSI") String nssiServiceInstanceId = currentNSSI['nssiServiceInstanceId'] String profileId = currentNSSI['profileId'] String globalSubscriberId = currentNSSI["globalSubscriberId"] - String serviceType = execution.getVariable("serviceType") + String serviceType = currentNSSI['serviceType'] try { LOGGER.debug("delete nssiServiceInstanceId:${nssiServiceInstanceId}, profileId:${profileId}") AAIResourceUri resourceUri = AAIUriFactory.createResourceUri( - AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(nssiServiceInstanceId).sliceProfile(profileId)) + AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(profileId)) if (!getAAIClient().exists(resourceUri)) { exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") } @@ -310,4 +328,41 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor } LOGGER.debug("*****${PREFIX} Exist delSliceProfileFromAAI *****") } + + void delSliceProfileFromAAI(DelegateExecution execution){ + + LOGGER.debug("*****${PREFIX} start delSliceProfileFromAAI *****") + def currentNSSI = execution.getVariable("currentNSSI") + String globalSubscriberId = currentNSSI["globalSubscriberId"] + String serviceType = currentNSSI['serviceType'] + String sliceProfileInstId = currentNSSI['profileId'] + + try + { + AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(sliceProfileInstId).sliceProfiles()) + AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) + Optional<SliceProfiles> sliceProfilesOpt =wrapper.asBean(SliceProfiles.class) + SliceProfiles sliceProfiles + String profileId + if(sliceProfilesOpt.isPresent()){ + sliceProfiles = sliceProfilesOpt.get() + org.onap.aai.domain.yang.SliceProfile sliceProfile = sliceProfiles.getSliceProfile().get(0) + profileId = sliceProfile ? sliceProfile.getProfileId() : "" + } + if (profileId){ + AAISimpleUri profileUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(sliceProfileInstId).sliceProfile(profileId)) + if (!getAAIClient().exists(profileUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + getAAIClient().delete(profileUri) + } + + } + catch (any) + { + String msg = "delete service profile from aai failed! cause-"+any.getCause() + LOGGER.error(any.printStackTrace()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } } 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 c817eaad61..a715e7799d 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 @@ -25,7 +25,6 @@ import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance -import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory @@ -81,6 +80,9 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { "modelVersion":"" }""" execution.setVariable("serviceModelInfo", serviceModelInfo) + + tnNssmfUtils.setEnableSdncConfig(execution) + logger.debug("Finish preProcessRequest") } @@ -150,18 +152,15 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { String status, String progress, String statusDescription) { - String serviceId = execution.getVariable("sliceServiceInstanceId") + String ssInstanceId = execution.getVariable("sliceServiceInstanceId") + String modelUuid = execution.getVariable("modelUuid") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") - ResourceOperationStatus roStatus = new ResourceOperationStatus() - roStatus.setServiceId(serviceId) - roStatus.setOperationId(jobId) - roStatus.setResourceTemplateUUID(nsiId) - roStatus.setOperType("Deallocate") - roStatus.setProgress(progress) - roStatus.setStatus(status) - roStatus.setStatusDescription(statusDescription) + ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId, + jobId, nsiId, "DEALLOCATE", status, progress, statusDescription) + + logger.debug("DoDeallocateTnNssi: roStatus={}", roStatus) requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy index c4321220fd..5fd06fd8d4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy @@ -19,19 +19,15 @@ */ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.isBlank -import javax.ws.rs.NotFoundException -import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.AllottedResource import org.onap.aai.domain.yang.AllottedResources import org.onap.aai.domain.yang.Relationship import org.onap.aai.domain.yang.ServiceInstance -import org.onap.aai.domain.yang.ServiceProfile -import org.onap.aai.domain.yang.ServiceProfiles import org.onap.aaiclient.client.aai.AAIObjectName 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 @@ -45,6 +41,11 @@ import org.onap.so.client.HttpClientFactory import org.slf4j.Logger import org.slf4j.LoggerFactory +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + /** * This groovy class supports the <class>DoDeleteSliceService.bpmn</class> process. * @@ -99,7 +100,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { * save snssai * @param execution */ - void queryE2ESliceSeriveFromAAI(DelegateExecution execution) + void queryServiceProfileFromAAI(DelegateExecution execution) { LOGGER.trace(" *****${PREFIX} Start queryE2ESliceSeriveFromAAI *****") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -111,11 +112,11 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { if(si.isPresent()) { String snssai = si.get()?.getEnvironmentContext() - ServiceProfiles serviceProfiles = si.get()?.getServiceProfiles() - ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0) - String serviceProfileId = serviceProfile ? serviceProfile.getProfileId() : "" execution.setVariable("snssai", snssai ?: "") - execution.setVariable("serviceProfileId",serviceProfileId) +// ServiceProfiles serviceProfiles = si.get()?.getServiceProfiles() +// ServiceProfile serviceProfile = serviceProfiles.getServiceProfile().get(0) +// String serviceProfileId = serviceProfile ? serviceProfile.getProfileId() : "" +// execution.setVariable("serviceProfileId", serviceProfileId) List<ServiceInstance> sliceProfileList = [] List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship() for (Relationship relationship : relationshipList) { @@ -127,7 +128,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class) if (serviceInstance.isPresent()) { ServiceInstance instance = serviceInstance.get() - if ("slice-profile-instance".equalsIgnoreCase(instance.getServiceRole())) { + if ("slice-profile".equalsIgnoreCase(instance.getServiceRole())) { sliceProfileList.add(instance) } } @@ -158,7 +159,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { try { String errorMsg = "query allotted resource from aai failed." - AAIResultWrapper wrapper = queryAAI(execution, Types.ALLOTTED_RESOURCES, serviceInstanceId, errorMsg) + AAIResultWrapper wrapper = queryAAI(execution, Types.ALLOTTED_RESOURCE, serviceInstanceId, errorMsg) Optional<AllottedResources> ars = wrapper?.asBean(AllottedResources.class) if(ars.isPresent() && ars.get().getAllottedResource()) { @@ -190,13 +191,27 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { { LOGGER.trace(" *****${PREFIX} Start getNSIFromAAI *****") String nsiId = execution.getVariable("nsiId") + List<String> nssiIdList = getNSSIIdList(execution, nsiId) + String msg = "nsiId: ${nsiId}, nssiIdList:" + msg+= nssiIdList.join(",") + LOGGER.info(msg) + execution.setVariable("nssiIdList", nssiIdList) + LOGGER.trace(" *****${PREFIX} Exit getNSIFromAAI *****") + } + /** + * Get NSSI Id from AAI + * @param execution + * @param nsiId + * @return + */ + private List<String> getNSSIIdList(DelegateExecution execution, String nsiId){ + List<String> nssiIdList = [] + try { - String errorMsg = "query nsi from aai failed." + String errorMsg = "query nssi from aai failed." AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, nsiId, errorMsg) - Optional<ServiceInstance> si =wrapper.asBean(ServiceInstance.class) - List<String> nssiIdList = [] - String msg = "nsiId:${nsiId},nssiIdList:" + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) if(si.isPresent()) { List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship() @@ -209,19 +224,17 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" AAIResultWrapper wrapper1 = queryAAI(execution, Types.SERVICE_INSTANCE, instanceId, errorMsg) Optional<ServiceInstance> serviceInstance = wrapper1.asBean(ServiceInstance.class) + def nssiId if (serviceInstance.isPresent()) { ServiceInstance instance = serviceInstance.get() if ("nssi".equalsIgnoreCase(instance.getServiceRole())) { nssiId = instance.getServiceInstanceId() + nssiIdList.add(nssiId) } } - nssiIdList.add(nssiId) - msg+="${nssiId}, " } } } - LOGGER.info(msg) - execution.setVariable("nssiIdList", nssiIdList) } catch(BpmnError e){ throw e @@ -231,7 +244,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { LOGGER.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - LOGGER.trace(" *****${PREFIX} Exit getNSIFromAAI *****") + return nssiIdList } /** @@ -274,14 +287,39 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { List<ServiceInstance> nssiInstanceList = execution.getVariable("nssiInstanceList") List<ServiceInstance> sliceProfileList = execution.getVariable("sliceProfileList") int currentIndex = execution.getVariable("currentNSSIIndex") as int - String profileId = "" + String profileInstId = "" ServiceInstance nssi = nssiInstanceList?.get(currentIndex) + List<Relationship> relationshipList = nssi.getRelationshipList()?.getRelationship() for(ServiceInstance sliceProfileInstance : sliceProfileList) { - if(sliceProfileInstance.getWorkloadContext().equalsIgnoreCase(nssi.getWorkloadContext())) - { - profileId = sliceProfileInstance.getServiceInstanceId() + for (Relationship relationship : relationshipList) { + String relatedTo = relationship.getRelatedTo() + if (relatedTo == "service-instance"){ + String relatedLink = relationship.getRelatedLink()?:"" + String instanceId = relatedLink ? relatedLink.substring(relatedLink.lastIndexOf("/") + 1,relatedLink.length()) : "" + if(instanceId.equals(sliceProfileInstance.getServiceInstanceId())){ + profileInstId = sliceProfileInstance.getServiceInstanceId() + break + } + } + } + if(profileInstId){ + break } } + + //@TODO Temp begin******************* +// AAIPluralResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(profileInstId).sliceProfiles()) +// AAIResultWrapper wrapper = getAAIClient().get(resourceUri, NotFoundException.class) +// Optional<SliceProfiles> sliceProfilesOpt =wrapper.asBean(SliceProfiles.class) +// SliceProfiles sliceProfiles +// String sliceProfileId +// if(sliceProfilesOpt.isPresent()){ +// sliceProfiles = sliceProfilesOpt.get() +// org.onap.aai.domain.yang.SliceProfile sliceProfile = sliceProfiles.getSliceProfile().get(0) +// sliceProfileId = sliceProfile ? sliceProfile.getProfileId() : "" +// } + //@TODO Temp end******************* + def currentNSSI = [:] currentNSSI['nssiServiceInstanceId'] = nssi?.getServiceInstanceId() currentNSSI['modelInvariantId'] = nssi?.getModelInvariantId() @@ -289,7 +327,10 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { currentNSSI['nssiName'] = nssi?.getServiceInstanceName() currentNSSI['sST'] = nssi?.getServiceType() currentNSSI['PLMNIdList'] = nssi?.getServiceInstanceLocationId() - currentNSSI['profileId'] = profileId + //@TODO Temp + + currentNSSI['profileId'] = profileInstId +// currentNSSI['profileId'] = sliceProfileId currentNSSI['snssai'] = execution.getVariable("snssai") ?: "" currentNSSI['nsiServiceInstanceId'] = execution.getVariable("nsiId") ?: "" currentNSSI['operationId'] = execution.getVariable("operationId") ?: "" @@ -343,7 +384,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { org.onap.aaiclient.client.generated.fluentbuilders.ServiceInstance serviceInstanceType = AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(serviceType).serviceInstance(instanceId) def type - if (aaiObjectName == Types.ALLOTTED_RESOURCES) { + if (aaiObjectName == Types.ALLOTTED_RESOURCE) { type = serviceInstanceType.allottedResources() } else if (aaiObjectName == Types.SLICE_PROFILES) { type = serviceInstanceType.sliceProfiles() @@ -361,8 +402,11 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { void terminateNSIQuery(DelegateExecution execution) { - logger.debug("Start terminateNSIQuery") - + LOGGER.debug("Start terminateNSIQuery") + + return + + //To test String requestId = execution.getVariable("msoRequestId") String nxlId = currentNSSI['nsiServiceInstanceId'] String nxlType = "NSI" @@ -375,17 +419,17 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { String basicAuthValue = utils.encrypt(basicAuth, msokey) if (basicAuthValue != null) { - logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + LOGGER.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) try { authHeader = utils.getBasicAuth(basicAuthValue, msokey) execution.setVariable("BasicAuthHeaderValue", authHeader) } catch (Exception ex) { - logger.debug( "Unable to encode username and password string: " + ex) + LOGGER.debug( "Unable to encode username and password string: " + ex) exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + "encode username and password string") } } else { - logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + LOGGER.debug( "Unable to obtain BasicAuth - BasicAuth value null") exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + "value null") } @@ -397,7 +441,7 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { Response httpResponse = httpClient.post(oofRequest) int responseCode = httpResponse.getStatus() - logger.debug("OOF sync response code is: " + responseCode) + LOGGER.debug("OOF sync response code is: " + responseCode) if(responseCode != 200){ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") @@ -407,9 +451,31 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor { boolean terminateResponse = resMap.get("terminateResponse") execution.setVariable("terminateNSI", terminateResponse) } catch (Exception ex) { - logger.debug( "Failed to get terminate Response suggested by OOF.") + LOGGER.debug( "Failed to get terminate Response suggested by OOF.") exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get terminate Response suggested by OOF.") } - logger.debug("Finish terminateNSIQuery") + LOGGER.debug("Finish terminateNSIQuery") + } + + + /** + * If no nssi,delete NSI from AAI + * @param execution + */ + void deleteNSIInstance(DelegateExecution execution){ + def currentNSSI = execution.getVariable("currentNSSI") + def nsiId = currentNSSI['nsiServiceInstanceId'] + List<String> nssiIdList = getNSSIIdList(execution, nsiId) + try + { + if(0 == nssiIdList.size()){ + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(nsiId)) + getAAIClient().delete(serviceInstanceUri) + } + } catch (Exception ex) { + LOGGER.debug( "Failed to delete NSI instance.") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to delete NSI instance.") + } + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy index f591855b5c..982771f681 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy @@ -549,7 +549,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { updateStatus.setResourceTemplateUUID(nsiId) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Modify") - updateStatus.setProgress(100) + updateStatus.setProgress("100") updateStatus.setStatus("finished") requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus) @@ -571,7 +571,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { updateStatus.setResourceTemplateUUID(nsiId) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Modify") - updateStatus.setProgress(0) + updateStatus.setProgress("0") updateStatus.setStatus("failed") requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus) } @@ -652,4 +652,4 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("Error occured within deleteServiceInstance method: " + e) } } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy index 6fdfbe3218..e0df9ea64b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy @@ -29,7 +29,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.JsonObject -import java.sql.Timestamp +import com.google.gson.JsonParser +import java.time.Instant import static org.apache.commons.lang3.StringUtils.isBlank import org.onap.so.bpmn.core.UrnPropertiesReader @@ -75,7 +76,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { execution.setVariable("sliceProfile", sliceProfile) break case "reconfigure": - String resourceConfig = execution.getVariable("additionalProperties") + String resourceConfig = execution.getVariable("additionalProperties") execution.setVariable("resourceConfig", resourceConfig) break default: @@ -83,7 +84,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction) } } - List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class) + List<String> snssaiList = execution.getVariable("snssaiList") String sliceProfileId = execution.getVariable("sliceProfileId") if (isBlank(sliceProfileId) || (snssaiList.empty)) { msg = "Mandatory fields are empty" @@ -109,7 +110,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { logger.debug(Prefix+"createSdnrRequest method start") String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId") String modifyAction = execution.getVariable("modifyAction") - String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl) + String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "instantiateRANSlice", callbackUrl) execution.setVariable("createNSSI_sdnrRequest", sdnrRequest) execution.setVariable("createNSSI_timeout", "PT10M") execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId")) @@ -123,6 +124,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { if(status.equalsIgnoreCase("success")) { String nfIds = jsonUtil.getJsonValue(SDNRResponse, "nfIds") execution.setVariable("ranNfIdsJson", nfIds) + execution.setVariable("ranNfStatus", status) }else { String reason = jsonUtil.getJsonValue(SDNRResponse, "reason") logger.error("received failed status from SDNR "+ reason) @@ -134,53 +136,47 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) { String requestId = execution.getVariable("msoRequestId") - Date date = new Date().getTime() - Timestamp time = new Timestamp(date) - String sliceProfileString + Instant time = Instant.now() + Map<String,Object> sliceProfile = new HashMap<>() JsonObject response = new JsonObject() JsonObject body = new JsonObject() JsonObject input = new JsonObject() JsonObject commonHeader = new JsonObject() JsonObject payload = new JsonObject() JsonObject payloadInput = new JsonObject() + JsonParser parser = new JsonParser() if(action.equals("allocate")) { - Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) + sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions")) sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL")) sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL")) - sliceProfileString = objectMapper.writeValueAsString(sliceProfile) action = "modify-"+action payloadInput.add("additionalproperties", new JsonObject()) }else if(action.equals("deallocate")) { action = "modify-"+action - Map<String,Object> sliceProfile = new HashMap<>() sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) sliceProfile.put("sNSSAI", execution.getVariable("snssai")) - sliceProfileString = objectMapper.writeValueAsString(sliceProfile) payloadInput.add("additionalproperties", new JsonObject()) }else if(action.equals("reconfigure")) { - Map<String,Object> sliceProfile = new HashMap<>() sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) sliceProfile.put("sNSSAI", execution.getVariable("snssai")) - sliceProfileString = objectMapper.writeValueAsString(sliceProfile) JsonObject resourceconfig = new JsonObject() - resourceconfig.addProperty("resourceConfig", execution.getVariable("resourceConfig")) + resourceconfig.add("resourceConfig", (JsonObject) parser.parse(execution.getVariable("resourceConfig"))) payloadInput.add("additionalproperties", resourceconfig) } - commonHeader.addProperty("TimeStamp", time.toString()) - commonHeader.addProperty("APIver", "1.0") - commonHeader.addProperty("RequestID", requestId) - commonHeader.addProperty("SubRequestID", "1") - commonHeader.add("RequestTrack", new JsonObject()) - commonHeader.add("Flags", new JsonObject()) - payloadInput.addProperty("sliceProfile", sliceProfileString) + commonHeader.addProperty("timestamp", time.toString()) + commonHeader.addProperty("api-ver", "1.0") + commonHeader.addProperty("request-id", requestId) + commonHeader.addProperty("sub-request-id", "1") + commonHeader.add("flags", new JsonObject()) + payloadInput.addProperty("sliceProfile", sliceProfile.toString()) payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID")) payloadInput.addProperty("callbackURL", callbackUrl) payload.add("input", payloadInput) - input.add("CommonHeader", commonHeader) - input.addProperty("Action", action) - input.add("Payload", payload) + input.add("common-header", commonHeader) + input.addProperty("action", action) + input.addProperty("payload", payload.toString()) body.add("input", input) response.add("body", body) response.addProperty("version", "1.0") @@ -190,4 +186,4 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { return response.toString() } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy deleted file mode 100644 index a85f5d8ab3..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy +++ /dev/null @@ -1,423 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - # Copyright (c) 2019, CMCC Technologies Co., Ltd. - # - # 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.scripts - -import com.fasterxml.jackson.databind.ObjectMapper -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.beans.nsmf.* -import org.onap.so.bpmn.common.scripts.* -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.domain.ServiceArtifact -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.logging.filter.base.ErrorCode -import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.MessageEnum -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.web.util.UriUtils - -import java.lang.reflect.Type - -/** - * This class supports the DoCreateVnf building block subflow - * with the creation of a generic vnf for - * infrastructure. - * - */ -class DoSendCommandToNSSMF extends AbstractServiceTaskProcessor { - - private static final Logger logger = LoggerFactory.getLogger( DoSendCommandToNSSMF.class); - String Prefix="DoCNSSMF_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - - execution.setVariable("prefix",Prefix) - logger.debug("STARTED Do sendcommandtoNssmf PreProcessRequest Process") - - /*******************/ - try{ - // Get Variables - String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") - String serviceInstanceId = execution.getVariable("e2eserviceInstanceId") - execution.setVariable("e2eserviceInstanceId", e2eserviceInstanceId) - execution.setVariable("serviceInstanceId", serviceInstanceId) - logger.debug("Incoming e2eserviceInstanceId is: " + e2eserviceInstanceId) - - String NSIserviceid = execution.getVariable("NSIserviceid") - execution.setVariable("NSIserviceid", NSIserviceid) - logger.debug("Incoming NSI id is: " + NSIserviceid) - - - String nssiMap = execution.getVariable("nssiMap") - Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType() - Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type) - String strDonssiMap = mapToJsonStr(DonssiMap) - execution.setVariable("DonssiMap",strDonssiMap) - logger.debug("Incoming DonssiMap is: " + strDonssiMap) - - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("msoRequestId", requestId) - - String operationType = execution.getVariable("operationType") - execution.setVariable("operationType", operationType.toLowerCase()) - logger.debug("Incoming operationType is: " + operationType) - - if (operationType == "activation") { - execution.setVariable("activationSequence","an,tn,cn") - }else { - execution.setVariable("activationSequence","cn,tn,an") - } - execution.setVariable("activationIndex",0) - execution.setVariable("miniute", "0") - execution.setVariable("activateNumberSlice",0) - - logger.info("the end !!") - }catch(BpmnError b){ - logger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - logger.info("the end of catch !!") - logger.debug(" Error Occured in DoSendCommandToNSSMF PreProcessRequest method!" + e.getMessage()) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoSendCommandToNSSMF PreProcessRequest") - - } - logger.trace("COMPLETED DoSendCommandToNSSMF PreProcessRequest Process") - } - - private String mapToJsonStr(Map<String, NSSI> stringNSSIHashMap) { - HashMap<String, NSSI> map = new HashMap<String, NSSI>() - for(Map.Entry<String, NSSI> child:stringNSSIHashMap.entrySet()) - { - map.put(child.getKey(), child.getValue()) - } - return new Gson().toJson(map) - } - - public void getNSSIformlist(DelegateExecution execution) { - - String nssiMap = execution.getVariable("DonssiMap") - Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType() - Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type) - String isNSSIActivate = execution.getVariable("isNSSIActivate") - - String activationSequence01 = execution.getVariable("activationSequence") - String[] strlist = activationSequence01.split(",") - - int activationIndex = execution.getVariable("activationIndex") - int indexcurrent = 0 - if (isNSSIActivate == "true") - { - execution.setVariable("isGetSuccessfull", "false") - }else{for (int index = activationIndex; index < 3;index++) { - String domaintype01 = strlist[index] - if (DonssiMap.containsKey(domaintype01)) { - NSSI nssiobject = DonssiMap.get(domaintype01) - execution.setVariable("domainType", domaintype01) - execution.setVariable("nssiId", nssiobject.getNssiId()) - execution.setVariable("modelInvariantUuid", nssiobject.getModelInvariantId()) - execution.setVariable("modelUuid", nssiobject.getModelVersionId()) - execution.setVariable("isGetSuccessfull", "true") - String modelInvariantUuid = execution.getVariable("modelInvariantUuid") - String modelUuid = execution.getVariable("modelUuid") - //here modelVersion is not set, we use modelUuid to decompose the service. - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - indexcurrent = index - execution.setVariable("activationIndex", indexcurrent) - break - }else - { - indexcurrent = index + 1 - - } - } - if ( activationIndex > 2) { - execution.setVariable("isGetSuccessfull", "false") - } - execution.setVariable("activationIndex", indexcurrent)} - - } - - /** - * get vendor Info - * @param execution - */ - private void processDecomposition(DelegateExecution execution) { - logger.debug("***** processDecomposition *****") - - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") as ServiceDecomposition - ServiceArtifact serviceArtifact = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0) - String content = serviceArtifact.getContent() - String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") - //String domainType = jsonUtil.getJsonValue(content, "metadata.domainType") - - execution.setVariable("vendor", vendor) - // currentNSSI['domainType'] = domainType - logger.info("processDecomposition, current vendor-domainType:" + vendor) - - } catch (any) { - String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage() - logger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - logger.debug("***** Exit processDecomposition *****") - } - - public void UpdateIndex(DelegateExecution execution) { - def activationIndex = execution.getVariable("activationIndex") - int activateNumberSlice = execution.getVariable("activateNumberSlice") as Integer - def activationCount= execution.getVariable("activationCount") - //DecimalFormat df1 = new DecimalFormat("##%") - int rate = (activateNumberSlice / activationCount) * 100 - if (rate == 100) - { - execution.setVariable("isNSSIActivate","true") - } - else{ - execution.setVariable("isNSSIActivate","false") - } - activationIndex = activationIndex + 1 - execution.setVariable("activationIndex",activationIndex) - logger.trace("the Progress of activation is " + rate.toString() + "%" ) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = UUID.randomUUID().toString() - String operationType = execution.getVariable("operationType") - String userId = "" - String result = (operationType.equalsIgnoreCase("activation"))? "ACTIVATING": "DEACTIVATING" - int progress = rate - String reason = "" - String operationContent = "Service activation in progress" - logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("e2eserviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) - - String payload = - """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> - <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> - <userId>${MsoUtils.xmlEscape(userId)}</userId> - <result>${MsoUtils.xmlEscape(result)}</result> - <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <reason>${MsoUtils.xmlEscape(reason)}</reason> - </ns:initServiceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>""" - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - logger.debug("Outgoing CVFMI_updateServiceOperStatusRequest: \n" + payload) - - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing Activate Slice .", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during Activate Slice Method:\n" + e.getMessage()) - } - logger.trace("finished Activate Slice") - } - - public void WaitForReturn(DelegateExecution execution) { - //logger.debug("Query : "+ Jobid) - String miniute = execution.getVariable("miniute") - Thread.sleep(10000) - int miniute01 = Integer.parseInt(miniute) + 1 - logger.debug("waiting for : "+ miniute + "miniutes") - execution.setVariable("miniute", String.valueOf(miniute01)) - } - - public void GetTheStatusOfActivation(DelegateExecution execution) { - - String domaintype = execution.getVariable("domainType") - String NSIserviceid=execution.getVariable("NSIserviceid") - String nssiId = execution.getVariable("nssiId") - String Jobid=execution.getVariable("JobId") - String miniute=execution.getVariable("miniute") - String vendor = execution.getVariable("vendor") - String jobstatus - - - logger.debug("Query the jobid activation of SNSSAI: "+ Jobid) - logger.debug("the domain is : "+ domaintype) - logger.debug("the NSSID is : "+nssiId) - logger.debug("the NSIserviceid is : "+NSIserviceid) - - JobStatusRequest jobStatusRequest = new JobStatusRequest() - - EsrInfo info = new EsrInfo() - info.setNetworkType(NetworkType.fromString(domaintype)) - info.setVendor(vendor) - - jobStatusRequest.setNsiId(NSIserviceid) - jobStatusRequest.setNssiId(nssiId) - jobStatusRequest.setEsrInfo(info) - - - ObjectMapper mapper = new ObjectMapper() - String nssmfRequest = mapper.writeValueAsString(jobStatusRequest) - String isActivateSuccessfull - - String urlString = "/api/rest/provMns/v1/NSS/jobs/" +Jobid - - JobStatusResponse jobStatusResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest, JobStatusResponse.class) - - if (jobStatusResponse != null) { - execution.setVariable("statusDescription", jobStatusResponse.getResponseDescriptor().getStatusDescription()) - jobstatus = jobStatusResponse.getResponseDescriptor().getStatus() - switch(jobstatus) { - case "started": - case "processing": - isActivateSuccessfull = "waitting" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - break - case "finished": - isActivateSuccessfull = "true" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - execution.setVariable("activateNumberSlice",execution.getVariable("activateNumberSlice")+ 1) - break - case "error": - default: - isActivateSuccessfull = "false" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - - } - if(Integer.parseInt(miniute) > 6 ) - { - isActivateSuccessfull = "false" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a timeout job status Response from NSSMF.") - } - } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad job status Response from NSSMF.") - isActivateSuccessfull = false - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - } - } - - public void SendCommandToNssmf(DelegateExecution execution) { - - String snssai= execution.getVariable("snssai") - String domaintype = execution.getVariable("domainType") - String NSIserviceid=execution.getVariable("NSIserviceid") - String nssiId = execution.getVariable("nssiId") - String vendor = execution.getVariable("vendor") - - - logger.debug("the domain is : "+domaintype) - logger.debug("SNSSAI: "+snssai +" will be activated") - logger.debug("the NSSID is : "+nssiId) - logger.debug("the NSIserviceid is : "+NSIserviceid) - - EsrInfo esr = new EsrInfo(); - esr.setNetworkType(NetworkType.fromString(domaintype)) - esr.setVendor(vendor) - - ActDeActNssi actNssi = new ActDeActNssi(); - actNssi.setNsiId(NSIserviceid); - actNssi.setNssiId(nssiId); - NssiActDeActRequest actRequest = new NssiActDeActRequest(); - actRequest.setActDeActNssi(actNssi); - actRequest.setEsrInfo(esr) - - ObjectMapper mapper = new ObjectMapper() - String nssmfRequest = mapper.writeValueAsString(actRequest) - - String operationType = execution.getVariable("operationType") - - String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + operationType.toLowerCase() - - NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest, NssiResponse.class) - - if (nssmfResponse != null) { - String isNSSIActivated = "true" - execution.setVariable("isNSSIActivated", isNSSIActivated) - String jobId = nssmfResponse.getJobId() ?: "" - execution.setVariable("JobId", jobId) - } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.") - String isNSSIActivated = "false" - execution.setVariable("isNSSIActivated", isNSSIActivated) - execution.setVariable("isNSSIActivate","false") - } - - } - - void sendSyncError (DelegateExecution execution) { - logger.trace("start sendSyncError") - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> - <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> - <aetgt:ErrorCode>7000</aetgt:ErrorCode> - </aetgt:WorkflowException>""" - - logger.debug(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) - } - logger.trace("finished sendSyncError") - } -} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy index 5cdf540173..74c9a49911 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/QueryJobStatus.groovy @@ -20,9 +20,11 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.fasterxml.jackson.databind.ObjectMapper import groovy.json.JsonSlurper import org.json.JSONObject import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.beans.nsmf.JobStatusRequest import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils @@ -43,16 +45,15 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ try{ String requestId = execution.getVariable("msoRequestId") logger.debug("RequestId :" + requestId) - String responseId = execution.getVariable("responseId") - String jobId = execution.getVariable("jobId") + String jobId = execution.getVariable("jobId") def jsonSlurper = new JsonSlurper() - HashMap<String,?> esrInfo=jsonSlurper.parseText(execution.getVariable("esrInfo")) + HashMap<String,?> esrInfo = jsonSlurper.parseText(execution.getVariable("esrInfo")) logger.debug("esrInfo" + esrInfo.toString()) - HashMap<String,?> serviceInfo=jsonSlurper.parseText(execution.getVariable("serviceInfo")) + HashMap<String,?> serviceInfo = jsonSlurper.parseText(execution.getVariable("serviceInfo")) logger.debug("serviceInfo" + serviceInfo.toString()) - + execution.setVariable("esrInfo", esrInfo) execution.setVariable("serviceInfo", serviceInfo) @@ -60,10 +61,9 @@ public class QueryJobStatus extends AbstractServiceTaskProcessor{ String endPoint = String.format("/api/rest/provMns/v1/NSS/jobs/%s", jobId) String url = nssmfEndpoint + endPoint execution.setVariable("NSSMF_AdapterEndpoint", url) - + String payload = """ { - "responseId": "${responseId}", "esrInfo": ${execution.getVariable("esrInfo") as JSONObject}, "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject} } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceLevelUpgrade.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceLevelUpgrade.groovy new file mode 100644 index 0000000000..15f44ce03c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ServiceLevelUpgrade.groovy @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.workflow.context.WorkflowContext +import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder +import org.onap.so.bpmn.core.WorkflowException +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_ID + +class ServiceLevelUpgrade extends AbstractServiceTaskProcessor { + private static final Logger logger = LoggerFactory.getLogger(ServiceLevelUpgrade.class) + + ExceptionUtil exceptionUtil = new ExceptionUtil() + String prefix = "ServiceLevelUpgrade_" + + @Override + void preProcessRequest(DelegateExecution execution) { + } + + void sendResponse(DelegateExecution execution) { + def requestId = execution.getVariable(REQUEST_ID) + def instanceId = execution.getVariable(PNF_CORRELATION_ID) + logger.debug("Send response for requestId: {}, instanceId: {}", requestId, instanceId) + + String response = """{"requestReferences":{"requestId":"${requestId}", "instanceId":"${instanceId}"}}""".trim() + sendWorkflowResponse(execution, 200, response) + } + + static WorkflowContext getWorkflowContext(DelegateExecution execution) { + String requestId = execution.getVariable(REQUEST_ID) + return WorkflowContextHolder.getInstance().getWorkflowContext(requestId) + } + + void prepareCompletion(DelegateExecution execution) { + try { + String requestId = execution.getVariable(REQUEST_ID) + logger.debug("Prepare Completion of Service Level Upgrade for requestId: {}", requestId) + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>UPDATE</action> + <source>VID</source> + </request-info> + <aetgt:status-message>Service Level Upgrade successful.</aetgt:status-message> + <aetgt:mso-bpel-name>SERVICE_LEVEL_UPGRADE</aetgt:mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable(prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + + logger.debug("CompleteMsoProcessRequest of Service Level Upgrade - " + "\n" + xmlMsoCompletionRequest) + } catch (Exception e) { + String msg = "Prepare Completion error for Service Level Upgrade - " + e.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } + + void prepareFalloutHandler(DelegateExecution execution) { + WorkflowContext workflowContext = getWorkflowContext(execution) + if (workflowContext == null) { + logger.debug("Error occurred before sending response to API handler, and send it now") + sendResponse(execution) + } + + try { + String requestId = execution.getVariable(REQUEST_ID) + logger.debug("Prepare FalloutHandler of Service Level Upgrade for requestId: {}", requestId) + + WorkflowException workflowException = (WorkflowException)execution.getVariable("WorkflowException") + String errorCode = String.valueOf(workflowException.getErrorCode()) + String errorMessage = workflowException.getErrorMessage() + String falloutHandlerRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" + xmlns:ns="http://org.onap/so/request/types/v1"> + <request-info xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <action>UPDATE</action> + <source>VID</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + String xmlFalloutHandlerRequest = utils.formatXml(falloutHandlerRequest) + + execution.setVariable(prefix + "FalloutHandlerRequest", xmlFalloutHandlerRequest) + + logger.debug("FalloutHandlerRequest of Service Level Upgrade - " + "\n" + xmlFalloutHandlerRequest) + } catch (Exception e) { + String msg = "Prepare FalloutHandler error for Service Level upgrade - " + e.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg) + } + } +} 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 8a276ed330..deeec94b74 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 @@ -72,7 +72,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String additionalPropJsonStr = execution.getVariable("sliceParams") - String tnNssiId = execution.getVariable("serviceInstanceID") + String tnNssiId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug if (isBlank(tnNssiId)) { tnNssiId = UUID.randomUUID().toString() } @@ -321,17 +321,17 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String status, String progress, String statusDescription) { - String serviceId = execution.getVariable("dummyServiceId") + String modelUuid = execution.getVariable("modelUuid") String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") ResourceOperationStatus roStatus = new ResourceOperationStatus() - roStatus.setServiceId(serviceId) + roStatus.setServiceId(nsiId) roStatus.setOperationId(jobId) - roStatus.setResourceTemplateUUID(nsiId) + roStatus.setResourceTemplateUUID(modelUuid) roStatus.setResourceInstanceID(ssInstanceId) - roStatus.setOperType("Allocate") + roStatus.setOperType("ALLOCATE") roStatus.setProgress(progress) roStatus.setStatus(status) roStatus.setStatusDescription(statusDescription) 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 d97f416db9..009b0a1941 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 @@ -32,6 +32,7 @@ import org.onap.so.bpmn.core.RollbackData import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -122,7 +123,7 @@ class TnNssmfUtils { } String sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" + """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> <sdncadapter:RequestHeader> @@ -332,4 +333,39 @@ class TnNssmfUtils { createRelationShipInAAI(execution, aaiResourceUri, relationship) } + + ResourceOperationStatus buildRoStatus(String nsstId, + String nssiId, + String jobId, + String nsiId, + String action, + String status, + String progress, + String statusDescription) { + ResourceOperationStatus roStatus = new ResourceOperationStatus() + roStatus.setResourceTemplateUUID(nsstId) + roStatus.setResourceInstanceID(nssiId) + roStatus.setServiceId(nsiId) + roStatus.setOperationId(jobId) + roStatus.setOperType(action) + roStatus.setProgress(progress) + roStatus.setStatus(status) + roStatus.setStatusDescription(statusDescription) + + return roStatus + } + + + void setEnableSdncConfig(DelegateExecution execution) { + String enableSdnc = UrnPropertiesReader.getVariable( + "mso.workflow.TnNssmf.enableSDNCNetworkConfig") + if (isBlank(enableSdnc)) { + logger.debug("mso.workflow.TnNssmf.enableSDNCNetworkConfig is undefined, so use default value (true)") + enableSdnc = "true" + } + + logger.debug("setEnableSdncConfig: enableSdnc=" + enableSdnc) + + execution.setVariable("enableSdnc", enableSdnc) + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy index 6b15407dd0..fa1cef291e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy @@ -20,7 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.junit.Assert.* +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertEquals import org.junit.Before import org.junit.Test @@ -49,14 +50,19 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { @Test public void testPreProcessRequest() { - String networkServiceModelInfo=""" { - "modelName" : "5GC-eMBB Service Proxy", - "modelUuid" : "b666119e-4400-47c6-a0c1-bbe050a33b47", - "modelInvariantUuid" : "a26327e1-4a9b-4883-b7a5-5f37dcb7405a", + String networkServiceModelInfo="""{ + "modelInfo" : { + "modelName" : "vfw_cnf_service_2310 Service Proxy", + "modelUuid" : "35386eb0-b673-48c5-9757-45ecfc506bf8", + "modelInvariantUuid" : "b048d7bc-8bfd-4950-aea5-22b1aaf5d76b", "modelVersion" : "1.0", - "modelCustomizationUuid" : "cbc12c2a-67e6-4336-9236-eaf51eacdc75", - "modelInstanceName" : "5gcembb_proxy 0" - }""" + "modelCustomizationUuid" : "82f4db76-e7ad-47eb-b5e3-661683f14de6", + "modelInstanceName" : "vfw_cnf_service_2310_proxy 0" + }, + "toscaNodeType" : "org.openecomp.nodes.vfw_cnf_service_2310_proxy", + "description" : "A Proxy for Service vfw_cnf_service_2310", + "sourceModelUuid" : "f3666c56-744e-4055-9f4a-0726460898e0" + }""" String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoints\": [{\r\n\t\t\"IpAdress\": \"\",\r\n\t\t\"LogicalLinkId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t}],\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}""" @@ -70,10 +76,10 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceModelUuid"), captor.capture()) captor.getValue() - assertEquals("b666119e-4400-47c6-a0c1-bbe050a33b47", captor.getValue()) + assertEquals("f3666c56-744e-4055-9f4a-0726460898e0", captor.getValue()) Mockito.verify(mockExecution, times(1)).setVariable(eq("networkServiceName"), captor.capture()) - assertEquals("5GC-eMBB", captor.getValue()) + assertEquals("vfw_cnf_service_2310", captor.getValue()) Mockito.verify(mockExecution, times(1)).setVariable(eq("orchestrationStatus"), captor.capture()) assertEquals("created", captor.getValue()) @@ -90,6 +96,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { when(mockExecution.getVariable("networkServiceName")).thenReturn("5g_embb") when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("networkServiceModelUuid")).thenReturn("12345") + when(mockExecution.getVariable("vnfInstanceName")).thenReturn("vf00") DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice() allocateNssi.prepareServiceOrderRequest(mockExecution) @@ -106,7 +113,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { Map<String, Object> ServiceCharacteristicValue = new LinkedHashMap<>() Map<String, Object> ServiceCharacteristicValueObject = new LinkedHashMap<>() ServiceCharacteristicValueObject.put("serviceCharacteristicValue","001-100001") - ServiceCharacteristicValue.put("name", "snssai") + ServiceCharacteristicValue.put("name", "vf00_snssai") ServiceCharacteristicValue.put("value", ServiceCharacteristicValueObject) List expectedList= new ArrayList() @@ -116,8 +123,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { Map<String, Object> serviceCharacteristic = objectMapper.readValue(sliceProfile, Map.class); DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice() - List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(serviceCharacteristic) - + List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(mockExecution, serviceCharacteristic) assertEquals(expectedList, characteristicList) } }
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy index 0ac48ad189..9068692e30 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy @@ -20,6 +20,9 @@ package org.onap.so.bpmn.infrastructure.scripts +import static org.junit.Assert.assertNotNull +import static org.junit.Assert.assertEquals + import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before import org.junit.Test @@ -32,7 +35,6 @@ 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 static org.mockito.Mockito.spy import static org.mockito.Mockito.times @@ -91,7 +93,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { } @Test - public void tesPrepareSOMacroRequestPayload() { + public void testPrepareSOMacroRequestPayload() { String json ="{ \"serviceResources\" : {\r\n\t\"modelInfo\" : {\r\n\t\t\"modelName\" : \"MSOTADevInfra_vSAMP10a_Service\",\r\n\t\t\"modelUuid\" : \"5df8b6de-2083-11e7-93ae-92361f002671\",\r\n\t\t\"modelInvariantUuid\" : \"9647dfc4-2083-11e7-93ae-92361f002671\",\r\n\t\t\"modelVersion\" : \"1.0\"\r\n\t},\r\n\t\"serviceType\" : \"PortMirroring\",\r\n\t\"serviceRole\" : \"InfraRole\",\r\n\t\"environmentContext\" : \"Luna\",\r\n\t\"workloadContext\" : \"Oxygen\",\r\n\t\"serviceVnfs\": [\r\n\t\r\n\t\t{ \"modelInfo\" : {\r\n\t\t\t\"modelName\" : \"vSAMP10a\",\r\n\t\t\t\"modelUuid\" : \"ff2ae348-214a-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelInvariantUuid\" : \"2fff5b20-214b-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\"modelCustomizationUuid\" : \"68dc9a92-214c-11e7-93ae-92361f002671\",\r\n\t\t\t\"modelInstanceName\" : \"vSAMP10a 1\"\r\n\t\t\t},\r\n\t\t\"toscaNodeType\" : \"VF\",\r\n\t\t\"nfFunction\" \t: null,\r\n\t\t\"nfType\" \t\t: null,\r\n\t\t\"nfRole\" \t\t: null,\r\n\t\t\"nfNamingCode\" \t: null,\r\n\t\t\"multiStageDesign\"\t\t: null,\r\n\t\t\t\"vfModules\": [\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"NetworkFqdnTest4\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"025606c1-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba01a\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba01a\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"label\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"NetworkFqdnTest3\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02560575-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d13cba0bb\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"label\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"NetworkFqdnTest5\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"025607e4-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d14cba01a\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"06bd0a18-65c0-4418-83c7-5b0d14cba01a\"\r\n\t\t\t\t\t},\t\t\"isBase\" : false,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"label\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10aDEV::PCM::module-2\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"7774b4e4-7d37-11e7-bb31-be2e44b06b34\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"93e9c1d2-7d37-11e7-bb31-be2e44b06b34\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"6728bee8-7d3a-11e7-bb31-be2e44b06b34\"\r\n\t\t\t\t\t},\t\t\"isBase\" : false,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"PCM\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10aDEV::PCM::module-1\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"066de97e-253e-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"64efd51a-2544-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"b4ea86b4-253f-11e7-93ae-92361f002671\"\r\n\t\t\t\t\t},\t\t\"isBase\" : false,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"PCM\",\r\n\t\t\t\t\t\"initialCount\" : 0,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10aDEV::base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"20c4431c-246d-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : \"78ca26d0-246d-11e7-93ae-92361f002671\",\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"cb82ffd8-252a-11e7-93ae-92361f002671\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"base\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10a::base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02560de2-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : null,\r\n\t\t\t\t\t\t\"modelVersion\" : \"2\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_36e76920-ef30-4793-9979-cbd7d4b2bfc4\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"base\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"base::module-0\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02561381-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : null,\r\n\t\t\t\t\t\t\"modelVersion\" : \"1\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_51baae4c-b7c7-4f57-b77e-6e01acca89e5\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"module-0\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : false\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\t\"modelInfo\" : { \r\n\t\t\t\t\t\t\"modelName\" : \"vSAMP10a::PCM::module-1\",\r\n\t\t\t\t\t\t\"modelUuid\" : \"02560f1b-4223-11e7-9252-005056850d2e\",\r\n\t\t\t\t\t\t\"modelInvariantUuid\" : null,\r\n\t\t\t\t\t\t\"modelVersion\" : \"1\",\r\n\t\t\t\t\t\t\"modelCustomizationUuid\" : \"MIGRATED_e9be2ed7-45b6-479c-b06e-9093899f8ce8\"\r\n\t\t\t\t\t},\t\t\"isBase\" : true,\r\n\t\t\t\t\t\"vfModuleLabel\" : \"PCM\",\r\n\t\t\t\t\t\"initialCount\" : 1,\r\n\t\t\t\t\t\"hasVolumeGroup\" : true\r\n\t\t\t\t}\r\n\t\t\t]\r\n\t\t}\r\n\t],\r\n\t\"serviceNetworks\": [],\r\n\t\"serviceAllottedResources\": [\r\n\t\t{\r\n\t\t\t\"modelInfo\" : {\r\n\t\t\t\t\"modelName\" : \"Tunnel_Xconn\",\r\n\t\t\t\t\"modelUuid\" : \"f6b7d4c6-e8a4-46e2-81bc-31cad5072842\",\r\n\t\t\t\t\"modelInvariantUuid\" : \"b7a1b78e-6b6b-4b36-9698-8c9530da14af\",\r\n\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"5b9bee43-f537-4fb3-9e8b-4de9f714d28a\",\r\n\t\t\t\t\"modelInstanceName\" : \"Pri_Tunnel_Xconn 9\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\" : null,\r\n\t\t\t\"allottedResourceType\" : null,\r\n\t\t\t\"allottedResourceRole\" : null,\r\n\t\t\t\"providingServiceModelInvariantUuid\" : null,\r\n\t\t\t\"nfFunction\" : null,\r\n\t\t\t\"nfType\" : null,\r\n\t\t\t\"nfRole\" : null,\r\n\t\t\t\"nfNamingCode\" : null\r\n\t\t}\r\n\t],\r\n\t\"serviceConfigs\": [\r\n\t\t{\r\n\t\t\t\"modelInfo\" : {\r\n\t\t\t\t\"modelName\" : \"Mulder\",\r\n\t\t\t\t\"modelUuid\" : \"025606c1-4fff-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInvariantUuid\" : \"025606c1-4eee-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"025606c1-4ddd-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInstanceName\" : \"X_FILES_001\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\" : \"Scully\"\r\n\t\t},\r\n\t\t{\r\n\t\t\t\"modelInfo\" : {\r\n\t\t\t\t\"modelName\" : \"Krychuk\",\r\n\t\t\t\t\"modelUuid\" : \"025606c1-5fff-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInvariantUuid\" : \"025606c1-5eee-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelVersion\" : \"1.0\",\r\n\t\t\t\t\"modelCustomizationUuid\" : \"025606c1-5ddd-11e7-9252-005056850d2e\",\r\n\t\t\t\t\"modelInstanceName\" : \"X_FILES_002\"\r\n\t\t\t},\r\n\t\t\t\"toscaNodeType\" : \"Skinner\"\r\n\t\t}\r\n\t]\r\n\t}}\r\n\r\n" String sliceProfile = "{\r\n \"snssaiList\": [ \r\n \"001-100001\"\r\n ],\r\n \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n \"plmnIdList\": [\r\n \"460-00\",\r\n \"460-01\"\r\n ],\r\n \"perfReq\": {\r\n \"perfReqEmbbList \": [\r\n {\r\n \"activityFactor\": 50\r\n }\r\n ]\r\n },\r\n \"maxNumberofUEs\": 200, \r\n \"coverageAreaTAList\": [ \r\n \"1\",\r\n \"2\",\r\n \"3\",\r\n \"4\"\r\n ],\r\n \"latency\": 2,\r\n \"resourceSharingLevel\": \"non-shared\" \r\n }" @@ -125,7 +127,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(snssaiList) String returnedJsonAsString= allocate.prepareVnfInstanceParamsJson(mockExecution) - String expectedJsonAsString = """{supportedNssai={"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}}""" + String expectedJsonAsString = """{"sNssai":[{"snssai":"01-5C83F071","status":"activated"},{"snssai":"01-5B179BD4","status":"activated"}]}""" assertEquals(expectedJsonAsString, returnedJsonAsString) } @@ -137,6 +139,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { DoAllocateCoreSharedSlice obj = spy(DoAllocateCoreSharedSlice.class) when(obj.getAAIClient()).thenReturn(client) + AAIResourceUri resourceUri1 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")) when(client.exists(resourceUri1)).thenReturn(true) AAIResultWrapper wrapper1 = new AAIResultWrapper(mockQuerySliceServiceReturn()) @@ -149,15 +152,14 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { when(client.exists(resourceUri2)).thenReturn(true) AAIResultWrapper wrapper2 = new AAIResultWrapper(mockQueryNS()) when(client.get(resourceUri2, NotFoundException.class)).thenReturn(wrapper2) - //Check Vnf when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912") - AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf("eeb66c6f-36bd-47ad-8294-48f46b1aa912")) + + AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(mockExecution.getVariable("vnfId"))) when(client.exists(resourceUri3)).thenReturn(true) AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf()) when(client.get(resourceUri3, NotFoundException.class)).thenReturn(wrapper3) - //Allotted Resources-1 AAIResourceUri resourceUri4 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer("5GCustomer").serviceSubscription("5G").serviceInstance("0d3d3cce-46a8-486d-816a-954e71697c4e")) when(client.exists(resourceUri4)).thenReturn(true) @@ -185,22 +187,19 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { Mockito.verify(mockExecution, times(1)).setVariable(eq("owningEntityId"), captor.capture()) assertEquals("OE-generic", captor.getValue()) - //assertEquals("206535e7-77c9-4036-9387-3f1cf57b4379", captor.getValue()) - //VnfId Mockito.verify(mockExecution, times(1)).setVariable(eq("vnfId"), captor.capture()) assertEquals("eeb66c6f-36bd-47ad-8294-48f46b1aa912", captor.getValue()) - // Mockito.verify(mockExecution, times(1)).setVariable(eq("snssaiAndOrchStatusList"), captor.capture()) List<Map<String, Object>> snssaiList = new ArrayList<>() Map<String, Object> snssaiMap = new LinkedHashMap<>() snssaiMap.put("snssai", "01-5C83F071") - snssaiMap.put("orchestrationStatus", "activated") + snssaiMap.put("status", "activated") snssaiList.add(snssaiMap) Map<String, Object> snssaiMap1 = new LinkedHashMap<>() snssaiMap1.put("snssai", "01-5B179BD4") - snssaiMap1.put("orchestrationStatus", "activated") + snssaiMap1.put("status", "activated") snssaiList.add(snssaiMap1) assertEquals(snssaiList, captor.getValue()) @@ -237,6 +236,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest { when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be") when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX") + when(mockExecution.getVariable("nssiId")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX") when(mockExecution.getVariable("nsiId")).thenReturn("NSI-M-001-HDBNJ-NSMF-01-A-ZX") when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G") diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn index cd4cf473a6..af89197057 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn @@ -2,25 +2,12 @@ <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_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:error id="Error_0l3pcnc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn:error id="Error_1eyu7sx" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmn:collaboration id="Collaboration_0htncd8"> - <bpmn:participant id="ActivateSliceService01" name="ActivateSliceService" processRef="ActivateSliceService" /> - </bpmn:collaboration> + <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" /> <bpmn:process id="ActivateSliceService" name="ActivateSliceService" isExecutable="true"> - <bpmn:scriptTask id="Task_1vscxgp" name="Update the status of SNSSAI and NSI and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1jp9gjt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1gkpl5q</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0cbth6k" name="Prepare Completion Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1gkpl5q</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pzts4p</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new ActivateSliceService() -csi.prepareCompletionRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1aymwlt" name="Update Service Operation Status to Success"> + <bpmn:startEvent id="StartEvent_01bdhbw" name="start"> + <bpmn:outgoing>SequenceFlow_1tdecf1</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="ServiceTask_1hmtmeq" name="Update Service Operation Status"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -28,7 +15,7 @@ csi.prepareCompletionRequest(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> @@ -39,65 +26,95 @@ csi.prepareCompletionRequest(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0pzts4p</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ozefu5</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1ox6oh6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0szxmyf</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="EndEvent_0d1g3mv"> - <bpmn:incoming>SequenceFlow_0r611x8</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0ozefu5</bpmn:incoming> - </bpmn:endEvent> - <bpmn:endEvent id="EndEvent_1pujgw8"> - <bpmn:incoming>SequenceFlow_1qa8miv</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_17jklyl" errorRef="Error_1eyu7sx" /> - </bpmn:endEvent> - <bpmn:exclusiveGateway id="ExclusiveGateway_0z7s0nx" name="IsSuccessfull"> - <bpmn:incoming>SequenceFlow_00ba5l9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jp9gjt</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1qa8miv</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:callActivity id="CallActivity_1cvb0iq" name="Send command NSSMF" calledElement="DoSendCommandToNSSMF"> - <bpmn:extensionElements> - <camunda:in source="nssiMap" target="nssiMap" /> - <camunda:in source="operationType" target="operationType" /> - <camunda:in source="NSIserviceid" target="NSIserviceid" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="isNSSIActivate" target="isNSSIActivate" /> - <camunda:in source="snssai" target="snssai" /> - <camunda:in source="e2eserviceInstanceId" target="e2eserviceInstanceId" /> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="activationCount" target="activationCount" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1o4zjvp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00ba5l9</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_04p0zjj" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1yus0c1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1uqgdxr</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_1wow08q" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1tdecf1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0bvnci8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1730kjg" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0bvnci8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ox6oh6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1tdecf1" sourceRef="StartEvent_01bdhbw" targetRef="ScriptTask_1wow08q" /> + <bpmn:sequenceFlow id="SequenceFlow_0bvnci8" sourceRef="ScriptTask_1wow08q" targetRef="ScriptTask_1730kjg" /> + <bpmn:sequenceFlow id="SequenceFlow_1ox6oh6" sourceRef="ScriptTask_1730kjg" targetRef="ServiceTask_1hmtmeq" /> + <bpmn:scriptTask id="ScriptTask_1gm0rl4" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0szxmyf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1p778c2</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new ActivateSliceService() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1o8fe1v" name="check AAI Orch Status of slice" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1uqgdxr</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_149lhmo</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0szxmyf" sourceRef="ServiceTask_1hmtmeq" targetRef="ScriptTask_1gm0rl4" /> + <bpmn:scriptTask id="ScriptTask_1yc7wdf" name="check AAI Orch Status of e2e slice" default="SequenceFlow_0mr8oz6" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1p778c2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wrrg4v</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0mr8oz6</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() -csi.checkAAIOrchStatusofslice(execution)</bpmn:script> +csi.checkAAIOrchStatusOfE2ESlice(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0fcc3uy" name="Success?"> - <bpmn:incoming>SequenceFlow_149lhmo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15fdf5d</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0r611x8</bpmn:outgoing> + <bpmn:exclusiveGateway id="ExclusiveGateway_0nce7pi" name="Success?"> + <bpmn:incoming>SequenceFlow_19gpkz7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cn6n0t</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0cs78yf</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:scriptTask id="Task_08zavab" name="PrepareActiviation" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_15fdf5d</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_144cqr9</bpmn:outgoing> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_08yipcf" name="goto prepare active"> + <bpmn:incoming>SequenceFlow_0cn6n0t</bpmn:incoming> + <bpmn:linkEventDefinition name="prepareActive" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_0cn6n0t" name="yes" sourceRef="ExclusiveGateway_0nce7pi" targetRef="IntermediateThrowEvent_08yipcf"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0916zkl" name="PrepareActiviation" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_003ne6w</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1b7nvps</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() csi.prepareActivation(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="Task_18urz3r" name="Update Service Operation Status"> + <bpmn:endEvent id="EndEvent_0bvm36p"> + <bpmn:incoming>SequenceFlow_1pgjdeq</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1jpik0g" errorRef="Error_0l3pcnc" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_003ne6w" sourceRef="IntermediateThrowEvent_0m13l1h" targetRef="ScriptTask_0916zkl" /> + <bpmn:callActivity id="CallActivity_06ommam" name="DoActivateSliceService" default="SequenceFlow_1pgjdeq" calledElement="DoActivateSliceService"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isNSSIActivate" target="isNSSIActivate" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="nssInstances" target="nssInstances" /> + <camunda:out source="nssInstances" target="nssInstances" /> + <camunda:in source="customerInfo" target="customerInfo" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1b7nvps</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1rsr0hp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pgjdeq</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_150j97l</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0x0emke" name="Update the status of SNSSAI and NSI " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_194fylv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0eiek58</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0032ffo" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0eiek58</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dc8i0s</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.prepareCompletionRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_06tcv65" name="Update Service Operation Status to Success"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -105,7 +122,7 @@ csi.prepareActivation(execution)</bpmn:script> <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:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> @@ -116,256 +133,275 @@ csi.prepareActivation(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1av6du3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1yus0c1</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0dc8i0s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11u2ido</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="Task_1ossedo" name="Pre Process Incoming Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0qksr1g</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_183ypky</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1g8cg9g" name="Any NSSI to activate?"> - <bpmn:incoming>SequenceFlow_144cqr9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1o4zjvp</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1pj1j1o</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:startEvent id="StartEvent_1"> - <bpmn:outgoing>SequenceFlow_0qksr1g</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1taw2p9"> - <bpmn:incoming>SequenceFlow_1pj1j1o</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_03iwehr" errorRef="Error_0l3pcnc" /> + <bpmn:endEvent id="EndEvent_1uebh6a" name="end"> + <bpmn:incoming>SequenceFlow_11u2ido</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0cs78yf</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="Task_13zoo6a" name="Init Service Operation Status" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_183ypky</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1av6du3</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.prepareInitServiceOperationStatus(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> - <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response"> - <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_11u2ido" sourceRef="ServiceTask_06tcv65" targetRef="EndEvent_1uebh6a" /> + <bpmn:subProcess id="SubProcess_1s80wtc" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_0pv8gip" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_16jz1l6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_097vxbl</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() csi.sendSyncError(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1wd8iqk"> - <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> + <bpmn:endEvent id="EndEvent_0yy0a8r"> + <bpmn:incoming>SequenceFlow_097vxbl</bpmn:incoming> </bpmn:endEvent> - <bpmn:startEvent id="StartEvent_0hmwdqq"> - <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> + <bpmn:startEvent id="StartEvent_1a9lxvc"> + <bpmn:outgoing>SequenceFlow_16jz1l6</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_00r6zey" /> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> - <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> + <bpmn:sequenceFlow id="SequenceFlow_097vxbl" sourceRef="ScriptTask_0pv8gip" targetRef="EndEvent_0yy0a8r" /> + <bpmn:sequenceFlow id="SequenceFlow_16jz1l6" sourceRef="StartEvent_1a9lxvc" targetRef="ScriptTask_0pv8gip" /> </bpmn:subProcess> - <bpmn:sequenceFlow id="SequenceFlow_1av6du3" sourceRef="Task_13zoo6a" targetRef="Task_18urz3r" /> - <bpmn:sequenceFlow id="SequenceFlow_1pj1j1o" name="no" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="EndEvent_1taw2p9"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0r611x8" name="NO" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="EndEvent_0d1g3mv"> + <bpmn:sequenceFlow id="SequenceFlow_0eiek58" sourceRef="ScriptTask_0x0emke" targetRef="ScriptTask_0032ffo" /> + <bpmn:sequenceFlow id="SequenceFlow_0dc8i0s" sourceRef="ScriptTask_0032ffo" targetRef="ServiceTask_06tcv65" /> + <bpmn:sequenceFlow id="SequenceFlow_0cs78yf" name="no" sourceRef="ExclusiveGateway_0nce7pi" targetRef="EndEvent_1uebh6a"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "false"}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1qa8miv" name="no" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="EndEvent_1pujgw8"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1jp9gjt" name="yes" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="Task_1vscxgp"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0m13l1h" name="prepareActive"> + <bpmn:outgoing>SequenceFlow_003ne6w</bpmn:outgoing> + <bpmn:linkEventDefinition name="prepareActive" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="ScriptTask_1oa27ir" name="check AAI Orch Status of NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1wrrg4v</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ny9zkw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusOfAllocates(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1wrrg4v" name="continue" sourceRef="ScriptTask_1yc7wdf" targetRef="ScriptTask_1oa27ir"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == true}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_00ba5l9" sourceRef="CallActivity_1cvb0iq" targetRef="ExclusiveGateway_0z7s0nx" /> - <bpmn:sequenceFlow id="SequenceFlow_1uqgdxr" sourceRef="ScriptTask_04p0zjj" targetRef="Task_1o8fe1v" /> - <bpmn:sequenceFlow id="SequenceFlow_0qksr1g" sourceRef="StartEvent_1" targetRef="Task_1ossedo" /> - <bpmn:sequenceFlow id="SequenceFlow_183ypky" sourceRef="Task_1ossedo" targetRef="Task_13zoo6a" /> - <bpmn:sequenceFlow id="SequenceFlow_1yus0c1" sourceRef="Task_18urz3r" targetRef="ScriptTask_04p0zjj" /> - <bpmn:sequenceFlow id="SequenceFlow_149lhmo" sourceRef="Task_1o8fe1v" targetRef="ExclusiveGateway_0fcc3uy" /> - <bpmn:sequenceFlow id="SequenceFlow_15fdf5d" name="yes" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="Task_08zavab"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression> + <bpmn:endEvent id="EndEvent_0n9enas" name="already operate so end"> + <bpmn:incoming>SequenceFlow_0mr8oz6</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mr8oz6" sourceRef="ScriptTask_1yc7wdf" targetRef="EndEvent_0n9enas" /> + <bpmn:sequenceFlow id="SequenceFlow_1ny9zkw" sourceRef="ScriptTask_1oa27ir" targetRef="Task_14srbts" /> + <bpmn:sequenceFlow id="SequenceFlow_19gpkz7" sourceRef="Task_14srbts" targetRef="ExclusiveGateway_0nce7pi" /> + <bpmn:scriptTask id="Task_14srbts" name="check AAI Orch Status of NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ny9zkw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19gpkz7</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusOfNSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1b7nvps" sourceRef="ScriptTask_0916zkl" targetRef="CallActivity_06ommam" /> + <bpmn:sequenceFlow id="SequenceFlow_1pgjdeq" sourceRef="CallActivity_06ommam" targetRef="EndEvent_0bvm36p" /> + <bpmn:sequenceFlow id="SequenceFlow_150j97l" sourceRef="CallActivity_06ommam" targetRef="Task_0gu3dv6"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_144cqr9" sourceRef="Task_08zavab" targetRef="ExclusiveGateway_1g8cg9g" /> - <bpmn:sequenceFlow id="SequenceFlow_1o4zjvp" name="yes" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="CallActivity_1cvb0iq"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + <bpmn:sequenceFlow id="SequenceFlow_194fylv" sourceRef="Task_0gu3dv6" targetRef="ScriptTask_0x0emke"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isOperationFinished") == "true"}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1gkpl5q" sourceRef="Task_1vscxgp" targetRef="ScriptTask_0cbth6k" /> - <bpmn:sequenceFlow id="SequenceFlow_0pzts4p" sourceRef="ScriptTask_0cbth6k" targetRef="ServiceTask_1aymwlt" /> - <bpmn:sequenceFlow id="SequenceFlow_0ozefu5" sourceRef="ServiceTask_1aymwlt" targetRef="EndEvent_0d1g3mv" /> + <bpmn:sequenceFlow id="SequenceFlow_1rsr0hp" sourceRef="Task_0gu3dv6" targetRef="CallActivity_06ommam" /> + <bpmn:scriptTask id="Task_0gu3dv6" name="isOperationFinished " default="SequenceFlow_1rsr0hp" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_150j97l</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_194fylv</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1rsr0hp</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.isOperationFinished(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1p778c2" sourceRef="ScriptTask_1gm0rl4" targetRef="ScriptTask_1yc7wdf" /> </bpmn:process> - <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> - <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="ActivateSliceService01" isHorizontal="true"> - <dc:Bounds x="160" y="120" width="2290" height="990" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_1qw5nm4_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> - <dc:Bounds x="935" y="680" width="810" height="180" /> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSliceService"> + <bpmndi:BPMNShape id="StartEvent_01bdhbw_di" bpmnElement="StartEvent_01bdhbw"> + <dc:Bounds x="172" y="72" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="115" width="23" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1azew71_di" bpmnElement="Task_01ooik6"> - <dc:Bounds x="1255" y="720" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_1hmtmeq_di" bpmnElement="ServiceTask_1hmtmeq"> + <dc:Bounds x="550" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> - <dc:Bounds x="1492" y="742" width="36" height="36" /> + <bpmndi:BPMNShape id="ScriptTask_1wow08q_di" bpmnElement="ScriptTask_1wow08q"> + <dc:Bounds x="250" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> - <dc:Bounds x="1042" y="742" width="36" height="36" /> + <bpmndi:BPMNShape id="ScriptTask_1730kjg_di" bpmnElement="ScriptTask_1730kjg"> + <dc:Bounds x="390" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> - <di:waypoint x="1078" y="760" /> - <di:waypoint x="1255" y="760" /> + <bpmndi:BPMNEdge id="SequenceFlow_1tdecf1_di" bpmnElement="SequenceFlow_1tdecf1"> + <di:waypoint x="208" y="90" /> + <di:waypoint x="250" y="90" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> - <di:waypoint x="1355" y="760" /> - <di:waypoint x="1492" y="760" /> + <bpmndi:BPMNEdge id="SequenceFlow_0bvnci8_di" bpmnElement="SequenceFlow_0bvnci8"> + <di:waypoint x="350" y="90" /> + <di:waypoint x="390" y="90" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1lb7w6u_di" bpmnElement="Task_1vscxgp"> - <dc:Bounds x="1670" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> - <dc:Bounds x="2212" y="332" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1pujgw8_di" bpmnElement="EndEvent_1pujgw8"> - <dc:Bounds x="1462" y="422" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ox6oh6_di" bpmnElement="SequenceFlow_1ox6oh6"> + <di:waypoint x="490" y="90" /> + <di:waypoint x="550" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1gm0rl4_di" bpmnElement="ScriptTask_1gm0rl4"> + <dc:Bounds x="690" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0cbth6k_di" bpmnElement="ScriptTask_0cbth6k"> - <dc:Bounds x="1860" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0szxmyf_di" bpmnElement="SequenceFlow_0szxmyf"> + <di:waypoint x="650" y="90" /> + <di:waypoint x="690" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1yc7wdf_di" bpmnElement="ScriptTask_1yc7wdf"> + <dc:Bounds x="840" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0z7s0nx_di" bpmnElement="ExclusiveGateway_0z7s0nx" isMarkerVisible="true"> - <dc:Bounds x="1455" y="325" width="50" height="50" /> + <bpmndi:BPMNShape id="ExclusiveGateway_0nce7pi_di" bpmnElement="ExclusiveGateway_0nce7pi" isMarkerVisible="true"> + <dc:Bounds x="1315" y="65" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1449" y="313" width="65" height="14" /> + <dc:Bounds x="1347" y="55" width="48" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1cvb0iq_di" bpmnElement="CallActivity_1cvb0iq"> - <dc:Bounds x="1290" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_04p0zjj_di" bpmnElement="ScriptTask_04p0zjj"> - <dc:Bounds x="695" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1nsbn4r_di" bpmnElement="Task_1o8fe1v"> - <dc:Bounds x="850" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_10d4tak_di" bpmnElement="IntermediateThrowEvent_08yipcf"> + <dc:Bounds x="1432" y="72" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1422" y="115" width="63" height="27" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0fcc3uy_di" bpmnElement="ExclusiveGateway_0fcc3uy" isMarkerVisible="true"> - <dc:Bounds x="975" y="325" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_0cn6n0t_di" bpmnElement="SequenceFlow_0cn6n0t"> + <di:waypoint x="1365" y="90" /> + <di:waypoint x="1432" y="90" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1006" y="315" width="49" height="14" /> + <dc:Bounds x="1390" y="72" width="17" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0916zkl_di" bpmnElement="ScriptTask_0916zkl"> + <dc:Bounds x="250" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0g9vipz_di" bpmnElement="Task_08zavab"> - <dc:Bounds x="1060" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="EndEvent_0bvm36p_di" bpmnElement="EndEvent_0bvm36p"> + <dc:Bounds x="522" y="532" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1tv1ow6_di" bpmnElement="Task_18urz3r"> - <dc:Bounds x="540" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_003ne6w_di" bpmnElement="SequenceFlow_003ne6w"> + <di:waypoint x="208" y="430" /> + <di:waypoint x="250" y="430" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_06ommam_di" bpmnElement="CallActivity_06ommam"> + <dc:Bounds x="490" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0tam79l_di" bpmnElement="Task_1ossedo"> - <dc:Bounds x="290" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0x0emke_di" bpmnElement="ScriptTask_0x0emke"> + <dc:Bounds x="920" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1g8cg9g_di" bpmnElement="ExclusiveGateway_1g8cg9g" isMarkerVisible="true"> - <dc:Bounds x="1195" y="325" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1141" y="406" width="58" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ScriptTask_0032ffo_di" bpmnElement="ScriptTask_0032ffo"> + <dc:Bounds x="1120" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="212" y="332" width="36" height="36" /> + <bpmndi:BPMNShape id="ServiceTask_06tcv65_di" bpmnElement="ServiceTask_06tcv65"> + <dc:Bounds x="1270" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1o4zjvp_di" bpmnElement="SequenceFlow_1o4zjvp"> - <di:waypoint x="1220" y="350" /> - <di:waypoint x="1290" y="350" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1251" y="332" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_144cqr9_di" bpmnElement="SequenceFlow_144cqr9"> - <di:waypoint x="1160" y="350" /> - <di:waypoint x="1195" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_15fdf5d_di" bpmnElement="SequenceFlow_15fdf5d"> - <di:waypoint x="1025" y="350" /> - <di:waypoint x="1060" y="350" /> + <bpmndi:BPMNShape id="EndEvent_1uebh6a_di" bpmnElement="EndEvent_1uebh6a"> + <dc:Bounds x="1422" y="412" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1034" y="332" width="18" height="14" /> + <dc:Bounds x="1431" y="455" width="19" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11u2ido_di" bpmnElement="SequenceFlow_11u2ido"> + <di:waypoint x="1370" y="430" /> + <di:waypoint x="1422" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_149lhmo_di" bpmnElement="SequenceFlow_149lhmo"> - <di:waypoint x="950" y="350" /> - <di:waypoint x="975" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1yus0c1_di" bpmnElement="SequenceFlow_1yus0c1"> - <di:waypoint x="640" y="350" /> - <di:waypoint x="695" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_183ypky_di" bpmnElement="SequenceFlow_183ypky"> - <di:waypoint x="390" y="350" /> - <di:waypoint x="420" y="350" /> + <bpmndi:BPMNShape id="SubProcess_1s80wtc_di" bpmnElement="SubProcess_1s80wtc" isExpanded="true"> + <dc:Bounds x="410" y="700" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0pv8gip_di" bpmnElement="ScriptTask_0pv8gip"> + <dc:Bounds x="730" y="740" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0yy0a8r_di" bpmnElement="EndEvent_0yy0a8r"> + <dc:Bounds x="967" y="762" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1a9lxvc_di" bpmnElement="StartEvent_1a9lxvc"> + <dc:Bounds x="517" y="762" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_097vxbl_di" bpmnElement="SequenceFlow_097vxbl"> + <di:waypoint x="830" y="780" /> + <di:waypoint x="967" y="780" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0qksr1g_di" bpmnElement="SequenceFlow_0qksr1g"> - <di:waypoint x="248" y="350" /> - <di:waypoint x="290" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_16jz1l6_di" bpmnElement="SequenceFlow_16jz1l6"> + <di:waypoint x="553" y="780" /> + <di:waypoint x="730" y="780" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1uqgdxr_di" bpmnElement="SequenceFlow_1uqgdxr"> - <di:waypoint x="795" y="350" /> - <di:waypoint x="850" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0eiek58_di" bpmnElement="SequenceFlow_0eiek58"> + <di:waypoint x="1020" y="430" /> + <di:waypoint x="1120" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00ba5l9_di" bpmnElement="SequenceFlow_00ba5l9"> - <di:waypoint x="1390" y="350" /> - <di:waypoint x="1455" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0dc8i0s_di" bpmnElement="SequenceFlow_0dc8i0s"> + <di:waypoint x="1220" y="430" /> + <di:waypoint x="1270" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1jp9gjt_di" bpmnElement="SequenceFlow_1jp9gjt"> - <di:waypoint x="1505" y="350" /> - <di:waypoint x="1670" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0cs78yf_di" bpmnElement="SequenceFlow_0cs78yf"> + <di:waypoint x="1340" y="115" /> + <di:waypoint x="1340" y="170" /> + <di:waypoint x="1440" y="170" /> + <di:waypoint x="1440" y="412" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1596" y="332" width="18" height="14" /> + <dc:Bounds x="1384" y="152" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qa8miv_di" bpmnElement="SequenceFlow_1qa8miv"> - <di:waypoint x="1480" y="375" /> - <di:waypoint x="1480" y="422" /> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1vye481_di" bpmnElement="IntermediateThrowEvent_0m13l1h"> + <dc:Bounds x="172" y="412" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1489" y="383" width="12" height="14" /> + <dc:Bounds x="156" y="455" width="68" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0r611x8_di" bpmnElement="SequenceFlow_0r611x8"> - <di:waypoint x="1000" y="375" /> - <di:waypoint x="1000" y="500" /> - <di:waypoint x="2230" y="500" /> - <di:waypoint x="2230" y="368" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1oa27ir_di" bpmnElement="ScriptTask_1oa27ir"> + <dc:Bounds x="1000" y="50" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1wrrg4v_di" bpmnElement="SequenceFlow_1wrrg4v"> + <di:waypoint x="940" y="90" /> + <di:waypoint x="1000" y="90" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1608" y="482" width="15" height="14" /> + <dc:Bounds x="950" y="72" width="42" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1pj1j1o_di" bpmnElement="SequenceFlow_1pj1j1o"> - <di:waypoint x="1220" y="375" /> - <di:waypoint x="1220" y="422" /> + <bpmndi:BPMNShape id="EndEvent_0n9enas_di" bpmnElement="EndEvent_0n9enas"> + <dc:Bounds x="872" y="182" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1199" y="378" width="12" height="14" /> + <dc:Bounds x="855" y="225" width="77" height="27" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1taw2p9_di" bpmnElement="EndEvent_1taw2p9"> - <dc:Bounds x="1202" y="422" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0uwsu46_di" bpmnElement="Task_13zoo6a"> - <dc:Bounds x="420" y="310" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1av6du3_di" bpmnElement="SequenceFlow_1av6du3"> - <di:waypoint x="520" y="350" /> - <di:waypoint x="540" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0mr8oz6_di" bpmnElement="SequenceFlow_0mr8oz6"> + <di:waypoint x="890" y="130" /> + <di:waypoint x="890" y="182" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1aymwlt_di" bpmnElement="ServiceTask_1aymwlt"> - <dc:Bounds x="2020" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ny9zkw_di" bpmnElement="SequenceFlow_1ny9zkw"> + <di:waypoint x="1100" y="90" /> + <di:waypoint x="1170" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19gpkz7_di" bpmnElement="SequenceFlow_19gpkz7"> + <di:waypoint x="1270" y="90" /> + <di:waypoint x="1315" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0tmggtr_di" bpmnElement="Task_14srbts"> + <dc:Bounds x="1170" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ozefu5_di" bpmnElement="SequenceFlow_0ozefu5"> - <di:waypoint x="2120" y="350" /> - <di:waypoint x="2212" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_1b7nvps_di" bpmnElement="SequenceFlow_1b7nvps"> + <di:waypoint x="350" y="430" /> + <di:waypoint x="490" y="430" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pgjdeq_di" bpmnElement="SequenceFlow_1pgjdeq"> + <di:waypoint x="540" y="470" /> + <di:waypoint x="540" y="532" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0pzts4p_di" bpmnElement="SequenceFlow_0pzts4p"> - <di:waypoint x="1960" y="350" /> - <di:waypoint x="2020" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_150j97l_di" bpmnElement="SequenceFlow_150j97l"> + <di:waypoint x="590" y="430" /> + <di:waypoint x="710" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1gkpl5q_di" bpmnElement="SequenceFlow_1gkpl5q"> - <di:waypoint x="1770" y="350" /> - <di:waypoint x="1860" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_194fylv_di" bpmnElement="SequenceFlow_194fylv"> + <di:waypoint x="810" y="430" /> + <di:waypoint x="920" y="430" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rsr0hp_di" bpmnElement="SequenceFlow_1rsr0hp"> + <di:waypoint x="760" y="390" /> + <di:waypoint x="760" y="300" /> + <di:waypoint x="540" y="300" /> + <di:waypoint x="540" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0i2gnhv_di" bpmnElement="Task_0gu3dv6"> + <dc:Bounds x="710" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1p778c2_di" bpmnElement="SequenceFlow_1p778c2"> + <di:waypoint x="790" y="90" /> + <di:waypoint x="840" y="90" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn index a632266c2e..04bab09491 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateCommunicationService.bpmn @@ -145,7 +145,7 @@ csi.createCSAndSSRelationship(execution)</bpmn:script> <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> <camunda:in source="csInputMap" target="csInputMap" /> <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> - <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="csServiceType" target="csServiceType" /> <camunda:in source="uuiRequest" target="uuiRequest" /> <camunda:in source="modelInvariantUuid" target="modelInvariantUuid" /> <camunda:in source="modelUuid" target="modelUuid" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn index 1a9281f7d9..290e13d05c 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn @@ -34,7 +34,6 @@ css.processUserOptions(execution)</bpmn:script> <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> - <camunda:in source="serviceType" target="serviceType" /> <camunda:in source="uuiRequest" target="uuiRequest" /> <camunda:in source="operationId" target="operationId" /> <camunda:out source="WorkflowException" target="WorkflowException" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn index 36f6221da9..d46b5856d1 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" 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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.4.0"> <bpmn:process id="GenericPnfHealthCheck" name="GenericPnfHealthCheck" isExecutable="true"> <bpmn:startEvent id="pnfHealthCheck_startEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing> @@ -42,6 +42,7 @@ taskProcessor.prepareCompletion(execution)</bpmn:script> <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess"> <bpmn:extensionElements> <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="requestId" target="CMSO_request_id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn index 6a0b260a70..8c667a291b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSWUPDownload.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_0474hns" 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" id="Definitions_0474hns" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.4.0"> <bpmn:process id="GenericPnfSWUPDownload" name="GenericPnfSWUPDownload" isExecutable="true"> <bpmn:startEvent id="download_StartEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1fdclh0</bpmn:outgoing> @@ -131,6 +131,7 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> <bpmn:callActivity id="CallActivity_0tq2dug" name="Complete Process" calledElement="CompleteMsoProcess"> <bpmn:extensionElements> <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="requestId" target="CMSO_request_id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_183s0wo</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mjjdia</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn index 9b8ce4a7b7..0303d7d1d5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfSoftwareUpgrade.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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" 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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.4.0"> <bpmn:process id="GenericPnfSoftwareUpgrade" name="GenericPnfSoftwareUpgrade" isExecutable="true"> <bpmn:startEvent id="softwareUpgrade_startEvent" name="Start Flow"> <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing> @@ -138,6 +138,7 @@ pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess"> <bpmn:extensionElements> <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="requestId" target="CMSO_request_id" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn index 8ff1a1efec..a48278e19f 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ServiceLevelUpgrade.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_1k6npmy" 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" id="Definitions_1k6npmy" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.4.0"> <bpmn:process id="ServiceLevelUpgrade" name="ServiceLevelUpgrade" isExecutable="true"> <bpmn:startEvent id="Event_02mc8tr"> <bpmn:outgoing>Flow_0nrz340</bpmn:outgoing> @@ -54,13 +54,16 @@ <bpmn:outgoing>Flow_1ptk2a3</bpmn:outgoing> </bpmn:serviceTask> <bpmn:scriptTask id="Activity_1n4rk7m" name="Prepare Completion" scriptFormat="groovy"> - <bpmn:incoming>Flow_0l67uzl</bpmn:incoming> + <bpmn:incoming>Flow_05aa7gj</bpmn:incoming> <bpmn:outgoing>Flow_0frhsd0</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def pnfSwUpgrade = new GenericPnfSoftwareUpgrade() -pnfSwUpgrade.prepareCompletion(execution)</bpmn:script> +def serviceLevelUpgrade = new ServiceLevelUpgrade() +serviceLevelUpgrade.prepareCompletion(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="Activity_1lz38px" name="Complete Process" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="requestId" target="CMSO_request_id" /> + </bpmn:extensionElements> <bpmn:incoming>Flow_0frhsd0</bpmn:incoming> <bpmn:outgoing>Flow_10jgbxm</bpmn:outgoing> </bpmn:callActivity> @@ -100,7 +103,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1ru18s3" sourceRef="Activity_0ft7fa2" targetRef="Gateway_1vq11i7" /> <bpmn:sequenceFlow id="Flow_1tcnzdx" name="Failure" sourceRef="Gateway_1vq11i7" targetRef="Event_03tpudy" /> - <bpmn:sequenceFlow id="Flow_0l67uzl" name="Success" sourceRef="Gateway_1vq11i7" targetRef="Activity_1n4rk7m"> + <bpmn:sequenceFlow id="Flow_0l67uzl" name="Success" sourceRef="Gateway_1vq11i7" targetRef="Activity_0o2rrag"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_0frhsd0" sourceRef="Activity_1n4rk7m" targetRef="Activity_1lz38px" /> @@ -116,6 +119,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> <camunda:out source="ControllerStatus" target="ControllerStatus" /> <camunda:in source="isRollback" target="isRollback" /> <camunda:in source="pnfName" target="pnfName" /> + <camunda:in source="requestId" target="requestId" /> </bpmn:extensionElements> <bpmn:incoming>Flow_0rpnl02</bpmn:incoming> <bpmn:outgoing>Flow_0zjsp5x</bpmn:outgoing> @@ -129,6 +133,7 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> <camunda:out source="ControllerStatus" target="ControllerStatus" /> <camunda:in source="isRollback" target="isRollback" /> <camunda:in source="pnfName" target="pnfName" /> + <camunda:in source="requestId" target="requestId" /> </bpmn:extensionElements> <bpmn:incoming>Flow_0g6gkgx</bpmn:incoming> <bpmn:outgoing>Flow_1y3cptr</bpmn:outgoing> @@ -175,6 +180,14 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> <bpmn:incoming>Flow_19tmp99</bpmn:incoming> <bpmn:outgoing>Flow_0g6gkgx</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:scriptTask id="Activity_0o2rrag" name="Send Response" scriptFormat="groovy"> + <bpmn:incoming>Flow_0l67uzl</bpmn:incoming> + <bpmn:outgoing>Flow_05aa7gj</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def pnfSwUpgrade = new GenericPnfSoftwareUpgrade() +pnfSwUpgrade.sendResponse(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_05aa7gj" sourceRef="Activity_0o2rrag" targetRef="Activity_1n4rk7m" /> </bpmn:process> <bpmn:error id="Error_01a8p43" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn:error id="Error_0e5owqi" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -223,8 +236,8 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> <di:waypoint x="930" y="182" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ptk2a3_di" bpmnElement="Flow_1ptk2a3"> - <di:waypoint x="600" y="182" /> - <di:waypoint x="760" y="182" /> + <di:waypoint x="710" y="181" /> + <di:waypoint x="760" y="181" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0ny61qm_di" bpmnElement="Flow_0ny61qm"> <di:waypoint x="1140" y="346" /> @@ -263,11 +276,9 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0l67uzl_di" bpmnElement="Flow_0l67uzl"> <di:waypoint x="964" y="490" /> - <di:waypoint x="210" y="490" /> - <di:waypoint x="210" y="579" /> - <di:waypoint x="262" y="579" /> + <di:waypoint x="362" y="490" /> <bpmndi:BPMNLabel> - <dc:Bounds x="612" y="476" width="43" height="14" /> + <dc:Bounds x="637" y="476" width="43" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1tcnzdx_di" bpmnElement="Flow_1tcnzdx"> @@ -304,81 +315,69 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> <di:waypoint x="624" y="580" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1b392qs_di" bpmnElement="Flow_1b392qs"> - <di:waypoint x="362" y="182" /> - <di:waypoint x="500" y="182" /> + <di:waypoint x="536" y="182" /> + <di:waypoint x="610" y="182" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0nrz340_di" bpmnElement="Flow_0nrz340"> - <di:waypoint x="186" y="180" /> - <di:waypoint x="262" y="182" /> + <di:waypoint x="226" y="182" /> + <di:waypoint x="436" y="182" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Event_02mc8tr_di" bpmnElement="Event_02mc8tr"> - <dc:Bounds x="154" y="164" width="32" height="32" /> + <bpmndi:BPMNEdge id="Flow_05aa7gj_di" bpmnElement="Flow_05aa7gj"> + <di:waypoint x="262" y="490" /> + <di:waypoint x="210" y="490" /> + <di:waypoint x="210" y="579" /> + <di:waypoint x="262" y="579" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_12983th_di" bpmnElement="Event_12983th"> + <dc:Bounds x="624" y="565" width="32" height="32" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-6" y="-188" width="51" height="14" /> + <dc:Bounds x="-132" y="-188" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_18vue7u_di" bpmnElement="Activity_18vue7u"> - <dc:Bounds x="262" y="142" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_02fectw_di" bpmnElement="Gateway_02fectw" isMarkerVisible="true"> <dc:Bounds x="788" y="314" width="32" height="32" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0ldlupa_di" bpmnElement="Event_0ldlupa"> + <dc:Bounds x="788" y="414" width="32" height="32" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1nr51kr_di" bpmnElement="Gateway_1nr51kr" isMarkerVisible="true"> <dc:Bounds x="1124" y="166" width="32" height="32" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_16k9r1c_di" bpmnElement="Event_16k9r1c"> <dc:Bounds x="1284" y="166" width="32" height="32" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0snmatn_di" bpmnElement="Activity_0snmatn"> - <dc:Bounds x="262" y="290" width="100" height="80" /> + <bpmndi:BPMNShape id="Gateway_1vq11i7_di" bpmnElement="Gateway_1vq11i7" isMarkerVisible="true"> + <dc:Bounds x="964" y="474" width="32" height="32" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_09bqns0_di" bpmnElement="Activity_09bqns0"> - <dc:Bounds x="500" y="142" width="100" height="80" /> + <bpmndi:BPMNShape id="Event_03tpudy_di" bpmnElement="Event_03tpudy"> + <dc:Bounds x="964" y="554" width="32" height="32" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0ldlupa_di" bpmnElement="Event_0ldlupa"> - <dc:Bounds x="788" y="414" width="32" height="32" /> + <bpmndi:BPMNShape id="Activity_0snmatn_di" bpmnElement="Activity_0snmatn"> + <dc:Bounds x="262" y="290" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1lz38px_di" bpmnElement="Activity_1lz38px"> - <dc:Bounds x="450" y="539" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0ft7fa2_di" bpmnElement="Activity_0ft7fa2"> + <dc:Bounds x="1090" y="450" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1n4rk7m_di" bpmnElement="Activity_1n4rk7m"> <dc:Bounds x="262" y="539" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_12983th_di" bpmnElement="Event_12983th"> - <dc:Bounds x="624" y="565" width="32" height="32" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="-132" y="-188" width="20" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0n17xou_di" bpmnElement="Activity_0n17xou"> - <dc:Bounds x="930" y="142" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1q4o9fx_di" bpmnElement="Activity_1q4o9fx"> - <dc:Bounds x="590" y="290" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1hp67qz_di" bpmnElement="Activity_1hp67qz"> - <dc:Bounds x="930" y="290" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_18ch73t_di" bpmnElement="Gateway_18ch73t" isMarkerVisible="true"> - <dc:Bounds x="1124" y="314" width="32" height="32" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1fhov6x_di" bpmnElement="Event_1fhov6x"> - <dc:Bounds x="1124" y="404" width="32" height="32" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1bjlebw_di" bpmnElement="Activity_02vp5np"> - <dc:Bounds x="760" y="142" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_1lz38px_di" bpmnElement="Activity_1lz38px"> + <dc:Bounds x="450" y="539" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1knf0nl_di" bpmnElement="Activity_0e6w886"> - <dc:Bounds x="438" y="290" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_09bqns0_di" bpmnElement="Activity_09bqns0"> + <dc:Bounds x="610" y="140" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_03tpudy_di" bpmnElement="Event_03tpudy"> - <dc:Bounds x="964" y="554" width="32" height="32" /> + <bpmndi:BPMNShape id="Activity_0o2rrag_di" bpmnElement="Activity_0o2rrag"> + <dc:Bounds x="262" y="450" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0ft7fa2_di" bpmnElement="Activity_0ft7fa2"> - <dc:Bounds x="1090" y="450" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_18vue7u_di" bpmnElement="Activity_18vue7u"> + <dc:Bounds x="436" y="142" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1vq11i7_di" bpmnElement="Gateway_1vq11i7" isMarkerVisible="true"> - <dc:Bounds x="964" y="474" width="32" height="32" /> + <bpmndi:BPMNShape id="Event_02mc8tr_di" bpmnElement="Event_02mc8tr"> + <dc:Bounds x="194" y="166" width="32" height="32" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-6" y="-188" width="51" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0ui6tp1_di" bpmnElement="Activity_0ui6tp1" isExpanded="true"> <dc:Bounds x="362" y="810" width="650" height="190" /> @@ -413,6 +412,27 @@ pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script> <dc:Bounds x="-132" y="-188" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0n17xou_di" bpmnElement="Activity_0n17xou"> + <dc:Bounds x="930" y="142" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1q4o9fx_di" bpmnElement="Activity_1q4o9fx"> + <dc:Bounds x="590" y="290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1hp67qz_di" bpmnElement="Activity_1hp67qz"> + <dc:Bounds x="930" y="290" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_18ch73t_di" bpmnElement="Gateway_18ch73t" isMarkerVisible="true"> + <dc:Bounds x="1124" y="314" width="32" height="32" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1fhov6x_di" bpmnElement="Event_1fhov6x"> + <dc:Bounds x="1124" y="404" width="32" height="32" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1bjlebw_di" bpmnElement="Activity_02vp5np"> + <dc:Bounds x="760" y="142" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1knf0nl_di" bpmnElement="Activity_0e6w886"> + <dc:Bounds x="438" y="290" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn new file mode 100644 index 0000000000..ca231b3daf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn @@ -0,0 +1,211 @@ +<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:error id="Error_08p7hsc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:process id="DoActivateSliceService" name="DoActivateSliceService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_0s4ou5u" name="Start"> + <bpmn:outgoing>SequenceFlow_13fdjwf</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1774fcg" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13fdjwf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1lh6vpe</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_13fdjwf" sourceRef="StartEvent_0s4ou5u" targetRef="ScriptTask_1774fcg" /> + <bpmn:callActivity id="CallActivity_1ba0boc" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="nssInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1yqrli6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ru5d0h</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0vhhyt1" name="processDecomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ru5d0h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0so165e</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.processDecomposition(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_17x7ifp" name="SendCommandToNssmf" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0so165e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05wxhwm</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.sendCreateRequestNSSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ru5d0h" sourceRef="CallActivity_1ba0boc" targetRef="ScriptTask_0vhhyt1" /> + <bpmn:sequenceFlow id="SequenceFlow_0so165e" sourceRef="ScriptTask_0vhhyt1" targetRef="ScriptTask_17x7ifp" /> + <bpmn:sequenceFlow id="SequenceFlow_1lh6vpe" sourceRef="ScriptTask_1774fcg" targetRef="Task_0sjhszu" /> + <bpmn:sequenceFlow id="SequenceFlow_1yqrli6" sourceRef="Task_0sjhszu" targetRef="CallActivity_1ba0boc" /> + <bpmn:scriptTask id="Task_0sjhszu" name="Prepare Compose " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1lh6vpe</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yqrli6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.prepareCompose(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_00sf7s2" name="Query NSSI progress from adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0oa5clt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_05wxhwm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1herzai</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.queryNSSIStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0z3hxio" name="Completed" default="SequenceFlow_0btrzm8"> + <bpmn:incoming>SequenceFlow_1herzai</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0btrzm8</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1lvozh0</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_1mivpop" name="end"> + <bpmn:incoming>SequenceFlow_1lvozh0</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1lpgplr" name="Time delay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0btrzm8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0oa5clt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.timeDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0oa5clt" sourceRef="ScriptTask_1lpgplr" targetRef="ScriptTask_00sf7s2" /> + <bpmn:sequenceFlow id="SequenceFlow_1herzai" sourceRef="ScriptTask_00sf7s2" targetRef="ExclusiveGateway_0z3hxio" /> + <bpmn:sequenceFlow id="SequenceFlow_0btrzm8" name="false" sourceRef="ExclusiveGateway_0z3hxio" targetRef="ScriptTask_1lpgplr" /> + <bpmn:sequenceFlow id="SequenceFlow_1lvozh0" name="yes" sourceRef="ExclusiveGateway_0z3hxio" targetRef="EndEvent_1mivpop"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("jobFinished" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_05wxhwm" sourceRef="ScriptTask_17x7ifp" targetRef="ScriptTask_00sf7s2" /> + <bpmn:subProcess id="SubProcess_0bkr0v1" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0g7e26e"> + <bpmn:outgoing>SequenceFlow_0ca8iyv</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1cir65m" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_14z3xck"> + <bpmn:incoming>SequenceFlow_0aqapur</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1gitk4f" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ca8iyv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0aqapur</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0aqapur" sourceRef="ScriptTask_1gitk4f" targetRef="EndEvent_14z3xck" /> + <bpmn:sequenceFlow id="SequenceFlow_0ca8iyv" sourceRef="StartEvent_0g7e26e" targetRef="ScriptTask_1gitk4f" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateSliceService"> + <bpmndi:BPMNShape id="StartEvent_0s4ou5u_di" bpmnElement="StartEvent_0s4ou5u"> + <dc:Bounds x="152" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="158" y="145" width="25" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1774fcg_di" bpmnElement="ScriptTask_1774fcg"> + <dc:Bounds x="220" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13fdjwf_di" bpmnElement="SequenceFlow_13fdjwf"> + <di:waypoint x="188" y="120" /> + <di:waypoint x="220" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1ba0boc_di" bpmnElement="CallActivity_1ba0boc"> + <dc:Bounds x="520" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0vhhyt1_di" bpmnElement="ScriptTask_0vhhyt1"> + <dc:Bounds x="660" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_17x7ifp_di" bpmnElement="ScriptTask_17x7ifp"> + <dc:Bounds x="810" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ru5d0h_di" bpmnElement="SequenceFlow_0ru5d0h"> + <di:waypoint x="620" y="120" /> + <di:waypoint x="660" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0so165e_di" bpmnElement="SequenceFlow_0so165e"> + <di:waypoint x="760" y="120" /> + <di:waypoint x="810" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1lh6vpe_di" bpmnElement="SequenceFlow_1lh6vpe"> + <di:waypoint x="320" y="120" /> + <di:waypoint x="360" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yqrli6_di" bpmnElement="SequenceFlow_1yqrli6"> + <di:waypoint x="460" y="120" /> + <di:waypoint x="520" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1mfr1lo_di" bpmnElement="Task_0sjhszu"> + <dc:Bounds x="360" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_00sf7s2_di" bpmnElement="ScriptTask_00sf7s2"> + <dc:Bounds x="960" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0z3hxio_di" bpmnElement="ExclusiveGateway_0z3hxio" isMarkerVisible="true"> + <dc:Bounds x="1125" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1123" y="71" width="54" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1mivpop_di" bpmnElement="EndEvent_1mivpop"> + <dc:Bounds x="1292" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1301" y="145" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1lpgplr_di" bpmnElement="ScriptTask_1lpgplr"> + <dc:Bounds x="1100" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0oa5clt_di" bpmnElement="SequenceFlow_0oa5clt"> + <di:waypoint x="1100" y="300" /> + <di:waypoint x="1010" y="300" /> + <di:waypoint x="1010" y="160" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1herzai_di" bpmnElement="SequenceFlow_1herzai"> + <di:waypoint x="1060" y="120" /> + <di:waypoint x="1125" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0btrzm8_di" bpmnElement="SequenceFlow_0btrzm8"> + <di:waypoint x="1150" y="145" /> + <di:waypoint x="1150" y="260" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1126" y="205" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1lvozh0_di" bpmnElement="SequenceFlow_1lvozh0"> + <di:waypoint x="1175" y="120" /> + <di:waypoint x="1292" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1226" y="133" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_05wxhwm_di" bpmnElement="SequenceFlow_05wxhwm"> + <di:waypoint x="910" y="120" /> + <di:waypoint x="960" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0bkr0v1_di" bpmnElement="SubProcess_0bkr0v1" isExpanded="true"> + <dc:Bounds x="240" y="420" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0g7e26e_di" bpmnElement="StartEvent_0g7e26e"> + <dc:Bounds x="347" y="482" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_14z3xck_di" bpmnElement="EndEvent_14z3xck"> + <dc:Bounds x="797" y="482" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1gitk4f_di" bpmnElement="ScriptTask_1gitk4f"> + <dc:Bounds x="560" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0aqapur_di" bpmnElement="SequenceFlow_0aqapur"> + <di:waypoint x="660" y="500" /> + <di:waypoint x="797" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ca8iyv_di" bpmnElement="SequenceFlow_0ca8iyv"> + <di:waypoint x="383" y="500" /> + <di:waypoint x="560" y="500" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn index 4447b32f4a..eb0c007403 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn @@ -30,22 +30,24 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoActivateTnNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Activate or Deactivate successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Activate or Deactivate successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0nhxd67" /> <bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1jdb2oq</bpmn:incoming> + <bpmn:incoming>Flow_0b2uim4</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def actionType = execution.getVariable("actionType") -execution.setVariable("orchestrationStatus", actionType) def runScript = new DoActivateTnNssi() +def orchStatus = runScript.getOrchStatusBasedOnActionType(actionType) +execution.setVariable("orchestrationStatus", orchStatus) runScript.updateAAIOrchStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" /> <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Activate or Deactivate TN NSSI Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming> + <bpmn:incoming>Flow_0046aj5</bpmn:incoming> <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoActivateTnNssi() @@ -84,7 +86,7 @@ runScript.validateSDNCResponse(execution, response)</bpmn:script> def runScript = new DoActivateTnNssi() runScript.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" /> + <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Gateway_1v41rsb" /> <bpmn:serviceTask id="Activity_0nhxd67" name="Update Resource Operation Status"> <bpmn:extensionElements> <camunda:connector> @@ -108,46 +110,69 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmn:outgoing>Flow_1032bi1</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1032bi1" sourceRef="Activity_0nhxd67" targetRef="EndEvent_05h01gx" /> + <bpmn:exclusiveGateway id="Gateway_1v41rsb" name="Enable SDNC?"> + <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming> + <bpmn:outgoing>Flow_0046aj5</bpmn:outgoing> + <bpmn:outgoing>Flow_0b2uim4</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0046aj5" name="Yes" sourceRef="Gateway_1v41rsb" targetRef="Activity_1tw8eyy"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_0b2uim4" name="No" sourceRef="Gateway_1v41rsb" targetRef="ScriptTask_19uxoi8" /> </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="DoActivateTransportNSSI"> + <bpmndi:BPMNEdge id="Flow_1032bi1_di" bpmnElement="Flow_1032bi1"> + <di:waypoint x="1040" y="380" /> + <di:waypoint x="1192" y="380" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt"> <di:waypoint x="385" y="121" /> - <di:waypoint x="509" y="121" /> + <di:waypoint x="465" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq"> - <di:waypoint x="1080" y="121" /> - <di:waypoint x="1220" y="121" /> - <di:waypoint x="1220" y="210" /> - <di:waypoint x="335" y="210" /> - <di:waypoint x="335" y="310" /> + <di:waypoint x="1210" y="121" /> + <di:waypoint x="1310" y="121" /> + <di:waypoint x="1310" y="260" /> + <di:waypoint x="490" y="260" /> + <di:waypoint x="490" y="340" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs"> - <di:waypoint x="850" y="121" /> - <di:waypoint x="959" y="121" /> + <di:waypoint x="990" y="121" /> + <di:waypoint x="1089" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye"> - <di:waypoint x="630" y="121" /> - <di:waypoint x="729" y="121" /> + <di:waypoint x="730" y="121" /> + <di:waypoint x="869" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj"> - <di:waypoint x="385" y="350" /> - <di:waypoint x="530" y="350" /> + <di:waypoint x="540" y="380" /> + <di:waypoint x="685" y="380" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> - <di:waypoint x="630" y="350" /> - <di:waypoint x="740" y="350" /> + <di:waypoint x="785" y="380" /> + <di:waypoint x="940" y="380" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c"> <di:waypoint x="214" y="121" /> <di:waypoint x="285" y="121" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1032bi1_di" bpmnElement="Flow_1032bi1"> - <di:waypoint x="840" y="350" /> - <di:waypoint x="1002" y="350" /> + <bpmndi:BPMNEdge id="Flow_0046aj5_di" bpmnElement="Flow_0046aj5"> + <di:waypoint x="515" y="121" /> + <di:waypoint x="609" y="121" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="553" y="103" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0b2uim4_di" bpmnElement="Flow_0b2uim4"> + <di:waypoint x="490" y="146" /> + <di:waypoint x="490" y="340" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="498" y="166" width="14" 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" /> @@ -155,8 +180,35 @@ runScript.preProcessRequest(execution)</bpmn:script> <dc:Bounds x="163" y="146" width="81" height="53" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> + <dc:Bounds x="1192" y="362" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1200" y="405" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0nhxd67_di" bpmnElement="Activity_0nhxd67"> - <dc:Bounds x="740" y="310" width="100" height="80" /> + <dc:Bounds x="940" y="340" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> + <dc:Bounds x="685" y="340" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5"> + <dc:Bounds x="1089" y="74" width="121" height="94" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb"> + <dc:Bounds x="869" y="74" width="121" height="94" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy"> + <dc:Bounds x="609" y="74" width="121" height="94" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1v41rsb_di" bpmnElement="Gateway_1v41rsb" isMarkerVisible="true"> + <dc:Bounds x="465" y="96" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="453" y="73" width="75" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8"> + <dc:Bounds x="440" y="340" 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" /> @@ -178,27 +230,6 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw"> <dc:Bounds x="979" y="1144" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> - <dc:Bounds x="1002" y="332" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1010" y="375" width="20" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> - <dc:Bounds x="530" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8"> - <dc:Bounds x="285" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy"> - <dc:Bounds x="509" y="74" width="121" height="94" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb"> - <dc:Bounds x="729" y="74" width="121" height="94" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5"> - <dc:Bounds x="959" y="74" width="121" height="94" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge"> <dc:Bounds x="285" y="81" width="100" height="80" /> </bpmndi:BPMNShape> 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 9c12200657..9b449013b1 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 @@ -193,7 +193,7 @@ nss.prepareDecomposeService(execution)</bpmn:script> <camunda:in source="esrInfo" target="esrInfo" /> <camunda:in source="serviceInfo" target="serviceInfo" /> <camunda:in source="TNFH_jobId" target="jobId" /> - <camunda:out source="jobResponse" target="TNFH_jobResponse" /> + <camunda:out source="responseDescriptor" target="TNFH_jobResponse" /> <camunda:in source="responseId" target="responseId" /> <camunda:in source="job_timeout" target="timeout" /> </bpmn:extensionElements> @@ -206,7 +206,7 @@ nss.prepareDecomposeService(execution)</bpmn:script> <camunda:in source="esrInfo" target="esrInfo" /> <camunda:in source="serviceInfo" target="serviceInfo" /> <camunda:in source="TNMH_jobId" target="jobId" /> - <camunda:out source="jobResponse" target="TNMH_jobResponse" /> + <camunda:out source="responseDescriptor" target="TNMH_jobResponse" /> <camunda:in source="responseId" target="responseId" /> <camunda:in source="job_timeout" target="timeout" /> </bpmn:extensionElements> @@ -318,7 +318,7 @@ nss.prepareModifyAccessNssiInputs(execution)</bpmn:script> <camunda:in source="esrInfo" target="esrInfo" /> <camunda:in source="serviceInfo" target="serviceInfo" /> <camunda:in source="modifyRanNssiJobId" target="jobId" /> - <camunda:out source="jobResponse" target="jobResponse" /> + <camunda:out source="responseDescriptor" target="jobResponse" /> <camunda:in source="responseId" target="responseId" /> <camunda:in source="job_timeout" target="timeout" /> </bpmn:extensionElements> @@ -435,7 +435,7 @@ nss.updateAaiWithRANInstances(execution)</bpmn:script> <bpmn:sequenceFlow id="Flow_1exjm0h" sourceRef="Activity_0pa8al6" targetRef="Event_15zn4zi" /> <bpmn:sequenceFlow id="Flow_0bd6dhi" sourceRef="Activity_0zn4e4n" targetRef="Activity_0vf28ld" /> <bpmn:sequenceFlow id="Flow_0kcvava" sourceRef="Activity_0vf28ld" targetRef="Event_0u9308h" /> - <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships"> + <bpmn:scriptTask id="Activity_0vf28ld" name="update AAI relationships" scriptFormat="groovy"> <bpmn:incoming>Flow_0bd6dhi</bpmn:incoming> <bpmn:outgoing>Flow_0kcvava</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn index 92407e9b2a..45ebfb9664 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreNSSI.bpmn @@ -78,6 +78,7 @@ allocateNssi.prepareOOFRequest(execution)</bpmn:script> <camunda:in source="servicename" target="servicename" /> <camunda:in source="msoRequestId" target="msoRequestId" /> <camunda:in source="sliceProfile" target="sliceProfile" /> + <camunda:in source="jobId" target="jobId" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1ygklb8</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0tytimn</bpmn:outgoing> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn index 0a482beca0..88902d1c91 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateCoreSharedSlice.bpmn @@ -39,37 +39,15 @@ allocateNssi.prepareSOMacroRequestPayload(execution)</bpmn:script> def allocateNssi = new DoAllocateCoreSharedSlice() allocateNssi.sendPutRequestToSOMacro(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Activity_0ge2y0l" name="Prepare Call CheckServiceProcessStatus" scriptFormat="groovy"> + <bpmn:scriptTask id="Activity_0ge2y0l" name="Call Get SO PUT progress" scriptFormat="groovy"> <bpmn:incoming>Flow_0x7shtq</bpmn:incoming> + <bpmn:incoming>Flow_163kxug</bpmn:incoming> <bpmn:outgoing>Flow_1c9nkx4</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def allocateNssi = new DoAllocateCoreSharedSlice() -allocateNssi.prepareCallCheckProcessStatus(execution)</bpmn:script> +allocateNssi.getSOPUTProgress(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="Activity_19xwwnc" name="CallCheckServiceProcessStatus" calledElement="CheckServiceProcessStatus"> - <bpmn:extensionElements> - <camunda:in source="networkServiceInstanceId" target="serviceInstanceId" /> - <camunda:in source="macroOperationId" target="operationId" /> - <camunda:in source="successConditions" target="successConditions" /> - <camunda:in source="errorConditions" target="errorConditions" /> - <camunda:in source="processServiceType" target="processServiceType" /> - <camunda:in source="timeOut" target="timeOut" /> - <camunda:out source="operationStatus" target="result" /> - <camunda:out source="operationContent" target="reason" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="isTimeOut" target="isTimeOut" /> - <camunda:in source="subOperationType" target="operationType" /> - <camunda:in source="initProgress" target="initProgress" /> - <camunda:in source="endProgress" target="endProgress" /> - <camunda:in source="serviceInstanceID" target="parentServiceInstanceId" /> - <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> - <camunda:in source="operationId" target="parentOperationId" /> - </bpmn:extensionElements> - <bpmn:incoming>Flow_1c9nkx4</bpmn:incoming> - <bpmn:outgoing>Flow_0c94gye</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="Flow_1c9nkx4" sourceRef="Activity_0ge2y0l" targetRef="Activity_19xwwnc" /> - <bpmn:sequenceFlow id="Flow_0c94gye" sourceRef="Activity_19xwwnc" targetRef="Activity_1t49t6c" /> + <bpmn:sequenceFlow id="Flow_1c9nkx4" sourceRef="Activity_0ge2y0l" targetRef="Gateway_1boyqt9" /> <bpmn:scriptTask id="Activity_0no0sxa" name="Get VNF/VFs modelInfo from CatalogDB" scriptFormat="groovy"> <bpmn:incoming>Flow_1973d9m</bpmn:incoming> <bpmn:outgoing>Flow_0da7dao</bpmn:outgoing> @@ -78,13 +56,13 @@ def allocateNssi = new DoAllocateCoreSharedSlice() allocateNssi.getServiceVNFAndVFsFromCatalogDB(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="Activity_1t49t6c" name="Prepare Update Operation Status" scriptFormat="groovy"> - <bpmn:incoming>Flow_0c94gye</bpmn:incoming> + <bpmn:incoming>Flow_15lksyg</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1re5jor</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def allocateNssi = new DoAllocateCoreSharedSlice() allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="Activity_0t6viuq" name="Update Service Operation Status"> + <bpmn:serviceTask id="Activity_0t6viuq" name="Update Resource Operation Status"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -95,7 +73,7 @@ allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script> <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> - <camunda:inputParameter name="payload">${updateOperationStatus}</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> @@ -111,11 +89,11 @@ allocateNssi.prepareUpdateResourceOperationStatus(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_08q2fd9" sourceRef="Activity_12jcmzc" targetRef="Gateway_0sfmiku" /> <bpmn:sequenceFlow id="SequenceFlow_1re5jor" sourceRef="Activity_1t49t6c" targetRef="Activity_0t6viuq" /> <bpmn:sequenceFlow id="SequenceFlow_1j1qqcs" sourceRef="Task_16983t3" targetRef="IntermediateThrowEvent_09rhn4h" /> - <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_09rhn4h" name="Call SO macro api"> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_09rhn4h" name="CallSO"> <bpmn:incoming>SequenceFlow_1j1qqcs</bpmn:incoming> <bpmn:linkEventDefinition name="CallSO" /> </bpmn:intermediateThrowEvent> - <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0qh9wy2" name="Call SO macro api"> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0qh9wy2" name="CallSO"> <bpmn:outgoing>SequenceFlow_013bc74</bpmn:outgoing> <bpmn:linkEventDefinition name="CallSO" /> </bpmn:intermediateCatchEvent> @@ -178,16 +156,33 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmn:sequenceFlow id="Flow_0kadgoq" sourceRef="Activity_0sqggtb" targetRef="Activity_1btidug" /> <bpmn:sequenceFlow id="Flow_128o22z" sourceRef="Activity_1btidug" targetRef="Activity_1150yu6" /> </bpmn:subProcess> + <bpmn:exclusiveGateway id="Gateway_1boyqt9" default="Flow_15lksyg"> + <bpmn:incoming>Flow_1c9nkx4</bpmn:incoming> + <bpmn:outgoing>Flow_15lksyg</bpmn:outgoing> + <bpmn:outgoing>Flow_1lzv4jo</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_15lksyg" sourceRef="Gateway_1boyqt9" targetRef="Activity_1t49t6c" /> + <bpmn:sequenceFlow id="Flow_1lzv4jo" name="requestState=IN_PROGRESS" sourceRef="Gateway_1boyqt9" targetRef="Activity_1qm4des"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("requestState" ) == "IN_PROGRESS")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="Activity_1qm4des" name="Time Delay 5s" scriptFormat="groovy"> + <bpmn:incoming>Flow_1lzv4jo</bpmn:incoming> + <bpmn:outgoing>Flow_163kxug</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def allocateNssi = new DoAllocateCoreSharedSlice() +allocateNssi.timeDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="Flow_163kxug" sourceRef="Activity_1qm4des" targetRef="Activity_0ge2y0l" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateCoreSharedSlice"> <bpmndi:BPMNEdge id="Flow_1nn15tq_di" bpmnElement="Flow_1nn15tq"> - <di:waypoint x="420" y="306" /> - <di:waypoint x="420" y="360" /> - <di:waypoint x="967" y="360" /> - <di:waypoint x="967" y="321" /> + <di:waypoint x="420" y="256" /> + <di:waypoint x="420" y="200" /> + <di:waypoint x="967" y="200" /> + <di:waypoint x="967" y="241" /> <bpmndi:BPMNLabel> - <dc:Bounds x="687" y="342" width="14" height="12" /> + <dc:Bounds x="687" y="182" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0x7shtq_di" bpmnElement="Flow_0x7shtq"> @@ -232,16 +227,9 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="931.5" y="336" width="90" height="20" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0c94gye_di" bpmnElement="Flow_0c94gye"> - <di:waypoint x="736" y="281" /> - <di:waypoint x="778" y="281" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="652" y="336" width="90" height="20" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1c9nkx4_di" bpmnElement="Flow_1c9nkx4"> <di:waypoint x="584" y="281" /> - <di:waypoint x="636" y="281" /> + <di:waypoint x="655" y="281" /> <bpmndi:BPMNLabel> <dc:Bounds x="505" y="336" width="90" height="20" /> </bpmndi:BPMNLabel> @@ -271,6 +259,22 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <dc:Bounds x="207" y="179" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_15lksyg_di" bpmnElement="Flow_15lksyg"> + <di:waypoint x="705" y="281" /> + <di:waypoint x="778" y="281" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1lzv4jo_di" bpmnElement="Flow_1lzv4jo"> + <di:waypoint x="680" y="306" /> + <di:waypoint x="680" y="340" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="603" y="315" width="78" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_163kxug_di" bpmnElement="Flow_163kxug"> + <di:waypoint x="630" y="380" /> + <di:waypoint x="534" y="380" /> + <di:waypoint x="534" y="321" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> <dc:Bounds x="248" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -298,9 +302,6 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_0ge2y0l_di" bpmnElement="Activity_0ge2y0l"> <dc:Bounds x="484" y="241" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_19xwwnc_di" bpmnElement="Activity_19xwwnc"> - <dc:Bounds x="636" y="241" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0k70k5i_di" bpmnElement="Activity_0no0sxa"> <dc:Bounds x="654" y="80" width="100" height="80" /> </bpmndi:BPMNShape> @@ -313,21 +314,27 @@ allocateNssi.prepareFailedOperationStatusUpdate(execution)</bpmn:script> <bpmndi:BPMNShape id="IntermediateThrowEvent_06785ru_di" bpmnElement="IntermediateThrowEvent_09rhn4h"> <dc:Bounds x="949" y="102" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="923" y="142" width="90" height="14" /> + <dc:Bounds x="950" y="142" width="36" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_09u3rdp_di" bpmnElement="IntermediateThrowEvent_0qh9wy2"> <dc:Bounds x="182" y="263" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="156" y="303" width="90" height="14" /> + <dc:Bounds x="183" y="303" width="36" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0sfmiku_di" bpmnElement="Gateway_0sfmiku" isMarkerVisible="true"> <dc:Bounds x="395" y="256" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="380" y="226" width="80" height="27" /> + <dc:Bounds x="380" y="315.5" width="80" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1boyqt9_di" bpmnElement="Gateway_1boyqt9" isMarkerVisible="true"> + <dc:Bounds x="655" y="256" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1iksno7_di" bpmnElement="Activity_1qm4des"> + <dc:Bounds x="630" y="340" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_08h38js_di" bpmnElement="Activity_08h38js" isExpanded="true"> <dc:Bounds x="250" y="440" width="781" height="196" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn index 9090bf2fab..c6268d3638 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn @@ -140,7 +140,7 @@ dcnsio.createAnSliceProfileInstance(execution)</bpmn:script> def dcnsio = new DoAllocateNSIandNSSI() dcnsio.createAnSliceProfile(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_0zbd2tq" sourceRef="ScriptTask_1r2li91" targetRef="ScriptTask_0s8vhha" /> + <bpmn:sequenceFlow id="SequenceFlow_0zbd2tq" sourceRef="ScriptTask_1r2li91" targetRef="Task_0dkfe9n" /> <bpmn:scriptTask id="Task_1en3luv" name="Create Core Slice Profile Instance" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0k5iu2n</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0f36cu2</bpmn:outgoing> @@ -234,7 +234,7 @@ dcnsio.updateCnRelationship(execution)</bpmn:script> <bpmn:linkEventDefinition name="CreateTnSliceProfile" /> </bpmn:intermediateThrowEvent> <bpmn:scriptTask id="ScriptTask_0s8vhha" name="prepare Allocate An Nssi" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0zbd2tq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1rwy8q7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0npsyye</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnsio = new DoAllocateNSIandNSSI() @@ -242,14 +242,14 @@ dcnsio.prepareAllocateAnNssi(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0npsyye" sourceRef="ScriptTask_0s8vhha" targetRef="CallActivity_1yh9tiq" /> <bpmn:scriptTask id="ScriptTask_0z0ec5b" name="prepare Allocate Cn Nssi" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1wffel4</bpmn:incoming> + <bpmn:incoming>SequenceFlow_17r1oa0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0cwbtmr</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcnsio = new DoAllocateNSIandNSSI() dcnsio.prepareAllocateCnNssi(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0cwbtmr" sourceRef="ScriptTask_0z0ec5b" targetRef="CallActivity_1ixah3o" /> - <bpmn:sequenceFlow id="SequenceFlow_1wffel4" sourceRef="Task_1g8n8iz" targetRef="ScriptTask_0z0ec5b" /> + <bpmn:sequenceFlow id="SequenceFlow_1wffel4" sourceRef="Task_1g8n8iz" targetRef="Task_0fwhsq2" /> <bpmn:scriptTask id="ScriptTask_0ci5g6y" name="prepare Allocate Tn-BH Nssi" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_00dexhy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_01isn2q</bpmn:outgoing> @@ -258,6 +258,22 @@ def dcnsio = new DoAllocateNSIandNSSI() dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_01isn2q" sourceRef="ScriptTask_0ci5g6y" targetRef="CallActivity_0b28wlb" /> + <bpmn:sequenceFlow id="SequenceFlow_1rwy8q7" sourceRef="Task_0dkfe9n" targetRef="ScriptTask_0s8vhha" /> + <bpmn:scriptTask id="Task_0dkfe9n" name="Create AN EP" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0zbd2tq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1rwy8q7</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createANEndpoint(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_17r1oa0" sourceRef="Task_0fwhsq2" targetRef="ScriptTask_0z0ec5b" /> + <bpmn:scriptTask id="Task_0fwhsq2" name="Create CN EP" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1wffel4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17r1oa0</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createCNEndpoint(execution)</bpmn:script> + </bpmn:scriptTask> </bpmn:process> <bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -338,25 +354,25 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> <di:waypoint x="310" y="630" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1yh9tiq_di" bpmnElement="CallActivity_1yh9tiq"> - <dc:Bounds x="930" y="400" width="100" height="80" /> + <dc:Bounds x="1030" y="400" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1hfjn79_di" bpmnElement="SequenceFlow_1hfjn79"> <di:waypoint x="410" y="440" /> - <di:waypoint x="530" y="440" /> + <di:waypoint x="480" y="440" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1ixah3o_di" bpmnElement="CallActivity_1ixah3o"> - <dc:Bounds x="930" y="590" width="100" height="80" /> + <dc:Bounds x="1030" y="590" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0f36cu2_di" bpmnElement="SequenceFlow_0f36cu2"> <di:waypoint x="410" y="630" /> - <di:waypoint x="530" y="630" /> + <di:waypoint x="480" y="630" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1xb5nx1_di" bpmnElement="SequenceFlow_1xb5nx1"> - <di:waypoint x="1030" y="440" /> - <di:waypoint x="1140" y="440" /> + <di:waypoint x="1130" y="440" /> + <di:waypoint x="1210" y="440" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ParallelGateway_15vgf7c_di" bpmnElement="ExclusiveGateway_19ru3hp"> - <dc:Bounds x="1325" y="505" width="50" height="50" /> + <dc:Bounds x="1405" y="505" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_07sgklo_di" bpmnElement="ScriptTask_07sgklo"> <dc:Bounds x="930" y="220" width="100" height="80" /> @@ -377,21 +393,21 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> <dc:Bounds x="310" y="400" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1r2li91_di" bpmnElement="ScriptTask_1r2li91"> - <dc:Bounds x="530" y="400" width="100" height="80" /> + <dc:Bounds x="480" y="400" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0zbd2tq_di" bpmnElement="SequenceFlow_0zbd2tq"> - <di:waypoint x="630" y="440" /> - <di:waypoint x="730" y="440" /> + <di:waypoint x="580" y="440" /> + <di:waypoint x="650" y="440" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_01n5nmt_di" bpmnElement="Task_1en3luv"> <dc:Bounds x="310" y="590" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0juh1xy_di" bpmnElement="Task_1g8n8iz"> - <dc:Bounds x="530" y="590" width="100" height="80" /> + <dc:Bounds x="480" y="590" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ax2c4p_di" bpmnElement="SequenceFlow_0ax2c4p"> - <di:waypoint x="1375" y="530" /> - <di:waypoint x="1412" y="530" /> + <di:waypoint x="1455" y="530" /> + <di:waypoint x="1512" y="530" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0stnvp3_di" bpmnElement="ScriptTask_0stnvp3"> <dc:Bounds x="310" y="840" width="100" height="80" /> @@ -428,24 +444,24 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> <di:waypoint x="1412" y="880" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0mls87v_di" bpmnElement="ScriptTask_0mls87v"> - <dc:Bounds x="1140" y="400" width="100" height="80" /> + <dc:Bounds x="1210" y="400" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0xx5bwa_di" bpmnElement="SequenceFlow_0xx5bwa"> - <di:waypoint x="1240" y="440" /> - <di:waypoint x="1350" y="440" /> - <di:waypoint x="1350" y="505" /> + <di:waypoint x="1310" y="440" /> + <di:waypoint x="1430" y="440" /> + <di:waypoint x="1430" y="505" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0z9x5uh_di" bpmnElement="ScriptTask_0z9x5uh"> - <dc:Bounds x="1140" y="590" width="100" height="80" /> + <dc:Bounds x="1210" y="590" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1l74seh_di" bpmnElement="SequenceFlow_1l74seh"> - <di:waypoint x="1030" y="630" /> - <di:waypoint x="1140" y="630" /> + <di:waypoint x="1130" y="630" /> + <di:waypoint x="1210" y="630" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0jqxxjq_di" bpmnElement="SequenceFlow_0jqxxjq"> - <di:waypoint x="1240" y="630" /> - <di:waypoint x="1350" y="630" /> - <di:waypoint x="1350" y="555" /> + <di:waypoint x="1310" y="630" /> + <di:waypoint x="1430" y="630" /> + <di:waypoint x="1430" y="555" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1omynpt_di" bpmnElement="SequenceFlow_1omynpt"> <di:waypoint x="1030" y="880" /> @@ -455,28 +471,28 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> <dc:Bounds x="1412" y="862" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_0gz4vi6_di" bpmnElement="EndEvent_02c8wsp"> - <dc:Bounds x="1412" y="512" width="36" height="36" /> + <dc:Bounds x="1512" y="512" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1392" y="555" width="79" height="27" /> + <dc:Bounds x="1492" y="555" width="79" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0s8vhha_di" bpmnElement="ScriptTask_0s8vhha"> - <dc:Bounds x="730" y="400" width="100" height="80" /> + <dc:Bounds x="830" y="400" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0npsyye_di" bpmnElement="SequenceFlow_0npsyye"> - <di:waypoint x="830" y="440" /> <di:waypoint x="930" y="440" /> + <di:waypoint x="1030" y="440" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0z0ec5b_di" bpmnElement="ScriptTask_0z0ec5b"> - <dc:Bounds x="730" y="590" width="100" height="80" /> + <dc:Bounds x="830" y="590" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0cwbtmr_di" bpmnElement="SequenceFlow_0cwbtmr"> - <di:waypoint x="830" y="630" /> <di:waypoint x="930" y="630" /> + <di:waypoint x="1030" y="630" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1wffel4_di" bpmnElement="SequenceFlow_1wffel4"> - <di:waypoint x="630" y="630" /> - <di:waypoint x="730" y="630" /> + <di:waypoint x="580" y="630" /> + <di:waypoint x="650" y="630" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0ci5g6y_di" bpmnElement="ScriptTask_0ci5g6y"> <dc:Bounds x="730" y="840" width="100" height="80" /> @@ -485,6 +501,20 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> <di:waypoint x="830" y="880" /> <di:waypoint x="930" y="880" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rwy8q7_di" bpmnElement="SequenceFlow_1rwy8q7"> + <di:waypoint x="750" y="440" /> + <di:waypoint x="830" y="440" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0x8r537_di" bpmnElement="Task_0dkfe9n"> + <dc:Bounds x="650" y="400" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17r1oa0_di" bpmnElement="SequenceFlow_17r1oa0"> + <di:waypoint x="750" y="630" /> + <di:waypoint x="830" y="630" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0mlyx1u_di" bpmnElement="Task_0fwhsq2"> + <dc:Bounds x="650" y="590" width="100" height="80" /> + </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 12632dec72..124b75cbe8 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 @@ -69,7 +69,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new TnAllocateNssi() -runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI started")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"INPROGRESS","10","Allocate TN NSSI started")</bpmn:script> </bpmn:scriptTask> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection"> <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming> @@ -80,7 +80,7 @@ runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI sta <bpmn:outgoing>SequenceFlow_1qv8qw1</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> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService"> <bpmn:extensionElements> @@ -164,7 +164,7 @@ css.prepareOofSelection(execution)</bpmn:script> <bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -execution.setVariable("orchestrationStatus", "allocated") +execution.setVariable("orchestrationStatus", "deactivated") def runScript = new TnAllocateNssi() runScript.updateAAIOrchStatus(execution)</bpmn:script> </bpmn:scriptTask> @@ -174,7 +174,7 @@ runScript.updateAAIOrchStatus(execution)</bpmn:script> <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> +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"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn index fefa022bb9..1f29f817b8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn @@ -29,7 +29,7 @@ dcsi.createServiceInstance(execution)</bpmn:script> def dcsi = new DoCreateTnNssiInstance() dcsi.createAllottedResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Event_1a9swwa" /> + <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Gateway_1cehbyc" /> <bpmn:intermediateCatchEvent id="Event_0l9vk9p" name="Start SDNC Operation"> <bpmn:outgoing>Flow_1c8zr59</bpmn:outgoing> <bpmn:linkEventDefinition id="LinkEventDefinition_0uwmpn2" name="SdncOperation" /> @@ -67,13 +67,23 @@ dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script> <bpmn:sequenceFlow id="Flow_1c8zr59" name="" sourceRef="Event_0l9vk9p" targetRef="Activity_0eh82ds" /> <bpmn:sequenceFlow id="Flow_0pko5tm" name="" sourceRef="Activity_0eh82ds" targetRef="Activity_1fs2182" /> <bpmn:sequenceFlow id="Flow_11kadz7" name="" sourceRef="Activity_1fs2182" targetRef="Activity_16luyg1" /> - <bpmn:endEvent id="Event_1rsf7yb"> + <bpmn:endEvent id="Event_1rsf7yb" name="No"> <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + <bpmn:incoming>Flow_07tmxxo</bpmn:incoming> </bpmn:endEvent> <bpmn:intermediateThrowEvent id="Event_1a9swwa" name="Goto SDNC operation"> - <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming> + <bpmn:incoming>Flow_0dp5afv</bpmn:incoming> <bpmn:linkEventDefinition id="LinkEventDefinition_1skl6p7" name="SdncOperation" /> </bpmn:intermediateThrowEvent> + <bpmn:exclusiveGateway id="Gateway_1cehbyc" name="Enable SDNC?"> + <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming> + <bpmn:outgoing>Flow_0dp5afv</bpmn:outgoing> + <bpmn:outgoing>Flow_07tmxxo</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0dp5afv" name="Yes" sourceRef="Gateway_1cehbyc" targetRef="Event_1a9swwa"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("enableSdnc" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_07tmxxo" name="No" sourceRef="Gateway_1cehbyc" targetRef="Event_1rsf7yb" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateTnNssiInstance"> @@ -91,7 +101,7 @@ dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4"> <di:waypoint x="830" y="129" /> - <di:waypoint x="982" y="129" /> + <di:waypoint x="895" y="129" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> <di:waypoint x="600" y="129" /> @@ -118,12 +128,36 @@ dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script> <dc:Bounds x="266" y="123" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0dp5afv_di" bpmnElement="Flow_0dp5afv"> + <di:waypoint x="945" y="129" /> + <di:waypoint x="1072" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1000" y="113" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_07tmxxo_di" bpmnElement="Flow_07tmxxo"> + <di:waypoint x="920" y="154" /> + <di:waypoint x="920" y="375" /> + <di:waypoint x="972" y="375" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="929" y="262" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateTnNssi_StartEvent"> <dc:Bounds x="175" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="153" y="147" width="86" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="310" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="500" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb"> + <dc:Bounds x="730" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0l9vk9p_di" bpmnElement="Event_0l9vk9p"> <dc:Bounds x="175" y="357" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -141,21 +175,21 @@ dcsi.validateSDNCResponse(execution, response, "allocate")</bpmn:script> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1rsf7yb_di" bpmnElement="Event_1rsf7yb"> <dc:Bounds x="972" y="357" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="983" y="400" width="14" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1a9swwa_di" bpmnElement="Event_1a9swwa"> - <dc:Bounds x="982" y="111" width="36" height="36" /> + <dc:Bounds x="1072" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="973" y="154" width="59" height="27" /> + <dc:Bounds x="1063" y="154" width="59" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb"> - <dc:Bounds x="730" y="89" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> - <dc:Bounds x="500" y="89" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> - <dc:Bounds x="310" y="89" width="100" height="80" /> + <bpmndi:BPMNShape id="Gateway_1cehbyc_di" bpmnElement="Gateway_1cehbyc" isMarkerVisible="true"> + <dc:Bounds x="895" y="104" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="884" y="74" width="75" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn index a745f7c50d..85533e72dc 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.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_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2"> +<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_0884541" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="DoDeallocateNSSIV1" name="DoDeallocateNSSIV1" isExecutable="true"> <bpmn:startEvent id="StartEvent_1" name="start"> <bpmn:outgoing>SequenceFlow_05jfhy6</bpmn:outgoing> @@ -33,7 +33,7 @@ def dnssi= new DoDeallocateNSSI() dnssi.processDecomposition(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1e7o57n" sourceRef="Task_15ut397" targetRef="Task_0vi4ijv" /> - <bpmn:scriptTask id="Task_0vi4ijv" name="Send deallocate request to NSSMF" scriptFormat="groovy"> + <bpmn:scriptTask id="Task_0vi4ijv" name="Send request to NSSMF" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1e7o57n</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1wj89r5</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* @@ -53,9 +53,9 @@ def dnssi= new DoDeallocateNSSI() dnssi.delSliceProfileFromAAI(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:endEvent id="EndEvent_1f579t4" name="end"> - <bpmn:incoming>SequenceFlow_1ii5002</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0hyn6ca</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1ii5002" sourceRef="Task_13vaezk" targetRef="EndEvent_1f579t4" /> + <bpmn:sequenceFlow id="SequenceFlow_1ii5002" sourceRef="Task_13vaezk" targetRef="Task_0ocemjg" /> <bpmn:sequenceFlow id="SequenceFlow_0xq380j" name="yes" sourceRef="ExclusiveGateway_0nhfsui" targetRef="Task_13vaezk"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSIDeAllocated" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> @@ -102,7 +102,6 @@ dnssi.prepareUpdateOperationStatus(execution)</bpmn:script> <camunda:in source="esrInfo" target="esrInfo" /> <camunda:in source="serviceInfo" target="serviceInfo" /> <camunda:in source="jobId" target="jobId" /> - <camunda:in source="responseId" target="responseId" /> <camunda:out source="responseDescriptor" target="responseDescriptor" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming> @@ -133,6 +132,14 @@ dnssi.prepareJobStatusRequest(execution)</bpmn:script> <bpmn:errorEventDefinition id="ErrorEventDefinition_11pdh1q" errorRef="Error_1o5kb95" /> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_1wpbkt9" name="no" sourceRef="ExclusiveGateway_0nhfsui" targetRef="Event_11u9vp2" /> + <bpmn:sequenceFlow id="SequenceFlow_0hyn6ca" sourceRef="Task_0ocemjg" targetRef="EndEvent_1f579t4" /> + <bpmn:scriptTask id="Task_0ocemjg" name="Delete Slice Profile Service From AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ii5002</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hyn6ca</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dnssi= new DoDeallocateNSSI() +dnssi.delSliceProfileServiceFromAAI(execution)</bpmn:script> + </bpmn:scriptTask> </bpmn:process> <bpmn:error id="Error_1o5kb95" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -181,7 +188,7 @@ dnssi.prepareJobStatusRequest(execution)</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002"> <di:waypoint x="2040" y="130" /> - <di:waypoint x="2102" y="130" /> + <di:waypoint x="2090" y="130" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n"> <di:waypoint x="800" y="130" /> @@ -227,9 +234,9 @@ dnssi.prepareJobStatusRequest(execution)</bpmn:script> <dc:Bounds x="1940" y="90" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1f579t4_di" bpmnElement="EndEvent_1f579t4"> - <dc:Bounds x="2102" y="112" width="36" height="36" /> + <dc:Bounds x="2272" y="112" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2111" y="155" width="19" height="14" /> + <dc:Bounds x="2281" y="155" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1dytya8_di" bpmnElement="Task_1vste9s"> @@ -253,6 +260,13 @@ dnssi.prepareJobStatusRequest(execution)</bpmn:script> <bpmndi:BPMNShape id="Event_11u9vp2_di" bpmnElement="Event_11u9vp2"> <dc:Bounds x="1842" y="212" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0hyn6ca_di" bpmnElement="SequenceFlow_0hyn6ca"> + <di:waypoint x="2190" y="130" /> + <di:waypoint x="2272" y="130" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_12dnirp_di" bpmnElement="Task_0ocemjg"> + <dc:Bounds x="2090" y="90" width="100" height="80" /> + </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 bd759caffd..1dd362bf4b 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 @@ -29,13 +29,13 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:incoming>SequenceFlow_1jygjln</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def runScript = new TnAllocateNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Deallocated TN NSSI successfully")</bpmn:script> +def runScript = new DoDeallocateTnNssi() +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Deallocated TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" /> <bpmn:scriptTask id="Activity_1tw8eyy" name="PreProcess SDNC Deallocate TN NSSI Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_07e12rt</bpmn:incoming> + <bpmn:incoming>Flow_0sj0mtu</bpmn:incoming> <bpmn:outgoing>Flow_0cpctye</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoDeallocateTnNssi() @@ -68,6 +68,7 @@ runScript.validateSDNCResponse(execution, response, "deallocate")</bpmn:script> </bpmn:scriptTask> <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:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoDeallocateTnNssi() @@ -81,7 +82,7 @@ runScript.deleteServiceInstance(execution)</bpmn:script> def runScript = new DoDeallocateTnNssi() runScript.preProcessRequest(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_07e12rt" sourceRef="ScriptTask_1tc44ge" targetRef="Activity_1tw8eyy" /> + <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> @@ -106,6 +107,15 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmn:outgoing>Flow_0ca4l8d</bpmn:outgoing> </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:outgoing>Flow_0sj0mtu</bpmn:outgoing> + <bpmn:outgoing>Flow_0dirb5b</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0sj0mtu" name="Yes" sourceRef="Gateway_1spi9lo" targetRef="Activity_1tw8eyy"> + <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:process> <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" /> <bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -113,40 +123,54 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateTransportNSSI"> <bpmndi:BPMNEdge id="Flow_0ca4l8d_di" bpmnElement="Flow_0ca4l8d"> - <di:waypoint x="840" y="350" /> - <di:waypoint x="1022" y="350" /> + <di:waypoint x="1030" y="410" /> + <di:waypoint x="1152" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jygjln_di" bpmnElement="SequenceFlow_1jygjln"> - <di:waypoint x="360" y="350" /> - <di:waypoint x="520" y="350" /> + <di:waypoint x="530" y="410" /> + <di:waypoint x="660" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt"> <di:waypoint x="385" y="121" /> - <di:waypoint x="509" y="121" /> + <di:waypoint x="455" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1jdb2oq_di" bpmnElement="SequenceFlow_1jdb2oq"> - <di:waypoint x="1080" y="121" /> + <di:waypoint x="1130" y="121" /> <di:waypoint x="1220" y="121" /> - <di:waypoint x="1220" y="230" /> - <di:waypoint x="310" y="230" /> - <di:waypoint x="310" y="310" /> + <di:waypoint x="1220" y="260" /> + <di:waypoint x="480" y="260" /> + <di:waypoint x="480" y="370" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fuabjs_di" bpmnElement="Flow_0fuabjs"> - <di:waypoint x="850" y="121" /> - <di:waypoint x="959" y="121" /> + <di:waypoint x="910" y="121" /> + <di:waypoint x="1009" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0cpctye_di" bpmnElement="Flow_0cpctye"> - <di:waypoint x="630" y="121" /> - <di:waypoint x="729" y="121" /> + <di:waypoint x="690" y="121" /> + <di:waypoint x="789" y="121" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1"> - <di:waypoint x="620" y="350" /> - <di:waypoint x="740" y="350" /> + <di:waypoint x="760" y="410" /> + <di:waypoint x="930" y="410" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c"> <di:waypoint x="214" y="121" /> <di:waypoint x="285" y="121" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0sj0mtu_di" bpmnElement="Flow_0sj0mtu"> + <di:waypoint x="505" y="121" /> + <di:waypoint x="569" y="121" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="103" width="19" 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:BPMNLabel> + <dc:Bounds x="483" y="166" width="14" 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:BPMNLabel> @@ -154,17 +178,35 @@ runScript.preProcessRequest(execution)</bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9"> - <dc:Bounds x="520" y="310" width="100" height="80" /> + <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" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0rgeefb_di" bpmnElement="Activity_0rgeefb"> - <dc:Bounds x="740" y="310" width="100" height="80" /> + <dc:Bounds x="930" y="370" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_05h01gx_di" bpmnElement="EndEvent_05h01gx"> - <dc:Bounds x="1022" y="332" width="36" height="36" /> + <dc:Bounds x="1152" y="392" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1160" y="435" 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> + <bpmndi:BPMNShape id="Gateway_1spi9lo_di" bpmnElement="Gateway_1spi9lo" isMarkerVisible="true"> + <dc:Bounds x="455" y="96" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1030" y="375" width="20" height="14" /> + <dc:Bounds x="443" y="73" width="75" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb"> + <dc:Bounds x="789" y="74" 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" /> + </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> @@ -185,18 +227,6 @@ runScript.preProcessRequest(execution)</bpmn:script> <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw"> <dc:Bounds x="979" y="1144" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1tw8eyy_di" bpmnElement="Activity_1tw8eyy"> - <dc:Bounds x="509" y="74" width="121" height="94" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0p20esb_di" bpmnElement="Activity_0p20esb"> - <dc:Bounds x="729" y="74" width="121" height="94" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0phv8e5_di" bpmnElement="Activity_0phv8e5"> - <dc:Bounds x="959" y="74" width="121" height="94" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_013rjwc_di" bpmnElement="Activity_013rjwc"> - <dc:Bounds x="260" y="310" 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" /> </bpmndi:BPMNShape> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn index 5510dcde38..f1534a0360 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteSliceService.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_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.2"> +<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_1p1suc9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:process id="DoDeleteSliceServiceV1" name="DoDeleteSliceServiceV1" isExecutable="true"> <bpmn:startEvent id="StartEvent_1" name="start"> <bpmn:outgoing>SequenceFlow_0ep5het</bpmn:outgoing> @@ -34,9 +34,9 @@ ddss.getNSSIListFromAAI(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_0926ghe</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="EndEvent_0jaitqv" name="End"> - <bpmn:incoming>SequenceFlow_1c4fjbv</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1odnvjl</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_1c4fjbv" name="yes" sourceRef="ExclusiveGateway_1ogbunu" targetRef="EndEvent_0jaitqv"> + <bpmn:sequenceFlow id="SequenceFlow_1c4fjbv" name="yes" sourceRef="ExclusiveGateway_1ogbunu" targetRef="Task_10yni6k"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllNSSIFinished" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_0c58sw3" sourceRef="Task_1rc7mcw" targetRef="ScriptTask_159855t" /> @@ -68,14 +68,14 @@ ddss.parseNextNSSI(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_15z9iio" sourceRef="ScriptTask_159855t" targetRef="ExclusiveGateway_1ogbunu" /> <bpmn:sequenceFlow id="SequenceFlow_029u1wr" sourceRef="Task_13k9usx" targetRef="Task_1ujnqtj" /> - <bpmn:scriptTask id="Task_13k9usx" name="Query E2ESlice Serive From AAI" scriptFormat="groovy"> + <bpmn:scriptTask id="Task_13k9usx" name="Query ServiceProfile From AAI" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0npmman</bpmn:incoming> <bpmn:outgoing>SequenceFlow_029u1wr</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddss= new DoDeleteSliceService() -ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script> +ddss.queryServiceProfileFromAAI(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:callActivity id="Task_1rc7mcw" name="Do Deallocate NSSI " calledElement="DoDeallocateNSSIV1"> + <bpmn:callActivity id="Task_1rc7mcw" name="Do Deallocate NSSI" calledElement="DoDeallocateNSSIV1"> <bpmn:extensionElements> <camunda:in source="currentNSSI" target="currentNSSI" /> <camunda:in source="msoRequestId" target="msoRequestId" /> @@ -90,12 +90,20 @@ ddss.queryE2ESliceSeriveFromAAI(execution)</bpmn:script> <bpmn:incoming>SequenceFlow_1aa2ek0</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1252rbf</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dss= new DeleteSliceService() +def dss= new DoDeleteSliceService() dss.terminateNSIQuery(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_17tvomo" sourceRef="Task_1iomfas" targetRef="Task_1rc7mcw" /> <bpmn:sequenceFlow id="SequenceFlow_1aa2ek0" sourceRef="Task_1u755sr" targetRef="Task_1iuls9p" /> <bpmn:sequenceFlow id="SequenceFlow_1252rbf" sourceRef="Task_1iuls9p" targetRef="Task_1iomfas" /> + <bpmn:sequenceFlow id="SequenceFlow_1odnvjl" sourceRef="Task_10yni6k" targetRef="EndEvent_0jaitqv" /> + <bpmn:scriptTask id="Task_10yni6k" name="DeleteNSIFromAAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1c4fjbv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1odnvjl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def ddss= new DoDeleteSliceService() +ddss.deleteNSIInstance(execution)</bpmn:script> + </bpmn:scriptTask> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteSliceServiceV1"> @@ -138,9 +146,9 @@ dss.terminateNSIQuery(execution)</bpmn:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1c4fjbv_di" bpmnElement="SequenceFlow_1c4fjbv"> <di:waypoint x="1765" y="140" /> - <di:waypoint x="1802" y="140" /> + <di:waypoint x="1830" y="140" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1771" y="118" width="17" height="14" /> + <dc:Bounds x="1793" y="118" width="17" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1rgfzzy_di" bpmnElement="SequenceFlow_1rgfzzy"> @@ -177,9 +185,9 @@ dss.terminateNSIQuery(execution)</bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0jaitqv_di" bpmnElement="EndEvent_0jaitqv"> - <dc:Bounds x="1802" y="122" width="36" height="36" /> + <dc:Bounds x="2002" y="122" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1810" y="168" width="20" height="14" /> + <dc:Bounds x="2010" y="168" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0icszw6_di" bpmnElement="Task_0etki1p"> @@ -200,6 +208,13 @@ dss.terminateNSIQuery(execution)</bpmn:script> <bpmndi:BPMNShape id="Activity_1iuls9p_di" bpmnElement="Task_1iuls9p"> <dc:Bounds x="1050" y="100" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1odnvjl_di" bpmnElement="SequenceFlow_1odnvjl"> + <di:waypoint x="1930" y="140" /> + <di:waypoint x="2002" y="140" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1qk9lnm_di" bpmnElement="Task_10yni6k"> + <dc:Bounds x="1830" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn index d70bed68cb..2b122fb5e2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn @@ -30,7 +30,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoActivateTnNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Modified TN NSSI successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Modified TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0ziz3ti" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn deleted file mode 100644 index 4f12ca7f41..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn +++ /dev/null @@ -1,344 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns: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_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> - <bpmn:collaboration id="Collaboration_0htncd8"> - <bpmn:participant id="DoSendCommandToNSSMF01" name="DoSendCommandToNSSMF" processRef="DoSendCommandToNSSMF" /> - </bpmn:collaboration> - <bpmn:process id="DoSendCommandToNSSMF" name="DoSendCommandToNSSMF" isExecutable="true"> - <bpmn:scriptTask id="Task_0qx12sa" name="Get one NSSI info from list" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0umnozs</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1vuuuhr</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ea3pk8</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.getNSSIformlist(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_18qkm4u" name="Activation completed?"> - <bpmn:incoming>SequenceFlow_1yjsv5s</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1qxmooy</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1lh0it1</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0swcqw8</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:exclusiveGateway id="ExclusiveGateway_07yenxg" name="Get successful?"> - <bpmn:incoming>SequenceFlow_1ea3pk8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_080lgb0</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1oi86yc</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1vuuuhr" sourceRef="ServiceTask_0myj742" targetRef="Task_0qx12sa" /> - <bpmn:sequenceFlow id="SequenceFlow_1oeexsj" sourceRef="Task_1a9qxuo" targetRef="ServiceTask_0myj742" /> - <bpmn:sequenceFlow id="SequenceFlow_1ea3pk8" sourceRef="Task_0qx12sa" targetRef="ExclusiveGateway_07yenxg" /> - <bpmn:sequenceFlow id="SequenceFlow_1yjsv5s" sourceRef="Task_1y09kt4" targetRef="ExclusiveGateway_18qkm4u" /> - <bpmn:sequenceFlow id="SequenceFlow_0swcqw8" name="waitting" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_08qjojj"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "waitting"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1lh0it1" name="no" sourceRef="ExclusiveGateway_18qkm4u" targetRef="EndEvent_0k52g73"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1qxmooy" name="yes" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_1a9qxuo"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "true"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_080lgb0" name="yes" sourceRef="ExclusiveGateway_07yenxg" targetRef="CallActivity_0018jhc"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "true"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_08xfw41" sourceRef="Task_0xfp2r8" targetRef="ExclusiveGateway_0ljwjfh" /> - <bpmn:sequenceFlow id="SequenceFlow_1s2oozd" name="yes" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="Task_08qjojj"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "true"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_020xvv4" name="no" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="EndEvent_0k52g73"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_10162l8" sourceRef="Task_08qjojj" targetRef="Task_1y09kt4" /> - <bpmn:sequenceFlow id="SequenceFlow_1pfo460" sourceRef="StartEvent_1" targetRef="ScriptTask_1otgwej" /> - <bpmn:sequenceFlow id="SequenceFlow_1oi86yc" name="no" sourceRef="ExclusiveGateway_07yenxg" targetRef="EndEvent_0d1g3mv"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:endEvent id="EndEvent_0d1g3mv"> - <bpmn:incoming>SequenceFlow_1oi86yc</bpmn:incoming> - </bpmn:endEvent> - <bpmn:startEvent id="StartEvent_1"> - <bpmn:outgoing>SequenceFlow_1pfo460</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:scriptTask id="ScriptTask_1otgwej" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1pfo460</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0umnozs</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoSendCommandToNSSMF() -dcso.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> - <bpmn:startEvent id="StartEvent_0hmwdqq"> - <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1wd8iqk"> - <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> - <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> - <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.sendSyncError(execution)</bpmn:script> - </bpmn:scriptTask> - </bpmn:subProcess> - <bpmn:sequenceFlow id="SequenceFlow_0umnozs" sourceRef="ScriptTask_1otgwej" targetRef="Task_0qx12sa" /> - <bpmn:sequenceFlow id="SequenceFlow_1ucjcm1" sourceRef="CallActivity_0018jhc" targetRef="ScriptTask_0q7is68" /> - <bpmn:endEvent id="EndEvent_0k52g73"> - <bpmn:incoming>SequenceFlow_020xvv4</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1lh0it1</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0fypnen" errorRef="Error_08p7hsc" /> - </bpmn:endEvent> - <bpmn:scriptTask id="Task_08qjojj" name="wait for Return" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1s2oozd</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0swcqw8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_10162l8</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.WaitForReturn(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1y09kt4" name="Get the activation status" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_10162l8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1yjsv5s</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.GetTheStatusOfActivation(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0ljwjfh" name="Activation successful?"> - <bpmn:incoming>SequenceFlow_08xfw41</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1s2oozd</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_020xvv4</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:scriptTask id="Task_0xfp2r8" name="SendCommandToNssmf" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1a6iu8c</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_08xfw41</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.SendCommandToNssmf(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_0018jhc" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="nssiId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_080lgb0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ucjcm1</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0q7is68" name="processDecomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1ucjcm1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1a6iu8c</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.processDecomposition(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1a6iu8c" sourceRef="ScriptTask_0q7is68" targetRef="Task_0xfp2r8" /> - <bpmn:serviceTask id="ServiceTask_0myj742" name="Update Service Operation Status"> - <bpmn:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${CVFMI_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">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1oeexsj</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1vuuuhr</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:scriptTask id="Task_1a9qxuo" name="Update Index" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qxmooy</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1oeexsj</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.UpdateIndex(execution)</bpmn:script> - </bpmn:scriptTask> - </bpmn:process> - <bpmn:error id="Error_08p7hsc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> - <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="DoSendCommandToNSSMF01" isHorizontal="true"> - <dc:Bounds x="160" y="60" width="2080" height="1000" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> - <dc:Bounds x="1642" y="302" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="262" y="302" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> - <di:waypoint x="1120" y="860" /> - <di:waypoint x="1257" y="860" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> - <di:waypoint x="843" y="860" /> - <di:waypoint x="1020" y="860" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> - <dc:Bounds x="807" y="842" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> - <dc:Bounds x="1257" y="842" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0s82iw4_di" bpmnElement="Task_0xfp2r8"> - <dc:Bounds x="1230" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_18qkm4u_di" bpmnElement="ExclusiveGateway_18qkm4u" isMarkerVisible="true"> - <dc:Bounds x="835" y="595" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="832" y="558" width="55" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ea3pk8_di" bpmnElement="SequenceFlow_1ea3pk8"> - <di:waypoint x="770" y="320" /> - <di:waypoint x="815" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_08xfw41_di" bpmnElement="SequenceFlow_08xfw41"> - <di:waypoint x="1330" y="320" /> - <di:waypoint x="1415" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1yjsv5s_di" bpmnElement="SequenceFlow_1yjsv5s"> - <di:waypoint x="1390" y="620" /> - <di:waypoint x="885" y="620" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0ljwjfh_di" bpmnElement="ExclusiveGateway_0ljwjfh" isMarkerVisible="true"> - <dc:Bounds x="1415" y="295" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1412" y="265" width="60" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1s2oozd_di" bpmnElement="SequenceFlow_1s2oozd"> - <di:waypoint x="1440" y="345" /> - <di:waypoint x="1440" y="420" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1451" y="373" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0k52g73_di" bpmnElement="EndEvent_0k52g73"> - <dc:Bounds x="1532" y="302" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_020xvv4_di" bpmnElement="SequenceFlow_020xvv4"> - <di:waypoint x="1465" y="320" /> - <di:waypoint x="1532" y="320" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1494" y="302" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_121jfnq_di" bpmnElement="Task_0qx12sa"> - <dc:Bounds x="670" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_07yenxg_di" bpmnElement="ExclusiveGateway_07yenxg" isMarkerVisible="true"> - <dc:Bounds x="815" y="295" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="800" y="353" width="80" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_080lgb0_di" bpmnElement="SequenceFlow_080lgb0"> - <di:waypoint x="865" y="320" /> - <di:waypoint x="930" y="320" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="869" y="302" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_10162l8_di" bpmnElement="SequenceFlow_10162l8"> - <di:waypoint x="1440" y="500" /> - <di:waypoint x="1440" y="580" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qxmooy_di" bpmnElement="SequenceFlow_1qxmooy"> - <di:waypoint x="835" y="620" /> - <di:waypoint x="770" y="620" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="813" y="623" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0aspjme_di" bpmnElement="Task_1a9qxuo"> - <dc:Bounds x="670" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_170g0ll_di" bpmnElement="Task_08qjojj"> - <dc:Bounds x="1390" y="420" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1meh39q_di" bpmnElement="Task_1y09kt4"> - <dc:Bounds x="1390" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1lh0it1_di" bpmnElement="SequenceFlow_1lh0it1"> - <di:waypoint x="860" y="645" /> - <di:waypoint x="860" y="720" /> - <di:waypoint x="1550" y="720" /> - <di:waypoint x="1550" y="338" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1110" y="702" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0swcqw8_di" bpmnElement="SequenceFlow_0swcqw8"> - <di:waypoint x="860" y="595" /> - <di:waypoint x="860" y="460" /> - <di:waypoint x="1390" y="460" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1067" y="443" width="38" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1oeexsj_di" bpmnElement="SequenceFlow_1oeexsj"> - <di:waypoint x="720" y="580" /> - <di:waypoint x="720" y="520" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0myj742_di" bpmnElement="ServiceTask_0myj742"> - <dc:Bounds x="670" y="440" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vuuuhr_di" bpmnElement="SequenceFlow_1vuuuhr"> - <di:waypoint x="720" y="440" /> - <di:waypoint x="720" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1pfo460_di" bpmnElement="SequenceFlow_1pfo460"> - <di:waypoint x="298" y="320" /> - <di:waypoint x="420" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1oi86yc_di" bpmnElement="SequenceFlow_1oi86yc"> - <di:waypoint x="840" y="295" /> - <di:waypoint x="840" y="230" /> - <di:waypoint x="1660" y="230" /> - <di:waypoint x="1660" y="302" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="884" y="212" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1otgwej_di" bpmnElement="ScriptTask_1otgwej"> - <dc:Bounds x="420" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_1hlwd77_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> - <dc:Bounds x="700" y="780" width="810" height="180" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1c5l0io_di" bpmnElement="Task_01ooik6"> - <dc:Bounds x="1020" y="820" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0umnozs_di" bpmnElement="SequenceFlow_0umnozs"> - <di:waypoint x="520" y="320" /> - <di:waypoint x="670" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0018jhc_di" bpmnElement="CallActivity_0018jhc"> - <dc:Bounds x="930" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ucjcm1_di" bpmnElement="SequenceFlow_1ucjcm1"> - <di:waypoint x="1030" y="320" /> - <di:waypoint x="1070" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0q7is68_di" bpmnElement="ScriptTask_0q7is68"> - <dc:Bounds x="1070" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1a6iu8c_di" bpmnElement="SequenceFlow_1a6iu8c"> - <di:waypoint x="1170" y="320" /> - <di:waypoint x="1230" y="320" /> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java index 4322ff5bdf..7da3a2c81b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java @@ -145,7 +145,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { assertThat(pi).isEnded().hasPassedInOrder("Event_02mc8tr", "Activity_18vue7u", "Activity_09bqns0", "Activity_02vp5np", "Activity_0n17xou", "Gateway_1nr51kr", "Activity_0snmatn", "Activity_0e6w886", "Activity_1q4o9fx", "Gateway_02fectw", "Activity_1hp67qz", "Gateway_18ch73t", "Activity_0ft7fa2", - "Gateway_1vq11i7", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); + "Gateway_1vq11i7", "Activity_0o2rrag", "Activity_1n4rk7m", "Activity_1lz38px", "Event_12983th"); List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages(); assertThat(detailedMessages.size() == 5); @@ -205,7 +205,7 @@ public class ServiceLevelUpgradeTest extends BaseBPMNTest { private void mockAai() { final String sIUrl = - "/business/customers/customer/5df8b6de-2083-11e7-93ae-92361f002676/service-subscriptions/service-subscription/pNF/service-instances/service-instance/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce"; + "/business/customers/customer/ETE_Customer_807c7a02-249c-4db8-9fa9-bee973fe08ce/service-subscriptions/service-subscription/pNF/service-instances/service-instance/5df8b6de-2083-11e7-93ae-92361f002676"; final String aaiPnfDemoEntry = FileUtil.readResourceFile("response/PnfDemo_aai.json"); final String aaiPnfDemo1Entry = FileUtil.readResourceFile("response/PnfDemo1_aai.json"); final String aaiServiceInstanceEntry = FileUtil.readResourceFile("response/Service_instance_aai.json"); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterDeleteTasks.java new file mode 100644 index 0000000000..87466bbbd4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterDeleteTasks.java @@ -0,0 +1,66 @@ +/*- + * ============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 org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.adapter.cnf.CnfAdapterClient; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class CnfAdapterDeleteTasks { + private static final Logger logger = LoggerFactory.getLogger(CnfAdapterDeleteTasks.class); + + @Autowired + private ExtractPojosForBB extractPojosForBB; + @Autowired + private ExceptionBuilder exceptionUtil; + @Autowired + private CnfAdapterClient cnfAdapterClient; + + /** + * This method is used for deleting the instance with Multicloud K8s Plugin. + * + * @param execution + * @return + */ + public void deleteInstance(BuildingBlockExecution execution) { + try { + logger.debug("Running delete instance - Helm"); + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + String heatStackId = vfModule.getHeatStackId(); + execution.setVariable("heatStackId", heatStackId); + cnfAdapterClient.deleteVfModule(heatStackId); + } catch (Exception ex) { + logger.error("Exception occurred", ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/AaiResourceIdValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/AaiResourceIdValidator.java new file mode 100644 index 0000000000..6d90070b96 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/AaiResourceIdValidator.java @@ -0,0 +1,220 @@ +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import java.util.Map; +import java.util.Optional; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +@Component +public class AaiResourceIdValidator { + + private static final Logger LOGGER = LoggerFactory.getLogger(AaiResourceIdValidator.class); + + private static final String SERVICE_INSTANCE = "serviceInstance"; + private static final String NAME_EXISTS_WITH_DIFF_VERSION_ID = "(%s) and different version id (%s)"; + private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = + "WorkflowAction was unable to verify if the instance name already exist in AAI."; + private static final String NAME_EXISTS_MULTIPLE = + "(%s) and multiple combination of model-version-id + service-type + global-customer-id"; + private static final String NAME_EXISTS_WITH_DIFF_COMBINATION = + "(%s) and global-customer-id (%s), service-type (%s), model-version-id (%s)"; + private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID = + "(%s), same parent and different customization id (%s)"; + private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship"; + + + private final BBInputSetupUtils bbInputSetupUtils; + + public AaiResourceIdValidator(BBInputSetupUtils bbInputSetupUtils) { + this.bbInputSetupUtils = bbInputSetupUtils; + } + + protected String validateResourceIdInAAI(String generatedResourceId, WorkflowType type, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws Exception { + try { + if ("SERVICE".equalsIgnoreCase(type.toString())) { + return validateServiceResourceIdInAAI(generatedResourceId, instanceName, reqDetails); + } else if ("NETWORK".equalsIgnoreCase(type.toString())) { + return validateNetworkResourceIdInAAI(generatedResourceId, instanceName, reqDetails, + workflowResourceIds); + } else if ("VNF".equalsIgnoreCase(type.toString())) { + return validateVnfResourceIdInAAI(generatedResourceId, instanceName, reqDetails, workflowResourceIds); + } else if ("VFMODULE".equalsIgnoreCase(type.toString())) { + return validateVfModuleResourceIdInAAI(generatedResourceId, instanceName, reqDetails, + workflowResourceIds); + } else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) { + return validateVolumeGroupResourceIdInAAI(generatedResourceId, instanceName, reqDetails, + workflowResourceIds); + } else if ("CONFIGURATION".equalsIgnoreCase(type.toString())) { + return validateConfigurationResourceIdInAAI(generatedResourceId, instanceName, reqDetails, + workflowResourceIds); + } + return generatedResourceId; + } catch (DuplicateNameException dne) { + throw dne; + } catch (Exception ex) { + LOGGER.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex); + throw new IllegalStateException( + WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI); + } + } + + protected String validateServiceResourceIdInAAI(String generatedResourceId, String instanceName, + RequestDetails reqDetails) throws DuplicateNameException { + String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId(); + String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType(); + if (instanceName != null) { + Optional<ServiceInstance> serviceInstanceAAI = + bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName); + if (serviceInstanceAAI.isPresent()) { + if (serviceInstanceAAI.get().getModelVersionId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) { + return serviceInstanceAAI.get().getServiceInstanceId(); + } else { + throw new DuplicateNameException(SERVICE_INSTANCE, String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, + instanceName, reqDetails.getModelInfo().getModelVersionId())); + } + } else { + ServiceInstances aaiServiceInstances = + bbInputSetupUtils.getAAIServiceInstancesGloballyByName(instanceName); + if (aaiServiceInstances != null) { + if (aaiServiceInstances.getServiceInstance() != null + && !aaiServiceInstances.getServiceInstance().isEmpty()) { + if (aaiServiceInstances.getServiceInstance().size() > 1) { + throw new DuplicateNameException(SERVICE_INSTANCE, + String.format(NAME_EXISTS_MULTIPLE, instanceName)); + } else { + ServiceInstance si = aaiServiceInstances.getServiceInstance().stream().findFirst().get(); + Map<String, String> keys = + bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId()); + + throw new DuplicateNameException(SERVICE_INSTANCE, String.format( + NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName, + keys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId), + keys.get( + AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType), + si.getModelVersionId())); + } + } + } + } + } + return generatedResourceId; + } + + protected String validateNetworkResourceIdInAAI(String generatedResourceId, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) + throws DuplicateNameException, MultipleObjectsFoundException { + Optional<L3Network> network = bbInputSetupUtils + .getRelatedNetworkByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName); + if (network.isPresent()) { + if (network.get().getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return network.get().getNetworkId(); + } else { + throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, + instanceName, network.get().getModelCustomizationId())); + } + } + if (bbInputSetupUtils.existsAAINetworksGloballyByName(instanceName)) { + throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName, + workflowResourceIds.getServiceInstanceId())); + } + return generatedResourceId; + } + + protected String validateVnfResourceIdInAAI(String generatedResourceId, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { + Optional<GenericVnf> vnf = bbInputSetupUtils + .getRelatedVnfByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName); + if (vnf.isPresent()) { + if (vnf.get().getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return vnf.get().getVnfId(); + } else { + throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, + instanceName, vnf.get().getModelCustomizationId())); + } + } + GenericVnfs vnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(instanceName); + if (vnfs != null) { + throw new DuplicateNameException("generic-vnf", + String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName, vnfs.getGenericVnf().get(0).getVnfId())); + } + return generatedResourceId; + } + + protected String validateVfModuleResourceIdInAAI(String generatedResourceId, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { + GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); + if (vnf != null && vnf.getVfModules() != null) { + for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { + if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { + if (vfModule.getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return vfModule.getVfModuleId(); + } else { + throw new DuplicateNameException("vfModule", + String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, + reqDetails.getModelInfo().getModelCustomizationId())); + } + } + } + } + if (bbInputSetupUtils.existsAAIVfModuleGloballyByName(instanceName)) { + throw new DuplicateNameException("vfModule", instanceName); + } + return generatedResourceId; + } + + protected String validateVolumeGroupResourceIdInAAI(String generatedResourceId, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { + Optional<VolumeGroup> volumeGroup = + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName); + if (volumeGroup.isPresent()) { + if (volumeGroup.get().getVfModuleModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return volumeGroup.get().getVolumeGroupId(); + } else { + throw new DuplicateNameException("volumeGroup", volumeGroup.get().getVolumeGroupName()); + } + } + if (bbInputSetupUtils.existsAAIVolumeGroupGloballyByName(instanceName)) { + throw new DuplicateNameException("volumeGroup", instanceName); + } + return generatedResourceId; + } + + protected String validateConfigurationResourceIdInAAI(String generatedResourceId, String instanceName, + RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { + Optional<org.onap.aai.domain.yang.Configuration> configuration = + bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance( + workflowResourceIds.getServiceInstanceId(), instanceName); + if (configuration.isPresent()) { + if (configuration.get().getModelCustomizationId() + .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { + return configuration.get().getConfigurationId(); + } else { + throw new DuplicateNameException("configuration", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, + instanceName, configuration.get().getConfigurationId())); + } + } + if (bbInputSetupUtils.existsAAIConfigurationGloballyByName(instanceName)) { + throw new DuplicateNameException("configuration", instanceName); + } + return generatedResourceId; + } +} 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 new file mode 100644 index 0000000000..b8699838e2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java @@ -0,0 +1,217 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2021 Nokia + * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ + * 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.workflow.tasks; + +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.macro.OrchestrationFlow; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import java.util.stream.Collectors; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONFIGURATION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.VOLUMEGROUP; + +@Component +public class ExecuteBuildingBlockBuilder { + + private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockBuilder.class); + + private static final String VNF = "Vnf"; + private static final String PNF = "Pnf"; + private static final String VFMODULE = "VfModule"; + private static final String NETWORK = "Network"; + + protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, + List<Resource> resourceList, String requestId, String apiVersion, String resourceId, String requestAction, + String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, + boolean replaceVnf) { + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + for (OrchestrationFlow orchFlow : orchFlows) { + if (orchFlow.getFlowName().contains(SERVICE)) { + if (!replaceVnf) { + workflowResourceIds.setServiceInstanceId(resourceId); + } + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.SERVICE, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + } else if (orchFlow.getFlowName().contains(VNF) || (orchFlow.getFlowName().contains(CONTROLLER) + && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, 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, resourceList, WorkflowType.PNF, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + } else if (orchFlow.getFlowName().contains(NETWORK) + && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORK, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VIRTUAL_LINK, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + true, false); + } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER) + && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) { + List<Resource> vfModuleResourcesSorted; + if (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGNINSTANCE) + || requestAction.equals("activateInstance")) { + vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceList.stream() + .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); + } else { + vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream() + .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); + } + for (Resource resource : vfModuleResourcesSorted) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, + requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, + false, null)); + } + } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { + if (requestAction.equalsIgnoreCase(REPLACEINSTANCE) + || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) { + logger.debug("Replacing workflow resource id by volume group id"); + resourceId = workflowResourceIds.getVolumeGroupId(); + } + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VOLUMEGROUP, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + false, false); + } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORKCOLLECTION, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + false, false); + } else if (orchFlow.getFlowName().contains(CONFIGURATION)) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.CONFIGURATION, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + false, true); + } else { + flowsToExecute + .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction, + false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null)); + } + } + return flowsToExecute; + } + + protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, + Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, + String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, + boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration, + ReplaceInstanceRelatedInformation replaceInfo) { + + BuildingBlock buildingBlock = + new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString()) + .setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey) + .setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse("")); + Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction); + Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope); + String oldVolumeGroupName = ""; + if (replaceInfo != null) { + oldVolumeGroupName = replaceInfo.getOldVolumeGroupName(); + } + if (resource != null + && (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE) + || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) { + logger.debug("Setting resourceId to volume group id for volume group flow on replace"); + resourceId = workflowResourceIds.getVolumeGroupId(); + } + + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion) + .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType) + .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock) + .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName); + + if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) { + ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName); + executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys); + } + return executeBuildingBlock; + } + + protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) { + int count = 0; + for (Resource resource : vfModuleResources) { + if (resource.isBaseVfModule()) { + Collections.swap(vfModuleResources, 0, count); + break; + } + count++; + } + return vfModuleResources; + } + + protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) { + int count = 0; + for (Resource resource : vfModuleResources) { + if (resource.isBaseVfModule()) { + Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count); + break; + } + count++; + } + return vfModuleResources; + } + + private void addBuildingBlockToExecuteBBList(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList, + WorkflowType workflowType, OrchestrationFlow orchFlow, String requestId, String apiVersion, + String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds, + RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) { + + resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType)) + .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, + apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails, + isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null))); + } + + private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) { + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName); + configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId()); + configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId()); + configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId()); + return configurationResourceKeys; + } + + +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java new file mode 100644 index 0000000000..3556cc024c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java @@ -0,0 +1,232 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ + * 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.workflow.tasks; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +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.Networks; +import org.onap.so.serviceinstancebeans.Pnfs; +import org.onap.so.serviceinstancebeans.Service; +import org.onap.so.serviceinstancebeans.VfModules; +import org.onap.so.serviceinstancebeans.Vnfs; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE; + +@Component +public class UserParamsServiceTraversal { + + private static final Logger logger = LoggerFactory.getLogger(UserParamsServiceTraversal.class); + + private final CatalogDbClient catalogDbClient; + private final ExceptionBuilder exceptionBuilder; + + UserParamsServiceTraversal(CatalogDbClient catalogDbClient, ExceptionBuilder exceptionBuilder) { + this.catalogDbClient = catalogDbClient; + this.exceptionBuilder = exceptionBuilder; + } + + protected List<Resource> getResourceListFromUserParams(DelegateExecution execution, + List<Map<String, Object>> userParams, String serviceModelVersionId, String requestAction) + throws IOException { + List<Resource> resourceList = new ArrayList<>(); + boolean foundVfModuleOrVG = false; + String vnfCustomizationUUID = ""; + String vfModuleCustomizationUUID = ""; + if (userParams != null) { + for (Map<String, Object> params : userParams) { + if (params.containsKey(USER_PARAM_SERVICE)) { + ObjectMapper obj = new ObjectMapper(); + String input = obj.writeValueAsString(params.get(USER_PARAM_SERVICE)); + Service validate = obj.readValue(input, Service.class); + resourceList.add( + new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false)); + if (validate.getResources().getVnfs() != null) { + for (Vnfs vnf : validate.getResources().getVnfs()) { + resourceList.add(new Resource(WorkflowType.VNF, + vnf.getModelInfo().getModelCustomizationId(), false)); + if (vnf.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) { + vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid(); + } + if (vnf.getVfModules() != null) { + for (VfModules vfModule : vnf.getVfModules()) { + VfModuleCustomization vfModuleCustomization = + catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID( + vfModule.getModelInfo().getModelCustomizationUuid()); + if (vfModuleCustomization != null) { + + if (vfModuleCustomization.getVfModule() != null + && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null + && vfModuleCustomization.getVolumeHeatEnv() != null) { + resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, + vfModuleCustomization.getModelCustomizationUUID(), false)); + foundVfModuleOrVG = true; + } + + if ((vfModuleCustomization.getVfModule() != null) + && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null + && vfModuleCustomization.getHeatEnvironment() != null)) + || (vfModuleCustomization.getVfModule().getModelName() != null + && vfModuleCustomization.getVfModule().getModelName() + .contains("helm"))) { + foundVfModuleOrVG = true; + Resource resource = new Resource(WorkflowType.VFMODULE, + vfModuleCustomization.getModelCustomizationUUID(), false); + resource.setBaseVfModule( + vfModuleCustomization.getVfModule().getIsBase() != null + && vfModuleCustomization.getVfModule().getIsBase()); + resourceList.add(resource); + if (vfModule.getModelInfo() != null + && vfModule.getModelInfo().getModelCustomizationUuid() != null) { + vfModuleCustomizationUUID = + vfModule.getModelInfo().getModelCustomizationUuid(); + } + if (!vnfCustomizationUUID.isEmpty() + && !vfModuleCustomizationUUID.isEmpty()) { + List<CvnfcConfigurationCustomization> configs = + traverseCatalogDbForConfiguration( + validate.getModelInfo().getModelVersionId(), + vnfCustomizationUUID, vfModuleCustomizationUUID); + for (CvnfcConfigurationCustomization config : configs) { + Resource configResource = new Resource(WorkflowType.CONFIGURATION, + config.getConfigurationResource().getModelUUID(), false); + resource.setVnfCustomizationId( + vnf.getModelInfo().getModelCustomizationId()); + resource.setVfModuleCustomizationId( + vfModule.getModelInfo().getModelCustomizationId()); + resourceList.add(configResource); + } + } + } + if (!foundVfModuleOrVG) { + buildAndThrowException(execution, + "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); + } + } + } + } + } + } + if (validate.getResources().getPnfs() != null) { + for (Pnfs pnf : validate.getResources().getPnfs()) { + resourceList.add(new Resource(WorkflowType.PNF, + pnf.getModelInfo().getModelCustomizationId(), false)); + } + } + if (validate.getResources().getNetworks() != null) { + for (Networks network : validate.getResources().getNetworks()) { + resourceList.add(new Resource(WorkflowType.NETWORK, + network.getModelInfo().getModelCustomizationId(), false)); + } + if (requestAction.equals(CREATE_INSTANCE)) { + String networkColCustId = + queryCatalogDbForNetworkCollection(execution, serviceModelVersionId); + if (networkColCustId != null) { + resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false)); + } + } + } + break; + } + } + } + return resourceList; + } + + + private List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID, + String vnfCustomizationUUID, String vfModuleCustomizationUUID) { + List<CvnfcConfigurationCustomization> configurations = new ArrayList<>(); + try { + List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID, + vnfCustomizationUUID, vfModuleCustomizationUUID); + for (CvnfcCustomization cvnfc : cvnfcCustomizations) { + for (CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()) { + if (customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { + configurations.add(customization); + } + } + } + logger.debug("found {} fabric configuration(s)", configurations.size()); + return configurations; + } catch (Exception ex) { + logger.error("Error in finding configurations", ex); + return configurations; + } + } + + private String queryCatalogDbForNetworkCollection(DelegateExecution execution, String serviceModelVersionId) { + org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(serviceModelVersionId); + if (service != null) { + CollectionResourceCustomization networkCollection = this.findCatalogNetworkCollection(execution, service); + if (networkCollection != null) { + return networkCollection.getModelCustomizationUUID(); + } + } + return null; + } + + private CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution, + org.onap.so.db.catalog.beans.Service service) { + CollectionResourceCustomization networkCollection = null; + int count = 0; + for (CollectionResourceCustomization collectionCustom : service.getCollectionResourceCustomizations()) { + if (catalogDbClient.getNetworkCollectionResourceCustomizationByID( + collectionCustom.getModelCustomizationUUID()) != null) { + networkCollection = collectionCustom; + count++; + } + } + if (count == 0) { + return null; + } else if (count > 1) { + buildAndThrowException(execution, + "Found multiple Network Collections in the Service model, only one per Service is supported."); + } + return networkCollection; + } + + private void buildAndThrowException(DelegateExecution execution, String msg) { + logger.error(msg); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } +} 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 5d95f973bf..aad8b51a48 100644 --- 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 @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Modifications Copyright (c) 2020 Nokia + * Modifications Copyright (c) 2021 Nokia * ================================================================================ * Modifications Copyright (c) 2020 Tech Mahindra * ================================================================================ @@ -26,27 +26,13 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.UUID; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.commons.lang3.SerializationUtils; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.javatuples.Pair; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.GenericVnfs; -import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; @@ -62,22 +48,17 @@ import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; -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.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; -import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; -import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.MultipleObjectsFoundException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIEntityNotFoundException; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; -import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; -import org.onap.so.db.catalog.beans.CvnfcCustomization; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; @@ -86,68 +67,56 @@ import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; -import org.onap.so.serviceinstancebeans.Networks; -import org.onap.so.serviceinstancebeans.Pnfs; import org.onap.so.serviceinstancebeans.RelatedInstance; import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestDetails; -import org.onap.so.serviceinstancebeans.Service; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; -import org.onap.so.serviceinstancebeans.VfModules; -import org.onap.so.serviceinstancebeans.Vnfs; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE; +import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE; @Component public class WorkflowAction { - private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; + private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); + private static final String SERVICE_INSTANCES = "serviceInstances"; - private static final String SERVICE_INSTANCE = "serviceInstance"; private static final String VF_MODULES = "vfModules"; - private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = - "WorkflowAction was unable to verify if the instance name already exist in AAI."; private static final String VNF_TYPE = "vnfType"; - private static final String SERVICE = "Service"; - private static final String VNF = "Vnf"; - private static final String PNF = "Pnf"; - private static final String VFMODULE = "VfModule"; - private static final String VOLUMEGROUP = "VolumeGroup"; - private static final String NETWORK = "Network"; - private static final String NETWORKCOLLECTION = "NetworkCollection"; private static final String CONFIGURATION = "Configuration"; - private static final String ASSIGNINSTANCE = "assignInstance"; - private static final String CREATEINSTANCE = "createInstance"; - private static final String REPLACEINSTANCE = "replaceInstance"; - private static final String REPLACEINSTANCERETAINASSIGNMENTS = "replaceInstanceRetainAssignments"; - private static final String USERPARAMSERVICE = "service"; private static final String SUPPORTEDTYPES = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups"; private static final String HOMINGSOLUTION = "Homing_Solution"; - private static final String FABRIC_CONFIGURATION = "FabricConfiguration"; private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT"; private static final String SERVICE_TYPE_BONDING = "BONDING"; private static final String CLOUD_OWNER = "DEFAULT"; - private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); - private static final String NAME_EXISTS_WITH_DIFF_VERSION_ID = "(%s) and different version id (%s)"; - private static final String NAME_EXISTS_MULTIPLE = - "(%s) and multiple combination of model-version-id + service-type + global-customer-id"; - private static final String NAME_EXISTS_WITH_DIFF_COMBINATION = - "(%s) and global-customer-id (%s), service-type (%s), model-version-id (%s)"; - private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID = - "(%s), same parent and different customization id (%s)"; - private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship"; private static final String CREATENETWORKBB = "CreateNetworkBB"; private static final String ACTIVATENETWORKBB = "ActivateNetworkBB"; private static final String VOLUMEGROUP_DELETE_PATTERN = "(Un|De)(.*)Volume(.*)"; private static final String VOLUMEGROUP_CREATE_PATTERN = "(A|C)(.*)Volume(.*)"; - private static final String CONTROLLER = "Controller"; private static final String DEFAULT_CLOUD_OWNER = "org.onap.so.cloud-owner"; private static final String HOMING = "homing"; @@ -167,6 +136,12 @@ public class WorkflowAction { private VrfValidation vrfValidation; @Autowired private Environment environment; + @Autowired + private UserParamsServiceTraversal userParamsServiceTraversal; + @Autowired + private AaiResourceIdValidator aaiResourceIdValidator; + @Autowired + private ExecuteBuildingBlockBuilder executeBuildingBlockBuilder; public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -238,7 +213,7 @@ public class WorkflowAction { requestDetails, requestAction, resourceId, flowsToExecute, vnfType, orchFlows, apiVersion, resourceKey, replaceInfo); } else { - if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) { + if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATE_INSTANCE)) { addConfigBuildingBlocksToFlowsToExecuteList(execution, sIRequest, requestId, workflowResourceIds, requestDetails, requestAction, resourceId, flowsToExecute, vnfType, apiVersion, resourceKey, replaceInfo, orchFlows); @@ -248,43 +223,48 @@ public class WorkflowAction { .collect(Collectors.toList()); for (OrchestrationFlow orchFlow : orchFlows) { - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, - apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, - requestDetails, false, null, null, false, replaceInfo); + ExecuteBuildingBlock ebb = executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, + requestId, resourceKey, apiVersion, resourceId, requestAction, true, vnfType, + workflowResourceIds, requestDetails, false, null, null, false, replaceInfo); flowsToExecute.add(ebb); } } } else { - boolean foundRelated = false; boolean containsService = false; List<Resource> resourceList = new ArrayList<>(); List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); + List<Map<String, Object>> userParams = + sIRequest.getRequestDetails().getRequestParameters().getUserParams(); if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) { // SERVICE-MACRO-ASSIGN will always get user params with a // service. - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + + if (userParams != null) { containsService = isContainsService(sIRequest); if (containsService) { - traverseUserParamsService(execution, resourceList, sIRequest, requestAction); + resourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, + userParams, serviceInstanceId, requestAction); } } else { buildAndThrowException(execution, "Service-Macro-Assign request details must contain user params with a service"); } - } else if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(CREATEINSTANCE)) { + } else if (resourceType == WorkflowType.SERVICE + && requestAction.equalsIgnoreCase(CREATE_INSTANCE)) { // SERVICE-MACRO-CREATE will get user params with a service, // a service with a network, a service with a - // networkcollection, OR an empty service. + // network collection, OR an empty service. // If user params is just a service or null and macro // queries the SI and finds a VNF, macro fails. - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { + if (userParams != null) { containsService = isContainsService(sIRequest); } if (containsService) { - foundRelated = traverseUserParamsService(execution, resourceList, sIRequest, requestAction); + resourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, + userParams, serviceInstanceId, requestAction); } - if (!foundRelated) { + if (!foundRelated(resourceList)) { traverseCatalogDbService(execution, sIRequest, resourceList, aaiResourceIds); } } else if (resourceType == WorkflowType.SERVICE @@ -327,21 +307,22 @@ public class WorkflowAction { || REPLACEINSTANCERETAINASSIGNMENTS.equalsIgnoreCase(requestAction))) { vnfReplace = true; } - flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceList, requestId, apiVersion, - resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace); + flowsToExecute = executeBuildingBlockBuilder.buildExecuteBuildingBlockList(orchFlows, resourceList, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, + requestDetails, vnfReplace); if (isNetworkCollectionInTheResourceList(resourceList)) { logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); } - // By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE + // By default, enable homing at VNF level for CREATE_INSTANCE and ASSIGNINSTANCE if (resourceType == WorkflowType.SERVICE - && (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)) + && (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGNINSTANCE)) && resourceList.stream().anyMatch(x -> WorkflowType.VNF.equals(x.getResourceType()))) { execution.setVariable(HOMING, true); execution.setVariable("calledHoming", false); } if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) - || requestAction.equalsIgnoreCase(CREATEINSTANCE))) { + || requestAction.equalsIgnoreCase(CREATE_INSTANCE))) { generateResourceIds(flowsToExecute, resourceList, serviceInstanceId); } else { updateResourceIdsFromAAITraversal(flowsToExecute, resourceList, aaiResourceIds, @@ -351,9 +332,8 @@ public class WorkflowAction { } // If the user set "Homing_Solution" to "none", disable homing, else if "Homing_Solution" is specified, // enable it. - if (sIRequest.getRequestDetails().getRequestParameters() != null - && sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { - List<Map<String, Object>> userParams = getListOfUserParams(sIRequest); + List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + if (sIRequest.getRequestDetails().getRequestParameters() != null && userParams != null) { for (Map<String, Object> params : userParams) { if (params.containsKey(HOMINGSOLUTION)) { execution.setVariable(HOMING, !"none".equals(params.get(HOMINGSOLUTION))); @@ -400,14 +380,12 @@ public class WorkflowAction { private boolean isContainsService(ServiceInstancesRequest sIRequest) { boolean containsService; - List<Map<String, Object>> userParams = getListOfUserParams(sIRequest); - containsService = userParams.stream().anyMatch(param -> param.containsKey(USERPARAMSERVICE)); + List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams(); + containsService = userParams.stream().anyMatch(param -> param.containsKey(USER_PARAM_SERVICE)); return containsService; } - private List<Map<String, Object>> getListOfUserParams(ServiceInstancesRequest sIRequest) { - return sIRequest.getRequestDetails().getRequestParameters().getUserParams(); - } + private List<ExecuteBuildingBlock> loadExecuteBuildingBlocks(DelegateExecution execution, String requestId, String errorMessage) { @@ -446,9 +424,9 @@ public class WorkflowAction { requestDetails, requestAction, resourceId, flowsToExecute, vnfType, apiVersion, resourceKey, replaceInfo, configOrchFlows); } else { - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, - resourceId, requestAction, true, vnfType, workflowResourceIds, requestDetails, false, null, - null, false, replaceInfo); + ExecuteBuildingBlock ebb = executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, requestId, + resourceKey, apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, + requestDetails, false, null, null, false, replaceInfo); flowsToExecute.add(ebb); } } @@ -596,35 +574,50 @@ public class WorkflowAction { } workflowIdsCopy.setConfigurationId(configuration.getConfigurationId()); for (OrchestrationFlow orchFlow : result) { - if (!isReplace) { - dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID); - dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID); - } else { - if (orchFlow.getFlowName().contains("Delete")) { + if (!isReplace || (isReplace && (orchFlow.getFlowName().contains("Delete")))) { + if (!isReplace) { dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID); dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID); } else { - dataObj.getResourceKey().setVfModuleCustomizationId(replaceVfModuleCustomizationUUID); - dataObj.getResourceKey().setVnfCustomizationId(replaceVnfModuleCustomizationUUID); + if (orchFlow.getFlowName().contains("Delete")) { + dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID); + dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID); + } else { + dataObj.getResourceKey().setVfModuleCustomizationId(replaceVfModuleCustomizationUUID); + dataObj.getResourceKey().setVnfCustomizationId(replaceVnfModuleCustomizationUUID); + } } + dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId()); + String vnfcName = vnfc.getVnfcName(); + if (vnfcName == null || vnfcName.isEmpty()) { + buildAndThrowException(dataObj.getExecution(), "Exception in create execution list " + + ": VnfcName does not exist or is null while there is a configuration for the vfModule", + new Exception("Vnfc and Configuration do not match")); + } + ExecuteBuildingBlock ebb = + executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), + dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(), + dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), + workflowIdsCopy, dataObj.getRequestDetails(), false, null, vnfcName, true, null); + flowsToExecuteConfigs.add(ebb); } - dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId()); - String vnfcName = vnfc.getVnfcName(); - if (vnfcName == null || vnfcName.isEmpty()) { - buildAndThrowException(dataObj.getExecution(), "Exception in create execution list " - + ": VnfcName does not exist or is null while there is a configuration for the vfModule", - new Exception("Vnfc and Configuration do not match")); - } - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), - dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(), - dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), workflowIdsCopy, - dataObj.getRequestDetails(), false, null, vnfcName, true, null); - flowsToExecuteConfigs.add(ebb); } } return flowsToExecuteConfigs; } + protected void buildAndThrowException(DelegateExecution execution, String msg) { + logger.error(msg); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); + } + + protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { + logger.error(msg, ex); + execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg + ex.getMessage()); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg + ex.getMessage()); + } + protected List<OrchestrationFlow> getVfModuleReplaceBuildingBlocks(ConfigBuildingBlocksDataObject dataObj) throws Exception { @@ -687,29 +680,7 @@ public class WorkflowAction { return orchFlows; } - protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) { - int count = 0; - for (Resource resource : vfModuleResources) { - if (resource.isBaseVfModule()) { - Collections.swap(vfModuleResources, 0, count); - break; - } - count++; - } - return vfModuleResources; - } - protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) { - int count = 0; - for (Resource resource : vfModuleResources) { - if (resource.isBaseVfModule()) { - Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count); - break; - } - count++; - } - return vfModuleResources; - } private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) { @@ -1214,150 +1185,6 @@ public class WorkflowAction { } } - protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceList, - ServiceInstancesRequest sIRequest, String requestAction) throws IOException { - boolean foundRelated = false; - boolean foundVfModuleOrVG = false; - String vnfCustomizationUUID = ""; - String vfModuleCustomizationUUID = ""; - if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) { - List<Map<String, Object>> userParams = getListOfUserParams(sIRequest); - for (Map<String, Object> params : userParams) { - if (params.containsKey(USERPARAMSERVICE)) { - ObjectMapper obj = new ObjectMapper(); - String input = obj.writeValueAsString(params.get(USERPARAMSERVICE)); - Service validate = obj.readValue(input, Service.class); - resourceList.add( - new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false)); - if (validate.getResources().getVnfs() != null) { - for (Vnfs vnf : validate.getResources().getVnfs()) { - resourceList.add(new Resource(WorkflowType.VNF, - vnf.getModelInfo().getModelCustomizationId(), false)); - foundRelated = true; - if (vnf.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) { - vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid(); - } - if (vnf.getVfModules() != null) { - for (VfModules vfModule : vnf.getVfModules()) { - VfModuleCustomization vfModuleCustomization = - catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID( - vfModule.getModelInfo().getModelCustomizationUuid()); - if (vfModuleCustomization != null) { - - if (vfModuleCustomization.getVfModule() != null - && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null - && vfModuleCustomization.getVolumeHeatEnv() != null) { - resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, - vfModuleCustomization.getModelCustomizationUUID(), false)); - foundVfModuleOrVG = true; - } - - if ((vfModuleCustomization.getVfModule() != null) - && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null - && vfModuleCustomization.getHeatEnvironment() != null)) - || (vfModuleCustomization.getVfModule().getModelName() != null - && vfModuleCustomization.getVfModule().getModelName() - .contains("helm"))) { - foundVfModuleOrVG = true; - Resource resource = new Resource(WorkflowType.VFMODULE, - vfModuleCustomization.getModelCustomizationUUID(), false); - resource.setBaseVfModule( - vfModuleCustomization.getVfModule().getIsBase() != null - && vfModuleCustomization.getVfModule().getIsBase()); - resourceList.add(resource); - if (vfModule.getModelInfo() != null - && vfModule.getModelInfo().getModelCustomizationUuid() != null) { - vfModuleCustomizationUUID = - vfModule.getModelInfo().getModelCustomizationUuid(); - } - if (!vnfCustomizationUUID.isEmpty() - && !vfModuleCustomizationUUID.isEmpty()) { - List<CvnfcConfigurationCustomization> configs = - traverseCatalogDbForConfiguration( - validate.getModelInfo().getModelVersionId(), - vnfCustomizationUUID, vfModuleCustomizationUUID); - for (CvnfcConfigurationCustomization config : configs) { - Resource configResource = new Resource(WorkflowType.CONFIGURATION, - config.getConfigurationResource().getModelUUID(), false); - resource.setVnfCustomizationId( - vnf.getModelInfo().getModelCustomizationId()); - resource.setVfModuleCustomizationId( - vfModule.getModelInfo().getModelCustomizationId()); - resourceList.add(configResource); - } - } - } - if (!foundVfModuleOrVG) { - buildAndThrowException(execution, - "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); - } - } - } - } - } - } - if (validate.getResources().getPnfs() != null) { - for (Pnfs pnf : validate.getResources().getPnfs()) { - resourceList.add(new Resource(WorkflowType.PNF, - pnf.getModelInfo().getModelCustomizationId(), false)); - foundRelated = true; - } - } - if (validate.getResources().getNetworks() != null) { - for (Networks network : validate.getResources().getNetworks()) { - resourceList.add(new Resource(WorkflowType.NETWORK, - network.getModelInfo().getModelCustomizationId(), false)); - foundRelated = true; - } - if (requestAction.equals(CREATEINSTANCE)) { - String networkColCustId = queryCatalogDBforNetworkCollection(execution, sIRequest); - if (networkColCustId != null) { - resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false)); - foundRelated = true; - } - } - } - break; - } - } - } - return foundRelated; - } - - protected List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID, - String vnfCustomizationUUID, String vfModuleCustomizationUUID) { - List<CvnfcConfigurationCustomization> configurations = new ArrayList<>(); - try { - List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID, - vnfCustomizationUUID, vfModuleCustomizationUUID); - for (CvnfcCustomization cvnfc : cvnfcCustomizations) { - for (CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()) { - if (customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { - configurations.add(customization); - } - } - } - logger.debug("found {} fabric configuration(s)", configurations.size()); - return configurations; - } catch (Exception ex) { - logger.error("Error in finding configurations", ex); - return configurations; - } - } - - protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, - ServiceInstancesRequest sIRequest) { - org.onap.so.db.catalog.beans.Service service = - catalogDbClient.getServiceByID(sIRequest.getRequestDetails().getModelInfo().getModelVersionId()); - if (service != null) { - CollectionResourceCustomization networkCollection = this.findCatalogNetworkCollection(execution, service); - if (networkCollection != null) { - return networkCollection.getModelCustomizationUUID(); - } - } - return null; - } - protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) { return WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution); } @@ -1397,36 +1224,6 @@ public class WorkflowAction { } } - protected String validateResourceIdInAAI(String generatedResourceId, WorkflowType type, String instanceName, - RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws Exception { - try { - if ("SERVICE".equalsIgnoreCase(type.toString())) { - return validateServiceResourceIdInAAI(generatedResourceId, instanceName, reqDetails); - } else if ("NETWORK".equalsIgnoreCase(type.toString())) { - return validateNetworkResourceIdInAAI(generatedResourceId, instanceName, reqDetails, - workflowResourceIds); - } else if ("VNF".equalsIgnoreCase(type.toString())) { - return validateVnfResourceIdInAAI(generatedResourceId, instanceName, reqDetails, workflowResourceIds); - } else if ("VFMODULE".equalsIgnoreCase(type.toString())) { - return validateVfModuleResourceIdInAAI(generatedResourceId, instanceName, reqDetails, - workflowResourceIds); - } else if ("VOLUMEGROUP".equalsIgnoreCase(type.toString())) { - return validateVolumeGroupResourceIdInAAI(generatedResourceId, instanceName, reqDetails, - workflowResourceIds); - } else if ("CONFIGURATION".equalsIgnoreCase(type.toString())) { - return validateConfigurationResourceIdInAAI(generatedResourceId, instanceName, reqDetails, - workflowResourceIds); - } - return generatedResourceId; - } catch (DuplicateNameException dne) { - throw dne; - } catch (Exception ex) { - logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex); - throw new IllegalStateException( - WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI); - } - } - protected String convertTypeFromPlural(String type) { if (!type.matches(SUPPORTEDTYPES)) { return type; @@ -1442,7 +1239,7 @@ public class WorkflowAction { protected List<ExecuteBuildingBlock> sortExecutionPathByObjectForVlanTagging(List<ExecuteBuildingBlock> orchFlows, String requestAction) { List<ExecuteBuildingBlock> sortedOrchFlows = new ArrayList<>(); - if (requestAction.equals(CREATEINSTANCE)) { + if (requestAction.equals(CREATE_INSTANCE)) { for (ExecuteBuildingBlock ebb : orchFlows) { if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) { String key = ebb.getBuildingBlock().getKey(); @@ -1510,125 +1307,6 @@ public class WorkflowAction { return sortedOrchFlows; } - private void addBuildingBlockToExecuteBBList(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList, - WorkflowType workflowType, OrchestrationFlow orchFlow, String requestId, String apiVersion, - String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds, - RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) { - - resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType)) - .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, - apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails, - isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null))); - } - - protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, - List<Resource> resourceList, String requestId, String apiVersion, String resourceId, String requestAction, - String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, - boolean replaceVnf) { - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); - for (OrchestrationFlow orchFlow : orchFlows) { - if (orchFlow.getFlowName().contains(SERVICE)) { - if (!replaceVnf) { - workflowResourceIds.setServiceInstanceId(resourceId); - } - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.SERVICE, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - } else if (orchFlow.getFlowName().contains(VNF) || (orchFlow.getFlowName().contains(CONTROLLER) - && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, 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, resourceList, WorkflowType.PNF, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - } else if (orchFlow.getFlowName().contains(NETWORK) - && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORK, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VIRTUAL_LINK, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - true, false); - } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER) - && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) { - List<Resource> vfModuleResourcesSorted; - if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE) - || requestAction.equals("activateInstance")) { - vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceList.stream() - .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); - } else { - vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream() - .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); - } - for (Resource resource : vfModuleResourcesSorted) { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, - requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, - false, null)); - } - } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { - if (requestAction.equalsIgnoreCase(REPLACEINSTANCE) - || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) { - logger.debug("Replacing workflow resource id by volume group id"); - resourceId = workflowResourceIds.getVolumeGroupId(); - } - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VOLUMEGROUP, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - false, false); - } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORKCOLLECTION, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - false, false); - } else if (orchFlow.getFlowName().contains(CONFIGURATION)) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.CONFIGURATION, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - false, true); - } else { - flowsToExecute - .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction, - false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null)); - } - } - return flowsToExecute; - } - - protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, - Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, - String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, - boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration, - ReplaceInstanceRelatedInformation replaceInfo) { - - BuildingBlock buildingBlock = - new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString()) - .setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey) - .setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse("")); - Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction); - Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope); - String oldVolumeGroupName = ""; - if (replaceInfo != null) { - oldVolumeGroupName = replaceInfo.getOldVolumeGroupName(); - } - if (resource != null - && (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE) - || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) { - logger.debug("Setting resourceId to volume group id for volume group flow on replace"); - resourceId = workflowResourceIds.getVolumeGroupId(); - } - - ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion) - .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType) - .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock) - .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName); - - if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) { - ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName); - executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys); - } - return executeBuildingBlock; - } - private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) { ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName); @@ -1686,18 +1364,6 @@ public class WorkflowAction { return listToExecute; } - protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) { - logger.error(msg, ex); - execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg + ex.getMessage()); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg + ex.getMessage()); - } - - protected void buildAndThrowException(DelegateExecution execution, String msg) { - logger.error(msg); - execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg); - } - public void handleRuntimeException(DelegateExecution execution) { StringBuilder wfeExpMsg = new StringBuilder("Runtime error "); String runtimeErrorMessage; @@ -1724,155 +1390,20 @@ public class WorkflowAction { protected boolean isRequestMacroServiceResume(boolean aLaCarte, WorkflowType resourceType, String requestAction, String serviceInstanceId) { return (!aLaCarte && resourceType == WorkflowType.SERVICE - && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE)) + && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATE_INSTANCE)) && (serviceInstanceId != null && serviceInstanceId.trim().length() > 1) && (bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId) != null)); } - protected String validateServiceResourceIdInAAI(String generatedResourceId, String instanceName, - RequestDetails reqDetails) throws DuplicateNameException { - String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId(); - String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType(); - if (instanceName != null) { - Optional<ServiceInstance> serviceInstanceAAI = - bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, instanceName); - if (serviceInstanceAAI.isPresent()) { - if (serviceInstanceAAI.get().getModelVersionId() - .equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) { - return serviceInstanceAAI.get().getServiceInstanceId(); - } else { - throw new DuplicateNameException(SERVICE_INSTANCE, String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, - instanceName, reqDetails.getModelInfo().getModelVersionId())); - } - } else { - ServiceInstances aaiServiceInstances = - bbInputSetupUtils.getAAIServiceInstancesGloballyByName(instanceName); - if (aaiServiceInstances != null) { - if (aaiServiceInstances.getServiceInstance() != null - && !aaiServiceInstances.getServiceInstance().isEmpty()) { - if (aaiServiceInstances.getServiceInstance().size() > 1) { - throw new DuplicateNameException(SERVICE_INSTANCE, - String.format(NAME_EXISTS_MULTIPLE, instanceName)); - } else { - ServiceInstance si = aaiServiceInstances.getServiceInstance().stream().findFirst().get(); - Map<String, String> keys = - bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId()); - - throw new DuplicateNameException(SERVICE_INSTANCE, String.format( - NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName, - keys.get(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId), - keys.get( - AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType), - si.getModelVersionId())); - } - } - } - } - } - return generatedResourceId; - } - - protected String validateNetworkResourceIdInAAI(String generatedResourceId, String instanceName, - RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) - throws DuplicateNameException, MultipleObjectsFoundException { - Optional<L3Network> network = bbInputSetupUtils - .getRelatedNetworkByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName); - if (network.isPresent()) { - if (network.get().getModelCustomizationId() - .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { - return network.get().getNetworkId(); - } else { - throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, - instanceName, network.get().getModelCustomizationId())); - } - } - if (bbInputSetupUtils.existsAAINetworksGloballyByName(instanceName)) { - throw new DuplicateNameException("l3Network", String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName, - workflowResourceIds.getServiceInstanceId())); - } - return generatedResourceId; - } - - protected String validateVnfResourceIdInAAI(String generatedResourceId, String instanceName, - RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { - Optional<GenericVnf> vnf = bbInputSetupUtils - .getRelatedVnfByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName); - if (vnf.isPresent()) { - if (vnf.get().getModelCustomizationId() - .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { - return vnf.get().getVnfId(); - } else { - throw new DuplicateNameException("generic-vnf", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, - instanceName, vnf.get().getModelCustomizationId())); - } - } - GenericVnfs vnfs = bbInputSetupUtils.getAAIVnfsGloballyByName(instanceName); - if (vnfs != null) { - throw new DuplicateNameException("generic-vnf", - String.format(NAME_EXISTS_WITH_DIFF_PARENT, instanceName, vnfs.getGenericVnf().get(0).getVnfId())); - } - return generatedResourceId; - } - - protected String validateVfModuleResourceIdInAAI(String generatedResourceId, String instanceName, - RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { - GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(workflowResourceIds.getVnfId()); - if (vnf != null && vnf.getVfModules() != null) { - for (org.onap.aai.domain.yang.VfModule vfModule : vnf.getVfModules().getVfModule()) { - if (vfModule.getVfModuleName().equalsIgnoreCase(instanceName)) { - if (vfModule.getModelCustomizationId() - .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { - return vfModule.getVfModuleId(); - } else { - throw new DuplicateNameException("vfModule", - String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, instanceName, - reqDetails.getModelInfo().getModelCustomizationId())); - } - } - } - } - if (bbInputSetupUtils.existsAAIVfModuleGloballyByName(instanceName)) { - throw new DuplicateNameException("vfModule", instanceName); - } - return generatedResourceId; + protected boolean foundRelated(List<Resource> resourceList) { + return (containsWorkflowType(resourceList, WorkflowType.VNF) + || containsWorkflowType(resourceList, WorkflowType.PNF) + || containsWorkflowType(resourceList, WorkflowType.NETWORK) + || containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION)); } - protected String validateVolumeGroupResourceIdInAAI(String generatedResourceId, String instanceName, - RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { - Optional<VolumeGroup> volumeGroup = - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName); - if (volumeGroup.isPresent()) { - if (volumeGroup.get().getVfModuleModelCustomizationId() - .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { - return volumeGroup.get().getVolumeGroupId(); - } else { - throw new DuplicateNameException("volumeGroup", volumeGroup.get().getVolumeGroupName()); - } - } - if (bbInputSetupUtils.existsAAIVolumeGroupGloballyByName(instanceName)) { - throw new DuplicateNameException("volumeGroup", instanceName); - } - return generatedResourceId; - } - - protected String validateConfigurationResourceIdInAAI(String generatedResourceId, String instanceName, - RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException { - Optional<org.onap.aai.domain.yang.Configuration> configuration = - bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance( - workflowResourceIds.getServiceInstanceId(), instanceName); - if (configuration.isPresent()) { - if (configuration.get().getModelCustomizationId() - .equalsIgnoreCase(reqDetails.getModelInfo().getModelCustomizationId())) { - return configuration.get().getConfigurationId(); - } else { - throw new DuplicateNameException("configuration", String.format(NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID, - instanceName, configuration.get().getConfigurationId())); - } - } - if (bbInputSetupUtils.existsAAIConfigurationGloballyByName(instanceName)) { - throw new DuplicateNameException("configuration", instanceName); - } - return generatedResourceId; + protected boolean containsWorkflowType(List<Resource> resourceList, WorkflowType workflowType) { + return resourceList.stream().anyMatch(resource -> resource.getResourceType().equals(workflowType)); } private void fillExecutionDefault(DelegateExecution execution) { @@ -1904,7 +1435,7 @@ public class WorkflowAction { WorkflowResourceIds workflowResourceIds) throws Exception { if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance") && requestDetails.getRequestInfo().getInstanceName() != null) { - return validateResourceIdInAAI(resource.getResourceId(), resource.getResourceType(), + return aaiResourceIdValidator.validateResourceIdInAAI(resource.getResourceId(), resource.getResourceType(), requestDetails.getRequestInfo().getInstanceName(), requestDetails, workflowResourceIds); } else { return resource.getResourceId(); 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 217b3a848e..b756772188 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 @@ -52,6 +52,9 @@ import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestReferences; import org.onap.so.serviceinstancebeans.ServiceInstancesResponse; import org.slf4j.Logger; @@ -78,6 +81,7 @@ public class WorkflowActionBBTasks { private static final String ROLLBACKTOCREATEDNOCONFIGURATION = "RollbackToCreatedNoConfiguration"; private static final String REPLACEINSTANCE = "replaceInstance"; private static final String VFMODULE = "VfModule"; + private static final String CONFIGURATION_PATTERN = "(Ad|De)(.*)FabricConfiguration(.*)"; protected String maxRetries = "mso.rainyDay.maxRetries"; private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class); @@ -99,22 +103,26 @@ public class WorkflowActionBBTasks { private RequestsDbListenerRunner requestsDbListener; public void selectBB(DelegateExecution execution) { - List<ExecuteBuildingBlock> flowsToExecute = - (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); - execution.setVariable("MacroRollback", false); try { - flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution)); - } catch (NullPointerException ex) { - workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex); - } - int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); + List<ExecuteBuildingBlock> flowsToExecute = + (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + execution.setVariable("MacroRollback", false); + try { + flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution)); + } catch (NullPointerException ex) { + workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex); + } + int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence); + ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence); - execution.setVariable("buildingBlock", ebb); - currentSequence++; - execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size()); - execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); + execution.setVariable("buildingBlock", ebb); + currentSequence++; + execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size()); + execution.setVariable(G_CURRENT_SEQUENCE, currentSequence); + } catch (Exception e) { + workflowAction.buildAndThrowException(execution, "Internal Error occured during selectBB", e); + } } public void updateFlowStatistics(DelegateExecution execution) { @@ -417,12 +425,9 @@ public class WorkflowActionBBTasks { String handlingCode = (String) execution.getVariable(HANDLINGCODE); final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE); int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE); - String requestAction = (String) execution.getVariable(G_ACTION); ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1); String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName(); - if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode) - && !(requestAction.equalsIgnoreCase("replaceInstance") - || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments"))) { + if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) { postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute); } } @@ -430,15 +435,32 @@ public class WorkflowActionBBTasks { protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb, List<ExecuteBuildingBlock> flowsToExecute) { try { + String requestAction = (String) execution.getVariable(G_ACTION); String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId(); String vnfId = ebb.getWorkflowResourceIds().getVnfId(); String vfModuleId = ebb.getResourceId(); ebb.getWorkflowResourceIds().setVfModuleId(vfModuleId); - String serviceModelUUID = - bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId(); - String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(); - String vfModuleCustomizationUUID = - bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId(); + String serviceModelUUID = ""; + String vnfCustomizationUUID = ""; + String vfModuleCustomizationUUID = ""; + if (requestAction.equalsIgnoreCase("replaceInstance") + || requestAction.equalsIgnoreCase("replaceInstanceRetainAssignments")) { + for (RelatedInstanceList relatedInstList : ebb.getRequestDetails().getRelatedInstanceList()) { + RelatedInstance relatedInstance = relatedInstList.getRelatedInstance(); + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) { + vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId(); + } + if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) { + serviceModelUUID = relatedInstance.getModelInfo().getModelVersionId(); + } + } + vfModuleCustomizationUUID = ebb.getRequestDetails().getModelInfo().getModelCustomizationId(); + } else { + serviceModelUUID = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId).getModelVersionId(); + vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId(); + vfModuleCustomizationUUID = + bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId).getModelCustomizationId(); + } List<Vnfc> vnfcs = workflowAction.getRelatedResourcesInVfModule(vnfId, vfModuleId, Vnfc.class, Types.VNFC); logger.debug("Vnfc Size: {}", vnfcs.size()); for (Vnfc vnfc : vnfcs) { @@ -458,8 +480,9 @@ public class WorkflowActionBBTasks { ExecuteBuildingBlock addConfigBB = getExecuteBBForConfig(ADD_FABRIC_CONFIGURATION_BB, ebb, configurationId, configurationResourceKeys); flowsToExecute.add(addConfigBB); - flowsToExecute.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", - executeBB.getBuildingBlock().getBpmnFlowName())); + flowsToExecute.stream() + .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}", + executeBB.getBuildingBlock().getBpmnFlowName())); execution.setVariable("flowsToExecute", flowsToExecute); execution.setVariable(COMPLETED, false); } else { 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 new file mode 100644 index 0000000000..5e16097304 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ + * 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.workflow.tasks; + +public final class WorkflowActionConstants { + + private WorkflowActionConstants() { + throw new IllegalStateException("Utility class"); + } + + static final String USER_PARAM_SERVICE = "service"; + static final String CREATE_INSTANCE = "createInstance"; + static final String FABRIC_CONFIGURATION = "FabricConfiguration"; + static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; + static final String SERVICE = "Service"; + static final String CONTROLLER = "Controller"; + static final String NETWORKCOLLECTION = "NetworkCollection"; + static final String CONFIGURATION = "Configuration"; + static final String ASSIGNINSTANCE = "assignInstance"; + static final String REPLACEINSTANCE = "replaceInstance"; + static final String VOLUMEGROUP = "VolumeGroup"; + static final String REPLACEINSTANCERETAINASSIGNMENTS = "replaceInstanceRetainAssignments"; +} 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 2119ced951..564ee91fb2 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 @@ -84,7 +84,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID, vnfResourceCustomizations); if (null != vrc) { - boolean skipConfigVNF = vrc.isSkipPostInstConf(); + boolean skipConfigVNF = vrc.isSkipPostInstConf().booleanValue(); currentSequenceSkipCheck(execution, skipConfigVNF); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java index 6589ae77f5..83f61e3a4f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java @@ -34,7 +34,7 @@ public class SkipConfigVnfListener implements FlowManipulator { if (vnfResourceCustomizations != null && !vnfResourceCustomizations.isEmpty()) { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); - boolean skipConfigVNF = vrc.isSkipPostInstConf(); + boolean skipConfigVNF = vrc.isSkipPostInstConf().booleanValue(); if (skipConfigVNF) { execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, ((int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE)) + 1); 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 b74aa9056d..da36a6f040 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 @@ -54,14 +54,14 @@ public class CnfAdapterClient { @Autowired private Environment env; - private static final String INSTANCE_CREATE_PATH = "/api/multicloud-k8s/v1/v1/instance"; + private static final String INSTANCE_CREATE_PATH = "/api/cnf-adapter/v1/instance"; @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000)) public InstanceResponse createVfModule(InstanceRequest request) throws CnfAdapterClientException { try { // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well // for configuration - String uri = "https://localhost:32780"; // TODO: What is the correct uri? + String uri = "http://so-cnf-adapter:8090"; String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH).build().toString(); HttpEntity<?> entity = getHttpEntity(request); ResponseEntity<InstanceResponse> result = @@ -76,12 +76,31 @@ public class CnfAdapterClient { } } + + @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000)) + public void deleteVfModule(String heatStackId) throws CnfAdapterClientException { + try { + // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well + // for configuration + String uri = "http://so-cnf-adapter:8090"; + String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH + "/" + heatStackId).build().toString(); + HttpEntity<?> entity = new HttpEntity<>(getHttpHeaders()); + restTemplate.exchange(endpoint, HttpMethod.DELETE, entity, String.class); + } 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; + } + } + @Retryable(value = {HttpServerErrorException.class}, maxAttempts = 3, backoff = @Backoff(delay = 3000)) public InstanceResponse healthcheck() throws CnfAdapterClientException { try { // String uri = env.getRequiredProperty("mso.cnf.adapter.endpoint"); //TODO: This needs to be added as well // for configuration - String uri = "https://localhost:32780"; // TODO: What is the correct uri? + String uri = "http://so-cnf-adapter:8090"; String endpoint = UriBuilder.fromUri(uri).path("/api/cnf-adapter/v1/healthcheck").build().toString(); HttpEntity<?> entity = new HttpEntity<>(getHttpHeaders()); ResponseEntity<InstanceResponse> result = diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceResponse.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceResponse.java index e38bcc2664..13ccb4eb92 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceResponse.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceResponse.java @@ -7,15 +7,21 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"id", "request", "namespace", "resources"}) +@JsonPropertyOrder({"id", "request", "namespace", "release-name", "resources"}) public class InstanceResponse { @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; @@ -59,4 +65,14 @@ public class InstanceResponse { 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/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java index 6278d48e03..7291b713ca 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java @@ -21,18 +21,16 @@ package org.onap.so.client.adapter.vnf.mapper; import java.io.Serializable; +import com.fasterxml.jackson.annotation.JsonProperty; public class AttributeNameValue implements Serializable { private static final long serialVersionUID = -5215028275587848311L; + @JsonProperty("attribute_name") private String attributeName; + @JsonProperty("attribute_value") private transient Object attributeValue; - public AttributeNameValue(String attributeName, Object attributeValue) { - this.attributeName = attributeName; - this.attributeValue = attributeValue; - } - public String getAttributeName() { return attributeName; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 59da22f8e1..7c686bd165 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -235,7 +235,10 @@ public class VnfAdapterVfModuleObjectMapper { logger.error("No value tag found for attribute: {}", attributeName); throw new MissingValueTagException("No value tag found for " + attributeName); } - directives.append(new AttributeNameValue(attributeName, attributeValue.toString())); + String nameValue = new StringBuilder().append("{\"attribute_name\": \"").append(attributeName) + .append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}") + .toString(); + directives.append(nameValue); if (i < (srcMap.size() - 1 + noOfDirectivesSize)) directives.append(", "); i++; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java index e8ce828652..ab83acaec2 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java @@ -24,7 +24,6 @@ package org.onap.so.bpmn; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; -import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; @@ -33,8 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.aaiclient.client.aai.AAIResourcesClient; -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; -import org.onap.aaiclient.client.aai.entities.Relationships; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; import org.onap.so.client.appc.ApplicationControllerAction; @@ -162,5 +159,4 @@ public abstract class BaseTaskTest extends TestDataSetup { @Mock protected NamingRequestObject namingRequestObject; - } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java new file mode 100644 index 0000000000..0ba1e27f5e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/buildingblock/controller/sdnc/prepare/PrepareSdncUpgradePreCheckPnfBBTest.java @@ -0,0 +1,88 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2020 Nokia + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.decisionpoint.impl.buildingblock.controller.sdnc.prepare; + +import static org.assertj.core.api.Assertions.assertThat; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; + +public class PrepareSdncUpgradePreCheckPnfBBTest { + + private PrepareSdncUpgradePreCheckPnfBB testedObject; + + @Before + public void setup() { + testedObject = new PrepareSdncUpgradePreCheckPnfBB(); + } + + @Test + public void understandTrue() { + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext("sdnc", "UpgradePreCheck", "pnf"); + boolean result = testedObject.understand(controllerContext); + assertThat(result).isTrue(); + } + + @Test + public void understandFalse() { + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext("actor1", "action1", "scope1"); + boolean result = testedObject.understand(controllerContext); + assertThat(result).isFalse(); + } + + @Test + public void prepare_jsonWithoutActionPayload() { + String payloadWithoutActionArray = "{\"json name\": \"test1\"}"; + ControllerContext<BuildingBlockExecution> controllerContext = + createControllerContext(payloadWithoutActionArray); + testedObject.prepare(controllerContext); + + assertThat((String) controllerContext.getExecution().getVariable("payload")) + .isEqualTo(payloadWithoutActionArray); + } + + private ControllerContext<BuildingBlockExecution> createControllerContext(String actor, String action, + String scope) { + ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>(); + controllerContext.setControllerActor(actor); + controllerContext.setControllerAction(action); + controllerContext.setControllerScope(scope); + return controllerContext; + } + + private ControllerContext<BuildingBlockExecution> createControllerContext(String payload) { + ControllerContext<BuildingBlockExecution> controllerContext = new ControllerContext<>(); + controllerContext.setExecution(prepareBuildingBlockExecution(payload)); + return controllerContext; + } + + private BuildingBlockExecution prepareBuildingBlockExecution(String payload) { + DelegateExecution execution = new DelegateExecutionFake(); + execution.setVariable("payload", payload); + return new DelegateExecutionImpl(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/AaiResourceIdValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/AaiResourceIdValidatorTest.java new file mode 100644 index 0000000000..ead6c0b4cf --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/AaiResourceIdValidatorTest.java @@ -0,0 +1,765 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ + * 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.workflow.tasks; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.when; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.ServiceInstances; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.SubscriberInfo; + +@RunWith(MockitoJUnitRunner.class) +public class AaiResourceIdValidatorTest { + + @Mock + private BBInputSetupUtils bbInputSetupUtilsMock; + + @InjectMocks + private AaiResourceIdValidator testedObject; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void validateResourceIdInAAIVnfTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setModelCustomizationId("1234567"); + Optional<GenericVnf> opVnf = Optional.of(vnf); + GenericVnf vnf2 = new GenericVnf(); + vnf2.setVnfId("id123"); + vnf2.setModelCustomizationId("222"); + Optional<GenericVnf> opVnf2 = Optional.of(vnf2); + when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); + when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName222")).thenReturn(opVnf2); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "nameTest", reqDetails, + workflowResourceIds); + assertEquals("generatedId123", id2); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "generic-vnf with name (vnfName222), same parent and different customization id (222) already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateResourceIdInAAIVnfNotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + GenericVnfs genericVnfs = new GenericVnfs(); + GenericVnf vnf3 = new GenericVnf(); + vnf3.setVnfId("id123"); + + genericVnfs.getGenericVnf().add(vnf3); + when(bbInputSetupUtilsMock.getAAIVnfsGloballyByName("vnfName333")).thenReturn(genericVnfs); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "generic-vnf with name (vnfName333) id (id123) and different parent relationship already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName333", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateResourceIdInAAINetworkTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setModelCustomizationId("1234567"); + Optional<L3Network> opNetwork = Optional.of(network); + L3Network network2 = new L3Network(); + network2.setNetworkId("id123"); + network2.setModelCustomizationId("222"); + Optional<L3Network> opNetwork2 = Optional.of(network2); + + when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opNetwork); + when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "networkName222")) + .thenReturn(opNetwork2); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, + workflowResourceIds); + assertEquals("generatedId123", id2); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "l3Network with name (networkName222), same parent and different customization id (222) already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateNetworkResourceNameExistsInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + when(bbInputSetupUtilsMock.existsAAINetworksGloballyByName("networkName333")).thenReturn(true); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "l3Network with name (networkName333) id (siId123) and different parent relationship already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName333", reqDetails, + workflowResourceIds); + } + + @Test + public void validateResourceIdInAAIVfModuleTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("id123"); + + GenericVnf vnf = new GenericVnf(); + VfModules vfModules = new VfModules(); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("id123"); + vfModule.setVfModuleName("name123"); + vfModule.setModelCustomizationId("1234567"); + vfModules.getVfModule().add(vfModule); + vnf.setVfModules(vfModules); + + when(bbInputSetupUtilsMock.getAAIGenericVnf("id123")).thenReturn(vnf); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + + GenericVnf vnf1 = new GenericVnf(); + VfModules vfModules2 = new VfModules(); + VfModule vfModule2 = new VfModule(); + vfModule2.setVfModuleName("vFModName222"); + vfModule2.setModelCustomizationId("222"); + vfModules2.getVfModule().add(vfModule2); + vnf1.setVfModules(vfModules2); + workflowResourceIds.setVnfId("id111"); + when(bbInputSetupUtilsMock.getAAIGenericVnf("id111")).thenReturn(vnf1); + String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", reqDetails, + workflowResourceIds); + assertEquals("generatedId123", id2); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "vfModule with name (vFModName222), same parent and different customization id (1234567) already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateResourceIdInAAIVfModuleNotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + + when(bbInputSetupUtilsMock.existsAAIVfModuleGloballyByName("vFModName333")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("vfModule with name vFModName333 already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName333", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateResourceIdInAAIVolumeGroupTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("id123"); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + volumeGroup.setVfModuleModelCustomizationId("1234567"); + Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); + + when(bbInputSetupUtilsMock.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(opVolumeGroup); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", + reqDetails, workflowResourceIds); + assertEquals("id123", id); + + String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", + reqDetails, workflowResourceIds); + assertEquals("generatedId123", id2); + } + + + @Test + public void validateSourceIdInAAIVolumeGroupNotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + when(bbInputSetupUtilsMock.existsAAIVolumeGroupGloballyByName("testVolumeGroup")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("volumeGroup with name testVolumeGroup already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "testVolumeGroup", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateResourceIdInAAIConfigurationTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); + configuration.setConfigurationId("id123"); + configuration.setModelCustomizationId("1234567"); + Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); + + org.onap.aai.domain.yang.Configuration configuration2 = new org.onap.aai.domain.yang.Configuration(); + configuration2.setConfigurationId("id123"); + configuration2.setModelCustomizationId("222"); + Optional<org.onap.aai.domain.yang.Configuration> opConfiguration2 = Optional.of(configuration2); + + when(bbInputSetupUtilsMock.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opConfiguration); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name123", + reqDetails, workflowResourceIds); + assertEquals("id123", id); + + String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "111111", + reqDetails, workflowResourceIds); + assertEquals("generatedId123", id2); + + when(bbInputSetupUtilsMock.getRelatedConfigurationByNameFromServiceInstance("siId123", "name222")) + .thenReturn(opConfiguration2); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "configuration with name (name222), same parent and different customization id (id123) already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name222", reqDetails, + workflowResourceIds); + } + + @Test + public void validateResourceIdInAAIConfigurationNotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + when(bbInputSetupUtilsMock.existsAAIConfigurationGloballyByName("testConfig")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("configuration with name testConfig already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "testConfig", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateResourceIdInAAISITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + si.setModelVersionId("1234567"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + Optional<ServiceInstance> siOp = Optional.of(si); + ServiceInstance si2 = new ServiceInstance(); + si2.setServiceInstanceId("siId222"); + si2.setModelVersionId("22222"); + si2.setServiceInstanceName("siName222"); + Optional<ServiceInstance> siOp2 = Optional.of(si2); + ServiceInstances serviceInstances2 = new ServiceInstances(); + serviceInstances2.getServiceInstance().add(si2); + + when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")) + .thenReturn(siOp); + when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName222")) + .thenReturn(siOp2); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", + reqDetails, new WorkflowResourceIds()); + assertEquals("siId123", id); + String id2 = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", reqDetails, + new WorkflowResourceIds()); + assertEquals("generatedId123", id2); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName222) and different version id (1234567) already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName222", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateResourceIdInAAIMultipleSITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + reqDetails.getModelInfo().setModelVersionId("1234567"); + ServiceInstance si = new ServiceInstance(); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + ServiceInstance si2 = new ServiceInstance(); + serviceInstances.getServiceInstance().add(si2); + when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName123) and multiple combination of model-version-id + service-type + global-customer-id already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateResourceIdInAAISIExistsTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + si.setModelVersionId("1234567"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + + Map<String, String> uriKeys = new HashMap<>(); + uriKeys.put(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId, "globalCustomerId"); + uriKeys.put(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType, "serviceType"); + + when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); + when(bbInputSetupUtilsMock.getURIKeysFromServiceInstance("siId123")).thenReturn(uriKeys); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName123) and global-customer-id (globalCustomerId), service-type (serviceType), model-version-id (1234567) already exists. The name must be unique.")); + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, + new WorkflowResourceIds()); + } + + @Test + public void validateServiceResourceIdInAAINoDupTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + String id = testedObject.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails); + assertEquals("generatedId123", id); + } + + @Test + public void validateServiceResourceIdInAAISameModelVersionId() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + si.setModelVersionId("1234567"); + Optional<ServiceInstance> siOp = Optional.of(si); + + when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")) + .thenReturn(siOp); + String id = testedObject.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails); + assertEquals("siId123", id); + } + + @Test + public void validateServiceResourceIdInAAIDifferentModelVersionId() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + reqDetails.getModelInfo().setModelVersionId("1234567"); + + ServiceInstance si = new ServiceInstance(); + si.setModelVersionId("9999999"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + Optional<ServiceInstance> siOp = Optional.of(si); + + when(bbInputSetupUtilsMock.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")) + .thenReturn(siOp); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName123) and different version id (1234567) already exists. The name must be unique.")); + + String id = testedObject.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails); + assertEquals("siId123", id); + } + + @Test + public void validateServiceResourceIdInAAIDuplicateNameTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + ServiceInstance si = new ServiceInstance(); + si.setModelVersionId("1234567"); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(si); + + when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName")).thenReturn(serviceInstances); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName) and global-customer-id (null), service-type (null), model-version-id (1234567) already exists. The name must be unique.")); + + testedObject.validateServiceResourceIdInAAI("generatedId123", "siName", reqDetails); + } + + @Test + public void validateServiceResourceIdInAAIDuplicateNameMultipleTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + ServiceInstances serviceInstances = new ServiceInstances(); + serviceInstances.getServiceInstance().add(new ServiceInstance()); + serviceInstances.getServiceInstance().add(new ServiceInstance()); + + when(bbInputSetupUtilsMock.getAAIServiceInstancesGloballyByName("siName")).thenReturn(serviceInstances); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "serviceInstance with name (siName) and multiple combination of model-version-id + service-type + global-customer-id already exists. The name must be unique.")); + + testedObject.validateServiceResourceIdInAAI("generatedId123", "siName", reqDetails); + } + + @Test + public void validateNetworkResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + String id = testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, + new WorkflowResourceIds()); + assertEquals("generatedId123", id); + } + + @Test + public void validateNetworkResourceIdInAAISameModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setModelCustomizationId("1234567"); + Optional<L3Network> opNetwork = Optional.of(network); + + when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opNetwork); + + String id = testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + } + + @Test + public void validateNetworkResourceIdInAAIDuplicateNameTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + L3Network network = new L3Network(); + network.setModelCustomizationId("9999999"); + Optional<L3Network> opNetwork = Optional.of(network); + + when(bbInputSetupUtilsMock.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opNetwork); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "l3Network with name (name123), same parent and different customization id (9999999) already exists. The name must be unique.")); + + testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); + } + + @Test + public void validateNetworkResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + when(bbInputSetupUtilsMock.existsAAINetworksGloballyByName("name123")).thenReturn(true); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "l3Network with name (name123) id (siId123) and different parent relationship already exists. The name must be unique.")); + + testedObject.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); + } + + @Test + public void validateVnfResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + String id = testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, + new WorkflowResourceIds()); + assertEquals("generatedId123", id); + } + + @Test + public void validateVnfResourceIdInAAISameModelCustomizationIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setModelCustomizationId("1234567"); + Optional<GenericVnf> opVnf = Optional.of(vnf); + + when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); + String id = testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + } + + @Test + public void validateVnfResourceIdInAAIDiffModelCustomizationIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + GenericVnf vnf = new GenericVnf(); + vnf.setModelCustomizationId("9999999"); + Optional<GenericVnf> opVnf = Optional.of(vnf); + + when(bbInputSetupUtilsMock.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "generic-vnf with name (vnfName123), same parent and different customization id (9999999) already exists. The name must be unique.")); + + testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds); + } + + @Test + public void validateVnfResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + GenericVnfs genericVnfs = new GenericVnfs(); + genericVnfs.getGenericVnf().add(vnf); + + when(bbInputSetupUtilsMock.getAAIVnfsGloballyByName("vnfName123")).thenReturn(genericVnfs); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "generic-vnf with name (vnfName123) id (id123) and different parent relationship already exists. The name must be unique.")); + + testedObject.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, new WorkflowResourceIds()); + } + + @Test + public void validateVfModuleResourceIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + String id = testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, + new WorkflowResourceIds()); + assertEquals("generatedId123", id); + } + + @Test + public void validateVfModuleResourceIdSameModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("vnfId123"); + VfModules vfModules = new VfModules(); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("id123"); + vfModule.setVfModuleName("name123"); + vfModule.setModelCustomizationId("1234567"); + vfModules.getVfModule().add(vfModule); + GenericVnf vnf = new GenericVnf(); + vnf.setVfModules(vfModules); + + when(bbInputSetupUtilsMock.getAAIGenericVnf("vnfId123")).thenReturn(vnf); + + String id = testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + } + + @Test + public void validateVfModuleResourceIdDifferentModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("vnfId123"); + VfModules vfModules = new VfModules(); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleName("name123"); + vfModule.setModelCustomizationId("9999999"); + vfModules.getVfModule().add(vfModule); + GenericVnf vnf = new GenericVnf(); + vnf.setVfModules(vfModules); + + when(bbInputSetupUtilsMock.getAAIGenericVnf("vnfId123")).thenReturn(vnf); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "vfModule with name (name123), same parent and different customization id (1234567) already exists. The name must be unique.")); + + testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); + } + + @Test + public void validateVfModuleResourceIdNotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + when(bbInputSetupUtilsMock.existsAAIVfModuleGloballyByName("name123")).thenReturn(true); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException + .expectMessage(containsString("vfModule with name name123 already exists. The name must be unique.")); + + testedObject.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); + } + + @Test + public void validateVolumeGroupResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + String id = testedObject.validateVolumeGroupResourceIdInAAI("generatedId123", "name123", reqDetails, + new WorkflowResourceIds()); + assertEquals("generatedId123", id); + } + + @Test + public void validateVolumeGroupResourceIdInAAISameModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("vnfId123"); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVfModuleModelCustomizationId("1234567"); + Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); + + when(bbInputSetupUtilsMock.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(opVolumeGroup); + String id = testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", + reqDetails, workflowResourceIds); + + assertEquals("id123", id); + } + + @Test + public void validateVolumeGroupResourceIdInAAIDifferentModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setVnfId("vnfId123"); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupName("name123"); + volumeGroup.setVfModuleModelCustomizationId("9999999"); + Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); + + when(bbInputSetupUtilsMock.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(opVolumeGroup); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("volumeGroup with name name123 already exists. The name must be unique.")); + + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, + workflowResourceIds); + } + + @Test + public void validateVolumeGroupResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + when(bbInputSetupUtilsMock.existsAAIVolumeGroupGloballyByName("name123")).thenReturn(true); + + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("volumeGroup with name name123 already exists. The name must be unique.")); + + testedObject.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, + workflowResourceIds); + } + + @Test + public void validateConfigurationResourceIdInAAITest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + String id = testedObject.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, + new WorkflowResourceIds()); + assertEquals("generatedId123", id); + } + + @Test + public void validateConfigurationResourceIdInAAISameModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); + configuration.setConfigurationId("id123"); + configuration.setModelCustomizationId("1234567"); + Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); + + when(bbInputSetupUtilsMock.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opConfiguration); + + String id = testedObject.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, + workflowResourceIds); + assertEquals("id123", id); + } + + @Test + public void validateConfigurationResourceIdInAAIDifferentModelCustIdTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("siId123"); + org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); + configuration.setConfigurationId("id123"); + configuration.setModelCustomizationId("9999999"); + Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); + + when(bbInputSetupUtilsMock.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) + .thenReturn(opConfiguration); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage(containsString( + "configuration with name (name123), same parent and different customization id (id123) already exists. The name must be unique.")); + + testedObject.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); + } + + @Test + public void validateConfigurationResourceIdInAAINotGloballyUniqueTest() throws Exception { + RequestDetails reqDetails = setupRequestDetails(); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + + when(bbInputSetupUtilsMock.existsAAIConfigurationGloballyByName("name123")).thenReturn(true); + this.expectedException.expect(DuplicateNameException.class); + this.expectedException.expectMessage( + containsString("configuration with name name123 already exists. The name must be unique.")); + + testedObject.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); + } + + private RequestDetails setupRequestDetails() { + RequestDetails reqDetails = new RequestDetails(); + SubscriberInfo subInfo = new SubscriberInfo(); + subInfo.setGlobalSubscriberId("id123"); + reqDetails.setSubscriberInfo(subInfo); + RequestParameters reqParams = new RequestParameters(); + reqParams.setSubscriptionServiceType("subServiceType123"); + reqDetails.setRequestParameters(reqParams); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelCustomizationId("1234567"); + reqDetails.setModelInfo(modelInfo); + return reqDetails; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java new file mode 100644 index 0000000000..c8914f6e02 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2021 Nokia + * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ + * 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.workflow.tasks; + +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import java.util.ArrayList; +import java.util.List; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +public class ExecuteBuildingBlockBuilderTest { + + final private ExecuteBuildingBlockBuilder executeBBBuilder = new ExecuteBuildingBlockBuilder(); + + @Test + public void sortVfModulesByBaseFirstTest() { + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); + resource1.setBaseVfModule(false); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); + resource3.setBaseVfModule(true); + resources.add(resource3); + + List<Resource> result = executeBBBuilder.sortVfModulesByBaseFirst(resources); + assertEquals("333", result.get(0).getResourceId()); + assertEquals("222", result.get(1).getResourceId()); + assertEquals("111", result.get(2).getResourceId()); + } + + @Test + public void sortVfModulesByBaseLastTest() { + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); + resource1.setBaseVfModule(true); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); + resource3.setBaseVfModule(false); + resources.add(resource3); + List<Resource> result = executeBBBuilder.sortVfModulesByBaseLast(resources); + assertEquals("333", result.get(0).getResourceId()); + assertEquals("222", result.get(1).getResourceId()); + assertEquals("111", result.get(2).getResourceId()); + } + + @Test + public void verifyLackOfNullPointerExceptionForNullResource() { + ExecuteBuildingBlock result = null; + try { + result = executeBBBuilder.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, + false, null, null, null, false, null, null, true, null); + } catch (NullPointerException e) { + fail("NullPointerException should not be thrown when 'resource' is null"); + } + assertNotNull(result); + } +} 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 3290bb3dce..5cd3055b5f 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 @@ -22,6 +22,22 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyObject; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.isA; +import static org.mockito.Mockito.doNothing; +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.ArrayList; +import java.util.List; +import java.util.Optional; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; @@ -29,6 +45,7 @@ import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.mockito.ArgumentCaptor; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; @@ -47,24 +64,16 @@ 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.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.ModelType; +import org.onap.so.serviceinstancebeans.RelatedInstance; +import org.onap.so.serviceinstancebeans.RelatedInstanceList; import org.onap.so.serviceinstancebeans.RequestDetails; import org.springframework.core.env.Environment; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.anyObject; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; public class WorkflowActionBBTasksTest extends BaseTaskTest { @@ -96,6 +105,9 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { @Rule public ExpectedException thrown = ExpectedException.none(); + @Mock + private DelegateExecution mockExecution; + @Before public void before() throws Exception { execution = new DelegateExecutionFake(); @@ -602,7 +614,228 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest { } @Test - public void postProcessingExecuteBBActivateVfModuleTest() throws CloneNotSupportedException { + public void postProcessingExecuteBBActivateVfModuleNotReplaceInstanceTest() throws CloneNotSupportedException { + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("1"); + workflowResourceIds.setVnfId("1"); + + BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule); + ebbActivateVfModule.setWorkflowResourceIds(workflowResourceIds); + ebbActivateVfModule.setResourceId("1"); + + ServiceInstance service = new ServiceInstance(); + service.setServiceInstanceName("name"); + service.setModelVersionId("1"); + doReturn(service).when(bbSetupUtils).getAAIServiceInstanceById("1"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfName("name"); + vnf.setModelCustomizationId("1"); + doReturn(vnf).when(bbSetupUtils).getAAIGenericVnf("1"); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleName("name"); + vfModule.setModelCustomizationId("1"); + doReturn(vfModule).when(bbSetupUtils).getAAIVfModule("1", "1"); + + List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>(); + org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc(); + vnfc.setModelInvariantId("1"); + vnfc.setVnfcName("name"); + vnfc.setModelCustomizationId("2"); + vnfcs.add(vnfc); + doReturn(vnfcs).when(workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any()); + + CvnfcConfigurationCustomization vfModuleCustomization = new CvnfcConfigurationCustomization(); + ConfigurationResource configuration = new ConfigurationResource(); + configuration.setToscaNodeType("FabricConfiguration"); + configuration.setModelUUID("1"); + vfModuleCustomization.setConfigurationResource(configuration); + + doReturn(vfModuleCustomization).when(catalogDbClient).getCvnfcCustomization("1", "1", "1", "2"); + + prepareDelegateExecution(); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + flowsToExecute.add(ebbActivateVfModule); + + execution.setVariable("requestAction", "createInstance"); + execution.setVariable("completed", true); + + ArgumentCaptor<DelegateExecution> executionCaptor = ArgumentCaptor.forClass(DelegateExecution.class); + ArgumentCaptor<ExecuteBuildingBlock> bbCaptor = ArgumentCaptor.forClass(ExecuteBuildingBlock.class); + ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class); + workflowActionBBTasks.postProcessingExecuteBBActivateVfModule(execution, ebbActivateVfModule, flowsToExecute); + verify(workflowActionBBTasks, times(1)).postProcessingExecuteBBActivateVfModule(executionCaptor.capture(), + bbCaptor.capture(), listCaptor.capture()); + assertEquals(false, executionCaptor.getAllValues().get(0).getVariable("completed")); + assertEquals(2, ((ArrayList) executionCaptor.getAllValues().get(0).getVariable("flowsToExecute")).size()); + assertEquals("2", + ((ExecuteBuildingBlock) ((ArrayList) executionCaptor.getAllValues().get(0) + .getVariable("flowsToExecute")).get(1)).getConfigurationResourceKeys() + .getCvnfcCustomizationUUID()); + assertEquals("AddFabricConfigurationBB", ((ExecuteBuildingBlock) ((ArrayList) executionCaptor.getAllValues() + .get(0).getVariable("flowsToExecute")).get(1)).getBuildingBlock().getBpmnFlowName()); + } + + @Test + public void postProcessingExecuteBBActivateVfModuleReplaceInstanceHasConfigurationTest() + throws CloneNotSupportedException { + RequestDetails reqDetails = new RequestDetails(); + RelatedInstanceList[] list = new RelatedInstanceList[2]; + RelatedInstanceList vnfList = new RelatedInstanceList(); + RelatedInstanceList serviceList = new RelatedInstanceList(); + list[0] = vnfList; + list[1] = serviceList; + RelatedInstance vnfInstance = new RelatedInstance(); + RelatedInstance serviceInstance = new RelatedInstance(); + ModelInfo vnfModelInfo = new ModelInfo(); + vnfModelInfo.setModelType(ModelType.vnf); + vnfModelInfo.setModelCustomizationId("1"); + ModelInfo serviceModelInfo = new ModelInfo(); + serviceModelInfo.setModelType(ModelType.service); + serviceModelInfo.setModelVersionId("1"); + vnfInstance.setModelInfo(vnfModelInfo); + serviceInstance.setModelInfo(serviceModelInfo); + reqDetails.setRelatedInstanceList(list); + vnfList.setRelatedInstance(vnfInstance); + serviceList.setRelatedInstance(serviceInstance); + ModelInfo vfModuleInfo = new ModelInfo(); + vfModuleInfo.setModelCustomizationId("1"); + reqDetails.setModelInfo(vfModuleInfo); + BuildingBlock bbAddFabric = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB"); + ExecuteBuildingBlock ebbAddFabric = new ExecuteBuildingBlock().setBuildingBlock(bbAddFabric); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("1"); + workflowResourceIds.setVnfId("1"); + ebbAddFabric.setWorkflowResourceIds(workflowResourceIds); + ebbAddFabric.setResourceId("1"); + + BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule); + ebbActivateVfModule.setWorkflowResourceIds(workflowResourceIds); + ebbActivateVfModule.setResourceId("1"); + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + ebbAddFabric.setConfigurationResourceKeys(configurationResourceKeys); + ebbActivateVfModule.setRequestDetails(reqDetails); + + ServiceInstance service = new ServiceInstance(); + service.setServiceInstanceName("name"); + service.setModelVersionId("1"); + doReturn(service).when(bbSetupUtils).getAAIServiceInstanceById("1"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfName("name"); + vnf.setModelCustomizationId("1"); + doReturn(vnf).when(bbSetupUtils).getAAIGenericVnf("1"); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleName("name"); + vfModule.setModelCustomizationId("1"); + doReturn(vfModule).when(bbSetupUtils).getAAIVfModule("1", "1"); + + List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>(); + org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc(); + vnfc.setModelInvariantId("1"); + vnfc.setVnfcName("name"); + vnfc.setModelCustomizationId("2"); + vnfcs.add(vnfc); + doReturn(vnfcs).when(workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any()); + + CvnfcConfigurationCustomization vfModuleCustomization = new CvnfcConfigurationCustomization(); + ConfigurationResource configuration = new ConfigurationResource(); + configuration.setToscaNodeType("FabricConfiguration"); + configuration.setModelUUID("1"); + vfModuleCustomization.setConfigurationResource(configuration); + + doReturn(vfModuleCustomization).when(catalogDbClient).getCvnfcCustomization("1", "1", "1", "2"); + + prepareDelegateExecution(); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + flowsToExecute.add(ebbActivateVfModule); + + ArgumentCaptor<DelegateExecution> executionCaptor = ArgumentCaptor.forClass(DelegateExecution.class); + ArgumentCaptor<ExecuteBuildingBlock> bbCaptor = ArgumentCaptor.forClass(ExecuteBuildingBlock.class); + ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class); + + execution.setVariable("requestAction", "replaceInstance"); + execution.setVariable("completed", true); + workflowActionBBTasks.postProcessingExecuteBBActivateVfModule(execution, ebbActivateVfModule, flowsToExecute); + verify(workflowActionBBTasks, times(1)).postProcessingExecuteBBActivateVfModule(executionCaptor.capture(), + bbCaptor.capture(), listCaptor.capture()); + assertEquals(false, executionCaptor.getAllValues().get(0).getVariable("completed")); + assertEquals(2, ((ArrayList) executionCaptor.getAllValues().get(0).getVariable("flowsToExecute")).size()); + assertEquals("2", + ((ExecuteBuildingBlock) ((ArrayList) executionCaptor.getAllValues().get(0) + .getVariable("flowsToExecute")).get(1)).getConfigurationResourceKeys() + .getCvnfcCustomizationUUID()); + } + + @Test + public void postProcessingExecuteBBActivateVfModuleReplaceInstanceHasNoConfigurationTest() + throws CloneNotSupportedException { + + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + workflowResourceIds.setServiceInstanceId("1"); + workflowResourceIds.setVnfId("1"); + + BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); + ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule); + ebbActivateVfModule.setWorkflowResourceIds(workflowResourceIds); + ebbActivateVfModule.setResourceId("1"); + + ServiceInstance service = new ServiceInstance(); + service.setServiceInstanceName("name"); + service.setModelVersionId("1"); + doReturn(service).when(bbSetupUtils).getAAIServiceInstanceById("1"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfName("name"); + vnf.setModelCustomizationId("1"); + doReturn(vnf).when(bbSetupUtils).getAAIGenericVnf("1"); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleName("name"); + vfModule.setModelCustomizationId("1"); + doReturn(vfModule).when(bbSetupUtils).getAAIVfModule("1", "1"); + + List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>(); + org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc(); + vnfc.setModelInvariantId("1"); + vnfc.setVnfcName("name"); + vnfc.setModelCustomizationId("2"); + vnfcs.add(vnfc); + doReturn(vnfcs).when(workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any()); + + CvnfcConfigurationCustomization vfModuleCustomization = new CvnfcConfigurationCustomization(); + ConfigurationResource configuration = new ConfigurationResource(); + configuration.setToscaNodeType("FabricConfiguration"); + configuration.setModelUUID("1"); + vfModuleCustomization.setConfigurationResource(configuration); + + doReturn(vfModuleCustomization).when(catalogDbClient).getCvnfcCustomization("1", "1", "1", "2"); + + prepareDelegateExecution(); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + flowsToExecute.add(ebbActivateVfModule); + + ArgumentCaptor<DelegateExecution> executionCaptor = ArgumentCaptor.forClass(DelegateExecution.class); + ArgumentCaptor<ExecuteBuildingBlock> bbCaptor = ArgumentCaptor.forClass(ExecuteBuildingBlock.class); + ArgumentCaptor<List> listCaptor = ArgumentCaptor.forClass(List.class); + + execution.setVariable("requestAction", "replaceInstance"); + execution.setVariable("completed", true); + + workflowActionBBTasks.postProcessingExecuteBBActivateVfModule(execution, ebbActivateVfModule, flowsToExecute); + verify(workflowActionBBTasks, times(1)).postProcessingExecuteBBActivateVfModule(executionCaptor.capture(), + bbCaptor.capture(), listCaptor.capture()); + assertEquals(true, executionCaptor.getAllValues().get(0).getVariable("completed")); + } + + + + @Test + public void getExecuteBBForConfigTest() throws CloneNotSupportedException { BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB"); ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAITest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAITest.java new file mode 100644 index 0000000000..35a5bfefd7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionExtractResourcesAAITest.java @@ -0,0 +1,102 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Modifications Copyright (c) 2020 Nokia + * ================================================================================ + * 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.workflow.tasks; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +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.VpnBinding; +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.AAISimpleUri; +import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; + +@RunWith(MockitoJUnitRunner.class) +public class WorkflowActionExtractResourcesAAITest { + + private static final String CONFIGURATION_ID = "configTestId"; + private static final String VPN_ID = "vpnTestId"; + + @Mock + private BBInputSetupUtils bbInputSetupUtils; + @InjectMocks + private WorkflowActionExtractResourcesAAI testedObject; + + @Test + public void extractRelationshipsConfigurationSuccess() { + // given + Relationships relationships = mock(Relationships.class); + when(relationships.getByType(Types.CONFIGURATION)).thenReturn(getConfigurationList()); + // when + Optional<Configuration> resultOpt = testedObject.extractRelationshipsConfiguration(relationships); + // then + assertThat(resultOpt).isNotEmpty(); + assertThat(resultOpt.get().getConfigurationId()).isEqualTo(CONFIGURATION_ID); + } + + @Test + public void extractRelationshipsConfiguration_notFound() { + // given + Relationships relationships = mock(Relationships.class); + when(relationships.getByType(Types.CONFIGURATION)).thenReturn(Collections.emptyList()); + // when + Optional<Configuration> resultOpt = testedObject.extractRelationshipsConfiguration(relationships); + // then + assertThat(resultOpt).isEmpty(); + } + + @Test + public void extractRelationshipsVpnBindingSuccess() { + // given + Relationships relationships = mock(Relationships.class); + AAIResourceUri aaiResourceUri = mock(AAISimpleUri.class); + List<AAIResourceUri> aaiResourceUriList = new ArrayList<>(); + aaiResourceUriList.add(aaiResourceUri); + when(relationships.getRelatedUris(Types.VPN_BINDING)).thenReturn(aaiResourceUriList); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("{\"vpn-id\" : \"" + VPN_ID + "\"}"); + when(bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri)).thenReturn(aaiResultWrapper); + // when + Optional<VpnBinding> resultOpt = testedObject.extractRelationshipsVpnBinding(relationships); + // then + assertThat(resultOpt).isNotEmpty(); + assertThat(resultOpt.get().getVpnId()).isEqualTo(VPN_ID); + } + + private List<AAIResultWrapper> getConfigurationList() { + List<AAIResultWrapper> configurations = new ArrayList<>(); + AAIResultWrapper aaiResultWrapper = + new AAIResultWrapper("{\"configuration-id\" : \"" + CONFIGURATION_ID + "\"}"); + configurations.add(aaiResultWrapper); + return configurations; + } +} 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 7f22c5138e..100c32f1c2 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 @@ -35,6 +35,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyList; import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -50,9 +51,7 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError; @@ -67,15 +66,10 @@ import org.junit.rules.ExpectedException; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.onap.aai.domain.yang.GenericVnf; -import org.onap.aai.domain.yang.GenericVnfs; -import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipList; import org.onap.aai.domain.yang.ServiceInstance; -import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.VfModule; -import org.onap.aai.domain.yang.VfModules; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aaiclient.client.aai.entities.AAIResultWrapper; import org.onap.aaiclient.client.aai.entities.Relationships; @@ -107,11 +101,8 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; -import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; -import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; -import org.onap.so.serviceinstancebeans.SubscriberInfo; import org.springframework.core.env.Environment; public class WorkflowActionTest extends BaseTaskTest { @@ -127,14 +118,23 @@ public class WorkflowActionTest extends BaseTaskTest { @Mock protected Environment environment; + @Mock + protected UserParamsServiceTraversal userParamsServiceTraversal; + + @Mock + private AaiResourceIdValidator aaiResourceIdValidator; @InjectMocks protected WorkflowAction workflowAction; + private DelegateExecution execution; @InjectMocks @Spy protected WorkflowAction SPY_workflowAction; + @Spy + protected ExecuteBuildingBlockBuilder executeBuildingBlockBuilder; + @Rule public ExpectedException thrown = ExpectedException.none(); @@ -163,6 +163,7 @@ public class WorkflowActionTest extends BaseTaskTest { when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); workflowAction.setBbInputSetupUtils(bbSetupUtils); workflowAction.setBbInputSetup(bbInputSetup); + } /** @@ -183,6 +184,7 @@ public class WorkflowActionTest extends BaseTaskTest { when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignNetwork1802BB", "CreateNetworkBB", "ActivateNetworkBB"); @@ -203,6 +205,7 @@ public class WorkflowActionTest extends BaseTaskTest { when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetwork1802BB"); @@ -223,6 +226,7 @@ public class WorkflowActionTest extends BaseTaskTest { when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "ActivateServiceInstanceBB"); @@ -237,7 +241,7 @@ public class WorkflowActionTest extends BaseTaskTest { doThrow(new DuplicateNameException( "serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique.")) - .when(SPY_workflowAction).validateResourceIdInAAI(anyString(), eq(WorkflowType.SERVICE), + .when(aaiResourceIdValidator).validateResourceIdInAAI(anyString(), eq(WorkflowType.SERVICE), eq("test"), any(RequestDetails.class), any(WorkflowResourceIds.class)); SPY_workflowAction.selectExecutionList(execution); @@ -286,6 +290,8 @@ public class WorkflowActionTest extends BaseTaskTest { VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString())) + .thenReturn(prepareListWithResources()); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")) @@ -294,6 +300,7 @@ public class WorkflowActionTest extends BaseTaskTest { .thenReturn(vfModuleCustomization2); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")) .thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB", @@ -334,6 +341,8 @@ public class WorkflowActionTest extends BaseTaskTest { VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString())) + .thenReturn(prepareListWithResources()); when(environment.getProperty("org.onap.so.cloud-owner")).thenReturn("att-aic"); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "att-aic")).thenReturn(northBoundRequest); @@ -471,6 +480,7 @@ public class WorkflowActionTest extends BaseTaskTest { doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignNetworkBB", "CreateNetworkBB", @@ -606,6 +616,8 @@ public class WorkflowActionTest extends BaseTaskTest { VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString())) + .thenReturn(prepareListWithResources()); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")) @@ -622,6 +634,7 @@ public class WorkflowActionTest extends BaseTaskTest { "ActivateVolumeGroupBB", "CreateVfModuleBB", "CreateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB"); + assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length()); int randomUUIDLength = UUID.randomUUID().toString().length(); assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length()); @@ -1255,8 +1268,8 @@ public class WorkflowActionTest extends BaseTaskTest { List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "DeleteFabricConfigurationBB", "DeactivateVfModuleBB", "DeleteVfModuleATTBB", - "UnassignVFModuleBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", - "AddFabricConfigurationBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB"); + "UnassignVFModuleBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", + "ChangeModelServiceInstanceBB"); } @Test @@ -2010,906 +2023,6 @@ public class WorkflowActionTest extends BaseTaskTest { assertNull(x.getVolumeGroupId()); } - private RequestDetails setupRequestDetails(String globalSubscriberId, String subscriptionServiceType, - String modelCustomizationId) { - RequestDetails reqDetails = new RequestDetails(); - SubscriberInfo subInfo = new SubscriberInfo(); - subInfo.setGlobalSubscriberId(globalSubscriberId); - reqDetails.setSubscriberInfo(subInfo); - RequestParameters reqParams = new RequestParameters(); - reqParams.setSubscriptionServiceType(subscriptionServiceType); - reqDetails.setRequestParameters(reqParams); - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelCustomizationId(modelCustomizationId); - reqDetails.setModelInfo(modelInfo); - return reqDetails; - } - - @Test - public void validateResourceIdInAAIVnfTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - // Vnf - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setModelCustomizationId("1234567"); - Optional<GenericVnf> opVnf = Optional.of(vnf); - GenericVnf vnf2 = new GenericVnf(); - vnf2.setVnfId("id123"); - vnf2.setVnfName("vnfName222"); - vnf2.setModelCustomizationId("222"); - Optional<GenericVnf> opVnf2 = Optional.of(vnf2); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName222")).thenReturn(opVnf2); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty()); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName123", reqDetails, - workflowResourceIds); - assertEquals("id123", id); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id2); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "generic-vnf with name (vnfName222), same parent and different customization id (222) already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName222", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIVnfNotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - // Vnf - GenericVnfs genericVnfs = new GenericVnfs(); - GenericVnf vnf3 = new GenericVnf(); - vnf3.setVnfId("id123"); - vnf3.setVnfName("vnfName333"); - genericVnfs.getGenericVnf().add(vnf3); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName333")).thenReturn(Optional.empty()); - when(bbSetupUtils.getAAIVnfsGloballyByName("vnfName333")).thenReturn(genericVnfs); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "generic-vnf with name (vnfName333) id (id123) and different parent relationship already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "vnfName333", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAINetworkTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - // Network - L3Network network = new L3Network(); - network.setNetworkId("id123"); - network.setNetworkName("name123"); - network.setModelCustomizationId("1234567"); - workflowResourceIds.setServiceInstanceId("siId123"); - Optional<L3Network> opNetwork = Optional.of(network); - L3Network network2 = new L3Network(); - network2.setNetworkId("id123"); - network2.setNetworkName("networkName222"); - network2.setModelCustomizationId("222"); - Optional<L3Network> opNetwork2 = Optional.of(network2); - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork); - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "networkName222")) - .thenReturn(opNetwork2); - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "111111")).thenReturn(Optional.empty()); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", - reqDetails, workflowResourceIds); - assertEquals("id123", id); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", - reqDetails, workflowResourceIds); - assertEquals("generatedId123", id2); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "l3Network with name (networkName222), same parent and different customization id (222) already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName222", reqDetails, - workflowResourceIds); - } - - @Test - public void validateNetworkResourceNameExistsInAAITest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - // Network - L3Network network = new L3Network(); - network.setNetworkId("id123"); - network.setNetworkName("name123"); - network.setModelCustomizationId("1234567"); - workflowResourceIds.setServiceInstanceId("siId123"); - - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("networkName333", "111111")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAINetworksGloballyByName("networkName333")).thenReturn(true); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "l3Network with name (networkName333) id (siId123) and different parent relationship already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "networkName333", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIVfModuleTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setModelCustomizationId("222"); - - // VfModule - VfModules vfModules = new VfModules(); - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("id123"); - vfModule.setVfModuleName("name123"); - vfModule.setModelCustomizationId("1234567"); - vfModules.getVfModule().add(vfModule); - vnf.setVfModules(vfModules); - workflowResourceIds.setVnfId("id123"); - when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", - reqDetails, workflowResourceIds); - assertEquals("id123", id); - - GenericVnf vnf1 = new GenericVnf(); - VfModules vfModules2 = new VfModules(); - VfModule vfModule2 = new VfModule(); - vfModule2.setVfModuleId("id123"); - vfModule2.setVfModuleName("vFModName222"); - vfModule2.setModelCustomizationId("222"); - vfModules2.getVfModule().add(vfModule2); - vnf1.setVfModules(vfModules2); - workflowResourceIds.setVnfId("id111"); - when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf1); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", - reqDetails, workflowResourceIds); - assertEquals("generatedId123", id2); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "vfModule with name (vFModName222), same parent and different customization id (1234567) already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName222", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIVfModuleNotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("id111"); - - GenericVnf vnf1 = new GenericVnf(); - workflowResourceIds.setVnfId("id111"); - when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf1); - - when(bbSetupUtils.existsAAIVfModuleGloballyByName("vFModName333")).thenReturn(true); - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage( - containsString("vfModule with name vFModName333 already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "vFModName333", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIVolumeGroupTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setModelCustomizationId("1234567"); - - GenericVnf vnf2 = new GenericVnf(); - vnf2.setVnfId("id123"); - vnf2.setVnfName("vnfName123"); - vnf2.setModelCustomizationId("222"); - - // VolumeGroup - VolumeGroup volumeGroup = new VolumeGroup(); - volumeGroup.setVolumeGroupId("id123"); - volumeGroup.setVolumeGroupName("name123"); - volumeGroup.setVfModuleModelCustomizationId("1234567"); - workflowResourceIds.setVnfId("id123"); - Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); - - workflowResourceIds.setVnfId("id123"); - - when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(opVolumeGroup); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", - reqDetails, workflowResourceIds); - assertEquals("id123", id); - - when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf2); - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "111111")) - .thenReturn(opVolumeGroup); - - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "111111")).thenReturn(Optional.empty()); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", - reqDetails, workflowResourceIds); - assertEquals("generatedId123", id2); - } - - @Test - public void validatesourceIdInAAIVolumeGroupNotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("id123"); - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "testVolumeGroup")).thenReturn(Optional.empty()); - - when(bbSetupUtils.existsAAIVolumeGroupGloballyByName("testVolumeGroup")).thenReturn(true); - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage( - containsString("volumeGroup with name testVolumeGroup already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "testVolumeGroup", - reqDetails, workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIConfigurationTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - // Configuration - org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); - configuration.setConfigurationId("id123"); - configuration.setConfigurationName("name123"); - configuration.setModelCustomizationId("1234567"); - Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); - - org.onap.aai.domain.yang.Configuration configuration2 = new org.onap.aai.domain.yang.Configuration(); - configuration2.setConfigurationId("id123"); - configuration2.setConfigurationName("name123"); - configuration2.setModelCustomizationId("222"); - Optional<org.onap.aai.domain.yang.Configuration> opConfiguration2 = Optional.of(configuration2); - - workflowResourceIds.setVnfId("id123"); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) - .thenReturn(opConfiguration); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name123", - reqDetails, workflowResourceIds); - assertEquals("id123", id); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "111111")) - .thenReturn(Optional.empty()); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "111111", - reqDetails, workflowResourceIds); - assertEquals("generatedId123", id2); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name222")) - .thenReturn(opConfiguration2); - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "configuration with name (name222), same parent and different customization id (id123) already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "name222", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIConfigurationNotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "testConfig")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAIConfigurationGloballyByName("testConfig")).thenReturn(true); - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage( - containsString("configuration with name testConfig already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.CONFIGURATION, "testConfig", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAISITest() throws Exception { - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("1234567"); - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(si); - Optional<ServiceInstance> siOp = Optional.of(si); - ServiceInstance si2 = new ServiceInstance(); - si2.setServiceInstanceId("siId222"); - si2.setModelVersionId("22222"); - si2.setServiceInstanceName("siName222"); - Optional<ServiceInstance> siOp2 = Optional.of(si2); - ServiceInstances serviceInstances2 = new ServiceInstances(); - serviceInstances2.getServiceInstance().add(si2); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName222")).thenReturn(siOp2); - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111")) - .thenReturn(Optional.empty()); - - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", - reqDetails, workflowResourceIds); - assertEquals("siId123", id); - String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", - reqDetails, workflowResourceIds); - assertEquals("generatedId123", id2); - - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName222")).thenReturn(serviceInstances2); - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "serviceInstance with name (siName222) and different version id (1234567) already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName222", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAIMultipleSITest() throws Exception { - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("1234567"); - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(si); - - ServiceInstance si2 = new ServiceInstance(); - si2.setServiceInstanceId("siId222"); - si2.setModelVersionId("22222"); - si2.setServiceInstanceName("siName222"); - serviceInstances.getServiceInstance().add(si2); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siId123")) - .thenReturn(Optional.empty()); - - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "serviceInstance with name (siName123) and multiple combination of model-version-id + service-type + global-customer-id already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, - workflowResourceIds); - } - - @Test - public void validateResourceIdInAAISIExistsTest() throws Exception { - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("1234567"); - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(si); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siId123")) - .thenReturn(Optional.empty()); - - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(serviceInstances); - - Map<String, String> uriKeys = new HashMap<>(); - uriKeys.put(AAIFluentTypeBuilder.Types.CUSTOMER.getUriParams().globalCustomerId, "globalCustomerId"); - uriKeys.put(AAIFluentTypeBuilder.Types.SERVICE_SUBSCRIPTION.getUriParams().serviceType, "serviceType"); - - when(bbSetupUtils.getURIKeysFromServiceInstance("siId123")).thenReturn(uriKeys); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "serviceInstance with name (siName123) and global-customer-id (globalCustomerId), service-type (serviceType), model-version-id (1234567) already exists. The name must be unique.")); - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, - workflowResourceIds); - } - - @Test - public void validateServiceResourceIdInAAINoDupTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName123")).thenReturn(null); - String id = workflowAction.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails); - assertEquals("generatedId123", id); - } - - @Test - public void validateServiceResourceIdInAAISameModelVersionId() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("1234567"); - Optional<ServiceInstance> siOp = Optional.of(si); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); - String id = workflowAction.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails); - assertEquals("siId123", id); - } - - @Test - public void validateServiceResourceIdInAAIDifferentModelVersionId() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("9999999"); - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(si); - Optional<ServiceInstance> siOp = Optional.of(si); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "serviceInstance with name (siName123) and different version id (1234567) already exists. The name must be unique.")); - - String id = workflowAction.validateServiceResourceIdInAAI("generatedId123", "siName123", reqDetails); - assertEquals("siId123", id); - } - - @Test - public void validateServiceResourceIdInAAIDuplicateNameTest() throws Exception { - - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("1234567"); - - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(si); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName")).thenReturn(serviceInstances); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "serviceInstance with name (siName) and global-customer-id (null), service-type (null), model-version-id (1234567) already exists. The name must be unique.")); - - workflowAction.validateServiceResourceIdInAAI("generatedId123", "siName", reqDetails); - } - - @Test - public void validateServiceResourceIdInAAIDuplicateNameMultipleTest() throws Exception { - - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - reqDetails.getModelInfo().setModelVersionId("1234567"); - - ServiceInstance si = new ServiceInstance(); - si.setServiceInstanceId("siId123"); - si.setModelVersionId("1234567"); - - ServiceInstance si2 = new ServiceInstance(); - si2.setServiceInstanceId("siId222"); - si2.setModelVersionId("22222"); - si2.setServiceInstanceName("siName222"); - - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(si); - serviceInstances.getServiceInstance().add(si2); - - when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.getAAIServiceInstancesGloballyByName("siName")).thenReturn(serviceInstances); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "serviceInstance with name (siName) and multiple combination of model-version-id + service-type + global-customer-id already exists. The name must be unique.")); - - workflowAction.validateServiceResourceIdInAAI("generatedId123", "siName", reqDetails); - } - - @Test - public void validateNetworkResourceIdInAAITest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAINetworksGloballyByName("name123")).thenReturn(false); - - String id = workflowAction.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id); - } - - @Test - public void validateNetworkResourceIdInAAISameModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - L3Network network = new L3Network(); - network.setNetworkId("id123"); - network.setNetworkName("name123"); - network.setModelCustomizationId("1234567"); - Optional<L3Network> opNetwork = Optional.of(network); - - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork); - - String id = workflowAction.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("id123", id); - } - - @Test - public void validateNetworkResourceIdInAAIDuplicateNameTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - L3Network network = new L3Network(); - network.setNetworkId("id123"); - network.setNetworkName("name123"); - network.setModelCustomizationId("9999999"); - Optional<L3Network> opNetwork = Optional.of(network); - - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")).thenReturn(opNetwork); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "l3Network with name (name123), same parent and different customization id (9999999) already exists. The name must be unique.")); - - workflowAction.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); - } - - @Test - public void validateNetworkResourceIdInAAINotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123", "name123")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAINetworksGloballyByName("name123")).thenReturn(true); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "l3Network with name (name123) id (siId123) and different parent relationship already exists. The name must be unique.")); - - workflowAction.validateNetworkResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); - } - - @Test - public void validateVnfResourceIdInAAITest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(Optional.empty()); - String id = workflowAction.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id); - } - - @Test - public void validateVnfResourceIdInAAISameModelCustomizationIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setModelCustomizationId("1234567"); - Optional<GenericVnf> opVnf = Optional.of(vnf); - - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); - String id = workflowAction.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, - workflowResourceIds); - assertEquals("id123", id); - } - - @Test - public void validateVnfResourceIdInAAIDiffModelCustomizationIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setModelCustomizationId("9999999"); - Optional<GenericVnf> opVnf = Optional.of(vnf); - - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(opVnf); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "generic-vnf with name (vnfName123), same parent and different customization id (9999999) already exists. The name must be unique.")); - - workflowAction.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds); - } - - @Test - public void validateVnfResourceIdInAAINotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - GenericVnfs genericVnfs = new GenericVnfs(); - genericVnfs.getGenericVnf().add(vnf); - - when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123", "vnfName123")).thenReturn(Optional.empty()); - when(bbSetupUtils.getAAIVnfsGloballyByName("vnfName123")).thenReturn(genericVnfs); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "generic-vnf with name (vnfName123) id (id123) and different parent relationship already exists. The name must be unique.")); - - workflowAction.validateVnfResourceIdInAAI("generatedId123", "vnfName123", reqDetails, workflowResourceIds); - } - - @Test - public void validateVfModuleResourceIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("vnfId123"); - - when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(null); - when(bbSetupUtils.existsAAIVfModuleGloballyByName("name123")).thenReturn(false); - - String id = workflowAction.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id); - } - - @Test - public void validateVfModuleResourceIdSameModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("vnfId123"); - - VfModules vfModules = new VfModules(); - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("id123"); - vfModule.setVfModuleName("name123"); - vfModule.setModelCustomizationId("1234567"); - vfModules.getVfModule().add(vfModule); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setVfModules(vfModules); - - when(bbSetupUtils.getAAIGenericVnf("vnfId123")).thenReturn(vnf); - - String id = workflowAction.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("id123", id); - } - - @Test - public void validateVfModuleResourceIdDifferentModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("vnfId123"); - - VfModules vfModules = new VfModules(); - VfModule vfModule = new VfModule(); - vfModule.setVfModuleId("id123"); - vfModule.setVfModuleName("name123"); - vfModule.setModelCustomizationId("9999999"); - vfModules.getVfModule().add(vfModule); - - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("vnfName123"); - vnf.setVfModules(vfModules); - - when(bbSetupUtils.getAAIGenericVnf("vnfId123")).thenReturn(vnf); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "vfModule with name (name123), same parent and different customization id (1234567) already exists. The name must be unique.")); - - workflowAction.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); - - } - - @Test - public void validateVfModuleResourceIdNotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("vnfId123"); - - when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(null); - when(bbSetupUtils.existsAAIVfModuleGloballyByName("name123")).thenReturn(true); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException - .expectMessage(containsString("vfModule with name name123 already exists. The name must be unique.")); - - workflowAction.validateVfModuleResourceIdInAAI("generatedId123", "name123", reqDetails, workflowResourceIds); - } - - @Test - public void validateVolumeGroupResourceIdInAAITest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("vnfId123"); - - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123")).thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAIVolumeGroupGloballyByName("name123")).thenReturn(false); - - String id = workflowAction.validateVolumeGroupResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id); - } - - @Test - public void validateVolumeGroupResourceIdInAAISameModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - workflowResourceIds.setVnfId("vnfId123"); - - VolumeGroup volumeGroup = new VolumeGroup(); - volumeGroup.setVolumeGroupId("id123"); - volumeGroup.setVolumeGroupName("name123"); - volumeGroup.setVfModuleModelCustomizationId("1234567"); - - Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); - - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(opVolumeGroup); - String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", - reqDetails, workflowResourceIds); - - assertEquals("id123", id); - } - - @Test - public void validateVolumeGroupResourceIdInAAIDifferentModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - workflowResourceIds.setVnfId("vnfId123"); - - VolumeGroup volumeGroup = new VolumeGroup(); - volumeGroup.setVolumeGroupId("id123"); - volumeGroup.setVolumeGroupName("name123"); - volumeGroup.setVfModuleModelCustomizationId("9999999"); - - Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); - - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(opVolumeGroup); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage( - containsString("volumeGroup with name name123 already exists. The name must be unique.")); - - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, - workflowResourceIds); - } - - @Test - public void validateVolumeGroupResourceIdInAAINotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setVnfId("vnfId123"); - - when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("vnfId123", "name123")).thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAIVolumeGroupGloballyByName("name123")).thenReturn(true); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage( - containsString("volumeGroup with name name123 already exists. The name must be unique.")); - - workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, - workflowResourceIds); - } - - @Test - public void validateConfigurationResourceIdInAAITest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAIConfigurationGloballyByName("name123")).thenReturn(false); - - String id = workflowAction.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("generatedId123", id); - } - - @Test - public void validateConfigurationResourceIdInAAISameModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); - configuration.setConfigurationId("id123"); - configuration.setConfigurationName("name123"); - configuration.setModelCustomizationId("1234567"); - Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) - .thenReturn(opConfiguration); - when(bbSetupUtils.existsAAIConfigurationGloballyByName("name123")).thenReturn(false); - - String id = workflowAction.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - assertEquals("id123", id); - } - - @Test - public void validateConfigurationResourceIdInAAIDifferentModelCustIdTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration(); - configuration.setConfigurationId("id123"); - configuration.setConfigurationName("name123"); - configuration.setModelCustomizationId("9999999"); - Optional<org.onap.aai.domain.yang.Configuration> opConfiguration = Optional.of(configuration); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) - .thenReturn(opConfiguration); - when(bbSetupUtils.existsAAIConfigurationGloballyByName("name123")).thenReturn(false); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage(containsString( - "configuration with name (name123), same parent and different customization id (id123) already exists. The name must be unique.")); - - workflowAction.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - } - - @Test - public void validateConfigurationResourceIdInAAINotGloballyUniqueTest() throws Exception { - RequestDetails reqDetails = setupRequestDetails("id123", "subServiceType123", "1234567"); - WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); - workflowResourceIds.setServiceInstanceId("siId123"); - - when(bbSetupUtils.getRelatedConfigurationByNameFromServiceInstance("siId123", "name123")) - .thenReturn(Optional.empty()); - when(bbSetupUtils.existsAAIConfigurationGloballyByName("name123")).thenReturn(true); - - this.expectedException.expect(DuplicateNameException.class); - this.expectedException.expectMessage( - containsString("configuration with name name123 already exists. The name must be unique.")); - - workflowAction.validateConfigurationResourceIdInAAI("generatedId123", "name123", reqDetails, - workflowResourceIds); - } - @Test public void handleRuntimeExceptionTest() { execution.setVariable("BPMN_javaExpMsg", "test runtime error message"); @@ -2960,41 +2073,7 @@ public class WorkflowActionTest extends BaseTaskTest { workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds); } - @Test - public void sortVfModulesByBaseFirstTest() { - List<Resource> resources = new ArrayList<>(); - Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); - resource1.setBaseVfModule(false); - resources.add(resource1); - Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); - resource2.setBaseVfModule(false); - resources.add(resource2); - Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); - resource3.setBaseVfModule(true); - resources.add(resource3); - List<Resource> result = workflowAction.sortVfModulesByBaseFirst(resources); - assertEquals("333", result.get(0).getResourceId()); - assertEquals("222", result.get(1).getResourceId()); - assertEquals("111", result.get(2).getResourceId()); - } - @Test - public void sortVfModulesByBaseLastTest() { - List<Resource> resources = new ArrayList<>(); - Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); - resource1.setBaseVfModule(true); - resources.add(resource1); - Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); - resource2.setBaseVfModule(false); - resources.add(resource2); - Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); - resource3.setBaseVfModule(false); - resources.add(resource3); - List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources); - assertEquals("333", result.get(0).getResourceId()); - assertEquals("222", result.get(1).getResourceId()); - assertEquals("111", result.get(2).getResourceId()); - } @Test public void findCatalogNetworkCollectionTest() { @@ -3033,17 +2112,6 @@ public class WorkflowActionTest extends BaseTaskTest { execution.getVariable("WorkflowActionErrorMessage")); } - @Test - public void verifyLackOfNullPointerExceptionForNullResource() { - ExecuteBuildingBlock result = null; - try { - result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, - false, null, null, null, false, null, null, true, null); - } catch (NullPointerException e) { - fail("NullPointerException should not be thrown when 'resource' is null"); - } - assertNotNull(result); - } @Test public void traverseAAIServiceTest() { @@ -3100,6 +2168,32 @@ public class WorkflowActionTest extends BaseTaskTest { } } + @Test + public void foundRelatedTest() { + List<Resource> resourceList = new ArrayList<>(); + resourceList.add(new Resource(WorkflowType.PNF, "model customization id", false)); + resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false)); + resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false)); + resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false)); + + assertEquals(workflowAction.foundRelated(resourceList), true); + } + + @Test + public void containsWorkflowTypeTest() { + List<Resource> resourceList = new ArrayList<>(); + resourceList.add(new Resource(WorkflowType.PNF, "resource id", false)); + resourceList.add(new Resource(WorkflowType.VNF, "model customization id", false)); + resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false)); + resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false)); + + assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.PNF), true); + assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.VNF), true); + assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.NETWORK), true); + assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION), true); + assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.CONFIGURATION), false); + } + private List<Pair<WorkflowType, String>> getExpectedResourceIds() { List<Pair<WorkflowType, String>> resourceIds = new ArrayList<>(); resourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, "testVnfId1")); @@ -3141,4 +2235,15 @@ public class WorkflowActionTest extends BaseTaskTest { private String readBpmnRequestFromFile(String fileName) throws IOException { return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName))); } + + private List<Resource> prepareListWithResources() { + List<Resource> resourceList = new ArrayList<>(); + resourceList.add(new Resource(WorkflowType.SERVICE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false)); + resourceList.add(new Resource(WorkflowType.VNF, "ab153b6e-c364-44c0-bef6-1f2982117f04", false)); + resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f", false)); + resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false)); + resourceList.add(new Resource(WorkflowType.VFMODULE, "3c40d244-808e-42ca-b09a-256d83d19d0a", false)); + resourceList.add(new Resource(WorkflowType.VFMODULE, "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", false)); + return resourceList; + } } |