aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java1
-rw-r--r--asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java22
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java9
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy70
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy35
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy283
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy35
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java (renamed from bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java)2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java49
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java5
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java30
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn34
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn118
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml1
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java7
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java6
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java2
-rw-r--r--common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java13
-rw-r--r--common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java11
-rw-r--r--common/src/main/java/org/openecomp/mso/client/policy/RestClient.java20
-rw-r--r--common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java15
-rw-r--r--common/src/test/resources/aai.properties4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java10
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java8
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java5
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java18
33 files changed, 481 insertions, 372 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 925086a9d3..3dcf69c815 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -311,6 +311,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
operStatus.setOperation(operationType);
operStatus.setReason(reason);
operStatus.setProgress(progress);
+ operStatus.setResult(result);
operStatus.setOperationContent(operationContent);
RequestsDatabase.getInstance().updateOperationStatus(operStatus);
}
diff --git a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java b/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java
index 537de3e238..be5af5d51f 100644
--- a/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java
+++ b/asdc-controller/src/main/java/org/openecomp/mso/asdc/tenantIsolation/AaiClientPropertiesImpl.java
@@ -49,4 +49,14 @@ public class AaiClientPropertiesImpl implements AAIProperties {
public AAIVersion getDefaultVersion() {
return AAIVersion.LATEST;
}
+
+ @Override
+ public String getAuth() {
+ return props.getProperty("aai.auth", null);
+ }
+
+ @Override
+ public String getKey() {
+ return props.getProperty("mso.msoKey", null);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java
index 3e315a5f04..16fd351b43 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/adapter/vnf/AdapterRestClient.java
@@ -21,7 +21,6 @@
package org.openecomp.mso.client.adapter.vnf;
import java.net.URI;
-import java.security.GeneralSecurityException;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
@@ -29,8 +28,6 @@ import java.util.UUID;
import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.ext.ContextResolver;
-import org.apache.commons.codec.binary.Base64;
-import org.openecomp.mso.bpmn.common.util.CryptoUtils;
import org.openecomp.mso.client.ResponseExceptionMapperImpl;
import org.openecomp.mso.client.policy.JettisonStyleMapperProvider;
import org.openecomp.mso.client.policy.RestClient;
@@ -52,8 +49,7 @@ public class AdapterRestClient extends RestClient {
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
- headerMap.put("Authorization",
- this.getBasicAuth(props.getAuth(), props.getKey()));
+ addBasicAuthHeader(props.getAuth(), props.getKey());
}
@Override
@@ -70,20 +66,4 @@ public class AdapterRestClient extends RestClient {
protected ContextResolver<ObjectMapper> getMapper() {
return new JettisonStyleMapperProvider();
}
-
- private String getBasicAuth(String encryptedAuth, String msoKey) {
- if ((encryptedAuth == null || encryptedAuth.isEmpty()) || (msoKey == null || msoKey.isEmpty())) {
- return null;
- }
- try {
- String auth = CryptoUtils.decrypt(encryptedAuth, msoKey);
- byte[] encoded = Base64.encodeBase64(auth.getBytes());
- String encodedString = new String(encoded);
- encodedString = "Basic " + encodedString;
- return encodedString;
- } catch (GeneralSecurityException e) {
- this.logger.warn(e.getMessage(), e);
- return null;
- }
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java
index 27352dc11d..a1ef35a49d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/restproperties/AAIPropertiesImpl.java
@@ -52,4 +52,13 @@ public class AAIPropertiesImpl implements AAIProperties {
return AAIVersion.LATEST;
}
+ @Override
+ public String getAuth() {
+ return props.get("aai.auth");
+ }
+
+ @Override
+ public String getKey() {
+ return props.get("mso.msoKey");
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 8eea0f5b9c..6f41879e7d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -20,6 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.scripts
+import org.codehaus.jackson.map.ObjectMapper
import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties
import java.util.ArrayList
@@ -100,25 +101,44 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
String serviceModelUUID = execution.getVariable("modelUuid")
- List<Resource> addResourceList = execution.getVariable("addResourceList")
-
+ List<Resource> addResourceList = execution.getVariable("addResourceList")
List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>()
- //define sequenced resource list, we deploy vf first and then network and then ar
- //this is defaule sequence
List<Resource> sequencedResourceList = new ArrayList<Resource>()
def resourceSequence = BPMNProperties.getResourceSequenceProp()
- for (resourceType in resourceSequence) {
- for (resource in addResourceList) {
- if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
- sequencedResourceList.add(resource)
+ if(resourceSequence != null) {
+ // sequence is defined in config file
+ for (resourceType in resourceSequence) {
+ for (resource in addResourceList) {
+ if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
+ sequencedResourceList.add(resource)
- if (resource instanceof NetworkResource) {
- networkResourceList.add(resource)
+ if (resource instanceof NetworkResource) {
+ networkResourceList.add(resource)
+ }
}
}
}
+ } else {
+
+ //define sequenced resource list, we deploy vf first and then network and then ar
+ //this is defaule sequence
+ List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
+ List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
+
+ for (Resource rc : addResourceList){
+ if (rc instanceof VnfResource) {
+ vnfResourceList.add(rc)
+ } else if (rc instanceof NetworkResource) {
+ networkResourceList.add(rc)
+ } else if (rc instanceof AllottedResource) {
+ arResourceList.add(rc)
+ }
+ }
+ sequencedResourceList.addAll(vnfResourceList)
+ sequencedResourceList.addAll(networkResourceList)
+ sequencedResourceList.addAll(arResourceList)
}
String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true"
@@ -127,7 +147,28 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
execution.setVariable("sequencedResourceList", sequencedResourceList)
utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled)
utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
- }
+ }
+
+ public prepareServiceTopologyRequest(DelegateExecution execution) {
+
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start prepareServiceTopologyRequest Process ======== ", isDebugEnabled)
+
+ String serviceDecompose = execution.getVariable("serviceDecomposition")
+
+ execution.setVariable("operationType", "create")
+ execution.setVariable("resourceType", "")
+
+ String serviceInvariantUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelInvariantUuid")
+ String serviceUuid = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelUuid")
+ String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName")
+
+ execution.setVariable("modelInvariantUuid", serviceInvariantUuid)
+ execution.setVariable("modelUuid", serviceUuid)
+ execution.setVariable("serviceModelName", serviceModelName)
+
+ utils.log("INFO", "======== End prepareServiceTopologyRequest Process ======== ", isDebugEnabled)
+ }
public void getCurrentResoure(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
@@ -156,7 +197,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
}
public void prepareResourceRecipeRequest(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled)
ResourceInput resourceInput = new ResourceInput()
String serviceInstanceName = execution.getVariable("serviceInstanceName")
@@ -199,7 +240,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceType = execution.getVariable("serviceType")
ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
+
+ // requestAction is action, not opertiontype
+ //String requestAction = resourceInput.getOperationType()
+ String requestAction = "createInstance"
JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 690738b312..6e19a3469a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -32,11 +32,13 @@ import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.domain.AllottedResource
import org.openecomp.mso.bpmn.core.domain.ModelInfo
import org.openecomp.mso.bpmn.core.domain.NetworkResource
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
+import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties
@@ -156,16 +158,37 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
def resourceSequence = BPMNProperties.getResourceSequenceProp()
- for (resourceType in resourceSequence.reverse()) {
- for (resource in delResourceList) {
- if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
- sequencedResourceList.add(resource)
+ if(resourceSequence != null) {
+ for (resourceType in resourceSequence.reverse()) {
+ for (resource in delResourceList) {
+ if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
+ sequencedResourceList.add(resource)
- if (resource instanceof NetworkResource) {
- wanResources.add(resource)
+ if (resource instanceof NetworkResource) {
+ wanResources.add(resource)
+ }
}
}
}
+ }else {
+ //define sequenced resource list, we deploy vf first and then network and then ar
+ //this is defaule sequence
+ List<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
+ List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
+
+ for (Resource rc : delResourceList) {
+ if (rc instanceof VnfResource) {
+ vnfResourceList.add(rc)
+ } else if (rc instanceof NetworkResource) {
+ networkResourceList.add(rc)
+ } else if (rc instanceof AllottedResource) {
+ arResourceList.add(rc)
+ }
+ }
+
+ sequencedResourceList.addAll(arResourceList)
+ sequencedResourceList.addAll(networkResourceList)
+ sequencedResourceList.addAll(vnfResourceList)
}
String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index 44e3b73697..9540508075 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -22,6 +22,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
import groovy.xml.XmlUtil
import groovy.json.*
+import groovy.util.XmlParser
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
@@ -50,11 +51,7 @@ import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils;
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
+
/**
* This groovy class supports the <class>DoUpdateE2EServiceInstance.bpmn</class> process.
*
@@ -89,18 +86,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
public void preProcessRequest (DelegateExecution execution) {
- //only for dug
- execution.setVariable("isDebugLogEnabled","true")
- execution.setVariable("unit_test", "true")
- execution.setVariable("skipVFC", "true")
-
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
utils.log("INFO","Entered " + method, isDebugEnabled)
String msg = ""
utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled)
-
- utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled)
try {
execution.setVariable("prefix", Prefix)
@@ -139,89 +130,28 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
if (productFamilyId == null) {
execution.setVariable("productFamilyId", "")
}
-
- String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (isBlank(sdncCallbackUrl)) {
- msg = "URN_mso_workflow_sdncadapter_callback is null"
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
- execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
- //requestDetails.modelInfo.for AAI PUT servieInstanceData
- //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
String serviceInstanceName = execution.getVariable("serviceInstanceName")
- //String serviceInstanceId = execution.getVariable("serviceInstanceId")
String uuiRequest = execution.getVariable("uuiRequest")
utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)
- String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ execution.setVariable("model-invariant-id-target", modelInvariantUuid)
- String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
+ execution.setVariable("modelUuid", modelUuid)
+ execution.setVariable("model-version-id-target", modelUuid)
String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
- execution.setVariable("serviceModelName", serviceModelName)
-
- //aai serviceType and Role can be setted as fixed value now.
- String aaiServiceType = serviceType
- String aaiServiceRole = serviceType+"Role"
-
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- execution.setVariable("model-invariant-id-target", modelInvariantUuid)
- execution.setVariable("modelUuid", modelUuid)
- execution.setVariable("model-version-id-target", modelUuid)
-
- //AAI PUT
- String oStatus = execution.getVariable("initialStatus") ?: ""
- utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)
- if ("TRANSPORT".equalsIgnoreCase(serviceType))
- {
- oStatus = "Update"
+ if(serviceModelName == null) {
+ serviceModelName = ""
}
-
- String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
- utils.log("INFO","statusLine: " + statusLine, isDebugEnabled)
- AaiUtil aaiUriUtil = new AaiUtil(this)
- utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- utils.log("INFO","namespace: " + namespace, isDebugEnabled)
- /*
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- <service-type>${aaiServiceType}</service-type>
- <service-role>${aaiServiceRole}</service-role>
- ${statusLine}
- <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
- <model-version-id>${modelUuid}</model-version-id>
- </service-instance>""".trim()
- */
- //begin only for test
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- <service-type>${aaiServiceType}</service-type>
- <service-role>${aaiServiceRole}</service-role>
- ${statusLine}
- </service-instance>""".trim()
- //end only for test
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
- utils.logAudit(serviceInstanceData)
- utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
- utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
-
- execution.setVariable("serviceSDNCCreate", "false")
- execution.setVariable("operationStatus", "Waiting deploy resource...")
-
+ execution.setVariable("serviceModelName", serviceModelName)
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -253,101 +183,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("INFO", msg, isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- else
- {
- utils.log("INFO", "SI Data" + siData, isDebugEnabled)
-
- InputSource source = new InputSource(new StringReader(siData));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document serviceXml = docBuilder.parse(source)
- serviceXml.getDocumentElement().normalize()
-
- // Get Template uuid and version
- if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
- utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)
- def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()
- def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()
-
- // Set Original Template info
- execution.setVariable("model-invariant-id-original", modelInvariantId)
- execution.setVariable("model-version-id-original", modelVersionId)
- }
-
- //Confirm there are no related service instances (vnf/network or volume)
- if (utils.nodeExists(siData, "relationship-list")) {
- utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
-
- //test(siData)
- NodeList nodeList = serviceXml.getElementsByTagName("relationship")
- JSONArray jArray = new JSONArray()
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
- if(e.equals("service-instance")){
- def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
- utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled)
- NodeList dataList = node.getChildNodes()
- if(null != dataList) {
- JSONObject jObj = new JSONObject()
- for (int i = 0; i < dataList.getLength(); i++) {
- Node dNode = dataList.item(i)
- if(dNode.getNodeName() == "relationship-data") {
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
- if(eKey.equals("service-instance.service-instance-id")){
- jObj.put("resourceInstanceId", eValue)
- }
- }
- else if(dNode.getNodeName() == "related-to-property"){
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
- if(eKey.equals("service-instance.service-instance-name")){
- jObj.put("resourceType", eValue)
- }
- }
- }
- utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
- jArray.put(jObj)
- }
- //for overlay/underlay
- }else if (e.equals("configuration")){
- def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
- utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled)
- NodeList dataList = node.getChildNodes()
- if(null != dataList) {
- JSONObject jObj = new JSONObject()
- for (int i = 0; i < dataList.getLength(); i++) {
- Node dNode = dataList.item(i)
- if(dNode.getNodeName() == "relationship-data") {
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
- if(eKey.equals("configuration.configuration-id")){
- jObj.put("resourceInstanceId", eValue)
- }
- }
- else if(dNode.getNodeName() == "related-to-property"){
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
- if(eKey.equals("configuration.configuration-type")){
- jObj.put("resourceType", eValue)
- }
- }
- }
- utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
- jArray.put(jObj)
- }
- }
- }
- }
- execution.setVariable("serviceRelationShip", jArray.toString())
+
+ utils.log("INFO", "SI Data" + siData, isDebugEnabled)
+
+ // Get Template uuid and version
+ if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
+ utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)
+
+ def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id")
+ def modelVersionId = utils.getNodeText1(siData, "model-version-id")
+
+ // Set Original Template info
+ execution.setVariable("model-invariant-id-original", modelInvariantId)
+ execution.setVariable("model-version-id-original", modelVersionId)
+ }
+
+ //get related service instances (vnf/network or volume) for delete
+ if (utils.nodeExists(siData, "relationship-list")) {
+ utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
+
+ JSONArray jArray = new JSONArray()
+
+ XmlParser xmlParser = new XmlParser()
+ Node root = xmlParser.parseText(siData)
+ def relation_list = utils.getChildNode(root, 'relationship-list')
+ def relationships = utils.getIdenticalChildren(relation_list, 'relationship')
+
+ for (def relation: relationships) {
+ def jObj = getRelationShipData(relation, isDebugEnabled)
+ jArray.put(jObj)
}
+
+ execution.setVariable("serviceRelationShip", jArray.toString())
}
}else{
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
@@ -378,6 +245,42 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
}
+ private JSONObject getRelationShipData(node, isDebugEnabled){
+ JSONObject jObj = new JSONObject()
+
+ def relation = utils.nodeToString(node)
+ def rt = utils.getNodeText1(relation, "related-to")
+
+ def rl = utils.getNodeText1(relation, "related-link")
+ utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled)
+
+ def rl_datas = utils.getIdenticalChildren(node, "relationship-data")
+ for(def rl_data : rl_datas) {
+ def eKey = utils.getChildNodeText(rl_data, "relationship-key")
+ def eValue = utils.getChildNodeText(rl_data, "relationship-value")
+
+ if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id"))
+ //for overlay/underlay
+ || (rt == "configuration" && eKey.equals("configuration.configuration-id"))){
+ jObj.put("resourceInstanceId", eValue)
+ }
+ }
+
+ def rl_props = utils.getIdenticalChildren(node, "related-to-property")
+ for(def rl_prop : rl_props) {
+ def eKey = utils.getChildNodeText(rl_prop, "property-key")
+ def eValue = utils.getChildNodeText(rl_prop, "property-value")
+ if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name"))
+ //for overlay/underlay
+ || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){
+ jObj.put("resourceType", eValue)
+ }
+ }
+
+ utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
+
+ return jObj
+ }
public void preInitResourcesOperStatus(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -400,7 +303,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
List<Resource> resourceList = new ArrayList<String>()
List<Resource> addResourceList = execution.getVariable("addResourceList")
- List<Resource> delResourceList = execution.setVariable("delResourceList")
+ List<Resource> delResourceList = execution.getVariable("delResourceList")
resourceList.addAll(addResourceList)
resourceList.addAll(delResourceList)
for(Resource resource : resourceList){
@@ -520,27 +423,39 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
+ utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled)
+
+ execution.setVariable("operationType", "create")
+
+ utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled)
}
public void postProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)
- ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
- execution.setVariable("serviceDecomposition", serviceDecomposition_Target)
-
+ execution.setVariable("operationType", "update")
+
utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
}
public void preProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled)
+
+ execution.setVariable("operationType", "delete")
+
+ utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)
}
public void postProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
+ utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled)
+
+ execution.setVariable("operationType", "update")
+
+ utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled)
}
public void preProcessAAIGET2(DelegateExecution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index 240b8d089b..adea23aa19 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -109,8 +109,8 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled)
- //requestParameters
- String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.parameters.serviceType")
+ //serviceType for aai
+ String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.serviceType")
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
utils.log("INFO", msg, isDebugEnabled)
@@ -119,6 +119,29 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("serviceType", serviceType)
}
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+
+ Map reqMap = jsonSlurper.parseText(siRequest)
+
+ //InputParams
+ def userParamsList = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+ if (userParamsList) {
+ for (def i=0; i<userParamsList.size(); i++) {
+ def userParams1 = userParamsList.get(i)
+ userParams1.each { param -> inputMap.put(param.key, param.value)}
+ }
+ }
+
+ utils.log("DEBUG", "User Input Parameters map: " + inputMap.toString(), isDebugEnabled)
+ execution.setVariable("serviceInputParams", inputMap)
+ execution.setVariable("uuiRequest", inputMap.get("UUIRequest"))
+
//operationId
String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
if (isBlank(operationId)) {
@@ -147,7 +170,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
try{
String serviceId = execution.getVariable("serviceInstanceId")
- String operationId = UUID.randomUUID().toString()
+ String operationId = execution.getVariable("operationId")
String operationType = execution.getVariable("operationType")
String userId = ""
String result = "processing"
@@ -202,9 +225,9 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String operationId = execution.getVariable("operationId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
// RESTResponse for API Handler (APIH) Reply Task
- String updateServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
- utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceRestRequest, isDebugEnabled)
- sendWorkflowResponse(execution, 202, updateServiceRestRequest)
+ String updateServiceResp = """{"operationId":"${operationId}"}""".trim()
+ utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, updateServiceResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 5a8d741a05..edff36fe68 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
+import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.beans.factory.annotation.Autowired;
public class InformDmaapClient implements JavaDelegate {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index 07e8ada21e..c6b6be6842 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.bpmn.infrastructure.pnf.implementation;
+package org.openecomp.mso.bpmn.infrastructure.pnf.dmaap;
public interface DmaapClient {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
index 6871665ba1..8c9903e87a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
@@ -20,6 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.pnf.dmaap;
+import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.net.URI;
import java.util.Map;
@@ -34,11 +35,10 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
import org.openecomp.mso.jsonpath.JsonPathUtil;
import org.openecomp.mso.logger.MsoLogger;
-public class PnfEventReadyConsumer implements Runnable, DmaapClient {
+public class PnfEventReadyConsumer implements DmaapClient {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
@@ -54,9 +54,8 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
private Map<String, Runnable> pnfCorrelationIdToThreadMap;
private HttpGet getRequest;
private ScheduledExecutorService executor;
- private int dmaapClientInitialDelayInSeconds;
private int dmaapClientDelayInSeconds;
- private boolean dmaapThreadListenerIsRunning;
+ private volatile boolean dmaapThreadListenerIsRunning;
public PnfEventReadyConsumer() {
httpClient = HttpClientBuilder.create().build();
@@ -68,8 +67,9 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
getRequest = new HttpGet(buildURI());
}
- @Override
- public void run() {
+ //TODO: extract this logic to separate class and test it there to avoid using VisibleForTesting
+ @VisibleForTesting
+ void sendRequest() {
try {
HttpResponse response = httpClient.execute(getRequest);
getCorrelationIdFromResponse(response).ifPresent(this::informAboutPnfReadyIfCorrelationIdFound);
@@ -79,21 +79,23 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
}
@Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
+ public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) {
pnfCorrelationIdToThreadMap.put(correlationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
startDmaapThreadListener();
}
}
- private void startDmaapThreadListener() {
- executor = Executors.newScheduledThreadPool(1);
- executor.scheduleWithFixedDelay(this, dmaapClientInitialDelayInSeconds,
- dmaapClientDelayInSeconds, TimeUnit.SECONDS);
- dmaapThreadListenerIsRunning = true;
+ private synchronized void startDmaapThreadListener() {
+ if (!dmaapThreadListenerIsRunning) {
+ executor = Executors.newScheduledThreadPool(1);
+ executor.scheduleWithFixedDelay(this::sendRequest, 0,
+ dmaapClientDelayInSeconds, TimeUnit.SECONDS);
+ dmaapThreadListenerIsRunning = true;
+ }
}
- private void stopDmaapThreadListener() {
+ private synchronized void stopDmaapThreadListener() {
if (dmaapThreadListenerIsRunning) {
executor.shutdownNow();
dmaapThreadListenerIsRunning = false;
@@ -120,17 +122,14 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
}
- private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
- pnfCorrelationIdToThreadMap.keySet().stream().filter(key -> key.equals(correlationId)).findAny()
- .ifPresent(this::informAboutPnfReady);
- }
-
- private void informAboutPnfReady(String correlationId) {
- pnfCorrelationIdToThreadMap.get(correlationId).run();
- pnfCorrelationIdToThreadMap.remove(correlationId);
+ private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
+ Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId);
+ if (runnable != null) {
+ runnable.run();
- if (pnfCorrelationIdToThreadMap.isEmpty()) {
- stopDmaapThreadListener();
+ if (pnfCorrelationIdToThreadMap.isEmpty()) {
+ stopDmaapThreadListener();
+ }
}
}
@@ -162,10 +161,6 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
this.consumerGroup = consumerGroup;
}
- public void setDmaapClientInitialDelayInSeconds(int dmaapClientInitialDelayInSeconds) {
- this.dmaapClientInitialDelayInSeconds = dmaapClientInitialDelayInSeconds;
- }
-
public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) {
this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java
index acf8f052cd..dbb552c818 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java
@@ -52,9 +52,6 @@ public class BPMNProperties {
if (resourceSequence != null) {
return Arrays.asList(resourceSequence.split(","));
}
- return Arrays.asList(ResourceSequence.RESOURCE_EPC,
- ResourceSequence.RESOURCE_IMS,
- ResourceSequence.RESOUCE_OVERLAY,
- ResourceSequence.RESOURCE_UNDERLAY);
+ return null;
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java
deleted file mode 100644
index 86e5d30b11..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/ResourceSequence.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Huawei 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.openecomp.mso.bpmn.infrastructure.properties;
-
-public final class ResourceSequence {
-
- public static final String RESOURCE_IMS = "ims";
- public static final String RESOURCE_EPC = "epc";
- public static final String RESOUCE_OVERLAY = "overlay";
- public static final String RESOURCE_UNDERLAY = "underlay";
-
- private ResourceSequence() {}
-} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 3a8b6b9036..0aeb0c6310 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -255,7 +255,9 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
String operationId = (String) execution.getVariable("operationId");
String resourceTemplateUUID = (String) execution.getVariable("resourceUUID");
- resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID;
+ String resourceTemplateId = (String) execution.getVariable("resourceTemplateId");
+ resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID;
+ resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID;
try {
ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
if (!StringUtils.isBlank(status)) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
index de50fe11b5..09561a620e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java
@@ -110,7 +110,7 @@ public abstract class AbstractBuilder<IN, OUT> {
protected String getRequestActoin(DelegateExecution execution) {
String action = /*RequestInformation.*/RequestAction.CreateNetworkInstance.getName();
String operType = (String) execution.getVariable(OPERATION_TYPE);
- String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase();
+ String resourceType = (String)execution.getVariable(RESOURCE_TYPE);
if (!StringUtils.isBlank(operType)) {
if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
if (isOverlay(resourceType)) {
@@ -134,17 +134,17 @@ public abstract class AbstractBuilder<IN, OUT> {
}
private boolean isOverlay(String resourceType) {
- return !StringUtils.isBlank(resourceType) && resourceType.contains("overlay");
+ return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("overlay");
}
private boolean isUnderlay(String resourceType) {
- return !StringUtils.isBlank(resourceType) && resourceType.contains("underlay");
+ return !StringUtils.isBlank(resourceType) && resourceType.toLowerCase().contains("underlay");
}
protected String getSvcAction(DelegateExecution execution) {
String action = /*SdncRequestHeader.*/SvcAction.Create.getName();
String operType = (String) execution.getVariable(OPERATION_TYPE);
- String resourceType = ((String) execution.getVariable(RESOURCE_TYPE)).toLowerCase();
+ String resourceType = (String)execution.getVariable(RESOURCE_TYPE);
if (!StringUtils.isBlank(operType)) {
if (RequestsDbConstant.OperationType.DELETE.equalsIgnoreCase(operType)) {
if (isOverlay(resourceType)) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
index b23d1c6b8f..a3e63fa14e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="CreateVcpeResCustService" name="CreateVcpeResCustService" isExecutable="true">
+ <bpmn2:process id="CreateVcpeResCustServiceV2" name="CreateVcpeResCustServiceV2" isExecutable="true">
<bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
@@ -592,7 +592,7 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVcpeResCustService">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVcpeResCustServiceV2">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createVCPE_startEvent">
<dc:Bounds x="87" y="215" width="36" height="36" />
<bpmndi:BPMNLabel>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn
index 9ed1431ed8..5bb3d315b0 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateResources.bpmn
@@ -20,7 +20,7 @@ def csi = new DoCreateResources()
csi.postConfigRequest(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:serviceTask id="Task_0io5qby" name="Call Sync SDNC service Create " camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask">
- <bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0k0f7lm</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_11f2zuu</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_11f2zuu" sourceRef="Task_0io5qby" targetRef="IntermediateThrowEvent_0f2w7aj" />
@@ -85,7 +85,7 @@ ddsi.executeResourceRecipe(execution)]]></bpmn2:script>
<bpmn2:incoming>SequenceFlow_11f2zuu</bpmn2:incoming>
<bpmn2:linkEventDefinition name="ResourceLoop" />
</bpmn2:intermediateThrowEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_0io5qby">
+ <bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_1blaq0f">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource">
@@ -126,6 +126,14 @@ ex.processJavaException(execution)]]></bpmn2:script>
<bpmn2:sequenceFlow id="SequenceFlow_0gr9xqj" name="" sourceRef="StartEvent_0x7o2ug" targetRef="ScriptTask_1648adp" />
<bpmn2:sequenceFlow id="SequenceFlow_0a6l29p" name="" sourceRef="ScriptTask_1648adp" targetRef="EndEvent_0lgdyyb" />
</bpmn2:subProcess>
+ <bpmn2:scriptTask id="Task_1blaq0f" name="Prepare SDNC service Create" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0k0f7lm</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def ddsi = new DoCreateResources()
+ddsi.prepareServiceTopologyRequest(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_0k0f7lm" sourceRef="Task_1blaq0f" targetRef="Task_0io5qby" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
@@ -144,15 +152,15 @@ ex.processJavaException(execution)]]></bpmn2:script>
<dc:Bounds x="1119" y="485" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0qi8cgg_di" bpmnElement="Task_0io5qby">
- <dc:Bounds x="944" y="353" width="100" height="80" />
+ <dc:Bounds x="1047" y="353" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu">
- <di:waypoint xsi:type="dc:Point" x="1044" y="393" />
- <di:waypoint xsi:type="dc:Point" x="1090" y="393" />
- <di:waypoint xsi:type="dc:Point" x="1090" y="300" />
+ <di:waypoint xsi:type="dc:Point" x="1147" y="393" />
+ <di:waypoint xsi:type="dc:Point" x="1219" y="393" />
+ <di:waypoint xsi:type="dc:Point" x="1219" y="300" />
<di:waypoint xsi:type="dc:Point" x="1315" y="300" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1060" y="340.5" width="90" height="12" />
+ <dc:Bounds x="1189" y="340.5" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1y0los4_di" bpmnElement="ScriptTask_1y0los4">
@@ -243,7 +251,7 @@ ex.processJavaException(execution)]]></bpmn2:script>
<bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9">
<di:waypoint xsi:type="dc:Point" x="778" y="325" />
<di:waypoint xsi:type="dc:Point" x="778" y="393" />
- <di:waypoint xsi:type="dc:Point" x="944" y="393" />
+ <di:waypoint xsi:type="dc:Point" x="861" y="394" />
<bpmndi:BPMNLabel>
<dc:Bounds x="784" y="353" width="20" height="12" />
</bpmndi:BPMNLabel>
@@ -347,6 +355,16 @@ ex.processJavaException(execution)]]></bpmn2:script>
<dc:Bounds x="567.5" y="888" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0dh2mj1_di" bpmnElement="Task_1blaq0f">
+ <dc:Bounds x="861" y="354" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0k0f7lm_di" bpmnElement="SequenceFlow_0k0f7lm">
+ <di:waypoint xsi:type="dc:Point" x="961" y="394" />
+ <di:waypoint xsi:type="dc:Point" x="1047" y="393" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1004" y="372.5" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
index 86b422632f..7735b192dc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
@@ -30,16 +30,18 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:callActivity id="Task_1wyyy33" name="Call DoCreateResources" calledElement="DoCreateResources">
<bpmn2:extensionElements>
- <camunda:in source="nsServiceName" target="nsServiceName" />
- <camunda:in source="nsServiceDescription" target="nsServiceDescription" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceDescription" target="nsServiceDescription" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
- <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="operationId" target="operationId" />
<camunda:in source="resourceType" target="resourceType" />
- <camunda:in source="resourceUUID" target="resourceUUID" />
- <camunda:in source="resourceParameters" target="resourceParameters" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="serviceDecomposition_Target" target="serviceDecomposition" />
<camunda:in source="operationType" target="operationType" />
+ <camunda:in source="addResourceList" target="addResourceList" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0yztz2p</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0lblyhi</bpmn2:outgoing>
@@ -71,16 +73,16 @@ csi.preProcessForDeleteResource(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:callActivity id="CallActivity_0yphqzk" name="Call DoDeleteResources" calledElement="DoDeleteResources">
<bpmn2:extensionElements>
- <camunda:in source="nsServiceName" target="nsServiceName" />
- <camunda:in source="nsServiceDescription" target="nsServiceDescription" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
<camunda:in source="serviceId" target="serviceId" />
<camunda:in source="operationId" target="operationId" />
- <camunda:in source="resourceType" target="resourceType" />
- <camunda:in source="resourceUUID" target="resourceUUID" />
- <camunda:in source="resourceParameters" target="resourceParameters" />
+ <camunda:in source="serviceDecomposition_Original" target="serviceDecomposition" />
<camunda:in source="operationType" target="operationType" />
+ <camunda:in source="delResourceList" target="delResourceList" />
+ <camunda:in source="serviceRelationShip" target="serviceRelationShip" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_14rubz2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0tm9bw9</bpmn2:outgoing>
@@ -121,6 +123,18 @@ ddsi.preCompareModelVersions(execution)]]></bpmn2:script>
<bpmn2:sequenceFlow id="SequenceFlow_1vtlt1v" sourceRef="IntermediateCatchEvent_0gk8ige" targetRef="ScriptTask_1afvv50" />
<bpmn2:sequenceFlow id="SequenceFlow_0h40pn8" sourceRef="ScriptTask_1afvv50" targetRef="ServiceTask_02u5iza" />
<bpmn2:callActivity id="ServiceTask_02u5iza" name="Call DoCompareModelVersions" calledElement="DoCompareModelVersions">
+ <bpmn2:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="model-invariant-id-target" target="model-invariant-id-target" />
+ <camunda:in source="model-version-id-target" target="model-version-id-target" />
+ <camunda:in source="model-invariant-id-original" target="model-invariant-id-original" />
+ <camunda:in source="model-version-id-original" target="model-version-id-original" />
+ <camunda:out source="serviceDecomposition_Target" target="serviceDecomposition_Target" />
+ <camunda:out source="serviceDecomposition_Original" target="serviceDecomposition_Original" />
+ <camunda:out source="addResourceList" target="addResourceList" />
+ <camunda:out source="delResourceList" target="delResourceList" />
+ </bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0h40pn8</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_02d5ibj</bpmn2:outgoing>
</bpmn2:callActivity>
@@ -284,17 +298,6 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
<bpmn2:endEvent id="EndEvent_014jyvb">
<bpmn2:incoming>SequenceFlow_02znk15</bpmn2:incoming>
</bpmn2:endEvent>
- <bpmn2:callActivity id="CallActivity_1lu6rx0" name="Call DoUpdateE2EServiceInstanceRollback" calledElement="DoUpdateE2EServiceInstanceRollback">
- <bpmn2:extensionElements>
- <camunda:in source="msoRequestId" target="mso-request-id" />
- <camunda:in source="rollbackData" target="rollbackData" />
- <camunda:out source="rolledBack" target="rolledBack" />
- <camunda:in source="disableRollback" target="disableRollback" />
- <camunda:out source="rollbackError" target="rollbackErrror" />
- </bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_19ly8h7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0jsdqmq</bpmn2:outgoing>
- </bpmn2:callActivity>
<bpmn2:scriptTask id="ScriptTask_1awrp72" name="Pre Process Rollback" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_05j3sat</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_19ly8h7</bpmn2:outgoing>
@@ -304,7 +307,7 @@ dcsi.preProcessRollback(execution)
]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_0vc9jgo" name="Post Process Rollback" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0jsdqmq</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0utvwkh</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_02znk15</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateResources()
@@ -313,8 +316,39 @@ dcsi.postProcessRollback(execution)
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_05j3sat" sourceRef="StartEvent_06768u3" targetRef="ScriptTask_1awrp72" />
<bpmn2:sequenceFlow id="SequenceFlow_02znk15" sourceRef="ScriptTask_0vc9jgo" targetRef="EndEvent_014jyvb" />
- <bpmn2:sequenceFlow id="SequenceFlow_19ly8h7" sourceRef="ScriptTask_1awrp72" targetRef="CallActivity_1lu6rx0" />
- <bpmn2:sequenceFlow id="SequenceFlow_0jsdqmq" sourceRef="CallActivity_1lu6rx0" targetRef="ScriptTask_0vc9jgo" />
+ <bpmn2:sequenceFlow id="SequenceFlow_19ly8h7" sourceRef="ScriptTask_1awrp72" targetRef="ScriptTask_1bb9adn" />
+ <bpmn2:serviceTask id="ServiceTask_1kw189j" name="Update Service Oper Status">
+ <bpmn2:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>SequenceFlow_1lqzi94</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0utvwkh</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_0utvwkh" sourceRef="ServiceTask_1kw189j" targetRef="ScriptTask_0vc9jgo" />
+ <bpmn2:scriptTask id="ScriptTask_1bb9adn" name="Prepare Update Service Oper Status(error)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_19ly8h7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1lqzi94</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+execution.setVariable("operationStatus", "error")
+def ddsi = new DoUpdateE2EServiceInstance()
+ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1lqzi94" sourceRef="ScriptTask_1bb9adn" targetRef="ServiceTask_1kw189j" />
</bpmn2:subProcess>
<bpmn2:scriptTask id="ScriptTask_195nptq" name="Pre Process AAI GET 2" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1demy08</bpmn2:incoming>
@@ -700,9 +734,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
<dc:Bounds x="1554" y="1936" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="CallActivity_1lu6rx0_di" bpmnElement="CallActivity_1lu6rx0">
- <dc:Bounds x="923" y="1873" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1awrp72_di" bpmnElement="ScriptTask_1awrp72">
<dc:Bounds x="557" y="1873" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -713,7 +744,7 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
<di:waypoint xsi:type="dc:Point" x="302" y="1913" />
<di:waypoint xsi:type="dc:Point" x="557" y="1913" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="385.5" y="1898" width="0" height="12" />
+ <dc:Bounds x="384.5" y="1892" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_02znk15_di" bpmnElement="SequenceFlow_02znk15">
@@ -725,16 +756,9 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_19ly8h7_di" bpmnElement="SequenceFlow_19ly8h7">
<di:waypoint xsi:type="dc:Point" x="657" y="1913" />
- <di:waypoint xsi:type="dc:Point" x="923" y="1913" />
+ <di:waypoint xsi:type="dc:Point" x="786" y="1913" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="745" y="1898" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0jsdqmq_di" bpmnElement="SequenceFlow_0jsdqmq">
- <di:waypoint xsi:type="dc:Point" x="1023" y="1913" />
- <di:waypoint xsi:type="dc:Point" x="1248" y="1913" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1091.5" y="1898" width="0" height="12" />
+ <dc:Bounds x="676.5" y="1892" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_195nptq_di" bpmnElement="ScriptTask_195nptq">
@@ -781,6 +805,26 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
<dc:Bounds x="1331" y="1352" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1kw189j_di" bpmnElement="ServiceTask_1kw189j">
+ <dc:Bounds x="1005" y="1873" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0utvwkh_di" bpmnElement="SequenceFlow_0utvwkh">
+ <di:waypoint xsi:type="dc:Point" x="1105" y="1913" />
+ <di:waypoint xsi:type="dc:Point" x="1248" y="1913" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1176.5" y="1892" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1bb9adn_di" bpmnElement="ScriptTask_1bb9adn">
+ <dc:Bounds x="786" y="1873" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lqzi94_di" bpmnElement="SequenceFlow_1lqzi94">
+ <di:waypoint xsi:type="dc:Point" x="886" y="1913" />
+ <di:waypoint xsi:type="dc:Point" x="1005" y="1913" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="945.5" y="1892" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
index cbb8266bf7..03fff4f974 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
@@ -27,7 +27,6 @@
<property name="dmaapTopicName" value="${eventReadyTopicName}"/>
<property name="consumerGroup" value="${consumerGroup}"/>
<property name="consumerId" value="${consumerId}"/>
- <property name="dmaapClientInitialDelayInSeconds" value="${clientThreadInitialDelayInSeconds}"/>
<property name="dmaapClientDelayInSeconds" value="${clientThreadDelayInSeconds}"/>
</bean>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 1103597157..55dd3a968f 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
+import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient;
public class DmaapClientTestImpl implements DmaapClient {
private String correlationId;
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
index ef8fa3dd1e..73b8247ebc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
@@ -76,7 +76,6 @@ public class PnfEventReadyConsumerTest {
testedObject.setDmaapTopicName(EVENT_TOPIC_TEST);
testedObject.setConsumerId(CONSUMER_ID);
testedObject.setConsumerGroup(CONSUMER_GROUP);
- testedObject.setDmaapClientInitialDelayInSeconds(1);
testedObject.setDmaapClientDelayInSeconds(1);
testedObject.init();
httpClientMock = mock(HttpClient.class);
@@ -97,7 +96,7 @@ public class PnfEventReadyConsumerTest {
throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
- testedObject.run();
+ testedObject.sendRequest();
ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
verify(httpClientMock).execute(captor1.capture());
assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL)
@@ -120,7 +119,7 @@ public class PnfEventReadyConsumerTest {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(
String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
- testedObject.run();
+ testedObject.sendRequest();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
@@ -134,7 +133,7 @@ public class PnfEventReadyConsumerTest {
public void correlationIdIsNotFoundInHttpResponse() throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
- testedObject.run();
+ testedObject.sendRequest();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
index e2ec7e062f..99a87def80 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java
@@ -310,12 +310,12 @@ public class AbstractBuilderTest {
abstractBuilder.build(null, null);
}
- @Test(expected = NullPointerException.class)
+ @Test
public void getRequestActoinTest() throws Exception {
abstractBuilder.getRequestActoin(delegateExecution);
}
- @Test(expected = NullPointerException.class)
+ @Test
public void getSvcActionTest() throws Exception {
abstractBuilder.getSvcAction(delegateExecution);
}
@@ -340,7 +340,7 @@ public class AbstractBuilderTest {
abstractBuilder.getParamEntities(new HashMap<>());
}
- @Test(expected = NullPointerException.class)
+ @Test
public void getRequestInformationEntityTest() throws Exception {
abstractBuilder.getRequestInformationEntity(delegateExecution);
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
index 358bbbbbec..c208d6dd5f 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIProperties.java
@@ -25,4 +25,6 @@ import org.openecomp.mso.client.RestProperties;
public interface AAIProperties extends RestProperties {
public AAIVersion getDefaultVersion();
+ public String getAuth();
+ public String getKey();
}
diff --git a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
index 9348beb02a..e36033faa0 100644
--- a/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/openecomp/mso/client/aai/AAIRestClient.java
@@ -28,22 +28,31 @@ import java.util.UUID;
import javax.ws.rs.client.ClientResponseFilter;
import javax.ws.rs.ext.ContextResolver;
-import org.openecomp.mso.client.RestProperties;
import org.openecomp.mso.client.policy.RestClient;
import org.openecomp.mso.client.policy.RestClientSSL;
import com.fasterxml.jackson.databind.ObjectMapper;
public class AAIRestClient extends RestClientSSL {
+
+ private final AAIProperties props;
- protected AAIRestClient(RestProperties props, UUID requestId, URI uri) {
+ protected AAIRestClient(AAIProperties props, UUID requestId, URI uri) {
super(props, requestId, Optional.of(uri));
+ this.props = props;
headerMap.put("X-TransactionId", requestId.toString());
}
@Override
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("X-FromAppId", "MSO");
+
+ String auth = props.getAuth();
+ String key = props.getKey();
+
+ if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
+ addBasicAuthHeader(auth, key);
+ }
}
@Override
diff --git a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
index 354d47af06..3f5bfa97d0 100644
--- a/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
+++ b/common/src/main/java/org/openecomp/mso/client/defaultproperties/DefaultAAIPropertiesImpl.java
@@ -65,4 +65,15 @@ public class DefaultAAIPropertiesImpl implements AAIProperties {
return AAIVersion.LATEST;
}
+ @Override
+ public String getAuth() {
+ Object value = props.get("aai.auth");
+ return value == null ? null : value.toString();
+ }
+
+ @Override
+ public String getKey() {
+ Object value = props.get("mso.msoKey");
+ return value == null ? null : value.toString();
+ }
}
diff --git a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
index 4e6ffd1c6a..77afe82758 100644
--- a/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
+++ b/common/src/main/java/org/openecomp/mso/client/policy/RestClient.java
@@ -23,6 +23,7 @@ package org.openecomp.mso.client.policy;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
+import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -41,9 +42,11 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.ext.ContextResolver;
+import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
import org.openecomp.mso.client.RestProperties;
import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.utils.CryptoUtils;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -84,8 +87,6 @@ public abstract class RestClient {
this(props, requestId, path);
this.accept = accept;
this.contentType = contentType;
- this.requestId = requestId;
-
}
protected RestClient(URL host, UUID requestId, String contentType) {
@@ -134,6 +135,21 @@ public abstract class RestClient {
protected abstract Optional<ClientResponseFilter> addResponseFilter();
public abstract RestClient addRequestId(UUID requestId);
+
+ /**
+ * Adds a basic authentication header to the request.
+ * @param auth the encrypted credentials
+ * @param key the key for decrypting the credentials
+ */
+ protected void addBasicAuthHeader(String auth, String key) {
+ try {
+ byte[] decryptedAuth = CryptoUtils.decrypt(auth, key).getBytes();
+ String authHeaderValue = "Basic " + new String(Base64.encodeBase64(decryptedAuth));
+ headerMap.put("Authorization", authHeaderValue);
+ } catch (GeneralSecurityException e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
protected ContextResolver<ObjectMapper> getMapper() {
return new CommonObjectMapperProvider();
diff --git a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java
index daf8130cd4..c7cc549130 100644
--- a/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java
+++ b/common/src/test/java/org/openecomp/mso/client/aai/AAIResourcesClientTest.java
@@ -78,6 +78,21 @@ public class AAIResourcesClientTest {
}
@Test
+ public void verifyBasicAuth() {
+ AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
+ wireMockRule.stubFor(get(
+ urlPathEqualTo("/aai/" + AAIVersion.LATEST + path.build().toString()))
+ .withHeader("Authorization", equalTo("Basic TVNPOk1TTw=="))
+ .willReturn(
+ aResponse()
+ .withHeader("Content-Type", "application/json")
+ .withBodyFile("aai/resources/mockObject.json")
+ .withStatus(200)));
+ AAIResourcesClient client = new AAIResourcesClient();
+ client.get(path);
+ }
+
+ @Test
public void verifyConnect() {
AAIResourceUri path = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test2");
AAIResourceUri path2 = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test3");
diff --git a/common/src/test/resources/aai.properties b/common/src/test/resources/aai.properties
index 9d9f1bdce9..897659b332 100644
--- a/common/src/test/resources/aai.properties
+++ b/common/src/test/resources/aai.properties
@@ -1 +1,3 @@
-aai.endpoint=http://localhost:8443 \ No newline at end of file
+aai.endpoint=http://localhost:8443
+aai.auth=2630606608347B7124C244AB0FE34F6F
+mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index 08fe0f856b..8d3a64340d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -533,7 +533,7 @@ public class E2EServiceInstances {
private Response updateE2EserviceInstances(String requestJSON, Action action,
HashMap<String, String> instanceIdMap, String version) {
- String requestId = instanceIdMap.get("serviceId");
+ String requestId = UUIDChecker.generateUUID(msoLogger);
long startTime = System.currentTimeMillis();
msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceRequest e2eSir = null;
@@ -627,7 +627,7 @@ public class E2EServiceInstances {
String serviceInstanceType = e2eSir.getService().getServiceType();
- String serviceId = "";
+ String serviceId = instanceIdMap.get("serviceId");
RequestClient requestClient = null;
HttpResponse response = null;
@@ -675,6 +675,7 @@ public class E2EServiceInstances {
msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
"Null response from BPMN");
msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity());
+ this.createOperationStatusRecordForError(action, requestId);
return getBPMNResp;
}
@@ -707,9 +708,8 @@ public class E2EServiceInstances {
if (curStatus != null && curStatus.getResult() != null && curStatus.getResult().equalsIgnoreCase("processing")) {
String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "
- + "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "
- + curStatus.getServiceName()
- + "). The existing request must finish or be cleaned up before proceeding.";
+ + "now being worked with a status of " + curStatus.getResult()
+ + ". The latest workflow of instance must be finished or cleaned up.";
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
MsoException.ServiceException, chkMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
index 03af038574..92e74e8de2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java
@@ -49,4 +49,14 @@ public class AaiClientPropertiesImpl implements AAIProperties {
public AAIVersion getDefaultVersion() {
return AAIVersion.LATEST;
}
+
+ @Override
+ public String getAuth() {
+ return props.getProperty("aai.auth", null);
+ }
+
+ @Override
+ public String getKey() {
+ return props.getProperty("mso.msoKey", null);
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index f69378ec65..9964b93df4 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -643,13 +643,17 @@ public class RequestsDatabase {
msoLogger.debug("Execute query on infra active request table");
OperationStatus operStatus = null;
+ List<Object> list = null;
Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
try {
session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id";
+ String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc";
Query query = session.createQuery(hql);
query.setParameter("service_id", serviceId);
- operStatus = (OperationStatus)query.uniqueResult();
+ list = query.list();
+ if(list != null && list.size() >= 1) {
+ operStatus = (OperationStatus) list.get(0);
+ }
} finally {
if(session != null && session.isOpen()) {
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
index 005a28ec52..aacdd96420 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
@@ -33,6 +33,7 @@ import org.junit.runner.RunWith;
import org.openecomp.mso.db.AbstractSessionFactoryManager;
import java.util.Arrays;
+import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -237,8 +238,8 @@ public class RequestsDatabaseTest {
@Mocked Query query) throws Exception {
new Expectations() {{
sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc"); result = query;
+ List<Object>list = query.list(); result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatusByServiceId("123").getClass());
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
index 27c94f0770..4fb5ebc1f8 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java
@@ -93,8 +93,8 @@ public class CatalogDatabase implements Closeable {
private static final String MODEL_TYPE = "modelType";
private static final String MODEL_VERSION_ID = "modelVersionId";
private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid";
- private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId";
- private static final String NETWORK_SERVICE = "network service";
+ private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId";
+ private static final String NETWORK_SERVICE = "network service";
protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL);
@@ -4469,7 +4469,7 @@ public class CatalogDatabase implements Closeable {
/**
* Return a Network recipe that matches a given MODEL_UUID and ACTION
*
- * @param modelName
+ * @param networkModelUuid
* @param action
* @return NetworkRecipe object or null if none found
*/
@@ -4484,7 +4484,17 @@ public class CatalogDatabase implements Closeable {
}
NetworkRecipe recipe = getNetworkRecipeByNameVersion(networkResource.getModelName(), networkResource.getModelVersion(), action);
- return recipe;
+
+ if (recipe == null) {
+ recipe = getDefaultNetworkReceipe(action);
+ }
+
+ return recipe;
+ }
+
+ private NetworkRecipe getDefaultNetworkReceipe(String action) {
+ String modelName = "SDNC_DEFAULT";
+ return getNetworkRecipe(modelName, action);
}
/**