aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy119
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java58
-rw-r--r--bpmn/MSOCoreBPMN/pom.xml2
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java119
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml2
-rw-r--r--bpmn/pom.xml2
-rw-r--r--bpmn/so-bpmn-building-blocks/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy333
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy309
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn225
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn254
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java247
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java124
26 files changed, 1789 insertions, 335 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index e233e6a7c6..c817874fb6 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>MSOCommonBPMN</artifactId>
<name>MSOCommonBPMN</name>
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
new file mode 100644
index 0000000000..ce474fa713
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RequestDBUtil.groovy
@@ -0,0 +1,119 @@
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import org.springframework.web.util.UriUtils
+
+class RequestDBUtil {
+ private static final Logger logger = LoggerFactory.getLogger( RequestDBUtil.class);
+ private ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * update operation status in requestDB
+ * @param execution
+ * @param operationStatus
+ */
+ void prepareUpdateOperationStatus(DelegateExecution execution, final OperationStatus operationStatus){
+ logger.debug("start prepareUpdateOperationStatus")
+ try{
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+ execution.setVariable("dbAdapterEndpoint", dbAdapterEndpoint)
+ logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+ String serviceId = operationStatus.getServiceId()
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ String operationId = operationStatus.getOperationId()
+ String userId = operationStatus.getUserId()
+ String operationType = operationStatus.getOperation()
+ String result = operationStatus.getResult()
+ String progress = operationStatus.getProgress()
+ String operationContent = operationStatus.getOperationContent()
+ String reason = operationStatus.getReason()
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus 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:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ execution.setVariable("updateOperationStatus", payload)
+
+ }catch(any){
+ String exceptionMessage = "Prepare update ServiceOperationStatus failed. cause - " + any.getMessage()
+ logger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ logger.trace("finished update OperationStatus")
+ }
+
+
+ /**
+ * get operation status from requestDB by serviceId and operationId
+ * @param execution
+ * @param serviceId
+ * @param operationId
+ */
+ void getOperationStatus(DelegateExecution execution, String serviceId, String operationId) {
+ logger.trace("start getOperationStatus")
+ try {
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
+ execution.setVariable("dbAdapterEndpoint", dbAdapterEndpoint)
+ logger.trace("DB Adapter Endpoint is: " + dbAdapterEndpoint)
+
+ serviceId = UriUtils.encode(serviceId,"UTF-8")
+ operationId = UriUtils.encode(operationId,"UTF-8")
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.onap.so/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:getServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
+ <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
+ </ns:getServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ execution.setVariable("getOperationStatus", payload)
+
+ } catch(any){
+ String exceptionMessage = "Get ServiceOperationStatus failed. cause - " + any.getMessage()
+ logger.error(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+}
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 ec7b613727..e004e10cf0 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
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -398,68 +399,37 @@ public class BBInputSetupUtils {
}
public Configuration getAAIConfiguration(String configurationId) {
- return this.injectionHelper.getAaiClient()
- .get(Configuration.class,
- AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Configuration matched by id");
- return null;
- });
+ return this.getConcreteAAIResource(Configuration.class, AAIObjectType.CONFIGURATION, configurationId);
}
public GenericVnf getAAIGenericVnf(String vnfId) {
-
- return this.injectionHelper.getAaiClient()
- .get(GenericVnf.class,
- AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ return getConcreteAAIResource(GenericVnf.class, AAIObjectType.GENERIC_VNF, vnfId);
}
public VpnBinding getAAIVpnBinding(String vpnBindingId) {
-
- return this.injectionHelper.getAaiClient()
- .get(VpnBinding.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnBindingId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No VpnBinding matched by id");
- return null;
- });
+ return getConcreteAAIResource(VpnBinding.class, AAIObjectType.VPN_BINDING, vpnBindingId);
}
public VolumeGroup getAAIVolumeGroup(String cloudOwnerId, String cloudRegionId, String volumeGroupId) {
- return this.injectionHelper.getAaiClient()
- .get(VolumeGroup.class, AAIUriFactory
- .createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId, volumeGroupId)
- .depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ return getConcreteAAIResource(VolumeGroup.class, AAIObjectType.VOLUME_GROUP, cloudOwnerId, cloudRegionId,
+ volumeGroupId);
}
public VfModule getAAIVfModule(String vnfId, String vfModuleId) {
- return this.injectionHelper.getAaiClient()
- .get(VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
- return null;
- });
+ return getConcreteAAIResource(VfModule.class, AAIObjectType.VF_MODULE, vnfId, vfModuleId);
}
public L3Network getAAIL3Network(String networkId) {
+ return getConcreteAAIResource(L3Network.class, AAIObjectType.L3_NETWORK, networkId);
+ }
- return this.injectionHelper.getAaiClient()
- .get(L3Network.class,
- AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ONE))
- .orElseGet(() -> {
- logger.debug("No Generic Vnf matched by id");
+ private <T> T getConcreteAAIResource(Class<T> clazz, AAIObjectType objectType, Object... ids) {
+ return injectionHelper.getAaiClient()
+ .get(clazz, AAIUriFactory.createResourceUri(objectType, ids).depth(Depth.ONE)).orElseGet(() -> {
+ logger.debug("No resource of type: {} matched by ids: {}", objectType.typeName(),
+ Arrays.toString(ids));
return null;
});
-
}
public Optional<ServiceInstance> getRelatedServiceInstanceFromInstanceGroup(String instanceGroupId)
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml
index fd239562e2..47254e75f2 100644
--- a/bpmn/MSOCoreBPMN/pom.xml
+++ b/bpmn/MSOCoreBPMN/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>MSOCoreBPMN</artifactId>
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java
new file mode 100644
index 0000000000..aefd70ff89
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceArtifact.java
@@ -0,0 +1,119 @@
+/*-
+ * ============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.core.domain;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+import java.io.Serializable;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"artifactUUID", "name", "version", "checksum", "type", "content", "description"})
+@JsonRootName("serviceArtifact")
+public class ServiceArtifact extends JsonWrapper implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @JsonProperty("artifactUUID")
+ private String artifactUUID;
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("version")
+ private String version;
+ @JsonProperty("checksum")
+ private String checksum;
+ @JsonProperty("type")
+ private String type;
+ @JsonProperty("content")
+ private String content;
+ @JsonProperty("description")
+ private String description;
+
+ @JsonProperty("artifactUUID")
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ @JsonProperty("artifactUUID")
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("version")
+ public String getVersion() {
+ return version;
+ }
+
+ @JsonProperty("version")
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @JsonProperty("checksum")
+ public String getChecksum() {
+ return checksum;
+ }
+
+ @JsonProperty("checksum")
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @JsonProperty("content")
+ public String getContent() {
+ return content;
+ }
+
+ @JsonProperty("content")
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @JsonProperty("description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index c3c26ef5e7..04a291af8c 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mso-infrastructure-bpmn</artifactId>
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 65af2fd8d5..6b81bab4df 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<artifactId>bpmn</artifactId>
diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml
index a867613890..52c5502b32 100644
--- a/bpmn/so-bpmn-building-blocks/pom.xml
+++ b/bpmn/so-bpmn-building-blocks/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-building-blocks</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 74df3a2c2e..0df3fbe704 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-common</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
new file mode 100644
index 0000000000..3233bfff61
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
@@ -0,0 +1,333 @@
+/*-
+ * ============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 org.camunda.bpm.engine.delegate.BpmnError
+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.RequestDBUtil
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import java.util.concurrent.TimeUnit
+
+import static org.apache.commons.lang3.StringUtils.isBlank
+
+class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
+
+
+ String Prefix="CSPS_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ RequestDBUtil requestDBUtil = new RequestDBUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ AAIResourcesClient client = getAAIClient()
+
+ private static final Logger logger = LoggerFactory.getLogger(CheckServiceProcessStatus.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ logger.debug(Prefix + "CheckServiceProcessStatus preProcessRequest Start")
+ execution.setVariable("prefix", Prefix)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
+ String parentOperationId = execution.getVariable("parentOperationId")
+
+ if (isBlank(serviceInstanceId) || isBlank(operationId)) {
+ String msg = "Exception in" + Prefix + "preProcessRequest: Input serviceInstanceId or operationId is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ if (isBlank(parentServiceInstanceId) || isBlank(parentOperationId)) {
+ execution.setVariable("isNeedUpdateParentStatus", false)
+ }
+
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ execution.setVariable("globalSubscriberId", "5GCustomer")
+ }
+
+ // serviceType: type of service
+ String serviceType = execution.getVariable("processServiceType")
+ if (isBlank(serviceType)) {
+ execution.setVariable("processServiceType", "service")
+ }
+
+ // operationType: type of service
+ String operationType = execution.getVariable("operationType")
+ if (isBlank(operationType)) {
+ execution.setVariable("operationType", "CREATE")
+ }
+
+ //successConditions: processing end success conditions
+ List<String> successConditions = execution.getVariable("successConditions") as List
+
+ //errorConditions: processing end error conditions
+ List<String> errorConditions = execution.getVariable("errorConditions") as List
+
+ if ((successConditions == null || successConditions.size() < 1)
+ && (errorConditions == null || errorConditions.size() < 1)) {
+ String msg = "Exception in" + Prefix + "preProcessRequest: conditions is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ for (int i = 0; i < successConditions.size(); i++) {
+ String condition = successConditions.get(i)
+ successConditions.set(i, condition.toLowerCase())
+ }
+ for (int i = 0; i < errorConditions.size(); i++) {
+ String condition = errorConditions.get(i)
+ errorConditions.set(i, condition.toLowerCase())
+ }
+ }
+
+ execution.setVariable("startTime", System.currentTimeMillis())
+
+ String initProgress = execution.getVariable("initProgress")
+
+ if (isBlank(initProgress)) {
+ execution.setVariable("initProgress", 0)
+ }
+
+ String endProgress = execution.getVariable("endProgress")
+
+ if (isBlank(endProgress)) {
+ execution.setVariable("endProgress", 100)
+ }
+
+ execution.setVariable("progress", 0)
+ logger.debug(Prefix + "preProcessRequest Exit")
+ }
+
+
+ /**
+ * check service status through request operation id, update operation status
+ */
+ def preCheckServiceStatusReq = { DelegateExecution execution ->
+ logger.trace(Prefix + "preCheckServiceStatusReq Start")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId") as String
+ String operationId = execution.getVariable("operationId") as String
+ requestDBUtil.getOperationStatus(execution, serviceInstanceId, operationId)
+ logger.trace(Prefix + "preCheckServiceStatusReq Exit")
+ }
+
+
+ /**
+ * handle service status, if service status is finished or error, set the service status
+ * @param execution
+ */
+ def handlerServiceStatusResp = { DelegateExecution execution ->
+ logger.trace(Prefix + "handlerServiceStatusResp Start")
+ String msg
+ try {
+ def dbResponseCode = execution.getVariable("dbResponseCode") as Integer
+ if (dbResponseCode >= 200 && dbResponseCode < 400) {
+ String dbResponse = execution.getVariable("dbResponse")
+ def dbResponseJson = jsonUtil.xml2json(dbResponse) as String
+
+ String result = jsonUtil.getJsonValue(dbResponseJson,
+ "Envelope.Body.getServiceOperationStatusResponse.return.result")
+
+ if (isSuccessCompleted(execution, result)) {
+
+ handlerSuccess(execution, result)
+ execution.setVariable("isAllFinished", "true")
+
+ logger.debug(Prefix + "handlerServiceStatusResp: service success finished, dbResponse_result: "
+ + result)
+
+ } else if (isErrorCompleted(execution, result)) {
+
+ handlerError(execution, result)
+ execution.setVariable("isAllFinished", "true")
+
+ logger.debug(Prefix + "handlerServiceStatusResp: service error finished, dbResponse_result: "
+ + result)
+
+ } else {
+ String progress = jsonUtil.getJsonValue(dbResponseJson,
+ "Envelope.Body.getServiceOperationStatusResponse.return.progress")
+
+ String oldProgress = execution.getVariable("progress")
+
+ if (progress == oldProgress) {
+ execution.setVariable("isNeedUpdateDB", false)
+ } else {
+ execution.setVariable("progress", progress)
+ execution.setVariable("isNeedUpdateDB", true)
+ }
+ execution.setVariable("isAllFinished", "false")
+ TimeUnit.SECONDS.sleep(10)
+ }
+ } else {
+ execution.setVariable("isAllFinished", "false")
+ //todo: retry
+ TimeUnit.MILLISECONDS.sleep(10)
+ }
+
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in " + Prefix + "handlerServiceStatusResp: " + ex.getMessage()
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ logger.trace(Prefix + "handlerServiceStatusResp Exit")
+ }
+
+
+ def timeWaitDelay = { DelegateExecution execution ->
+
+ Long startTime = execution.getVariable("startTime") as Long
+ Long timeOut = execution.getVariable("timeOut") as Long
+
+ timeOut = timeOut == null ? 3 * 60 * 60 * 1000 : timeOut
+
+ if (System.currentTimeMillis() - startTime > timeOut) {
+
+ handlerTimeOut(execution)
+ execution.setVariable("isTimeOut", "YES")
+
+ } else {
+ execution.setVariable("isTimeOut", "NO")
+ }
+ }
+
+
+ private handlerTimeOut = { DelegateExecution execution ->
+
+ Map<String, Object> paramMap = execution.getVariable("timeOutParamMap") as Map
+
+ handlerProcess(execution, "error", paramMap, "error", "with timeout")
+ }
+
+
+ private handlerSuccess = { DelegateExecution execution, String result ->
+
+ Map<String, Object> paramMap = execution.getVariable("successParamMap") as Map
+
+ handlerProcess(execution, result, paramMap, "deactivated", "success")
+ }
+
+
+ private handlerError = { DelegateExecution execution, String result ->
+
+ Map<String, Object> paramMap = execution.getVariable("errorParamMap") as Map
+
+ handlerProcess(execution, result, paramMap, "error", "with error")
+ }
+
+
+ private handlerProcess = { DelegateExecution execution, String result, def paramMap, def status, def msg ->
+
+ if (paramMap != null) {
+ for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
+ execution.setVariable(entry.getKey(), entry.getValue())
+ }
+ }
+
+
+ if (isBlank(execution.getVariable("operationStatus") as String)) {
+ execution.setVariable("operationStatus", result)
+ }
+
+
+ if (isBlank(execution.getVariable("operationContent") as String)) {
+ String operationContent = execution.getVariable("processServiceType") + " " +
+ execution.getVariable("operationType") + " operation finished " + msg
+ execution.setVariable("operationContent", operationContent)
+ }
+
+ if (isBlank(execution.getVariable("orchestrationStatus") as String)) {
+ execution.setVariable("orchestrationStatus", status)
+ }
+
+ }
+
+
+ /**
+ * judge if the service processing success finished
+ */
+ private isSuccessCompleted = { DelegateExecution execution, String result ->
+
+ //successConditions: processing end success conditions
+ List<String> successConditions = execution.getVariable("successConditions") as List
+
+ result = result.toLowerCase()
+ if (successConditions.contains(result)) {
+ return true
+ }
+ return false
+ }
+
+
+ /**
+ * judge if the service processing error finished
+ */
+ private isErrorCompleted = { DelegateExecution execution, String result ->
+
+ //errorConditions: processing end error conditions
+ List<String> errorConditions = execution.getVariable("errorConditions") as List
+
+ result = result.toLowerCase()
+ if (errorConditions.contains(result)) {
+ return true
+ }
+ return false
+ }
+
+
+ def preUpdateOperationProgress = { DelegateExecution execution ->
+ logger.trace(Prefix + "prepareUpdateOperationStatus Start")
+
+ def progress = execution.getVariable("progress") as Integer
+ def initProgress = execution.getVariable("initProgress") as Integer
+ def endProgress = execution.getVariable("endProgress") as Integer
+
+ def resProgress = (initProgress + (endProgress - initProgress) / 100 * progress) as Integer
+
+ def operationType = execution.getVariable("operationType")
+ def operationContent = execution.getVariable("processServiceType") + " " +
+ operationType + " operation processing " + resProgress
+
+ // update status creating
+ OperationStatus status = new OperationStatus()
+ status.setServiceId(execution.getVariable("parentServiceInstanceId") as String)
+ status.setOperationId(execution.getVariable("parentOperationId") as String)
+ status.setOperation(operationType as String)
+ status.setResult("processing")
+ status.setProgress(resProgress as String)
+ status.setOperationContent(operationContent as String)
+ status.setUserId(execution.getVariable("globalSubscriberId") as String)
+
+ requestDBUtil.prepareUpdateOperationStatus(execution, status)
+ logger.trace(Prefix + "prepareUpdateOperationStatus Exit")
+ }
+}
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
new file mode 100644
index 0000000000..d8897a2468
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -0,0 +1,309 @@
+/*-
+ * ============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 org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.beans.nsmf.DeAllocateNssi
+import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.JobStatusRequest
+import org.onap.so.beans.nsmf.JobStatusResponse
+import org.onap.so.beans.nsmf.NetworkType
+import org.onap.so.beans.nsmf.NssiDeAllocateRequest
+import org.onap.so.beans.nsmf.NssiResponse
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.RequestDBUtil
+import org.onap.so.bpmn.core.UrnPropertiesReader
+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.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.AAIResourcesClient
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.db.request.beans.OperationStatus
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import javax.ws.rs.core.Response
+
+
+class DoDeallocateNSSI extends AbstractServiceTaskProcessor
+{
+ private final String PREFIX ="DoDeallocateNSSI"
+
+ private ExceptionUtil exceptionUtil = new ExceptionUtil()
+ private JsonUtils jsonUtil = new JsonUtils()
+ private RequestDBUtil requestDBUtil = new RequestDBUtil()
+ private static final Logger LOGGER = LoggerFactory.getLogger( DoDeallocateNSSI.class)
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ LOGGER.trace(" ***** ${PREFIX} Start preProcessRequest *****")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+ if (!currentNSSI) {
+ String msg = "currentNSSI is null"
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ LOGGER.trace("***** ${PREFIX} Exit preProcessRequest *****")
+ }
+
+ /**
+ *
+ * @param execution
+ */
+ private void prepareDecomposeService(DelegateExecution execution)
+ {
+ LOGGER.trace(" *****${PREFIX} Start prepareDecomposeService *****")
+ try
+ {
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String modelInvariantUuid = currentNSSI['modelInvariantId']
+ String modelVersionId = currentNSSI['modelVersionId']
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelVersionId}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ }
+ catch (any)
+ {
+ String exceptionMessage = "Bpmn error encountered in deallocate nssi. Unexpected Error from method prepareDecomposeService() - " + any.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ LOGGER.debug(" ***** ${PREFIX} Exit prepareDecomposeService *****")
+ }
+
+ /**
+ * get vendor Info
+ * @param execution
+ */
+ private void processDecomposition(DelegateExecution execution) {
+ LOGGER.debug("*****${PREFIX} start 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")
+
+ def currentNSSI = execution.getVariable("currentNSSI")
+ currentNSSI['vendor'] = vendor
+ currentNSSI['domainType'] = domainType
+ LOGGER.info("processDecomposition, current vendor-domainType:" +String.join("-", vendor, domainType))
+
+ } catch (any) {
+ String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage()
+ LOGGER.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ LOGGER.debug("*****${PREFIX} Exit processDecomposition *****")
+ }
+
+ /**
+ * send deallocate request to nssmf
+ * @param execution
+ */
+ private void sendRequestToNSSMF(DelegateExecution execution)
+ {
+ LOGGER.debug("*****${PREFIX} start sendRequestToNSSMF *****")
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String snssai= currentNSSI['snssai']
+ String profileId = currentNSSI['profileId']
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
+
+ DeAllocateNssi deAllocateNssi = new DeAllocateNssi()
+ deAllocateNssi.setNsiId(nsiId)
+ deAllocateNssi.setNssiId(nssiId)
+ deAllocateNssi.setTerminateNssiOption(0)
+ deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
+
+ NssiDeAllocateRequest deAllocateRequest = new NssiDeAllocateRequest()
+ deAllocateRequest.setDeAllocateNssi(deAllocateNssi)
+ deAllocateRequest.setEsrInfo(getEsrInfo(currentNSSI))
+
+ ObjectMapper mapper = new ObjectMapper()
+ String json = mapper.writeValueAsString(deAllocateRequest)
+
+ //Prepare auth for NSSMF - Begin
+ String nssmfRequest = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ nssmfRequest = nssmfRequest + String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s",profileId)
+ //nssmfRequest = nssmfRequest + String.format(NssmfAdapterUtil.NSSMI_DEALLOCATE_URL,profileId)
+ //send request to active NSSI TN option
+ URL url = new URL(nssmfRequest)
+ LOGGER.info("deallocate nssmfRequest:${nssmfRequest}, reqBody: ${json}")
+
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(json)
+ checkNssmfResponse(httpResponse, execution)
+
+ NssiResponse nssmfResponse = httpResponse.readEntity(NssiResponse.class)
+ currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
+ currentNSSI['jobProgress'] = 0
+ execution.setVariable("currentNSSI", currentNSSI)
+
+ LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
+ }
+
+ /**
+ * send to nssmf query progress
+ * @param execution
+ */
+ private void getJobStatus(DelegateExecution execution)
+ {
+ def currentNSSI = execution.getVariable("currentNSSI")
+ String jobId = currentNSSI['jobId']
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
+
+ JobStatusRequest jobStatusRequest = new JobStatusRequest()
+ jobStatusRequest.setNssiId(nssiId)
+ jobStatusRequest.setNsiId(nsiId)
+ jobStatusRequest.setEsrInfo(getEsrInfo(currentNSSI))
+
+ ObjectMapper mapper = new ObjectMapper()
+ String json = mapper.writeValueAsString(jobStatusRequest)
+
+ //Prepare auth for NSSMF - Begin
+ String nssmfRequest = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution)
+ nssmfRequest = nssmfRequest + String.format("/api/rest/provMns/v1/NSS/jobs/%s",jobId)
+ //send request to active NSSI TN option
+ URL url = new URL(nssmfRequest)
+ LOGGER.info("get deallocate job status, nssmfRequest:${nssmfRequest}, requestBody: ${json}")
+
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(json)
+ checkNssmfResponse(httpResponse, execution)
+
+ JobStatusResponse jobStatusResponse = httpResponse.readEntity(JobStatusResponse.class)
+ def progress = jobStatusResponse?.getResponseDescriptor()?.getProgress()
+ if(!progress)
+ {
+ LOGGER.error("job progress is null or empty!")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Job progress from NSSMF.")
+ }
+ int oldProgress = currentNSSI['jobProgress']
+ int currentProgress = progress
+
+ execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
+ execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
+ currentNSSI['jobProgress'] = currentProgress
+
+ def statusDescription = jobStatusResponse?.getResponseDescriptor()?.getStatusDescription()
+ currentNSSI['statusDescription'] = statusDescription
+
+ LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
+ }
+
+ private void checkNssmfResponse(Response httpResponse, DelegateExecution execution) {
+ int responseCode = httpResponse.getStatus()
+ LOGGER.debug("NSSMF response code is: " + responseCode)
+
+ if ( responseCode < 200 || responseCode > 204 || !httpResponse.hasEntity()) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Response from NSSMF.")
+ }
+ }
+
+
+ private EsrInfo getEsrInfo(def currentNSSI)
+ {
+ String domaintype = currentNSSI['domainType']
+ String vendor = currentNSSI['vendor']
+
+ EsrInfo info = new EsrInfo()
+ info.setNetworkType(NetworkType.fromString(domaintype))
+ info.setVendor(vendor)
+ return info
+ }
+
+ /**
+ * handle job status
+ * prepare update requestdb
+ * @param execution
+ */
+ private void handleJobStatus(DelegateExecution execution)
+ {
+ 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)
+
+ OperationStatus operationStatus = new OperationStatus()
+ operationStatus.setServiceId(currentNSSI['e2eServiceInstanceId'] as String)
+ operationStatus.setOperationId(currentNSSI['operationId'] as String)
+ operationStatus.setOperation("DELETE")
+ operationStatus.setResult("processing")
+ operationStatus.setProgress(progress as String)
+ operationStatus.setOperationContent(statusDes as String)
+ requestDBUtil.prepareUpdateOperationStatus(execution, operationStatus)
+ LOGGER.debug("update operation, currentProgress=${currentProgress}, proportion=${proportion}, progress = ${progress}" )
+ }
+
+ private void timeDelay(DelegateExecution execution) {
+ try {
+ Thread.sleep(10000);
+ } catch(InterruptedException e) {
+ LOGGER.error("Time Delay exception" + e)
+ }
+ }
+
+ /**
+ * delete slice profile from aai
+ * @param execution
+ */
+ private void delSliceProfileFromAAI(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 = currentNSSI["serviceType"]
+
+ try
+ {
+ LOGGER.debug("delete nssiServiceInstanceId:${nssiServiceInstanceId}, profileId:${profileId}")
+ AAIResourcesClient resourceClient = new AAIResourcesClient()
+ AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, globalSubscriberId, serviceType, nssiServiceInstanceId, profileId)
+ if (!resourceClient.exists(resourceUri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai")
+ }
+ resourceClient.delete(resourceUri)
+ }
+ catch (any)
+ {
+ String msg = "delete slice profile from aai failed! cause-"+any.getCause()
+ LOGGER.error(any.printStackTrace())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ LOGGER.debug("*****${PREFIX} Exist delSliceProfileFromAAI *****")
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index d0c16fc1cc..c7d4f3f894 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-flows</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn
new file mode 100644
index 0000000000..279dd2a4ad
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/CheckServiceProcessStatus.bpmn
@@ -0,0 +1,225 @@
+<?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_0lf96js" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+ <bpmn:process id="CheckServiceProcessStatus" name="CheckServiceProcessStatus" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start check processing status">
+ <bpmn:outgoing>SequenceFlow_1g4lx01</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_1mlave2" name="Prepare service Check Process status Req&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0e29y0f</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1n5nl53</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0r1x26k</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.preCheckServiceStatusReq(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_0w5fmqn" name="get service Operation Status&#10;">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${getOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0r1x26k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_009p8v1</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:scriptTask id="ScriptTask_0z37e29" name="handler service status Response&#10;" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_009p8v1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0yws8fh</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.handlerServiceStatusResp(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0gk7p3l" name="Is service process finished?&#10;" default="SequenceFlow_01o92x6">
+ <bpmn:incoming>SequenceFlow_0yws8fh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18jgpa8</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_01o92x6</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="ScriptTask_1ao91w3" name="Time Delay" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1pxnqsp</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ktr440</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0e29y0f</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.timeWaitDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0e29y0f" sourceRef="ScriptTask_1ao91w3" targetRef="ScriptTask_1mlave2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0r1x26k" sourceRef="ScriptTask_1mlave2" targetRef="ServiceTask_0w5fmqn" />
+ <bpmn:sequenceFlow id="SequenceFlow_009p8v1" sourceRef="ServiceTask_0w5fmqn" targetRef="ScriptTask_0z37e29" />
+ <bpmn:sequenceFlow id="SequenceFlow_0yws8fh" sourceRef="ScriptTask_0z37e29" targetRef="ExclusiveGateway_0gk7p3l" />
+ <bpmn:sequenceFlow id="SequenceFlow_18jgpa8" name="yes" sourceRef="ExclusiveGateway_0gk7p3l" targetRef="EndEvent_0a3w3xw">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isAllFinished") == "true") || (execution.getVariable("isTimeOut") == "YES")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0a3w3xw">
+ <bpmn:incoming>SequenceFlow_18jgpa8</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1g4lx01" sourceRef="StartEvent_1" targetRef="Task_1djj44q" />
+ <bpmn:sequenceFlow id="SequenceFlow_1n5nl53" sourceRef="Task_1djj44q" targetRef="ScriptTask_1mlave2" />
+ <bpmn:scriptTask id="Task_1djj44q" name="Prepare request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1g4lx01</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1n5nl53</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0oic8cv" name="prepare Update Service Operation progress" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0591ght</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1q8dls4</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CheckServiceProcessStatus()
+csi.preUpdateOperationProgress(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1q8dls4" sourceRef="ScriptTask_0oic8cv" targetRef="ServiceTask_1b60rre" />
+ <bpmn:serviceTask id="ServiceTask_1b60rre" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CSMF_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CSMF_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1q8dls4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1pxnqsp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1pxnqsp" sourceRef="ServiceTask_1b60rre" targetRef="ScriptTask_1ao91w3" />
+ <bpmn:sequenceFlow id="SequenceFlow_01o92x6" sourceRef="ExclusiveGateway_0gk7p3l" targetRef="ExclusiveGateway_1pdfjh4" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1pdfjh4" name="isNeedUpdateDB?&#10;" default="SequenceFlow_1ktr440">
+ <bpmn:incoming>SequenceFlow_01o92x6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0591ght</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1ktr440</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0591ght" name="yes" sourceRef="ExclusiveGateway_1pdfjh4" targetRef="ScriptTask_0oic8cv">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1ktr440" name="no" sourceRef="ExclusiveGateway_1pdfjh4" targetRef="ScriptTask_1ao91w3" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CheckServiceProcessStatus">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="179" y="159" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="156" y="202" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1mlave2_di" bpmnElement="ScriptTask_1mlave2">
+ <dc:Bounds x="460" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0w5fmqn_di" bpmnElement="ServiceTask_0w5fmqn">
+ <dc:Bounds x="610" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0z37e29_di" bpmnElement="ScriptTask_0z37e29">
+ <dc:Bounds x="770" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0gk7p3l_di" bpmnElement="ExclusiveGateway_0gk7p3l" isMarkerVisible="true">
+ <dc:Bounds x="955" y="152" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="944" y="122" width="89" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1ao91w3_di" bpmnElement="ScriptTask_1ao91w3">
+ <dc:Bounds x="460" y="290" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0e29y0f_di" bpmnElement="SequenceFlow_0e29y0f">
+ <di:waypoint x="510" y="290" />
+ <di:waypoint x="510" y="217" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0r1x26k_di" bpmnElement="SequenceFlow_0r1x26k">
+ <di:waypoint x="560" y="177" />
+ <di:waypoint x="610" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_009p8v1_di" bpmnElement="SequenceFlow_009p8v1">
+ <di:waypoint x="710" y="177" />
+ <di:waypoint x="770" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yws8fh_di" bpmnElement="SequenceFlow_0yws8fh">
+ <di:waypoint x="870" y="177" />
+ <di:waypoint x="955" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18jgpa8_di" bpmnElement="SequenceFlow_18jgpa8">
+ <di:waypoint x="1005" y="177" />
+ <di:waypoint x="1132" y="177" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1024" y="159" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0a3w3xw_di" bpmnElement="EndEvent_0a3w3xw">
+ <dc:Bounds x="1132" y="159" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1g4lx01_di" bpmnElement="SequenceFlow_1g4lx01">
+ <di:waypoint x="215" y="177" />
+ <di:waypoint x="270" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1n5nl53_di" bpmnElement="SequenceFlow_1n5nl53">
+ <di:waypoint x="370" y="177" />
+ <di:waypoint x="460" y="177" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1di7x3h_di" bpmnElement="Task_1djj44q">
+ <dc:Bounds x="270" y="137" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0oic8cv_di" bpmnElement="ScriptTask_0oic8cv">
+ <dc:Bounds x="930" y="430" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1q8dls4_di" bpmnElement="SequenceFlow_1q8dls4">
+ <di:waypoint x="930" y="470" />
+ <di:waypoint x="780" y="470" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1b60rre_di" bpmnElement="ServiceTask_1b60rre">
+ <dc:Bounds x="680" y="430" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1pxnqsp_di" bpmnElement="SequenceFlow_1pxnqsp">
+ <di:waypoint x="680" y="470" />
+ <di:waypoint x="510" y="470" />
+ <di:waypoint x="510" y="370" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01o92x6_di" bpmnElement="SequenceFlow_01o92x6">
+ <di:waypoint x="980" y="202" />
+ <di:waypoint x="980" y="305" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="964" y="243" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1pdfjh4_di" bpmnElement="ExclusiveGateway_1pdfjh4" isMarkerVisible="true">
+ <dc:Bounds x="955" y="305" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1007" y="310" width="86" height="40" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0591ght_di" bpmnElement="SequenceFlow_0591ght">
+ <di:waypoint x="980" y="355" />
+ <di:waypoint x="980" y="430" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="987" y="390" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ktr440_di" bpmnElement="SequenceFlow_1ktr440">
+ <di:waypoint x="955" y="330" />
+ <di:waypoint x="560" y="330" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="751" y="312" width="13" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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
new file mode 100644
index 0000000000..db805ecb92
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
@@ -0,0 +1,254 @@
+<?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.4.1">
+ <bpmn:process id="DoDeallocateNSSIV1" name="DoDeallocateNSSIV1" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1" name="start">
+ <bpmn:outgoing>SequenceFlow_05jfhy6</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_05jfhy6" sourceRef="StartEvent_1" targetRef="Task_1vste9s" />
+ <bpmn:scriptTask id="Task_1m8upus" name="Prepare Decompose Service" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0eug5nv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0wlyy5i</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.prepareDecomposeService(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0wlyy5i" sourceRef="Task_1m8upus" targetRef="Task_1giechg" />
+ <bpmn:callActivity id="Task_1giechg" name="Call Decompose Service" calledElement="DecomposeService">
+ <bpmn:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" 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_0wlyy5i</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1e451y9</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1e451y9" sourceRef="Task_1giechg" targetRef="Task_15ut397" />
+ <bpmn:scriptTask id="Task_15ut397" name="processDecomposition" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1e451y9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1e7o57n</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+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:incoming>SequenceFlow_1e7o57n</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_03b0822</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.sendRequestToNSSMF(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_03b0822" sourceRef="Task_0vi4ijv" targetRef="Task_0kl6lcq" />
+ <bpmn:scriptTask id="Task_0kl6lcq" name="Query Job Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_03b0822</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1anlirk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jj0p5q</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.getJobStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jj0p5q" sourceRef="Task_0kl6lcq" targetRef="ExclusiveGateway_0nhfsui" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0nhfsui" name="Is deallocate finish?" default="SequenceFlow_0sfh52b">
+ <bpmn:incoming>SequenceFlow_1jj0p5q</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xq380j</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0sfh52b</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:scriptTask id="Task_13vaezk" name="Delete Slice Profile From AAI" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0xq380j</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ii5002</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+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:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ii5002" sourceRef="Task_13vaezk" targetRef="EndEvent_1f579t4" />
+ <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>
+ <bpmn:sequenceFlow id="SequenceFlow_0eug5nv" sourceRef="Task_1vste9s" targetRef="Task_1m8upus" />
+ <bpmn:scriptTask id="Task_1vste9s" name="PreProcess Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_05jfhy6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0eug5nv</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1anlirk" sourceRef="Task_0fxuz4i" targetRef="Task_0kl6lcq" />
+ <bpmn:scriptTask id="Task_0fxuz4i" name="TimeDelay" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1ugva41</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1u66wjs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1anlirk</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.timeDelay(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_0amt4hu" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="DeNSSI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="DeNSSI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_04vg0c2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ugva41</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0y0w592" name="IsNeedUpdateDB?" default="SequenceFlow_1u66wjs">
+ <bpmn:incoming>SequenceFlow_0sfh52b</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0r95j9m</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1u66wjs</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0sfh52b" sourceRef="ExclusiveGateway_0nhfsui" targetRef="ExclusiveGateway_0y0w592" />
+ <bpmn:sequenceFlow id="SequenceFlow_0r95j9m" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_1renmzf">
+ <bpmn:documentation>#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:documentation>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNeedUpdateDB" ) == true)}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_04vg0c2" sourceRef="Task_1renmzf" targetRef="Task_0amt4hu" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ugva41" sourceRef="Task_0amt4hu" targetRef="Task_0fxuz4i" />
+ <bpmn:sequenceFlow id="SequenceFlow_1u66wjs" sourceRef="ExclusiveGateway_0y0w592" targetRef="Task_0fxuz4i" />
+ <bpmn:scriptTask id="Task_1renmzf" name="Prepare Update Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0r95j9m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_04vg0c2</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dnssi= new DoDeallocateNSSI()
+dnssi.handleJobStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateNSSIV1">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="192" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="199" y="155" width="22" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05jfhy6_di" bpmnElement="SequenceFlow_05jfhy6">
+ <di:waypoint x="228" y="130" />
+ <di:waypoint x="310" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_159g5ey_di" bpmnElement="Task_1m8upus">
+ <dc:Bounds x="490" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0wlyy5i_di" bpmnElement="SequenceFlow_0wlyy5i">
+ <di:waypoint x="590" y="130" />
+ <di:waypoint x="660" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1ep4ama_di" bpmnElement="Task_1giechg">
+ <dc:Bounds x="660" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e451y9_di" bpmnElement="SequenceFlow_1e451y9">
+ <di:waypoint x="760" y="130" />
+ <di:waypoint x="820" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1yt5s46_di" bpmnElement="Task_15ut397">
+ <dc:Bounds x="820" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1e7o57n_di" bpmnElement="SequenceFlow_1e7o57n">
+ <di:waypoint x="920" y="130" />
+ <di:waypoint x="970" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_16dxpvz_di" bpmnElement="Task_0vi4ijv">
+ <dc:Bounds x="970" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_03b0822_di" bpmnElement="SequenceFlow_03b0822">
+ <di:waypoint x="1070" y="130" />
+ <di:waypoint x="1120" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0arl3j9_di" bpmnElement="Task_0kl6lcq">
+ <dc:Bounds x="1120" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jj0p5q_di" bpmnElement="SequenceFlow_1jj0p5q">
+ <di:waypoint x="1220" y="130" />
+ <di:waypoint x="1505" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0nhfsui_di" bpmnElement="ExclusiveGateway_0nhfsui" isMarkerVisible="true">
+ <dc:Bounds x="1505" y="105" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1501" y="75" width="63" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1rfdrw3_di" bpmnElement="Task_13vaezk">
+ <dc:Bounds x="1690" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1f579t4_di" bpmnElement="EndEvent_1f579t4">
+ <dc:Bounds x="1862" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1871" y="155" width="19" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ii5002_di" bpmnElement="SequenceFlow_1ii5002">
+ <di:waypoint x="1790" y="130" />
+ <di:waypoint x="1862" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xq380j_di" bpmnElement="SequenceFlow_0xq380j">
+ <di:waypoint x="1555" y="130" />
+ <di:waypoint x="1690" y="130" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1614" y="112" width="17" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0eug5nv_di" bpmnElement="SequenceFlow_0eug5nv">
+ <di:waypoint x="410" y="130" />
+ <di:waypoint x="490" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dytya8_di" bpmnElement="Task_1vste9s">
+ <dc:Bounds x="310" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1anlirk_di" bpmnElement="SequenceFlow_1anlirk">
+ <di:waypoint x="1170" y="190" />
+ <di:waypoint x="1170" y="170" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0a4zalz_di" bpmnElement="Task_0fxuz4i">
+ <dc:Bounds x="1120" y="190" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0vegqix_di" bpmnElement="Task_0amt4hu">
+ <dc:Bounds x="1280" y="300" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0y0w592_di" bpmnElement="ExclusiveGateway_0y0w592" isMarkerVisible="true">
+ <dc:Bounds x="1505" y="205" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1567" y="216" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0sfh52b_di" bpmnElement="SequenceFlow_0sfh52b">
+ <di:waypoint x="1530" y="155" />
+ <di:waypoint x="1530" y="205" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0r95j9m_di" bpmnElement="SequenceFlow_0r95j9m">
+ <di:waypoint x="1530" y="255" />
+ <di:waypoint x="1530" y="300" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_04vg0c2_di" bpmnElement="SequenceFlow_04vg0c2">
+ <di:waypoint x="1480" y="340" />
+ <di:waypoint x="1380" y="340" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ugva41_di" bpmnElement="SequenceFlow_1ugva41">
+ <di:waypoint x="1280" y="340" />
+ <di:waypoint x="1170" y="340" />
+ <di:waypoint x="1170" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1u66wjs_di" bpmnElement="SequenceFlow_1u66wjs">
+ <di:waypoint x="1505" y="230" />
+ <di:waypoint x="1220" y="230" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_10pw6ot_di" bpmnElement="Task_1renmzf">
+ <dc:Bounds x="1480" y="300" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index d37120b452..14081960e6 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.4.0-SNAPSHOT</version>
+ <version>1.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-tasks</artifactId>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 8a6c4c2796..33b60a9ed3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -6,6 +6,7 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* Modifications Copyright (c) 2019 Bell Canada.
+ * 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.
@@ -70,43 +71,21 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update the status of Service to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
- OrchestrationStatus.ASSIGNED);
- execution.setVariable("aaiServiceInstanceRollback", true);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForService(execution, OrchestrationStatus.ASSIGNED);
+ execution.setVariable("aaiServiceInstanceRollback", true);
}
/**
* BPMN access method to update status of Service to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
- try {
- ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
- OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForService(execution, OrchestrationStatus.ACTIVE);
}
/**
* BPMN access method to update status of Pnf to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED);
@@ -114,8 +93,6 @@ public class AAIUpdateTasks {
/**
* BPMN access method to update status of Pnf to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ACTIVE);
@@ -135,44 +112,18 @@ public class AAIUpdateTasks {
updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTERED);
}
- private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
- try {
- Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
- aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
-
/**
* BPMN access method to update status of Vnf to Assigned in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ASSIGNED);
}
/**
* BPMN access method to update status of Vnf to Active in AAI
- *
- * @param execution
*/
public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
- try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE);
- } catch (Exception ex) {
- logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
+ updateOrchestrationStatusForVnf(execution, OrchestrationStatus.ACTIVE);
}
/**
@@ -839,4 +790,38 @@ public class AAIUpdateTasks {
throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action);
}
}
+
+ private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for service",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
+ aaiPnfResources.updateOrchestrationStatusPnf(pnf, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void updateOrchestrationStatusForVnf(BuildingBlockExecution execution, OrchestrationStatus status) {
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ aaiVnfResources.updateOrchestrationStatusVnf(vnf, status);
+ } catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for vnf",
+ status, ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 4285e9aa84..663b097b78 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -121,7 +121,7 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
- logger.error("Exception occurred if bb objrct not found in VnfAdapterCreateTasks createVfModule ",
+ logger.error("Exception occurred if bb object not found in VnfAdapterCreateTasks createVfModule ",
bbException);
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 79ccd9216f..00d0fdc01d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -6,12 +6,14 @@
* ================================================================================
* 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.
@@ -29,7 +31,6 @@ import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
import org.json.JSONArray;
import org.json.JSONObject;
-import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.core.json.JsonUtils;
@@ -143,7 +144,7 @@ public class AppcRunTasks {
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = null;
+ String controllerType;
if (controllerSelectionReference != null) {
controllerType = controllerSelectionReference.getControllerName();
} else {
@@ -191,13 +192,13 @@ public class AppcRunTasks {
logger.error("Error Message: {}", appcMessage);
logger.error("ERROR CODE: {}", appcCode);
logger.trace("End of runAppCommand ");
- if (appcCode != null && !appcCode.equals("0")) {
+ if (appcCode != null && !"0".equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
- if (appcCode != null && appcCode.equals("0") && action != null) {
+ if ("0".equals(appcCode) && action != null) {
if (action.equals(Action.Lock)) {
execution.setVariable(ROLLBACK_VNF_LOCK, true);
} else if (action.equals(Action.Unlock)) {
@@ -216,7 +217,7 @@ public class AppcRunTasks {
private HashMap<String, String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ HashMap<String, String> payloadInfo = new HashMap<>();
payloadInfo.put("vnfName", vnfName);
payloadInfo.put("aicIdentity", aicIdentity);
payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress);
@@ -242,44 +243,39 @@ public class AppcRunTasks {
return payload;
}
- protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
+ protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws RuntimeException {
AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
- if (aaiRW != null && aaiRW.getRelationships() != null && aaiRW.getRelationships().isPresent()) {
- Relationships relationships = aaiRW.getRelationships().get();
- if (relationships != null) {
- List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
- JSONArray vserverIds = new JSONArray();
- JSONArray vserverSelfLinks = new JSONArray();
- if (vserverUris != null) {
- for (AAIResourceUri j : vserverUris) {
- if (j != null) {
- if (j.getURIKeys() != null) {
- String vserverId = j.getURIKeys().get("vserver-id");
- vserverIds.put(vserverId);
- }
- Optional<Vserver> oVserver = aaiVnfResources.getVserver(j);
- if (oVserver.isPresent()) {
- Vserver vserver = oVserver.get();
- if (vserver != null) {
- String vserverSelfLink = vserver.getVserverSelflink();
- vserverSelfLinks.put(vserverSelfLink);
- }
- }
- }
+ if (aaiRW == null || aaiRW.getRelationships() == null || !aaiRW.getRelationships().isPresent()) {
+ return;
+ }
+ Relationships relationships = aaiRW.getRelationships().get();
+ List<AAIResourceUri> vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER);
+ JSONArray vserverIds = new JSONArray();
+ JSONArray vserverSelfLinks = new JSONArray();
+ if (vserverUris != null) {
+ for (AAIResourceUri j : vserverUris) {
+ if (j != null) {
+ if (j.getURIKeys() != null) {
+ String vserverId = j.getURIKeys().get("vserver-id");
+ vserverIds.put(vserverId);
}
+ aaiVnfResources.getVserver(j).ifPresent((vserver) -> {
+ String vserverSelfLink = vserver.getVserverSelflink();
+ vserverSelfLinks.put(vserverSelfLink);
+ });
}
-
- JSONObject vmidsArray = new JSONObject();
- JSONObject vserveridsArray = new JSONObject();
- vmidsArray.put("vmIds", vserverSelfLinks.toString());
- vserveridsArray.put("vserverIds", vserverIds.toString());
- logger.debug("vmidsArray is: {}", vmidsArray.toString());
- logger.debug("vserveridsArray is: {}", vserveridsArray.toString());
-
- execution.setVariable("vmIdList", vmidsArray.toString());
- execution.setVariable("vserverIdList", vserveridsArray.toString());
}
}
+
+ JSONObject vmidsArray = new JSONObject();
+ JSONObject vserveridsArray = new JSONObject();
+ vmidsArray.put("vmIds", vserverSelfLinks.toString());
+ vserveridsArray.put("vserverIds", vserverIds.toString());
+ logger.debug("vmidsArray is: {}", vmidsArray.toString());
+ logger.debug("vserveridsArray is: {}", vserveridsArray.toString());
+
+ execution.setVariable("vmIdList", vmidsArray.toString());
+ execution.setVariable("vserverIdList", vserveridsArray.toString());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 64f0072991..1cde9fb8f6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -29,11 +31,9 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.OrchestrationStatusValidationException;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
-import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
-import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,8 +52,6 @@ public class OrchestrationStatusValidator {
"Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -86,7 +84,7 @@ public class OrchestrationStatusValidator {
String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName));
}
- OrchestrationStatus orchestrationStatus = null;
+ OrchestrationStatus orchestrationStatus;
switch (buildingBlockDetail.getResourceType()) {
case SERVICE:
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 9ee0104a5f..f8a4d910f4 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
@@ -47,6 +47,7 @@ import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aai.domain.yang.VpnBinding;
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;
@@ -185,7 +186,7 @@ public class WorkflowAction {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Resource> resourceCounter = new ArrayList<>();
+ List<Resource> resourceList = new ArrayList<>();
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -304,7 +305,7 @@ public class WorkflowAction {
}
}
if (containsService) {
- traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
}
} else {
buildAndThrowException(execution,
@@ -327,11 +328,10 @@ public class WorkflowAction {
}
}
if (containsService) {
- foundRelated =
- traverseUserParamsService(execution, resourceCounter, sIRequest, requestAction);
+ foundRelated = traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
}
if (!foundRelated) {
- traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
+ traverseCatalogDbService(execution, sIRequest, resourceList, aaiResourceIds);
}
} else if (resourceType == WorkflowType.SERVICE
&& ("activateInstance".equalsIgnoreCase(requestAction)
@@ -342,20 +342,20 @@ public class WorkflowAction {
// SERVICE-MACRO-DELETE
// Will never get user params with service, macro will have
// to query the SI in AAI to find related instances.
- traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ traverseAAIService(execution, resourceList, resourceId, aaiResourceIds);
} else if (resourceType == WorkflowType.SERVICE
&& "deactivateInstance".equalsIgnoreCase(requestAction)) {
- resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, "", false));
} else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction)
|| ("recreateInstance".equalsIgnoreCase(requestAction)))) {
- traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
+ traverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
buildAndThrowException(execution, "Current Macro Request is not supported");
}
String foundObjects = "";
for (WorkflowType type : WorkflowType.values()) {
- foundObjects = foundObjects + type + " - " + resourceCounter.stream()
+ foundObjects = foundObjects + type + " - " + resourceList.stream()
.filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size()
+ " ";
}
@@ -370,9 +370,9 @@ public class WorkflowAction {
|| "replaceInstanceRetainAssignments".equalsIgnoreCase(requestAction))) {
vnfReplace = true;
}
- flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion,
+ flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceList, requestId, apiVersion,
resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace);
- if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ if (!resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
.collect(Collectors.toList()).isEmpty()) {
logger.info("Sorting for Vlan Tagging");
flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
@@ -380,16 +380,16 @@ public class WorkflowAction {
// By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
if (resourceType == WorkflowType.SERVICE
&& (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
+ && !resourceList.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
.collect(Collectors.toList()).isEmpty()) {
execution.setVariable("homing", true);
execution.setVariable("calledHoming", false);
}
if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)
|| requestAction.equalsIgnoreCase(CREATEINSTANCE))) {
- generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId);
+ generateResourceIds(flowsToExecute, resourceList, serviceInstanceId);
} else {
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds,
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceList, aaiResourceIds,
serviceInstanceId);
}
}
@@ -471,9 +471,7 @@ public class WorkflowAction {
List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(type);
for (AAIResultWrapper vnfcResultWrapper : vnfcResultWrappers) {
Optional<T> vnfcOp = vnfcResultWrapper.asBean(resultClass);
- if (vnfcOp.isPresent()) {
- vnfcs.add(vnfcOp.get());
- }
+ vnfcOp.ifPresent(vnfcs::add);
}
}
return vnfcs;
@@ -493,9 +491,7 @@ public class WorkflowAction {
this.getResultWrappersFromRelationships(relationships, type);
for (AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
- if (configurationOp.isPresent()) {
- configurations.add(configurationOp.get());
- }
+ configurationOp.ifPresent(configurations::add);
}
}
return configurations;
@@ -574,8 +570,6 @@ public class WorkflowAction {
protected List<OrchestrationFlow> getVfModuleReplaceBuildingBlocks(ConfigBuildingBlocksDataObject dataObj)
throws Exception {
- List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
-
String vnfId = dataObj.getWorkflowResourceIds().getVnfId();
String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
@@ -639,19 +633,15 @@ public class WorkflowAction {
if (!relationshipsOp.isPresent()) {
logger.debug("No relationships were found for Configuration in AAI");
return null;
- } else {
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
- logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
- }
- Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
- if (vnfcOp.isPresent()) {
- return vnfcOp.get().getVnfcName();
- } else {
- return null;
- }
}
+ Relationships relationships = relationshipsOp.get();
+ List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
+ if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
+ }
+ Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
+ return vnfcOp.map(Vnfc::getVnfcName).orElse(null);
+
}
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
@@ -679,18 +669,15 @@ public class WorkflowAction {
}
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
logger.debug(pair.getValue0() + ", " + pair.getValue1());
}
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- List<Resource> resources =
- resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
- for (int i = 0; i < resources.size(); i++) {
- updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(),
- retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId);
- }
+ resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
+ retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId));
});
}
@@ -706,21 +693,16 @@ public class WorkflowAction {
return id;
}
- private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter,
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList,
String serviceInstanceId) {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- List<Resource> resources =
- resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
- for (int i = 0; i < resources.size(); i++) {
- Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
- .collect(Collectors.toList()).get(i);
- updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
- resource.getVirtualLinkKey(), serviceInstanceId);
- }
+ resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
+ resource.getVirtualLinkKey(), serviceInstanceId));
});
}
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource,
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resourceType,
String key, String id, String virtualLinkKey, String serviceInstanceId) {
String resourceId = id;
if (resourceId == null) {
@@ -728,24 +710,10 @@ public class WorkflowAction {
}
for (ExecuteBuildingBlock ebb : flowsToExecute) {
if (key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey())
- && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())) {
+ && ebb.getBuildingBlock().getBpmnFlowName().contains(resourceType.toString())) {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId(serviceInstanceId);
- if (resource == WorkflowType.VNF) {
- workflowResourceIds.setVnfId(resourceId);
- } else if (resource == WorkflowType.PNF) {
- workflowResourceIds.setPnfId(resourceId);
- } else if (resource == WorkflowType.VFMODULE) {
- workflowResourceIds.setVfModuleId(resourceId);
- } else if (resource == WorkflowType.VOLUMEGROUP) {
- workflowResourceIds.setVolumeGroupId(resourceId);
- } else if (resource == WorkflowType.NETWORK) {
- workflowResourceIds.setNetworkId(resourceId);
- } else if (resource == WorkflowType.NETWORKCOLLECTION) {
- workflowResourceIds.setNetworkCollectionId(resourceId);
- } else if (resource == WorkflowType.CONFIGURATION) {
- workflowResourceIds.setConfigurationId(resourceId);
- }
+ WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, resourceType, resourceId);
ebb.setWorkflowResourceIds(workflowResourceIds);
}
if (virtualLinkKey != null && ebb.getBuildingBlock().isVirtualLink()
@@ -779,29 +747,28 @@ public class WorkflowAction {
}
protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds)
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds)
throws JsonProcessingException, VrfBondingServiceException {
String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
if (service == null) {
buildAndThrowException(execution, "Could not find the service model in catalog db.");
} else {
- resourceCounter.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
RelatedInstance relatedVpnBinding =
bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
RelatedInstance relatedLocalNetwork =
bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
if (relatedVpnBinding != null && relatedLocalNetwork != null) {
- traverseVrfConfiguration(aaiResourceIds, resourceCounter, service, relatedVpnBinding,
- relatedLocalNetwork);
+ traverseVrfConfiguration(aaiResourceIds, resourceList, service, relatedVpnBinding, relatedLocalNetwork);
} else {
- traverseNetworkCollection(execution, resourceCounter, service);
+ traverseNetworkCollection(execution, resourceList, service);
}
}
}
protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds,
- List<Resource> resourceCounter, org.onap.so.db.catalog.beans.Service service,
+ List<Resource> resourceList, org.onap.so.db.catalog.beans.Service service,
RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork)
throws VrfBondingServiceException, JsonProcessingException {
org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
@@ -816,9 +783,9 @@ public class WorkflowAction {
vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
if (existingAAIVrfConfiguration != null) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
}
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,
+ resourceList.add(new Resource(WorkflowType.CONFIGURATION,
service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
}
@@ -869,7 +836,7 @@ public class WorkflowAction {
return false;
}
- protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceCounter,
+ protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
org.onap.so.db.catalog.beans.Service service) {
if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
@@ -879,7 +846,7 @@ public class WorkflowAction {
CollectionResourceCustomization collectionResourceCustomization =
findCatalogNetworkCollection(execution, service);
if (collectionResourceCustomization != null) {
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
collectionResourceCustomization.getModelCustomizationUUID(), false));
logger.debug("Found a network collection");
if (collectionResourceCustomization.getCollectionResource() != null) {
@@ -921,7 +888,7 @@ public class WorkflowAction {
Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
collectionNetworkResourceCust.getModelCustomizationUUID(), false);
resource.setVirtualLinkKey(Integer.toString(i));
- resourceCounter.add(resource);
+ resourceList.add(resource);
}
}
} else {
@@ -938,13 +905,13 @@ public class WorkflowAction {
logger.debug("No Network Collection Customization found");
}
}
- if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
+ if (resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
.collect(Collectors.toList()).isEmpty()) {
if (service.getNetworkCustomizations() == null) {
logger.debug("No networks were found on this service model");
} else {
for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
- resourceCounter.add(new Resource(WorkflowType.NETWORK,
+ resourceList.add(new Resource(WorkflowType.NETWORK,
service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
}
}
@@ -955,32 +922,30 @@ public class WorkflowAction {
}
}
- protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceCounter, String resourceId,
+ protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId,
List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
- resourceCounter.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
if (serviceInstanceMSO.getVnfs() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId()));
- resourceCounter.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
if (vnf.getVfModules() != null) {
for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(
- new Pair<WorkflowType, String>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
- resourceCounter.add(resource);
+ resourceList.add(resource);
}
}
if (vnf.getVolumeGroups() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
.getVolumeGroups()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP,
- volumeGroup.getVolumeGroupId()));
- resourceCounter
+ aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList
.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
}
}
@@ -989,15 +954,15 @@ public class WorkflowAction {
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
.getNetworks()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORK, network.getNetworkId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId()));
+ resourceList.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
}
}
if (serviceInstanceMSO.getCollection() != null) {
logger.debug("found networkcollection");
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION,
- serviceInstanceMSO.getCollection().getId()));
- resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ aaiResourceIds
+ .add(new Pair<>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
serviceInstanceMSO.getCollection().getId(), false));
}
if (serviceInstanceMSO.getConfigurations() != null) {
@@ -1008,9 +973,8 @@ public class WorkflowAction {
for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
if (relationship.getRelatedTo().contains("vnfc")
|| relationship.getRelatedTo().contains("vpn-binding")) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
- config.getConfigurationId()));
- resourceCounter.add(
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
+ resourceList.add(
new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
break;
}
@@ -1025,34 +989,32 @@ public class WorkflowAction {
}
}
- private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceCounter, String serviceId,
+ private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId,
String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceId);
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
- resourceCounter.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+ resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
if (serviceInstanceMSO.getVnfs() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
if (vnf.getVnfId().equals(vnfId)) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VNF, vnf.getVnfId()));
- resourceCounter.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
if (vnf.getVfModules() != null) {
for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VFMODULE,
- vfModule.getVfModuleId()));
- resourceCounter
- .add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ resourceList.add(new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false));
findConfigurationsInsideVfModule(execution, vnf.getVnfId(), vfModule.getVfModuleId(),
- resourceCounter, aaiResourceIds);
+ resourceList, aaiResourceIds);
}
}
if (vnf.getVolumeGroups() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
.getVolumeGroups()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.VOLUMEGROUP,
- volumeGroup.getVolumeGroupId()));
- resourceCounter.add(
+ aaiResourceIds
+ .add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList.add(
new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
}
}
@@ -1068,7 +1030,7 @@ public class WorkflowAction {
}
private void findConfigurationsInsideVfModule(DelegateExecution execution, String vnfId, String vfModuleId,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
AAIResultWrapper vfModuleWrapper = new AAIResultWrapper(
@@ -1081,9 +1043,8 @@ public class WorkflowAction {
Optional<Configuration> config =
workflowActionUtils.extractRelationshipsConfiguration(relationshipsOp.get());
if (config.isPresent()) {
- aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION,
- config.get().getConfigurationId()));
- resourceCounter.add(
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.get().getConfigurationId()));
+ resourceList.add(
new Resource(WorkflowType.CONFIGURATION, config.get().getConfigurationId(), false));
}
}
@@ -1094,7 +1055,7 @@ public class WorkflowAction {
}
}
- protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceCounter,
+ protected boolean traverseUserParamsService(DelegateExecution execution, List<Resource> resourceList,
ServiceInstancesRequest sIRequest, String requestAction) throws IOException {
boolean foundRelated = false;
boolean foundVfModuleOrVG = false;
@@ -1107,11 +1068,11 @@ public class WorkflowAction {
ObjectMapper obj = new ObjectMapper();
String input = obj.writeValueAsString(params.get(USERPARAMSERVICE));
Service validate = obj.readValue(input, Service.class);
- resourceCounter.add(
+ resourceList.add(
new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false));
if (validate.getResources().getVnfs() != null) {
for (Vnfs vnf : validate.getResources().getVnfs()) {
- resourceCounter.add(new Resource(WorkflowType.VNF,
+ resourceList.add(new Resource(WorkflowType.VNF,
vnf.getModelInfo().getModelCustomizationId(), false));
foundRelated = true;
if (vnf.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) {
@@ -1127,7 +1088,7 @@ public class WorkflowAction {
if (vfModuleCustomization.getVfModule() != null
&& vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null
&& vfModuleCustomization.getVolumeHeatEnv() != null) {
- resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,
+ resourceList.add(new Resource(WorkflowType.VOLUMEGROUP,
vfModuleCustomization.getModelCustomizationUUID(), false));
foundRelated = true;
foundVfModuleOrVG = true;
@@ -1146,7 +1107,7 @@ public class WorkflowAction {
} else {
resource.setBaseVfModule(false);
}
- resourceCounter.add(resource);
+ resourceList.add(resource);
if (vfModule.getModelInfo() != null
&& vfModule.getModelInfo().getModelCustomizationUuid() != null) {
vfModuleCustomizationUUID =
@@ -1165,7 +1126,7 @@ public class WorkflowAction {
vnf.getModelInfo().getModelCustomizationId());
resource.setVfModuleCustomizationId(
vfModule.getModelInfo().getModelCustomizationId());
- resourceCounter.add(configResource);
+ resourceList.add(configResource);
}
}
}
@@ -1180,22 +1141,21 @@ public class WorkflowAction {
}
if (validate.getResources().getPnfs() != null) {
for (Pnfs pnf : validate.getResources().getPnfs()) {
- resourceCounter.add(new Resource(WorkflowType.PNF,
+ resourceList.add(new Resource(WorkflowType.PNF,
pnf.getModelInfo().getModelCustomizationId(), false));
foundRelated = true;
}
}
if (validate.getResources().getNetworks() != null) {
for (Networks network : validate.getResources().getNetworks()) {
- resourceCounter.add(new Resource(WorkflowType.NETWORK,
+ resourceList.add(new Resource(WorkflowType.NETWORK,
network.getModelInfo().getModelCustomizationId(), false));
foundRelated = true;
}
if (requestAction.equals(CREATEINSTANCE)) {
String networkColCustId = queryCatalogDBforNetworkCollection(execution, sIRequest);
if (networkColCustId != null) {
- resourceCounter
- .add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false));
foundRelated = true;
}
}
@@ -1242,21 +1202,14 @@ public class WorkflowAction {
}
protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) {
- WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
- workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
- workflowResourceIds.setNetworkId((String) execution.getVariable("networkId"));
- workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
- workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
- workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
- workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
- return workflowResourceIds;
+ return WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
}
protected Resource extractResourceIdAndTypeFromUri(String uri) {
Pattern patt = Pattern.compile("[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES
+ ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?(?:/resume)?)?$");
Matcher m = patt.matcher(uri);
- Boolean generated = false;
+ boolean generated = false;
if (m.find()) {
logger.debug("found match on {} : {} ", uri, m);
@@ -1366,7 +1319,7 @@ public class WorkflowAction {
} else if (ebb.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
|| ebb.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)) {
continue;
- } else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
+ } else if (!"".equals(ebb.getBuildingBlock().getBpmnFlowName())) {
sortedOrchFlows.add(ebb);
}
}
@@ -1405,11 +1358,10 @@ public class WorkflowAction {
String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds,
RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) {
- List<Resource> serviceResources = resourceList.stream()
- .filter(resource -> resource.getResourceType().equals(workflowType)).collect(Collectors.toList());
- serviceResources.forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
- apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- isVirtualLink, resource.getVirtualLinkKey(), null, 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)));
}
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
@@ -1539,13 +1491,8 @@ public class WorkflowAction {
requestAction, resourceName.toString(), aLaCarte, CLOUD_OWNER);
}
if (northBoundRequest == null) {
- if (aLaCarte) {
- buildAndThrowException(execution,
- "The request: ALaCarte " + resourceName + " " + requestAction + " is not supported by GR_API.");
- } else {
- buildAndThrowException(execution,
- "The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API.");
- }
+ buildAndThrowException(execution, String.format("The request: %s %s %s is not supported by GR_API.",
+ (aLaCarte ? "AlaCarte" : "Macro"), resourceName, requestAction));
} else {
if (northBoundRequest.getIsToplevelflow() != null) {
execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
@@ -1557,9 +1504,7 @@ public class WorkflowAction {
if (!flow.getFlowName().contains("BB") && !flow.getFlowName().contains("Activity")) {
List<OrchestrationFlow> macroQueryFlows =
catalogDbClient.getOrchestrationFlowByAction(flow.getFlowName());
- for (OrchestrationFlow macroFlow : macroQueryFlows) {
- listToExecute.add(macroFlow);
- }
+ listToExecute.addAll(macroQueryFlows);
} else {
listToExecute.add(flow);
}
@@ -1582,11 +1527,11 @@ public class WorkflowAction {
public void handleRuntimeException(DelegateExecution execution) {
StringBuilder wfeExpMsg = new StringBuilder("Runtime error ");
- String runtimeErrorMessage = null;
+ String runtimeErrorMessage;
try {
String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg");
if (javaExpMsg != null && !javaExpMsg.isEmpty()) {
- wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg);
+ wfeExpMsg.append(": ").append(javaExpMsg);
}
runtimeErrorMessage = wfeExpMsg.toString();
logger.error(runtimeErrorMessage);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
new file mode 100644
index 0000000000..d16eac147e
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtils.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.utils;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+
+public final class WorkflowResourceIdsUtils {
+
+ private WorkflowResourceIdsUtils() {
+ throw new IllegalStateException("Utility class");
+ }
+
+ public static void setResourceIdByWorkflowType(WorkflowResourceIds workflowResourceIds, WorkflowType resourceType,
+ String resourceId) {
+ switch (resourceType) {
+ case SERVICE:
+ workflowResourceIds.setServiceInstanceId(resourceId);
+ break;
+ case VNF:
+ workflowResourceIds.setVnfId(resourceId);
+ break;
+ case PNF:
+ workflowResourceIds.setPnfId(resourceId);
+ break;
+ case VFMODULE:
+ workflowResourceIds.setVfModuleId(resourceId);
+ break;
+ case VOLUMEGROUP:
+ workflowResourceIds.setVolumeGroupId(resourceId);
+ break;
+ case NETWORK:
+ workflowResourceIds.setNetworkId(resourceId);
+ break;
+ case NETWORKCOLLECTION:
+ workflowResourceIds.setNetworkCollectionId(resourceId);
+ break;
+ case CONFIGURATION:
+ workflowResourceIds.setConfigurationId(resourceId);
+ break;
+ case INSTANCE_GROUP:
+ workflowResourceIds.setInstanceGroupId(resourceId);
+ break;
+ }
+ }
+
+ public static WorkflowResourceIds getWorkflowResourceIdsFromExecution(DelegateExecution execution) {
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId((String) execution.getVariable("serviceInstanceId"));
+ workflowResourceIds.setNetworkId((String) execution.getVariable("networkId"));
+ workflowResourceIds.setVfModuleId((String) execution.getVariable("vfModuleId"));
+ workflowResourceIds.setVnfId((String) execution.getVariable("vnfId"));
+ workflowResourceIds.setVolumeGroupId((String) execution.getVariable("volumeGroupId"));
+ workflowResourceIds.setInstanceGroupId((String) execution.getVariable("instanceGroupId"));
+ return workflowResourceIds;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index d78fa69680..3f81e432e1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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.
@@ -52,6 +54,7 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.openstack.beans.NetworkRollback;
import org.onap.so.openstack.beans.RouteTarget;
import org.onap.so.openstack.beans.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -65,8 +68,7 @@ public class NetworkAdapterObjectMapper {
public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
- Map<String, String> userInput, String cloudRegionPo, Customer customer)
- throws UnsupportedEncodingException {
+ Map<String, String> userInput, String cloudRegionPo, Customer customer) {
CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
// set cloudSiteId as determined for cloud region PO instead of cloudRegion.getLcpCloudRegionId()
@@ -119,7 +121,7 @@ public class NetworkAdapterObjectMapper {
}
public DeleteNetworkRequest deleteNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
- ServiceInstance serviceInstance, L3Network l3Network) throws UnsupportedEncodingException {
+ ServiceInstance serviceInstance, L3Network l3Network) {
DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest();
deleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
@@ -150,14 +152,14 @@ public class NetworkAdapterObjectMapper {
/**
* Access method to build Rollback Network Request
- *
+ *
* @return
* @throws UnsupportedEncodingException
*/
public RollbackNetworkRequest createNetworkRollbackRequestMapper(RequestContext requestContext,
CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance,
L3Network l3Network, Map<String, String> userInput, String cloudRegionPo,
- CreateNetworkResponse createNetworkResponse) throws UnsupportedEncodingException {
+ CreateNetworkResponse createNetworkResponse) {
RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest();
rollbackNetworkRequest = setCommonRollbackRequestFields(rollbackNetworkRequest, requestContext);
@@ -171,7 +173,7 @@ public class NetworkAdapterObjectMapper {
public UpdateNetworkRequest createNetworkUpdateRequestMapper(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network,
- Map<String, String> userInput, Customer customer) throws UnsupportedEncodingException {
+ Map<String, String> userInput, Customer customer) {
UpdateNetworkRequest updateNetworkRequest = new UpdateNetworkRequest();
updateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
@@ -198,11 +200,10 @@ public class NetworkAdapterObjectMapper {
}
private RollbackNetworkRequest setCommonRollbackRequestFields(RollbackNetworkRequest request,
- RequestContext requestContext) throws UnsupportedEncodingException {
+ RequestContext requestContext) {
request.setSkipAAI(true);
String messageId = requestContext.getMsoRequestId();
request.setMessageId(messageId);
- // request.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
return request;
}
@@ -240,7 +241,7 @@ public class NetworkAdapterObjectMapper {
return UUID.randomUUID().toString();
}
- protected String createCallbackUrl(String messageType, String correlator) throws UnsupportedEncodingException {
+ protected String createCallbackUrl(String messageType, String correlator) {
String endpoint = this.getEndpoint();
while (endpoint.endsWith("/")) {
@@ -256,14 +257,14 @@ public class NetworkAdapterObjectMapper {
/**
* Use BB L3Network object to build subnets list of type org.onap.so.openstack.beans.Subnet
- *
+ *
* @param L3Network
* @return List<org.onap.so.openstack.beans.Subnet>
*/
protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) {
List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets();
- List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>();
+ List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<>();
// create mapper from onap Subnet to openstack bean Subnet
if (modelMapper.getTypeMap(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet.class,
org.onap.so.openstack.beans.Subnet.class) == null) {
@@ -292,7 +293,7 @@ public class NetworkAdapterObjectMapper {
.setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask()));
List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes();
List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>();
- org.onap.so.openstack.beans.HostRoute openstackHostRoute = null;
+ org.onap.so.openstack.beans.HostRoute openstackHostRoute;
// TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed
for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) {
openstackHostRoute = new org.onap.so.openstack.beans.HostRoute();
@@ -319,10 +320,9 @@ public class NetworkAdapterObjectMapper {
private ProviderVlanNetwork buildProviderVlanNetwork(L3Network l3Network) {
ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork();
providerVlanNetwork.setPhysicalNetworkName(l3Network.getPhysicalNetworkName());
- List<Integer> vlans = new ArrayList<Integer>();
- List<org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment> segmentationAssignments =
- l3Network.getSegmentationAssignments();
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment assignment : segmentationAssignments) {
+ List<Integer> vlans = new ArrayList<>();
+ List<SegmentationAssignment> segmentationAssignments = l3Network.getSegmentationAssignments();
+ for (SegmentationAssignment assignment : segmentationAssignments) {
vlans.add(Integer.valueOf(assignment.getSegmentationId()));
}
providerVlanNetwork.setVlans(vlans);
@@ -401,7 +401,7 @@ public class NetworkAdapterObjectMapper {
private Map<String, String> addSharedAndExternal(Map<String, String> userInput, L3Network l3Network) {
if (userInput == null)
- userInput = new HashMap<String, String>();
+ userInput = new HashMap<>();
if (!userInput.containsKey("shared")) {
userInput.put("shared", Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
index 3d3058da0b..362f64d720 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/namingservice/NamingRequestObject.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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
@@ -24,7 +26,7 @@ import java.util.HashMap;
public class NamingRequestObject {
- private HashMap<String, String> namingRequestMap = new HashMap<String, String>();
+ private HashMap<String, String> namingRequestMap = new HashMap<>();
public HashMap<String, String> getNamingRequestObjectMap() {
return this.namingRequestMap;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
index fc1528526c..9b104f3250 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -37,14 +39,11 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class AAIServiceInstanceResources {
- private static final Logger logger = LoggerFactory.getLogger(AAIServiceInstanceResources.class);
@Autowired
private InjectionHelper injectionHelper;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
index 5513122560..dba1693e5d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/NamingServiceResources.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -33,14 +35,11 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.namingservice.NamingClient;
import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.namingservice.NamingRequestObjectBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class NamingServiceResources {
- private static final Logger logger = LoggerFactory.getLogger(NamingServiceResources.class);
private static final String NAMING_TYPE = "instanceGroup";
@Autowired
@@ -53,14 +52,14 @@ public class NamingServiceResources {
throws BadResponseException, IOException {
Element element = namingRequestObjectBuilder.elementMapper(instanceGroup.getId(), policyInstanceName,
NAMING_TYPE, nfNamingCode, instanceGroup.getInstanceGroupName());
- List<Element> elements = new ArrayList<Element>();
+ List<Element> elements = new ArrayList<>();
elements.add(element);
return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
}
public String deleteInstanceGroupName(InstanceGroup instanceGroup) throws BadResponseException, IOException {
Deleteelement deleteElement = namingRequestObjectBuilder.deleteElementMapper(instanceGroup.getId());
- List<Deleteelement> deleteElements = new ArrayList<Deleteelement>();
+ List<Deleteelement> deleteElements = new ArrayList<>();
deleteElements.add(deleteElement);
return (namingClient
.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(deleteElements)));
@@ -70,8 +69,8 @@ public class NamingServiceResources {
throws BadResponseException, IOException {
HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
Element element = new Element();
- nsRequestObject.forEach((k, v) -> element.put(k, v));
- List<Element> elements = new ArrayList<Element>();
+ nsRequestObject.forEach(element::put);
+ List<Element> elements = new ArrayList<>();
elements.add(element);
return (namingClient.postNameGenRequest(namingRequestObjectBuilder.nameGenRequestMapper(elements)));
}
@@ -81,7 +80,7 @@ public class NamingServiceResources {
HashMap<String, String> nsRequestObject = namingRequestObject.getNamingRequestObjectMap();
Deleteelement delElement = new Deleteelement();
nsRequestObject.forEach((k, v) -> delElement.setExternalKey(v));
- List<Deleteelement> delElements = new ArrayList<Deleteelement>();
+ List<Deleteelement> delElements = new ArrayList<>();
delElements.add(delElement);
return (namingClient.deleteNameGenRequest(namingRequestObjectBuilder.nameGenDeleteRequestMapper(delElements)));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
new file mode 100644
index 0000000000..0d68cf362b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/utils/WorkflowResourceIdsUtilsTest.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.utils;
+
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import java.util.function.Supplier;
+import static org.junit.Assert.assertEquals;
+
+
+public class WorkflowResourceIdsUtilsTest {
+
+ private static final String SERVICE_ID = "serviceId";
+ private static final String NETWORK_ID = "networkId";
+ private static final String VF_MODULE_ID = "vfModuleId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VOLUME_GROUP_ID = "volumeGroupId";
+ private static final String INSTANCE_GROUP_ID = "instanceGroupId";
+ private static final String PNF_ID = "pnfId";
+ private static final String NETWORK_COLLECTION_ID = "networkCollectionId";
+ private static final String CONFIGURATION_ID = "configurationId";
+
+ private WorkflowResourceIds workflowResourceIds;
+
+ @Before
+ public void setUp() {
+ workflowResourceIds = new WorkflowResourceIds();
+ }
+
+ @Test
+ public void shouldProperlySetFieldsFromExecution() {
+ DelegateExecutionFake execution = new DelegateExecutionFake();
+ execution.setVariable("serviceInstanceId", SERVICE_ID);
+ execution.setVariable("networkId", NETWORK_ID);
+ execution.setVariable("vfModuleId", VF_MODULE_ID);
+ execution.setVariable("vnfId", VNF_ID);
+ execution.setVariable("volumeGroupId", VOLUME_GROUP_ID);
+ execution.setVariable("instanceGroupId", INSTANCE_GROUP_ID);
+
+ workflowResourceIds = WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
+
+ assertEquals(SERVICE_ID, workflowResourceIds.getServiceInstanceId());
+ assertEquals(NETWORK_ID, workflowResourceIds.getNetworkId());
+ assertEquals(VF_MODULE_ID, workflowResourceIds.getVfModuleId());
+ assertEquals(VNF_ID, workflowResourceIds.getVnfId());
+ assertEquals(VOLUME_GROUP_ID, workflowResourceIds.getVolumeGroupId());
+ assertEquals(INSTANCE_GROUP_ID, workflowResourceIds.getInstanceGroupId());
+ }
+
+ @Test
+ public void shouldProperlySetServiceInstanceId() {
+ assertFieldSetProperly(WorkflowType.SERVICE, SERVICE_ID, workflowResourceIds::getServiceInstanceId);
+ }
+
+ @Test
+ public void shouldProperlySetVnfId() {
+ assertFieldSetProperly(WorkflowType.VNF, VNF_ID, workflowResourceIds::getVnfId);
+
+ }
+
+ @Test
+ public void shouldProperlySetPnfId() {
+ assertFieldSetProperly(WorkflowType.PNF, PNF_ID, workflowResourceIds::getPnfId);
+ }
+
+ @Test
+ public void shouldProperlySetVfModuleId() {
+ assertFieldSetProperly(WorkflowType.VFMODULE, VF_MODULE_ID, workflowResourceIds::getVfModuleId);
+ }
+
+ @Test
+ public void shouldProperlySetVolumeGroupId() {
+ assertFieldSetProperly(WorkflowType.VOLUMEGROUP, VOLUME_GROUP_ID, workflowResourceIds::getVolumeGroupId);
+ }
+
+ @Test
+ public void shouldProperlySetNetworkId() {
+ assertFieldSetProperly(WorkflowType.NETWORK, NETWORK_ID, workflowResourceIds::getNetworkId);
+ }
+
+ @Test
+ public void shouldProperlySetNetworkCollectionId() {
+ assertFieldSetProperly(WorkflowType.NETWORKCOLLECTION, NETWORK_COLLECTION_ID,
+ workflowResourceIds::getNetworkCollectionId);
+
+ }
+
+ @Test
+ public void shouldProperlySetConfigurationId() {
+ assertFieldSetProperly(WorkflowType.CONFIGURATION, CONFIGURATION_ID, workflowResourceIds::getConfigurationId);
+ }
+
+ @Test
+ public void shouldProperlySetInstanceGroupId() {
+ assertFieldSetProperly(WorkflowType.INSTANCE_GROUP, INSTANCE_GROUP_ID, workflowResourceIds::getInstanceGroupId);
+ }
+
+ private void assertFieldSetProperly(WorkflowType workflowType, String expectedId,
+ Supplier<String> testedObjectField) {
+ WorkflowResourceIdsUtils.setResourceIdByWorkflowType(workflowResourceIds, workflowType, expectedId);
+ assertEquals(expectedId, testedObjectField.get());
+ }
+}