aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy47
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java16
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java14
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java21
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java42
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java51
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java8
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java118
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn258
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java48
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java54
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java16
81 files changed, 1504 insertions, 541 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
index f14e3dcc42..ee70dcc89c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
@@ -44,7 +44,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.openpojo.rules.HasToStringRule
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@Deprecated
class AaiUtil {
@@ -96,7 +96,7 @@ class AaiUtil {
String regionId = ""
try{
URL Url = new URL(url)
- HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(Url, ONAPComponents.AAI)
client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 2bf7298584..83784e1960 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -37,7 +37,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.web.util.UriUtils
import javax.ws.rs.core.MediaType
@@ -442,7 +442,7 @@ class CatalogDbUtils {
String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution)
String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
def responseData = ''
- HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', "BPMN")
client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
index c23150384e..195b1fc0d6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
@@ -34,7 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
-import org.onap.so.utils.TargetEntities
+import org.onap.logging.filter.base.ONAPComponentsList
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -285,7 +285,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
logger.debug("Outgoing WorkflowException is " + exception)
}
- public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) {
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) {
MsoUtils utils = new MsoUtils()
String processKey = getProcessKey(execution);
logger.debug("Building a WorkflowException for " + processKey)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 5525c2642b..a5111a62d3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -29,7 +29,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@@ -145,7 +145,7 @@ class ExternalAPIUtil {
logger.debug( "URL to be used is: " + url)
logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
- HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL)
+ HttpClient client = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.EXTERNAL)
client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid)
@@ -183,7 +183,7 @@ class ExternalAPIUtil {
logger.debug( "URL to be used is: " + url)
logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
- HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI)
+ HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
httpClient.addAdditionalHeader("X-FromAppId", "MSO")
httpClient.addAdditionalHeader("X-TransactionId", uuid)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 3008f77b62..6d4b50f690 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -42,7 +42,7 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -92,7 +92,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
logger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index 6583ded413..b082c1830e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -41,7 +41,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.db.catalog.beans.ServerType
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -165,7 +165,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
URL url = new URL(urlString)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
httpClient.addAdditionalHeader("Authorization", authHeader)
Response httpResponse = httpClient.post(oofRequest)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 4bfb29bc45..606b97bec2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -40,7 +40,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index c30d807bf3..52d6758b2b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -47,7 +47,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@@ -223,7 +223,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(sdncAdapterUrl)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER)
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
index 8c2da2c112..08c032fba3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
@@ -37,7 +37,7 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.json.JSONArray
@@ -136,7 +136,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
logger.debug("Sniro Url is: " + urlString)
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO)
httpClient.addAdditionalHeader("Authorization", authHeader)
Response httpResponse = httpClient.post(sniroRequest)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index 866229f6b8..803a3f71de 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -35,8 +35,9 @@ import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import java.util.UUID
+import org.onap.so.utils.Components
@@ -80,7 +81,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
@@ -94,7 +95,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
@@ -108,7 +109,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
while (vnfAdapterEndpoint.endsWith('/')) {
@@ -126,7 +127,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'POST'
@@ -139,7 +140,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -148,7 +149,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'PUT'
@@ -162,7 +163,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -171,7 +172,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -185,7 +186,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
@@ -194,7 +195,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
@@ -203,7 +204,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -224,7 +225,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'PUT'
@@ -240,7 +241,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -256,7 +257,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -269,7 +270,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
@@ -306,7 +307,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
}
@@ -337,7 +338,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(vnfAdapterUrl);
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
@@ -357,7 +358,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
@@ -370,7 +371,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
}
@@ -399,7 +400,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO)
}
}
@@ -418,10 +419,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String rolledBack = getChildText(root, "rolledBack")
rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK);
+ " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK);
} catch (Exception e) {
response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK)
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java
new file mode 100644
index 0000000000..1018d7f025
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.validation;
+
+public interface WorkflowActionCompletion extends WorkflowActionListener {
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java
new file mode 100644
index 0000000000..4788c55053
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.validation;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+
+public interface WorkflowActionListener {
+
+ /**
+ * Should this listener run for given bb
+ *
+ * @return
+ *
+ */
+ public boolean shouldRunFor(String bbName, String eventName);
+
+ /**
+ * Determines whether or not the listener should be executed
+ *
+ *
+ * @param execution
+ * @return
+ */
+ public void executeListener(DelegateExecution execution);
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java
new file mode 100644
index 0000000000..806c1b835d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.listener.validation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.listener.ListenerRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class WorkflowActionListenerRunner extends ListenerRunner {
+
+ private static Logger logger = LoggerFactory.getLogger(WorkflowActionListenerRunner.class);
+
+ protected List<WorkflowActionListener> workflowActionListeners;
+
+ @PostConstruct
+ protected void init() {
+ workflowActionListeners = new ArrayList<>(Optional
+ .ofNullable(context.getBeansOfType(WorkflowActionListener.class)).orElse(new HashMap<>()).values());
+ }
+
+ public void executeAsyncListeners(String bbName, DelegateExecution execution, String eventName) {
+ try {
+ logger.info("NotifyingWorkflowActionListeners");
+ runNotifications(workflowActionListeners, bbName, execution, eventName);
+ } catch (Exception e) {
+ logger.error("Error in Notifying Workflow Action Listeners", e);
+ }
+ }
+
+ protected void runNotifications(List<? extends WorkflowActionListener> listeners, String bbName,
+ DelegateExecution execution, String eventName) {
+ List<? extends WorkflowActionListener> filtered =
+ filterListeners(listeners, (item -> item.shouldRunFor(bbName, eventName)));
+ filtered.forEach(item -> item.executeListener(execution));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 2c1d36273d..8efb6a3e1c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -383,7 +383,7 @@ public class ResourceRequestBuilder {
HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint)
.path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(),
- TargetEntity.CATALOG_DB);
+ ONAPComponents.CATALOG_DB);
client.addAdditionalHeader("Accept", "application/json");
client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth"));
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 dcb9e08d0b..fcac86b251 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
@@ -23,9 +23,7 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -76,12 +74,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.type.TypeFactory;
@Component("BBInputSetupUtils")
public class BBInputSetupUtils {
@@ -177,39 +174,32 @@ public class BBInputSetupUtils {
}
public InfraActiveRequests loadOriginalInfraActiveRequestById(String requestId) {
-
return this.requestsDbClient.getInfraActiveRequestbyRequestId(
this.requestsDbClient.getInfraActiveRequestbyRequestId(requestId).getOriginalRequestId());
}
public List<ExecuteBuildingBlock> loadOriginalFlowExecutionPath(String requestId) {
-
- List<ExecuteBuildingBlock> asList = null;
if (requestId != null) {
-
InfraActiveRequests request = loadInfraActiveRequestById(requestId);
-
if (request.getOriginalRequestId() != null) {
-
RequestProcessingData requestProcessingData =
this.requestsDbClient.getRequestProcessingDataBySoRequestIdAndName(
request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS);
-
- ObjectMapper om = new ObjectMapper();
try {
- ExecuteBuildingBlock[] asArray =
- om.readValue(requestProcessingData.getValue(), ExecuteBuildingBlock[].class);
- asList = Arrays.asList(asArray);
+ ObjectMapper om = new ObjectMapper();
+ TypeFactory typeFactory = objectMapper.getTypeFactory();
+ return om.readValue(requestProcessingData.getValue(),
+ typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class));
} catch (Exception e) {
logger.error(DATA_LOAD_ERROR, e);
+ throw new RuntimeException("Error Loading Original Request Data", e);
}
+ } else {
+ throw new RuntimeException("Original Request Id is null for record: " + requestId);
}
-
} else {
- logger.debug(REQUEST_ERROR);
+ throw new RuntimeException("Null Request Id Passed in");
}
-
- return asList;
}
public Service getCatalogServiceByModelUUID(String modelUUID) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index be53e505ac..ae7addcc57 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import java.util.Map;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.logging.filter.base.ONAPComponentsList;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -35,8 +36,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default serviceType value
- logger.error("Exception in serviceType retrivel", ex);
+ logger.error("Exception in serviceType retrieval", ex);
}
String vnfType = ASTERISK;
try {
@@ -116,22 +116,21 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default vnfType value
- logger.error("Exception in vnfType retrivel", ex);
+ logger.error("Exception in vnfType retrieval", ex);
}
String errorCode = ASTERISK;
- try {
+ if (workflowException != null) {
errorCode = "" + workflowException.getErrorCode();
- } catch (Exception ex) {
- // keep default errorCode value
- logger.error("Exception in errorCode retrivel", ex);
+ } else {
+ logger.debug("WorkflowException is null, unable to get error code");
}
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
// keep default errorCode value
- logger.error("Exception in errorCode retrivel", ex);
+ logger.error("Exception in errorCode retrieval", ex);
}
String workStep = ASTERISK;
@@ -139,7 +138,7 @@ public class ExecuteBuildingBlockRainyDay {
workStep = workflowException.getWorkStep();
} catch (Exception ex) {
// keep default workStep value
- logger.error("Exception in workStep retrivel", ex);
+ logger.error("Exception in workStep retrieval", ex);
}
String errorMessage = ASTERISK;
@@ -147,7 +146,7 @@ public class ExecuteBuildingBlockRainyDay {
errorMessage = workflowException.getErrorMessage();
} catch (Exception ex) {
// keep default workStep value
- logger.error("Exception in errorMessage retrivel", ex);
+ logger.error("Exception in errorMessage retrieval", ex);
}
String serviceRole = ASTERISK;
@@ -223,7 +222,7 @@ public class ExecuteBuildingBlockRainyDay {
try {
String requestId = (String) execution.getVariable("mso-request-id");
WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource();
+ ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource();
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
if (isRollbackFailure == null) {
@@ -244,10 +243,10 @@ public class ExecuteBuildingBlockRainyDay {
} else if (isRollbackFailure) {
logger.debug(
"rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN");
- request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setRollbackExtSystemErrorSource(Components.UNKNOWN.toString());
} else {
logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN");
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
}
request.setLastModifiedBy("CamundaBPMN");
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 729f5c95c4..c26a1cfecc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -43,8 +43,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -92,7 +92,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -156,7 +156,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -195,7 +195,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
if (execution instanceof DelegateExecutionImpl) {
buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
errorMessage, extSystemErrorSource);
@@ -215,7 +215,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String processKey = getProcessKey(execution);
logger.info("Building a WorkflowException for Subflow");
@@ -293,7 +293,7 @@ public class ExceptionBuilder {
execution.setVariable("StatusMessage", errorMessage.toString());
} else {
WorkflowException exception =
- new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO);
+ new WorkflowException(processKey, 400, errorMessage.toString(), ONAPComponents.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
logger.info("Outgoing WorkflowException is {}", exception);
@@ -303,7 +303,7 @@ public class ExceptionBuilder {
} else {
String errorMessage = "Unable to process audit results due to auditInventoryResult being null";
- WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO);
+ WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, ONAPComponents.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d7438f80f9..fda6b8e6e3 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.skyscreamer.jsonassert.JSONAssert
import org.skyscreamer.jsonassert.JSONCompareMode
import org.springframework.core.env.Environment
@@ -127,7 +127,7 @@ class CatalogDbUtilsTest {
private void mockGetResponseFromCatalogDb(String queryEndpoint) {
Environment environmentMock = createEnvironmentMock()
when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl")
- when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock)
+ when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)).thenReturn(httpClientMock)
Response responseMock = mock(Response.class)
when(httpClientMock.get()).thenReturn(responseMock)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
index 837bc77f19..7abfcffb13 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
@@ -26,7 +26,7 @@ import org.junit.Test
import org.onap.logging.ref.slf4j.ONAPLogConstants
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.http.HttpStatus
import javax.ws.rs.core.MediaType
@@ -53,7 +53,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
given(httpClient.get()).willReturn(expectedResponse)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient)
// WHEN
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil())
@@ -75,7 +75,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
willThrow(new RuntimeException("error occurred")).given(httpClient).get()
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient)
DelegateExecution delegateExecution = createDelegateExecution()
DummyExceptionUtil exceptionUtil = new DummyExceptionUtil()
@@ -97,7 +97,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient)
DelegateExecution delegateExecution = createDelegateExecution()
DummyExceptionUtil exceptionUtil = new DummyExceptionUtil()
@@ -120,7 +120,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient)
// WHEN
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil())
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
index 6a48558d11..6d5ce622d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
@@ -33,10 +33,11 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
@RunWith(MockitoJUnitRunner.class)
public class ExecuteBuildingBlockRainyDayUnitTest {
@@ -57,7 +58,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
@Before
public void setup() {
- exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC);
+ exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC);
noExtSystemErrorSourceException =
new WorkflowException("Test exception without extsystemErrorSource", 7000, "", "");
@@ -75,7 +76,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
execution.setVariable("isRollback", false);
execution.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@@ -87,42 +88,42 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
execution.setVariable("isRollback", true);
execution.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() {
+ public void updateExtSystemErrorSourceisRollbackONAPComponentsNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
execution.setVariable("isRollback", true);
execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceTargetEntityNullTest() {
+ public void updateExtSystemErrorSourceONAPComponentsNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
execution.setVariable("isRollback", false);
execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() {
+ public void updateExtSystemErrorSourceONAPComponentsisRollbackNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
executionNullisRollback.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
index b109ae258d..5baafbba67 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -39,7 +39,7 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
public class ExceptionBuilderUnitTest {
@@ -67,12 +67,12 @@ public class ExceptionBuilderUnitTest {
String expectedErrorMessage =
"Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SDNC);
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
}
@Test
@@ -80,12 +80,12 @@ public class ExceptionBuilderUnitTest {
String expectedErrorMessage =
"Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
- expectedErrorMessage, TargetEntity.SDNC);
+ expectedErrorMessage, ONAPComponents.SDNC);
- exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, ONAPComponents.SDNC);
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
- expectedErrorMessage, TargetEntity.SDNC);
+ expectedErrorMessage, ONAPComponents.SDNC);
}
@Test
@@ -93,6 +93,6 @@ public class ExceptionBuilderUnitTest {
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
thrown.expect(BpmnError.class);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 7d5bb0dcf1..f8dfad61f2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.core;
import java.io.Serializable;
-import org.onap.so.utils.TargetEntities;
+import org.onap.logging.filter.base.ONAPComponentsList;
/**
* An object that represents a workflow exception.
@@ -33,7 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
- private TargetEntities extSystemErrorSource;
+ private ONAPComponentsList extSystemErrorSource;
/**
* Constructor
@@ -50,7 +50,7 @@ public class WorkflowException implements Serializable {
}
public WorkflowException(String processKey, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
this.processKey = processKey;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
@@ -66,7 +66,7 @@ public class WorkflowException implements Serializable {
}
public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
this.processKey = processKey;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
@@ -102,7 +102,7 @@ public class WorkflowException implements Serializable {
return workStep;
}
- public TargetEntities getExtSystemErrorSource() {
+ public ONAPComponentsList getExtSystemErrorSource() {
return extSystemErrorSource;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 5f70ab5924..3a1e126fef 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -82,7 +82,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationValue = messageId;
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "queryVnfNotification")
@@ -117,7 +117,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setOutputs(outputs);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "createVnfNotification")
@@ -150,7 +150,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "updateVnfNotification")
@@ -181,7 +181,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "deleteVnfNotification")
@@ -208,6 +208,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setErrorMessage(errorMessage);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index d33e7aed0c..70365b744c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -85,12 +85,14 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
Map<String, Object> inputVariables = new HashMap<>();
@SuppressWarnings("unchecked")
Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
+ if (vMap != null) {
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
}
return inputVariables;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java
new file mode 100644
index 0000000000..56526c7f89
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java
@@ -0,0 +1,21 @@
+package org.onap.so.bpmn.core.plugins;
+
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
+import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
+import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
+import org.camunda.bpm.engine.impl.util.xml.Element;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AsyncTaskExecutor extends AbstractBpmnParseListener {
+
+ private void injectTaskExecutorExecutionListener(ActivityImpl activity) {
+ activity.addListener(ExecutionListener.EVENTNAME_END, new AsyncTaskExecutorListener());
+ }
+
+ @Override
+ public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectTaskExecutorExecutionListener(activity);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java
new file mode 100644
index 0000000000..94f4b313d4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java
@@ -0,0 +1,42 @@
+package org.onap.so.bpmn.core.plugins;
+
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.onap.so.bpmn.common.listener.validation.WorkflowActionListenerRunner;
+import org.onap.so.spring.SpringContextHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncTaskExecutorListener implements ExecutionListener {
+ private final Logger logger = LoggerFactory.getLogger(AsyncTaskExecutorListener.class);
+
+
+ private WorkflowActionListenerRunner listenerRunner;
+
+ @Override
+ public void notify(DelegateExecution execution) throws Exception {
+ if (!isBlank(execution.getCurrentActivityName())) {
+ try {
+ String id = execution.getId();
+ if (id != null) {
+ RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
+ String processName = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionId(execution.getProcessDefinitionId()).singleResult().getName();
+ logger.info("ProcessName : {}", processName);
+ if (processName != null) {
+ listenerRunner =
+ SpringContextHelper.getAppContext().getBean(WorkflowActionListenerRunner.class);
+ listenerRunner.executeAsyncListeners(processName, execution, ExecutionListener.EVENTNAME_END);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error occured in executing Complete Task Listeners", e);
+ }
+ }
+ }
+
+ private boolean isBlank(Object object) {
+ return object == null || "".equals(object.toString().trim());
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java
new file mode 100644
index 0000000000..96c6af42ed
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.core.plugins;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
+import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class BPMNProcessCompletePlugin extends AbstractProcessEnginePlugin {
+
+ @Autowired
+ private AsyncTaskExecutor asyncTaskExecutor;
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+ preParseListeners.add(asyncTaskExecutor);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index a049f81906..03feda6d0f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -38,9 +38,7 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -65,7 +63,7 @@ public class CXFConfiguration {
private WorkflowAsyncResource workflowAsyncResource;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private ObjectMapper mapper;
@@ -108,7 +106,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index a4fc6e54b0..29fc4e93fc 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -33,7 +33,7 @@ import org.camunda.bpm.engine.repository.DeploymentBuilder;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
new file mode 100644
index 0000000000..d15d71a9e9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
@@ -0,0 +1,118 @@
+package org.onap.so.bpmn.common.workflow.service;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfAdapterNotifyServiceImplTest {
+
+
+ @InjectMocks
+ @Spy
+ private VnfAdapterNotifyServiceImpl vnfAdapterNotifyServiceImpl;
+
+ @Mock
+ private CallbackHandlerService callbackHandlerService;
+
+ @Mock
+ private CallbackResult callbackResult;
+
+ protected CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
+ protected QueryVnfNotification.Outputs queryOutputs = new QueryVnfNotification.Outputs();
+ protected UpdateVnfNotification.Outputs updateOutputs = new UpdateVnfNotification.Outputs();
+
+ protected VnfRollback vnfRollback = new VnfRollback();
+
+ @Test
+ public void rollbackVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.rollbackVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK,
+ "Error creating stack");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void queryVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.queryVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ Boolean.TRUE, "vnfid", VnfStatus.ACTIVE, queryOutputs);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+
+ @Test
+ public void createVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.createVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ "vnfId", outputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void updateVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.updateVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ updateOutputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void deleteVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.deleteVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index dd993bca51..078317885c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -20,9 +20,8 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@@ -35,8 +34,7 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index efdee8601e..bb900420e3 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -46,7 +46,7 @@
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==false&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}">
<bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming>
@@ -54,7 +54,7 @@
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_SendSync" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
<bpmn:incoming>SequenceFlow_0sckerv</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1wb59ic</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1lrz41x</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_UpdateRequestComplete" name="Update Request To Complete" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToComplete(execution)}">
<bpmn:incoming>SequenceFlow_0kf5sen</bpmn:incoming>
@@ -83,7 +83,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" />
<bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&amp;&amp;execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" />
<bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
@@ -92,10 +92,10 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}">
<bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming>
@@ -104,7 +104,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" />
<bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}">
<bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming>
@@ -115,7 +115,6 @@
<bpmn:incoming>SequenceFlow_1r570x3</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" />
- <bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" />
<bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" />
<bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}">
<bpmn:incoming>SequenceFlow_01j184u</bpmn:incoming>
@@ -128,7 +127,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" />
<bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0">
<bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming>
@@ -137,7 +136,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" />
<bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen">
<bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming>
@@ -145,13 +144,13 @@
<bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="End_RollbackFailed" name="end">
<bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}">
<bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming>
@@ -159,7 +158,7 @@
<bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==true&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" />
<bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -186,7 +185,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable(&#34;requestAction&#34;), execution)}">
<bpmn:incoming>SequenceFlow_0unbew4</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0etawv5</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
@@ -196,6 +195,19 @@
<bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
<bpmn:sequenceFlow id="SequenceFlow_1fftixk" sourceRef="ServiceTask_0lbkcyp" targetRef="ExclusiveGateway_Finished" />
<bpmn:sequenceFlow id="SequenceFlow_1pnkpim" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1dez26n" name="Generated Id&#39;s?">
+ <bpmn:incoming>SequenceFlow_1lrz41x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0etawv5</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ilo6lo</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1lrz41x" sourceRef="Task_SendSync" targetRef="ExclusiveGateway_1dez26n" />
+ <bpmn:sequenceFlow id="SequenceFlow_0etawv5" name="no" sourceRef="ExclusiveGateway_1dez26n" targetRef="Task_PreValidateWorkflow">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_12f15tu" name="End">
+ <bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0ilo6lo" name="yes" sourceRef="ExclusiveGateway_1dez26n" targetRef="EndEvent_12f15tu" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -213,8 +225,8 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint x="-398" y="120" />
- <di:waypoint x="-365" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-398" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-365" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-381" y="99" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -223,8 +235,8 @@
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
- <di:waypoint x="339" y="120" />
- <di:waypoint x="400" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="400" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -239,9 +251,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint x="949" y="132" />
- <di:waypoint x="980" y="165" />
- <di:waypoint x="1060" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
@@ -250,15 +262,15 @@
<dc:Bounds x="-365" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync">
- <dc:Bounds x="-132" y="-6" width="100" height="80" />
+ <dc:Bounds x="-100" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete">
<dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint x="1261" y="246" />
- <di:waypoint x="1322" y="246" />
- <di:waypoint x="1322" y="183" />
+ <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -279,16 +291,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint x="936" y="145" />
- <di:waypoint x="936" y="262" />
- <di:waypoint x="339" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
- <di:waypoint x="289" y="222" />
- <di:waypoint x="289" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="160" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -297,16 +309,16 @@
<dc:Bounds x="239" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9">
- <di:waypoint x="-265" y="120" />
- <di:waypoint x="-228" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-265" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-228" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-246" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint x="946" y="105" />
- <di:waypoint x="983" y="44" />
- <di:waypoint x="1060" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="946" y="105" />
+ <di:waypoint xsi:type="dc:Point" x="983" y="44" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
@@ -321,28 +333,19 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint x="1276" y="-36" />
- <di:waypoint x="1359" y="-36" />
- <di:waypoint x="1359" y="45" />
- <di:waypoint x="1386" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint x="-32" y="34" />
- <di:waypoint x="32" y="34" />
- <di:waypoint x="32" y="120" />
- <di:waypoint x="80" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="47" y="77" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint x="936" y="95" />
- <di:waypoint x="936" y="55" />
- <di:waypoint x="936" y="55" />
- <di:waypoint x="936" y="4" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="95" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -357,16 +360,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint x="-202" y="96" />
- <di:waypoint x="-202" y="34" />
- <di:waypoint x="-132" y="34" />
+ <di:waypoint xsi:type="dc:Point" x="-202" y="96" />
+ <di:waypoint xsi:type="dc:Point" x="-202" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="-100" y="-36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" />
+ <dc:Bounds x="-195" y="17.612903225806477" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint x="-178" y="120" />
- <di:waypoint x="80" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-178" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -378,16 +381,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint x="1085" y="20" />
- <di:waypoint x="1085" y="-37" />
- <di:waypoint x="1176" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint x="1110" y="45" />
- <di:waypoint x="1386" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -399,10 +402,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint x="1110" y="165" />
- <di:waypoint x="1220" y="165" />
- <di:waypoint x="1220" y="165" />
- <di:waypoint x="1304" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -414,9 +417,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint x="289" y="302" />
- <di:waypoint x="289" y="368" />
- <di:waypoint x="960" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="302" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="960" y="368" />
<bpmndi:BPMNLabel>
<dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
@@ -428,33 +431,33 @@
<dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint x="942" y="139" />
- <di:waypoint x="976" y="252" />
- <di:waypoint x="1016" y="252" />
- <di:waypoint x="1016" y="325" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="139" />
+ <di:waypoint xsi:type="dc:Point" x="976" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
<bpmndi:BPMNLabel>
<dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
- <di:waypoint x="556" y="657" />
- <di:waypoint x="602" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="556" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="602" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="534" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf">
- <di:waypoint x="813" y="657" />
- <di:waypoint x="880" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="813" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="880" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="801.5" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint x="1060" y="365" />
- <di:waypoint x="1134" y="365" />
- <di:waypoint x="1134" y="365" />
- <di:waypoint x="1159" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
@@ -466,25 +469,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1">
- <di:waypoint x="652" y="657" />
- <di:waypoint x="683" y="657" />
- <di:waypoint x="683" y="657" />
- <di:waypoint x="713" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="652" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="683" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="683" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="677" y="634" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o">
- <di:waypoint x="627" y="632" />
- <di:waypoint x="627" y="548" />
- <di:waypoint x="713" y="548" />
+ <di:waypoint xsi:type="dc:Point" x="627" y="632" />
+ <di:waypoint xsi:type="dc:Point" x="627" y="548" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="548" />
<bpmndi:BPMNLabel>
<dc:Bounds x="633" y="584" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l">
- <di:waypoint x="763" y="588" />
- <di:waypoint x="763" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="617" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="596.5" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -511,15 +514,15 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w">
- <di:waypoint x="606" y="875" />
- <di:waypoint x="690" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="606" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="690" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="603" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88">
- <di:waypoint x="790" y="875" />
- <di:waypoint x="856" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="790" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="856" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -528,25 +531,25 @@
<dc:Bounds x="400" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint x="500" y="120" />
- <di:waypoint x="560" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="560" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint x="1085" y="190" />
- <di:waypoint x="1085" y="246" />
- <di:waypoint x="1161" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
- <di:waypoint x="180" y="120" />
- <di:waypoint x="211" y="120" />
- <di:waypoint x="211" y="120" />
- <di:waypoint x="239" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="180" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="226" y="120" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -558,27 +561,60 @@
<dc:Bounds x="735" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint x="660" y="120" />
- <di:waypoint x="735" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="735" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697.5" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
- <di:waypoint x="835" y="120" />
- <di:waypoint x="911" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="835" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="911" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
- <di:waypoint x="886" y="-36" />
- <di:waypoint x="289" y="-36" />
- <di:waypoint x="289" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
<bpmndi:BPMNLabel>
<dc:Bounds x="587.5" y="-57" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1dez26n_di" bpmnElement="ExclusiveGateway_1dez26n" isMarkerVisible="true">
+ <dc:Bounds x="105" y="-61" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="163" y="-48" width="61" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lrz41x_di" bpmnElement="SequenceFlow_1lrz41x">
+ <di:waypoint xsi:type="dc:Point" x="0" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="105" y="-36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="52.5" y="-57" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0etawv5_di" bpmnElement="SequenceFlow_0etawv5">
+ <di:waypoint xsi:type="dc:Point" x="130" y="-11" />
+ <di:waypoint xsi:type="dc:Point" x="130" y="80" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="139" y="29" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_12f15tu_di" bpmnElement="EndEvent_12f15tu">
+ <dc:Bounds x="112" y="-169.83592938733125" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="120" y="-195" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ilo6lo_di" bpmnElement="SequenceFlow_0ilo6lo">
+ <di:waypoint xsi:type="dc:Point" x="130" y="-61" />
+ <di:waypoint xsi:type="dc:Point" x="130" y="-134" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="136" y="-103" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index 901964f465..2e664d90da 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
* This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process.
@@ -273,7 +273,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
index 7abdd49d1d..1d3b2757e7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
@@ -52,7 +52,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import javax.ws.rs.core.MediaType
import org.apache.commons.codec.binary.Base64
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
index 41a302f5f1..e34e505e55 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
@@ -35,7 +35,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.Response
import org.camunda.bpm.engine.delegate.BpmnError
@@ -199,7 +199,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork)
URL url = new URL(urlRollbackPoNetwork)
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(rollbackNetworkRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index 1517a335d9..2def9e2d06 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
@@ -39,7 +39,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.Response
@@ -258,7 +258,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 731c5b8dc5..dafc4b5470 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -67,7 +67,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.NamedNodeMap
@@ -698,7 +698,7 @@ public class DoCreateVfModule extends VfModuleBase {
String endPoint = aaiUriUtil.createAaiUri(uri)
try {
- HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
@@ -781,7 +781,7 @@ public class DoCreateVfModule extends VfModuleBase {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
String endPoint = aaiUriUtil.createAaiUri(uri)
- HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index 34ea20ba62..a24bc4411e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -54,7 +54,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.web.util.UriUtils
import javax.ws.rs.NotFoundException
@@ -388,7 +388,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceAaiPath = "${aai_endpoint}${urlLink}"
URL url = new URL(serviceAaiPath)
- HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(url, ONAPComponents.AAI)
client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index df8735aaaa..09eb7994a8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -51,7 +51,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import groovy.json.JsonOutput
import javax.ws.rs.core.Response
@@ -455,7 +455,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest")
URL url = new URL(vnfAdapterUrl)
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER)
httpClient.accept = "application/xml"
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(vnfAdapterRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
index 00244aded0..28f4460d71 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
@@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
@@ -226,7 +226,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
@@ -257,7 +257,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
httpClient.addAdditionalHeader("Content-Type", "application/json")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
index 2a8cc08cdf..367975e003 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
@@ -51,7 +51,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@@ -209,7 +209,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try{
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
apiResponse = httpClient.post(requestBody)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index 75ac6900fa..cfdba89db7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
* This class supports the VID Flow
@@ -164,7 +164,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
logger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', 'application/xml')
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 2ababac7e3..a55f32aaaa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,14 +21,12 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import java.util.Map;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.camunda.bpm.engine.runtime.Execution;
-import org.onap.aai.domain.yang.v13.Metadatum;
import org.onap.so.bpmn.common.recipe.ResourceInput;
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
-import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +38,7 @@ import java.util.Optional;
@Component
public class InformDmaapClient implements JavaDelegate {
- private Logger logger = LoggerFactory.getLogger(getClass());
+ private static final Logger LOGGER = LoggerFactory.getLogger(InformDmaapClient.class);
private DmaapClient dmaapClient;
@Override
@@ -47,25 +46,34 @@ public class InformDmaapClient implements JavaDelegate {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
String processBusinessKey = execution.getProcessBusinessKey();
- HashMap<String, String> updateInfo = createUpdateInfo(execution);
- updateInfo.put("pnfCorrelationId", pnfCorrelationId);
- dmaapClient
- .registerForUpdate(pnfCorrelationId,
- () -> runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(processBusinessKey).correlateWithResult(),
- Optional.of(updateInfo));
+ dmaapClient.registerForUpdate(pnfCorrelationId,
+ () -> runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(processBusinessKey).correlateWithResult(),
+ createUpdateInfoMap(execution));
}
- private HashMap<String, String> createUpdateInfo(DelegateExecution execution) {
- HashMap<String, String> map = new HashMap();
-
- ResourceInput resourceInputObj = ResourceRequestBuilder
+ private Map<String, String> createUpdateInfoMap(DelegateExecution execution) {
+ Map<String, String> updateInfoMap = new HashMap<>();
+ updateInfoMap.put("pnfCorrelationId",
+ (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID));
+ getResourceInput(execution).ifPresent(resourceInput -> {
+ updateInfoMap.put("globalSubscriberID", resourceInput.getGlobalSubscriberId());
+ updateInfoMap.put("serviceType", resourceInput.getServiceType());
+ updateInfoMap.put("serviceInstanceId", resourceInput.getServiceInstanceId());
+ });
+ return updateInfoMap;
+ }
- .getJsonObject((String) execution.getVariable("resourceInput"), ResourceInput.class);
- map.put("globalSubscriberID", resourceInputObj.getGlobalSubscriberId());
- map.put("serviceType", resourceInputObj.getServiceType());
- map.put("serviceInstanceId", resourceInputObj.getServiceInstanceId());
- return map;
+ private Optional<ResourceInput> getResourceInput(DelegateExecution execution) {
+ ResourceInput resourceInput = null;
+ if (execution.getVariable("resourceInput") != null) {
+ resourceInput = ResourceRequestBuilder.getJsonObject((String) execution.getVariable("resourceInput"),
+ ResourceInput.class);
+ } else {
+ LOGGER.warn("resourceInput value is null for correlation id: {}",
+ execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID));
+ }
+ return Optional.ofNullable(resourceInput);
}
@Autowired
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index d513684659..bafb749e15 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,13 +21,11 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
-import java.util.HashMap;
-import java.util.Optional;
+import java.util.Map;
public interface DmaapClient {
- void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo);
Runnable unregister(String pnfCorrelationId);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index 8010ce62ab..a932e4ac50 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -28,6 +28,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Spliterator;
@@ -41,6 +42,9 @@ public final class JsonUtilForPnfCorrelationId {
}
static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
+ if (json == null || json.isEmpty()) {
+ return Collections.emptyList();
+ }
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 48061db887..bd1a45c64d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -23,12 +23,14 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -42,6 +44,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIObjectType;
+import static org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForPnfCorrelationId.*;
@Component
public class PnfEventReadyDmaapClient implements DmaapClient {
@@ -54,8 +57,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private int topicListenerDelayInSeconds;
private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
-
- public volatile List<HashMap<String, String>> updateInfoMap;
+ private volatile List<Map<String, String>> listOfUpdateInfoMap;
@Autowired
public PnfEventReadyDmaapClient(Environment env) {
@@ -68,18 +70,15 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
.port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName"))
.path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId"))
.build());
- updateInfoMap = new ArrayList<>();
+ listOfUpdateInfoMap = new ArrayList<>();
}
@Override
public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo) {
+ Map<String, String> updateInfo) {
logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
- HashMap<String, String> map = updateInfo.get();
- if (map != null && map.size() > 0) {
- synchronized (updateInfoMap) {
- updateInfoMap.add(map);
- }
+ synchronized (listOfUpdateInfoMap) {
+ listOfUpdateInfoMap.add(updateInfo);
}
pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
@@ -91,14 +90,14 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
public synchronized Runnable unregister(String pnfCorrelationId) {
logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
- synchronized (updateInfoMap) {
- for (int i = updateInfoMap.size() - 1; i >= 0; i--) {
- if (!updateInfoMap.get(i).containsKey("pnfCorrelationId"))
+ synchronized (listOfUpdateInfoMap) {
+ for (int i = listOfUpdateInfoMap.size() - 1; i >= 0; i--) {
+ if (!listOfUpdateInfoMap.get(i).containsKey("pnfCorrelationId"))
continue;
- String id = updateInfoMap.get(i).get("pnfCorrelationId");
+ String id = listOfUpdateInfoMap.get(i).get("pnfCorrelationId");
if (id != pnfCorrelationId)
continue;
- updateInfoMap.remove(i);
+ listOfUpdateInfoMap.remove(i);
}
}
if (pnfCorrelationIdToThreadMap.isEmpty()) {
@@ -133,15 +132,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- List<String> idList = getPnfCorrelationIdListFromResponse(response);
-
- // idList is never null
- if (!idList.isEmpty()) {
- // send only body of response
- registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
- }
-
- if (idList != null) {
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+ String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
+ List<String> idList = parseJsonToGelAllPnfCorrelationId(responseString);
+ idList.stream().findFirst().ifPresent(id -> registerClientResponse(id, responseString));
idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
}
} catch (IOException e) {
@@ -151,16 +145,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
}
}
- private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException {
- if (response.getStatusLine().getStatusCode() == 200) {
- String responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
- if (responseString != null) {
- return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString);
- }
- }
- return Collections.emptyList();
- }
-
private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) {
Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
@@ -174,8 +158,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
String customerId = null;
String serviceType = null;
String serId = null;
- synchronized (updateInfoMap) {
- for (HashMap<String, String> map : updateInfoMap) {
+ synchronized (listOfUpdateInfoMap) {
+ for (Map<String, String> map : listOfUpdateInfoMap) {
if (!map.containsKey("pnfCorrelationId"))
continue;
if (pnfCorrelationId != map.get("pnfCorrelationId"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
index afbace76d6..715a7dff6d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.scripts
import org.camunda.bpm.engine.delegate.BpmnError
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 2634f03d4b..598582bfd8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +21,9 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import java.util.Map;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
-import java.util.HashMap;
import java.util.Objects;
-import java.util.Optional;
public class DmaapClientTestImpl implements DmaapClient {
@@ -31,8 +31,7 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index 8741208d26..4edee24531 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -63,4 +63,13 @@ public class JsonUtilForPnfCorrelationIdTest {
assertThat(expectedResult).isEmpty();
}
+ @Test
+ public void shouldReturnEmptyListWhenInputIsNull() {
+ assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(null)).isEmpty();
+ }
+
+ @Test
+ public void shouldReturnEmptyListWhenInputIsEmpty() {
+ assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId("")).isEmpty();
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 19e08d9d59..cccfe0c762 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -30,8 +30,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -41,7 +41,7 @@ import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.InputStreamEntity;
import org.apache.http.message.BasicHttpResponse;
import org.junit.Before;
import org.junit.Test;
@@ -182,8 +182,8 @@ public class PnfEventReadyDmaapClientTest {
threadRunFlag.setAccessible(false);
}
- private HttpResponse createResponse(String json) throws UnsupportedEncodingException {
- HttpEntity entity = new StringEntity(json);
+ private HttpResponse createResponse(String json) {
+ HttpEntity entity = new InputStreamEntity(new ByteArrayInputStream(json.getBytes()));
ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
response.setEntity(entity);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 4e74e5d414..c223d3ff11 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -2,14 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2019 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.
@@ -20,7 +21,6 @@
package org.onap.so.bpmn.buildingblock;
-import java.util.Map;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -28,37 +28,37 @@ import org.springframework.stereotype.Component;
@Component
public class HomingV2 {
- @Autowired
- private OofHomingV2 oofHomingV2;
- @Autowired
+ static final String HOMING_SNIRO = "sniro";
+ static final String HOMING_OOF = "oof";
+ static final String HOMING_SOLUTION = "Homing_Solution";
+
private SniroHomingV2 sniroHomingV2;
+ private OofHomingV2 oofHomingV2;
- private static final String HOMINGSOLUTION = "Homing_Solution";
+ @Autowired
+ public HomingV2(OofHomingV2 oofHomingV2, SniroHomingV2 sniroHomingV2) {
+ this.oofHomingV2 = oofHomingV2;
+ this.sniroHomingV2 = sniroHomingV2;
+ }
public void callHoming(BuildingBlockExecution execution) {
- if (isOof(execution)) {
- oofHomingV2.callOof(execution);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.callSniro(execution);
+ } else {
+ oofHomingV2.callOof(execution);
}
}
public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
- if (isOof(execution)) {
- oofHomingV2.processSolution(execution, asyncResponse);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.processSolution(execution, asyncResponse);
+ } else {
+ oofHomingV2.processSolution(execution, asyncResponse);
}
}
- // Default solution is SNIRO. OOF gets called only if specified.
- private boolean isOof(BuildingBlockExecution execution) {
- for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
- .getUserParams()) {
- if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) {
- return true;
- }
- }
- return false;
+ private boolean isSniro(BuildingBlockExecution execution) {
+ return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream()
+ .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION)));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index f1fd23fe82..f10b503ed3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -162,14 +162,14 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO);
}
}
@@ -214,15 +214,15 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
"Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index d9c6857ef1..0c31dfa16f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -138,7 +138,9 @@ public class ExecuteActivity implements JavaDelegate {
execution.setVariable(WORKFLOW_EXCEPTION, workflowException);
} catch (Exception e) {
- buildAndThrowException(execution, e.getMessage());
+ logger.error("BPMN exception on activity execution: " + e.getMessage());
+ workflowException = new WorkflowException(EXECUTE_BUILDING_BLOCK, 7000, e.getMessage());
+ handlingCode = ABORT_HANDLING_CODE;
}
if (workflowException != null && handlingCode != null && handlingCode.equals(ABORT_HANDLING_CODE)) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index e9d33f46ab..2705d00d6b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.onap.so.utils.Components;
@Component
public class NetworkAdapterRestV1 {
@@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK);
}
}
@@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
+ "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK);
}
}
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 127d21c0ed..79ccd9216f 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
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
import org.json.JSONArray;
@@ -31,6 +32,7 @@ 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;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -60,6 +62,8 @@ public class AppcRunTasks {
public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop";
public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock";
public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic";
+ public static final String CONTROLLER_TYPE_DEFAULT = "APPC";
+ public static final String GENERIC_APPC_ERROR_CODE = "1002";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -139,7 +143,12 @@ public class AppcRunTasks {
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = controllerSelectionReference.getControllerName();
+ String controllerType = null;
+ if (controllerSelectionReference != null) {
+ controllerType = controllerSelectionReference.getControllerName();
+ } else {
+ controllerType = CONTROLLER_TYPE_DEFAULT;
+ }
String vfModuleId = null;
VfModule vfModule = null;
@@ -153,12 +162,16 @@ public class AppcRunTasks {
HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList,
vserverIdList, identityUrl, vfModuleId);
- Optional<String> payload = null;
+ Optional<String> payload = Optional.empty();
RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
if (requestParameters != null) {
String pay = requestParameters.getPayload();
if (pay != null) {
payload = Optional.of(pay);
+ } else {
+ String payloadFromUserParams =
+ buildPayloadFromUserParams(gBBInput.getRequestContext().getUserParams());
+ payload = Optional.of(payloadFromUserParams);
}
}
logger.debug("Running APP-C action: {}", action.toString());
@@ -169,7 +182,9 @@ public class AppcRunTasks {
mapRollbackVariables(execution, action, appcCode);
} catch (Exception e) {
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(),
+ "Error on request to APPC", e);
+ appcCode = GENERIC_APPC_ERROR_CODE;
appcMessage = e.getMessage();
}
@@ -212,6 +227,21 @@ public class AppcRunTasks {
return payloadInfo;
}
+ protected String buildPayloadFromUserParams(Map<String, Object> userParams) {
+ if (userParams == null || userParams.size() == 0) {
+ return null;
+ }
+
+ String payload = "{}";
+ for (Map.Entry<String, Object> entry : userParams.entrySet()) {
+ payload = JsonUtils.addJsonValue(payload, entry.getKey(), (String) entry.getValue());
+ }
+
+ payload = payload.replaceAll("\"", "\\\\\"");
+ payload = payload.replaceAll("\n", "");
+ return payload;
+ }
+
protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
new file mode 100644
index 0000000000..566cdccd50
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.infrastructure.flowspecific.exceptions;
+
+public class UnassignNetworkException extends Exception {
+
+ private static final long serialVersionUID = 2864418350216433736L;
+
+ public UnassignNetworkException() {
+ super();
+ }
+
+ public UnassignNetworkException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
index bc71fc6f67..9413e8ef2e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 TechMahindra.
+ * Copyright (C) 2019 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.
@@ -20,8 +21,10 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -33,15 +36,15 @@ import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf;
import org.onap.so.client.cds.beans.ConfigAssignRequestVnf;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- *
* Get vnf related data and config assign
- *
*/
@Component
public class ConfigAssignVnf {
@@ -51,48 +54,42 @@ public class ConfigAssignVnf {
private static final String ACTION_NAME = "config-assign";
private static final String MODE = "sync";
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionBuilder;
+
@Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ public ConfigAssignVnf(ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ this.extractPojosForBB = extractPojosForBB;
+ this.exceptionBuilder = exceptionBuilder;
+ }
/**
* Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the
* subprocess.
- *
- * @param execution
*/
public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
logger.info("Start preProcessAbstractCDSProcessing ");
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- List<Map<String, Object>> userParams =
- execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams();
-
ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
configAssignPropertiesForVnf
.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
configAssignPropertiesForVnf
- .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
- configAssignPropertiesForVnf.setVnfId(vnf.getVnfId());
- configAssignPropertiesForVnf.setVnfName(vnf.getVnfName());
-
- for (Map<String, Object> params : userParams) {
- for (Map.Entry<String, Object> entry : params.entrySet()) {
- configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue());
- }
- }
-
+ .setVnfCustomizationUuid(genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configAssignPropertiesForVnf.setVnfId(genericVnf.getVnfId());
+ configAssignPropertiesForVnf.setVnfName(genericVnf.getVnfName());
+ setUserParamsInConfigAssignPropertiesForVnf(configAssignPropertiesForVnf,
+ execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(),
+ genericVnf);
ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
- configAssignRequestVnf.setResolutionKey(vnf.getVnfName());
+ configAssignRequestVnf.setResolutionKey(genericVnf.getVnfName());
configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
- String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName();
- String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion();
+ String blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName();
+ String blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion();
logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion);
AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
@@ -109,9 +106,48 @@ public class ConfigAssignVnf {
abstractCDSPropertiesBean.setActionName(ACTION_NAME);
abstractCDSPropertiesBean.setMode(MODE);
execution.setVariable("executionObject", abstractCDSPropertiesBean);
-
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ logger.error("An exception occurred when creating ConfigAssignPropertiesForVnf for CDS request", ex);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void setUserParamsInConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignProperties,
+ List<Map<String, Object>> userParamsFromRequest, GenericVnf vnf) throws Exception {
+ Service service = getServiceFromRequestUserParams(userParamsFromRequest);
+ List<Map<String, String>> instanceParamsList =
+ getInstanceParamForVnf(service, vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ instanceParamsList
+ .forEach(instanceParamsMap -> instanceParamsMap.forEach(configAssignProperties::setUserParam));
+ }
+
+ private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
+ Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst()
+ .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
+ return convertServiceFromJsonToServiceObject((String) serviceMap.get("service"));
+ }
+
+ private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception {
+ try {
+ return new ObjectMapper().readValue(serviceFromJson, Service.class);
+ } catch (Exception e) {
+ logger.error(String.format(
+ "An exception occurred while converting json object to Service object. The json is: %s",
+ serviceFromJson), e);
+ throw e;
+ }
+ }
+
+ private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid)
+ throws Exception {
+ Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream()
+ .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(genericVnfModelCustomizationUuid))
+ .findFirst();
+ if (foundedVnf.isPresent()) {
+ return foundedVnf.get().getInstanceParams();
+ } else {
+ throw new Exception(String.format("Can not find vnf for genericVnfModelCustomizationUuid: %s",
+ genericVnfModelCustomizationUuid));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index c9a937b824..f95e7afed9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -24,19 +24,22 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
-
+ private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class);
private static String messageCannotPerformUnassign =
"Cannot perform Unassign Network. Network is still related to ";
private static String messageErrorRollback = " Rollback is not possible. Please restore data manually.";
@@ -71,7 +74,8 @@ public class UnassignNetworkBB {
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error("ErrorUnassignNetworkBB: {}", msg);
+ throw new UnassignNetworkException(msg);
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 080d6d34b1..192cb3fc90 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,13 +80,13 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -121,9 +121,9 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred for BadResponse ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
@@ -158,18 +158,18 @@ public class SDNCQueryTasks {
// module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO);
}
} catch (BadResponseException ex) {
logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 03714db943..3383fde0a8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -80,19 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
+ "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
+ "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
@@ -123,17 +123,17 @@ public class SDNCRequestTasks {
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
} catch (Exception e) {
logger.error("Error processing SDNC callback", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
+ "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
index e809ecd0ae..206942fcb1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
@@ -20,27 +20,14 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
-import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.core.WorkflowException;
-import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
-import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.serviceinstancebeans.RequestReferences;
-import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class FlowCompletionTasks {
@@ -50,7 +37,9 @@ public class FlowCompletionTasks {
@Autowired
private RequestsDbClient requestDbclient;
+
public void updateRequestDbStatus(BuildingBlockExecution execution) {
+
try {
String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
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 8822bc39dd..64f0072991 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
@@ -153,16 +153,6 @@ public class OrchestrationStatusValidator {
.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(),
orchestrationStatus, buildingBlockDetail.getTargetAction());
- if (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
- && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
- && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
- previousOrchestrationStatusValidationResult, genericVnf,
- orchestrationStatusStateTransitionDirective);
- }
-
if (orchestrationStatusStateTransitionDirective
.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) {
throw new OrchestrationStatusValidationException(
@@ -187,23 +177,4 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
- BuildingBlockExecution execution,
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
- .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
}
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 1f07166b60..11c6455474 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
@@ -197,7 +197,9 @@ public class WorkflowAction {
suppressRollback = false;
}
execution.setVariable("suppressRollback", suppressRollback);
+ boolean isResume = false;
if (isUriResume(uri)) {
+ isResume = true;
logger.debug("replacing URI {}", uri);
uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
logger.debug("for RESUME with original value {}", uri);
@@ -225,6 +227,12 @@ public class WorkflowAction {
if (flowsToExecute == null) {
buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
}
+ } else if (aLaCarte && isResume) {
+ flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
+ if (flowsToExecute == null) {
+ buildAndThrowException(execution,
+ "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
+ }
} else {
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
@@ -387,7 +395,7 @@ public class WorkflowAction {
flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
}
- if (!aLaCarte) {
+ if (!isResume) {
bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute);
}
execution.setVariable("flowNames", flowNames);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index be3e06c9ea..56cd9fd70f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -39,6 +39,8 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionBBFailure {
+ private static final String DEACTIVATE_FABRIC_CONFIGURATION_FLOW = "DeactivateFabricConfigurationBB";
+ private static final String UNASSIGN_FABRIC_CONFIGURATION_FLOW = "UnassignFabricConfigurationBB";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
@@ -96,6 +98,16 @@ public class WorkflowActionBBFailure {
String rollbackTargetState = (String) execution.getVariable(ROLLBACK_TARGET_STATE);
request.setRequestStatus(rollbackTargetState);
} else if (isRollbackFailure) {
+ if (ebb != null && ebb.getBuildingBlock() != null && ebb.getBuildingBlock().getBpmnFlowName() != null) {
+ String flowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if (DEACTIVATE_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)
+ || UNASSIGN_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)) {
+ String statusMessage = String.format(
+ "%s Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
+ request.getStatusMessage());
+ request.setStatusMessage(statusMessage);
+ }
+ }
Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
if (rollbackErrorMsgOp.isPresent()) {
rollbackErrorMsg = rollbackErrorMsgOp.get();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index d5798150d1..39aa9d6c41 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -38,6 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.Configuration;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -309,7 +310,8 @@ public class WorkflowActionBBTasks {
rollbackFlowsFiltered.addAll(rollbackFlows);
if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
for (int i = 0; i < rollbackFlows.size(); i++) {
- if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
+ if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign") && !rollbackFlows
+ .get(i).getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
&& ROLLBACKTOCREATED.equals(handlingCode)) {
@@ -398,7 +400,7 @@ public class WorkflowActionBBTasks {
if (fabricConfig != null && fabricConfig.getConfigurationResource() != null
&& fabricConfig.getConfigurationResource().getToscaNodeType() != null
&& fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
- String configurationId = UUID.randomUUID().toString();
+ String configurationId = getConfigurationId(vnfc);
ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
@@ -429,6 +431,17 @@ public class WorkflowActionBBTasks {
}
}
+ protected String getConfigurationId(Vnfc vnfc) {
+ List<Configuration> configurations =
+ workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
+ if (!configurations.isEmpty()) {
+ Configuration configuration = configurations.get(0);
+ return configuration.getConfigurationId();
+ } else {
+ return UUID.randomUUID().toString();
+ }
+ }
+
protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb,
String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
index e24e86285c..9af2128f63 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,11 +33,16 @@ import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class VnfAdapterClientImpl implements VnfAdapterClient {
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterClientImpl.class);
+
private static final String VF_MODULES = "/vf-modules/";
private VnfAdapterRestProperties props;
@@ -57,6 +62,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req,
CreateVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in createVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -69,6 +75,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req,
RollbackVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in rollbackVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -80,6 +87,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
.delete(req, DeleteVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in deleteVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -91,6 +99,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
.put(req, UpdateVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in updateVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -122,6 +131,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get();
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in queryVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
index 2af4d5f1fa..c5e8bf7416 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,11 +34,15 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.client.RestClient;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
+ private static final Logger logger = LoggerFactory.getLogger(VnfVolumeAdapterClientImpl.class);
+
private final VnfVolumeAdapterRestProperties props;
public VnfVolumeAdapterClientImpl() {
@@ -50,6 +54,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("").post(req, CreateVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in createVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -60,6 +65,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("/" + aaiVolumeGroupId).delete(req, DeleteVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in deleteVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -71,6 +77,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
return this.getAdapterRestClient("/" + aaiVolumeGroupId + "/rollback").delete(req,
RollbackVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in rollbackVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -81,6 +88,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("/" + aaiVolumeGroupId).put(req, UpdateVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in updateVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -94,6 +102,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
requestId, serviceInstanceId);
return this.getAdapterRestClient(path).get(QueryVolumeGroupResponse.class).get();
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in queryVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
index 6daed56675..6278d48e03 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
@@ -23,10 +23,10 @@ package org.onap.so.client.adapter.vnf.mapper;
import java.io.Serializable;
public class AttributeNameValue implements Serializable {
- private final static long serialVersionUID = -5215028275587848311L;
+ private static final long serialVersionUID = -5215028275587848311L;
private String attributeName;
- private Object attributeValue;
+ private transient Object attributeValue;
public AttributeNameValue(String attributeName, Object attributeValue) {
this.attributeName = attributeName;
@@ -51,7 +51,7 @@ public class AttributeNameValue implements Serializable {
@Override
public String toString() {
- return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName.toString())
+ return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName)
.append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}").toString();
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 5c69987a54..8c13c9be97 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -33,7 +33,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
@@ -76,10 +75,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
-import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -481,7 +480,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
}
sbInterfaceRoutePrefixes.append("]");
- if (interfaceRoutePrefixesList.size() > 0) {
+ if (!interfaceRoutePrefixesList.isEmpty()) {
paramsMap.put(key + UNDERSCORE + networkKey + "_route_prefixes",
sbInterfaceRoutePrefixes.toString());
}
@@ -508,7 +507,7 @@ public class VnfAdapterVfModuleObjectMapper {
sriovFilterBuf.append(heatVlanFilterValue);
}
}
- if (heatVlanFiltersList.size() > 0) {
+ if (!heatVlanFiltersList.isEmpty()) {
paramsMap.put(networkKey + "_ATT_VF_VLAN_FILTER", sriovFilterBuf.toString());
}
}
@@ -540,7 +539,7 @@ public class VnfAdapterVfModuleObjectMapper {
String ipVersion = ipAddress.getIpVersion();
for (int b = 0; b < ipsList.size(); b++) {
String ipAddressValue = ipsList.get(b);
- if (ipVersion.equals("ipv4")) {
+ if ("ipv4".equals(ipVersion)) {
if (b != ipsList.size() - 1) {
sbIpv4Ips.append(ipAddressValue + ",");
} else {
@@ -548,7 +547,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
paramsMap.put(key + UNDERSCORE + networkKey + IP + UNDERSCORE + b,
ipAddressValue);
- } else if (ipVersion.equals("ipv6")) {
+ } else if ("ipv6".equals(ipVersion)) {
if (b != ipsList.size() - 1) {
sbIpv6Ips.append(ipAddressValue + ",");
} else {
@@ -897,6 +896,7 @@ public class VnfAdapterVfModuleObjectMapper {
try {
json = mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
+ logger.error("JsonProcessingException in convertToString", e);
json = "{}";
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
new file mode 100644
index 0000000000..9dd0365e7a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.buildingblock;
+
+import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_OOF;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SNIRO;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SOLUTION;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+
+public class HomingV2Test {
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldCallSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(sniroHoming).should().callSniro(givenExecution);
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldProcessSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(sniroHoming).should().processSolution(givenExecution, "dummy");
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldCallOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldProcessOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldCallOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldProcessOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ private BuildingBlockExecution createBuildingBlockExecutionMock(Map<String, Object> userParams) {
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ GeneralBuildingBlock generalBuildingBlock = mock(GeneralBuildingBlock.class);
+ RequestContext requestContext = mock(RequestContext.class);
+ RequestParameters requestParameters = mock(RequestParameters.class);
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+
+ userParamsList.add(userParams);
+
+ when(execution.getGeneralBuildingBlock()).thenReturn(generalBuildingBlock);
+ when(generalBuildingBlock.getRequestContext()).thenReturn(requestContext);
+ when(requestContext.getRequestParameters()).thenReturn(requestParameters);
+ when(requestParameters.getUserParams()).thenReturn(userParamsList);
+
+ return execution;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index c0056291ef..1fde3f4fbc 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -92,6 +92,19 @@ public class ExecuteActivityTest extends BaseTaskTest {
}
@Test
+ public void executeException_Test() throws Exception {
+ execution.setVariable("workflowSyncAckSent", true);
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+ thrown.expect(BpmnError.class);
+ executeActivity.execute(execution);
+ String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage");
+ assertEquals(errorMessage, "not implemented");
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(workflowException.getErrorMessage(), "not implemented");
+ assertEquals(workflowException.getErrorCode(), 7000);
+ }
+
+ @Test
public void buildAndThrowException_Test() throws Exception {
doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 8aea2d2650..3994208d23 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ONAPComponents;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
- any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+ any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class));
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
@@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"), eq(TargetEntity.OPENSTACK));
+ eq("test error message"), eq(Components.OPENSTACK));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
index cc25689358..f0c333007e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -33,6 +33,8 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -168,6 +170,21 @@ public class AppcRunTasksTest extends BaseTaskTest {
assertEquals(vmIdList, expectedVmIdList);
}
+ @Test
+ public void testUserParams() throws Exception {
+ Map<String, Object> userParams = new HashMap<String, Object>();
+ userParams.put("existing_software_version", "3.1");
+ userParams.put("new_software_version", "3.2");
+ userParams.put("operations_timeout", "150000");
+
+ String actualPayload = appcRunTasks.buildPayloadFromUserParams(userParams);
+ System.out.println(actualPayload);
+ String expectedPayload =
+ "{\\\"operations_timeout\\\":\\\"150000\\\",\\\"existing_software_version\\\":\\\"3.1\\\",\\\"new_software_version\\\":\\\"3.2\\\"}";
+ assertEquals(expectedPayload, actualPayload.replaceAll(" ", ""));
+
+ }
+
private void mockReferenceResponse() {
ControllerSelectionReference reference = new ControllerSelectionReference();
reference.setControllerName("TEST-CONTROLLER-NAME");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
index 7d96a18305..468bc7d8f6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 TechMahindra.
+ * Copyright (C) 2019 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.
@@ -20,57 +21,139 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doThrow;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.util.UUID;
-import org.camunda.bpm.engine.delegate.BpmnError;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.ArgumentMatchers;
-import org.mockito.InjectMocks;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
-public class ConfigAssignVnfTest extends BaseTaskTest {
- @InjectMocks
- private ConfigAssignVnf configAssignVnf = new ConfigAssignVnf();
+public class ConfigAssignVnfTest {
- private GenericVnf genericVnf;
- private ServiceInstance serviceInstance;
- private RequestContext requestContext;
- private String msoRequestId;
+ private static final String GENERIC_VNF_ID = "vnfId_configVnfTest";
+ private static final String GENERIC_VNF_NAME = "vnfName_configVnfTest";
+ private static final String VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+ private static final String SERVICE_INSTANCE_ID = "serviceInst_configTest";
+ private static final String SERVICE_MODEL_UUID = "5af91c26-8418-4d3f-944c-965842deda94";
+ private static final String TARGET_VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
+ private static final int THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES = 8;
+
+ private static final String USER_PARAMS_FROM_REQUEST = "{\"resources\":{\"vnfs\":["
+ + "{\"modelInfo\":{\"modelCustomizationId\":\"" + VNF_MODEL_CUSTOMIZATION_UUID + "\"},"
+ + "\"instanceParams\":[{\"paramName1\":\"paramValue1\",\"paramName2\":\"paramValue2\"},{\"paramName3\":\"paramValue3\"}]},"
+ + "{\"modelInfo\":{\"modelCustomizationId\":\"2d1ac656-377e-467b-be50-6ce65f66a7ca\"},"
+ + "\"instanceParams\":[{\"parName4\":\"parValue4\",\"parName5\":\"parValue5\"}]}]}}\n";
+
+
+ private ConfigAssignVnf testedObject;
+
+ private BuildingBlockExecution buildingBlockExecution;
+ private ExtractPojosForBB extractPojosForBB;
@Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- serviceInstance = setServiceInstance();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- gBBInput.setRequestContext(requestContext);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
- .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
- .thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
- .thenReturn(serviceInstance);
+ public void setup() {
+ buildingBlockExecution = createBuildingBlockExecution();
+ extractPojosForBB = mock(ExtractPojosForBB.class);
+ testedObject = new ConfigAssignVnf(extractPojosForBB, new ExceptionBuilder());
}
@Test
- public void preProcessAbstractCDSProcessingTest() throws Exception {
+ public void prepareAbstractCDSPropertiesBean_success() throws Exception {
+ // given
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID))
+ .thenReturn(createGenericVnf());
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID))
+ .thenReturn(createServiceInstance());
+ // when
+ testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution);
+ // then
+ verifyConfigAssignPropertiesJsonContent();
+ }
- configAssignVnf.preProcessAbstractCDSProcessing(execution);
+ private void verifyConfigAssignPropertiesJsonContent() throws Exception {
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = buildingBlockExecution.getVariable("executionObject");
+ String payload = abstractCDSPropertiesBean.getRequestObject();
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode configAssignPropertiesNode = payloadJson.findValue("config-assign-properties");
+ assertThat(configAssignPropertiesNode.size()).isEqualTo(THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES);
+ assertThat(configAssignPropertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(configAssignPropertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ assertThat(configAssignPropertiesNode.get("vnf-name").asText()).isEqualTo(GENERIC_VNF_NAME);
+ assertThat(configAssignPropertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(configAssignPropertiesNode.get("vnf-customization-uuid").asText())
+ .isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID);
+ assertThat(configAssignPropertiesNode.has("paramName1")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName1").asText()).isEqualTo("paramValue1");
+ assertThat(configAssignPropertiesNode.has("paramName2")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName2").asText()).isEqualTo("paramValue2");
+ assertThat(configAssignPropertiesNode.has("paramName3")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName3").asText()).isEqualTo("paramValue3");
+ }
- assertTrue(true);
+ private BuildingBlockExecution createBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
}
+ private ServiceInstance createServiceInstance() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(SERVICE_MODEL_UUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ return serviceInstance;
+ }
+
+ private GenericVnf createGenericVnf() {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(GENERIC_VNF_ID);
+ genericVnf.setVnfName(GENERIC_VNF_NAME);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelCustomizationUuid(TARGET_VNF_MODEL_CUSTOMIZATION_UUID);
+ modelInfoGenericVnf.setBlueprintName("blueprintTest");
+ modelInfoGenericVnf.setBlueprintVersion("blueprintVerTest");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ return genericVnf;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams());
+ requestContext.setRequestParameters(requestParameters);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", USER_PARAMS_FROM_REQUEST);
+ userParams.add(userParamMap);
+ return userParams;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
index bacc57758b..ed55c56231 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -40,9 +40,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.springframework.beans.factory.annotation.Autowired;
public class UnassignNetworkBBTest extends BaseTaskTest {
@@ -84,6 +82,15 @@ public class UnassignNetworkBBTest extends BaseTaskTest {
}
@Test
+ public void checkRelationshipRelatedToUnassignNetworkExceptionTest() throws Exception {
+ String msg = "Cannot perform Unassign Network. Network is still related to vf-module";
+ expectedException.expect(BpmnError.class);
+ doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
+ assertEquals(execution.getVariable("ErrorUnassignNetworkBB"), msg);
+ }
+
+ @Test
public void getCloudSdncRegion25Test() throws Exception {
CloudRegion cloudRegion = setCloudRegion();
cloudRegion.setCloudRegionVersion("2.5");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 0ba9237aaf..e158925568 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.ONAPComponents;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
vfModule = setVfModule();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(
- any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class));
+ any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index 0fc33fe5ce..e435909f59 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index b371e3a48a..ffe48876c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -50,7 +51,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.beans.factory.annotation.Autowired;
-@Ignore
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,6 +72,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
@@ -115,6 +122,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -134,6 +148,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.getVariable("orchestrationStatusValidationResult"));
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -147,6 +162,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
expectedException.expect(BpmnError.class);
@@ -178,6 +194,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -228,8 +245,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
- execution.getVariable("orchestrationStatusValidationResult"));
+ assertNull(execution.getVariable("orchestrationStatusValidationResult"));
}
@Test
@@ -247,6 +263,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -257,7 +279,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
orchestrationStatusStateTransitionDirective.setId(1);
orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
@@ -288,6 +310,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -338,6 +366,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -380,6 +414,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -422,6 +462,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -464,6 +510,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -482,4 +534,39 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
}
+
+ @Test
+ public void continueValidationActivatedTest() throws Exception {
+ String flowToBeCalled = "DeactivateVnfBB";
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(flowToBeCalled);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE);
+ when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE);
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
+ OrchestrationAction.DEACTIVATE);
+
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 2d48d02774..573601b20f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -41,6 +41,8 @@ import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -140,6 +142,31 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
}
@Test
+ public void updateRequestStatusToFailedRollbackFabric() {
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ BuildingBlock bb = new BuildingBlock();
+ bb.setBpmnFlowName("UnassignFabricConfigurationBB");
+ ebb.setBuildingBlock(bb);
+ execution.setVariable("buildingBlock", ebb);
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", true);
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setStatusMessage("PINC failure.");
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("error in rollback", errorMsg);
+ assertEquals(
+ "PINC failure. Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
+ req.getStatusMessage());
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
public void updateRequestStatusToRolledback() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", true);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index aac09b4475..ac7d82cd51 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -328,6 +328,51 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToAssignedWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToAssigned");
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("AssignFabricConfigurationBB");
+ ebb4.setBuildingBlock(bb4);
+ flowsToExecute.add(ebb4);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
+ BuildingBlock bb5 = new BuildingBlock();
+ bb5.setBpmnFlowName("ActivateFabricConfigurationBB");
+ ebb5.setBuildingBlock(bb5);
+ flowsToExecute.add(ebb5);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 5);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(4, ebbs.size());
+ assertEquals("DeactivateFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("UnassignFabricConfigurationBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeleteVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName());
+
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
@@ -417,4 +462,22 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.updateInstanceId(execution);
Mockito.verify(reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
}
+
+ @Test
+ public void getConfigurationId() {
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ doReturn(configurations.get(0).getConfigurationId()).when(workflowActionBBTasks).getConfigurationId(vnfc);
+ assertEquals(workflowActionBBTasks.getConfigurationId(vnfc), "configurationId");
+ }
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index eea885288e..be6fc94890 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -45,11 +45,9 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -66,7 +64,6 @@ import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.L3Networks;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.ServiceInstance;
@@ -80,7 +77,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -103,8 +99,6 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
-import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
@@ -1476,9 +1470,19 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void extractResourceIdAndTypeFromUriResumeTest() {
+ Resource resource = workflowAction.extractResourceIdAndTypeFromUri(
+ "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume");
+ assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847");
+ }
+
+ @Test
public void isUriResumeTest() {
assertTrue(workflowAction.isUriResume(
"http://localhost:9100/onap/so/infra/orchestrationRequests/v7/requests/2f8ab587-ef6a-4456-b7b2-d73f9363dabd/resume"));
+ assertTrue(workflowAction.isUriResume(
+ " http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume"));
+
assertFalse(workflowAction.isUriResume("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace"));
}