aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy63
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy41
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy52
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy6
17 files changed, 147 insertions, 152 deletions
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 e3702f1014..2a2d1f494d 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
@@ -31,6 +31,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.onap.so.bpmn.core.UrnPropertiesReader
import groovy.json.*
import javax.ws.rs.core.Response
@@ -43,11 +44,6 @@ import org.onap.so.utils.TargetEntity
public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVFCNSResource.class);
-
- String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
- String host = "http://mso.mso.testlab.openecomp.org:8080"
-
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -116,6 +112,18 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
execution.setVariable("nsParameters", nsParameters)
execution.setVariable("nsServiceModelUUID", nsServiceModelUUID);
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
} catch (BpmnError e) {
throw e;
@@ -132,6 +140,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void createNetworkService(DelegateExecution execution) {
msoLogger.trace("createNetworkService ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsServiceModelUUID = execution.getVariable("nsServiceModelUUID");
String nsParameters = execution.getVariable("nsParameters");
@@ -149,8 +158,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"additionalParamForNs":${requestInputs}
}
}"""
- Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)
- String returnCode = apiResponse.getStatus()
+ Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
+ String returnCode = apiResponse.getStatus ()
String aaiResponseAsString = apiResponse.readEntity(String.class)
String nsInstanceId = "";
if(returnCode== "200" || returnCode == "201"){
@@ -165,6 +174,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void instantiateNetworkService(DelegateExecution execution) {
msoLogger.trace("instantiateNetworkService ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -176,7 +186,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
"nsParameters":${nsParameters}
}"""
String nsInstanceId = execution.getVariable("nsInstanceId")
- String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"
+ String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -193,9 +203,10 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + jobId
+ String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -214,7 +225,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
try {
Thread.sleep(5000);
} catch(InterruptedException e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Time Delay exception" + e , "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ msoLogger.error( "Time Delay exception" + e.getMessage());
}
}
@@ -239,7 +250,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
getAAIClient().connect(nsUri,relatedServiceUri)
msoLogger.info("NS relationship to Service added successfully")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while Creating NS relationship.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage(),e);
+ msoLogger.error("Exception occured while Creating NS relationship."+ e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
}
@@ -251,24 +262,30 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
*/
private Response postRequest(DelegateExecution execution, String urlString, String requestBody){
msoLogger.trace("Started Execute VFC adapter Post Process ")
- msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody)
+ msoLogger.info("url:" + urlString +"\nrequestBody:"+ requestBody)
Response apiResponse = null
try{
- URL url = new URL(urlString);
-
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Accept", "application/json")
- httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+ URL url = new URL(urlString);
+
+ // 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 HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
- apiResponse = httpClient.post(requestBody)
+ apiResponse = httpClient.post(requestBody)
+
+ msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- msoLogger.info("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
- msoLogger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
- throw new BpmnError("MSOWorkflowException")
- }
+ msoLogger.error("VFC Aatpter Post Call Exception:" + e.getMessage());
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VFC Aatpter Post Call Exception")
+ }
+
+ msoLogger.trace("Completed Execute VF-C adapter Post Process ")
+
return apiResponse
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
index 9c25a57adc..af46bf65b8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVnfInfra.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+
import static org.apache.commons.lang3.StringUtils.*;
import org.camunda.bpm.engine.delegate.BpmnError
@@ -55,8 +57,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
- CatalogDbUtils cutils = new CatalogDbUtils()
- AAICreateResources aaiCR = new AAICreateResources()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* This method gets and validates the incoming
@@ -448,7 +449,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor {
String vnfModelCustomizationUuid = jsonUtil.getJsonValueForKey(vnfModelInfo, "modelCustomizationUuid")
msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
- JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
+ JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
vnfModelCustomizationUuid, "v2")
msoLogger.debug("obtained VNF list: " + vnfs)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
index 9c9ed933e0..24071d38f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -20,42 +20,14 @@
package org.onap.so.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
-import groovy.xml.XmlUtil
-import groovy.json.*
import org.onap.so.bpmn.core.domain.ServiceDecomposition
-import org.onap.so.bpmn.core.domain.ServiceInstance
-import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.Resource
-import org.onap.so.bpmn.core.domain.AllottedResource
-import org.onap.so.bpmn.core.domain.NetworkResource
-import org.onap.so.bpmn.core.domain.VnfResource
-import org.onap.so.bpmn.common.recipe.ResourceInput
-import org.onap.so.bpmn.common.recipe.BpmnRestClient
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
-import org.onap.so.bpmn.core.RollbackData
-import org.onap.so.bpmn.core.WorkflowException
-import java.util.List;
-import java.util.UUID;
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.apache.commons.lang3.*
-import org.apache.commons.codec.binary.Base64;
-import org.springframework.web.util.UriUtils;
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
-
-
/**
* This groovy class supports the <class>DoCompareModelVersions.bpmn</class> process.
@@ -76,7 +48,6 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
String Prefix="DCMPMDV_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 194e7ff3e1..2168dab736 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -24,12 +24,10 @@ import static org.apache.commons.lang3.StringUtils.*;
import javax.ws.rs.NotFoundException
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.ServiceInstance
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils;
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.core.RollbackData
@@ -37,7 +35,6 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.Resource
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
@@ -50,10 +47,6 @@ import org.onap.so.logger.MsoLogger
import org.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
-import groovy.json.*
-
-
-
/**
* This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
*
@@ -86,7 +79,6 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DCRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 7707903391..aa1eed95bb 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -20,21 +20,12 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
-
-import java.util.ArrayList
-import java.util.Iterator
-import java.util.List
import org.apache.commons.lang3.StringUtils
import org.apache.http.HttpResponse
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.codehaus.groovy.runtime.ArrayUtil
-import org.codehaus.groovy.runtime.ScriptBytecodeAdapter
-import org.codehaus.groovy.runtime.callsite.CallSite
-import org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation
-import org.codehaus.groovy.runtime.typehandling.ShortTypeHandling
-import org.json.JSONArray
import org.json.JSONObject
import org.onap.so.bpmn.common.recipe.BpmnRestClient
import org.onap.so.bpmn.common.recipe.ResourceInput
@@ -48,7 +39,6 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
-import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
@@ -75,7 +65,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest(DelegateExecution execution) {
msoLogger.trace("preProcessRequest ")
@@ -260,18 +250,17 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
// requestAction is action, not opertiontype
//String requestAction = resourceInput.getOperationType()
String requestAction = "createInstance"
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceModelUUID, requestAction)
+ JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, resourceModelUUID, requestAction)
if (resourceRecipe != null) {
- String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://so-bpmn-infra.onap:8081") + resourceRecipe.getString("orchestrationUri")
int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
BpmnRestClient bpmnRestClient = new BpmnRestClient()
HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput, recipeParamXsd)
} else {
- String exceptionMessage = "Resource receipe is not found for resource modeluuid: " +
- resourceInput.getResourceModelInfo().getModelUuid()
+ String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + resourceModelUUID
msoLogger.trace(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
index 4bda803da0..c04bbd4806 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy
@@ -22,13 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
-import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.OwningEntity
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -42,16 +41,11 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
-import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-
-import groovy.json.*
-
/**
* This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process.
*
@@ -84,7 +78,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DCRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -330,7 +324,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
try{
- String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
msoLogger.debug("JSON IS: "+json)
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 a3c30dcb50..1e7f731708 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
@@ -31,6 +31,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.utils.TargetEntity
@@ -44,9 +45,6 @@ import javax.ws.rs.core.Response
public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateVFCNetworkServiceInstance.class);
- String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
- String host = "http://mso.mso.testlab.openecomp.org:8080"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -100,6 +98,19 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
execution.setVariable("nsOperationKey", nsOperationKey);
execution.setVariable("nsParameters", nsParameters)
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
+
} catch (BpmnError e) {
throw e;
@@ -116,6 +127,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void createNetworkService(DelegateExecution execution) {
msoLogger.trace("createNetworkService")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -126,7 +138,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
"nsOperationKey":${nsOperationKey},
"nsParameters":${nsParameters}
}"""
- Response apiResponse = postRequest(execution, host + vfcUrl + "/ns", reqBody)
+ Response apiResponse = postRequest(execution, vfcAdapterUrl + "/ns", reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
String nsInstanceId = "";
@@ -142,6 +154,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void instantiateNetworkService(DelegateExecution execution) {
msoLogger.trace("instantiateNetworkService")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
String nsParameters = execution.getVariable("nsParameters");
String nsServiceName = execution.getVariable("nsServiceName")
@@ -153,7 +166,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
"nsParameters":${nsParameters}
}"""
String nsInstanceId = execution.getVariable("nsInstanceId")
- String url = host + vfcUrl + "/ns/" +nsInstanceId + "/instantiate"
+ String url = vfcAdapterUrl + "/ns/" +nsInstanceId + "/instantiate"
Response apiResponse = postRequest(execution, url, reqBody)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -170,9 +183,10 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
*/
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + jobId
+ String url = vfcAdapterUrl + "/jobs/" + jobId
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -233,17 +247,20 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
try{
URL url = new URL(urlString);
+
+ // 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 HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Accept", "application/json")
- httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
-
- apiResponse = httpClient.post(requestBody)
+ apiResponse = httpClient.post(requestBody)
msoLogger.debug("response code:"+ apiResponse.getStatus() +"\nresponse body:"+ apiResponse.readEntity(String.class))
msoLogger.trace("Completed Execute VF-C adapter Post Process")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing AAI Post Call", "BPMN", MsoLogger.getServiceName(),MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error("Exception occured while executing VFC Adapter Post Call" + e.getMessage ());
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
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 50fe75e3df..a09f22f808 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
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
import javax.xml.parsers.DocumentBuilder
@@ -44,7 +46,6 @@ import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.HttpClient
import org.onap.so.client.aai.AAIObjectPlurals
import org.onap.so.client.aai.AAIObjectType;
@@ -59,7 +60,6 @@ import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.utils.TargetEntity
-import org.springframework.web.util.UriUtils
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.NamedNodeMap
@@ -78,8 +78,7 @@ public class DoCreateVfModule extends VfModuleBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
- CatalogDbUtils catalog = new CatalogDbUtils()
- DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* Validates the request message and sets up the workflow.
@@ -261,7 +260,7 @@ public class DoCreateVfModule extends VfModuleBase {
String serviceType =""
try{
- String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType")
}catch(BpmnError e){
throw e
@@ -2004,7 +2003,7 @@ public class DoCreateVfModule extends VfModuleBase {
msoLogger.debug("vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
- JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2")
+ JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2")
msoLogger.debug("Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid)
// Only one match here
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
index 93379c72be..b42962adac 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy
@@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.VolumeGroup
+import org.onap.aai.domain.yang.VolumeGroups
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
@@ -216,10 +217,11 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), cloudRegion).queryParam("volume-group-name", volumeGroupName)
- Optional<VolumeGroup> volumeGroup = getAAIClient().get(VolumeGroup.class,uri)
- if(volumeGroup.isPresent()){
+ Optional<VolumeGroups> volumeGroups = getAAIClient().get(VolumeGroups.class,uri)
+ if(volumeGroups.isPresent()){
+ VolumeGroup volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
execution.setVariable(prefix+'AaiReturnCode', 200)
- execution.setVariable("queriedVolumeGroupId",volumeGroup.get().getVolumeGroupId())
+ execution.setVariable("queriedVolumeGroupId",volumeGroup.getVolumeGroupId())
msoLogger.debug("Volume Group Name $volumeGroupName exists in AAI.")
}else{
execution.setVariable(prefix+'AaiReturnCode', 404)
@@ -298,6 +300,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase {
getAAIClient().create(volumeGroupUri, volumeGroup)
getAAIClient().connect(volumeGroupUri, vnfUri)
getAAIClient().connect(volumeGroupUri, tenantUri)
+ execution.setVariable("queriedVolumeGroupId", volumeGroupId)
RollbackData rollbackData = execution.getVariable("rollbackData")
rollbackData.put("DCVFMODULEVOL", "isAAIRollbackNeeded", "true")
} catch (NotFoundException ignored) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
index d3dbd9107e..232336b0ee 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
@@ -20,14 +20,11 @@
package org.onap.so.bpmn.infrastructure.scripts
-import java.util.UUID;
-
-import java.util.List
-
import org.json.JSONObject;
import org.json.JSONArray;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.RollbackData
@@ -59,7 +56,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* This method gets and validates the incoming
@@ -189,8 +186,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
msoLogger.debug("querying Catalog DB by vnfModelCustomizationUuid: " + vnfModelCustomizationUuid)
- JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution,
- vnfModelCustomizationUuid)
+ JSONArray vnfs = catalogDbUtils.getAllVnfsByVnfModelCustomizationUuid(execution,
+ vnfModelCustomizationUuid, "v1")
msoLogger.debug("obtained VNF list")
// Only one match here
JSONObject vnfObject = vnfs[0]
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 122cc08e89..9116b5ab14 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -20,6 +20,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
+
import static org.apache.commons.lang3.StringUtils.isBlank
import org.apache.commons.lang3.StringUtils
@@ -65,7 +67,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String Prefix="DDR_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils cutils = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -247,7 +249,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
Resource currentResource = execution.getVariable("currentResource")
String action = "deleteInstance"
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action)
+ JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action)
String recipeUri = resourceRecipe.getString("orchestrationUri")
int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
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 d855479694..ee094b03e3 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
@@ -32,6 +32,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
import org.onap.so.utils.TargetEntity
+import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
/**
@@ -41,11 +42,6 @@ import javax.ws.rs.core.Response
public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteVFCNetworkServiceInstance.class);
-
- String vfcUrl = "/vfc/rest/v1/vfcadapter"
-
- String host = "http://mso.mso.testlab.openecomp.org:8080"
-
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -83,6 +79,20 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
}"""
execution.setVariable("nsOperationKey", nsOperationKey);
msoLogger.info("nsOperationKey:" + nsOperationKey)
+
+ String vfcAdapterUrl = UrnPropertiesReader.getVariable("mso.adapters.vfc.rest.endpoint", execution)
+
+ if (vfcAdapterUrl == null || vfcAdapterUrl.isEmpty()) {
+ msg = getProcessKey(execution) + ': mso:adapters:vfcc:rest:endpoint URN mapping is not defined'
+ msoLogger.debug(msg)
+ }
+
+ while (vfcAdapterUrl.endsWith('/')) {
+ vfcAdapterUrl = vfcAdapterUrl.substring(0, vfcAdapterUrl.length()-1)
+ }
+
+ execution.setVariable("vfcAdapterUrl", vfcAdapterUrl)
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -123,8 +133,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void deleteNetworkService(DelegateExecution execution) {
msoLogger.trace("deleteNetworkService start ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId")
+ String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId")
Response apiResponse = deleteRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String operationStatus = "error";
@@ -142,8 +153,9 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void terminateNetworkService(DelegateExecution execution) {
msoLogger.trace("terminateNetworkService start ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String nsOperationKey = execution.getVariable("nsOperationKey")
- String url = host + vfcUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
+ String url = vfcAdapterUrl + "/ns/" + execution.getVariable("nsInstanceId") + "/terminate"
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
@@ -161,9 +173,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
public void queryNSProgress(DelegateExecution execution) {
msoLogger.trace("queryNSProgress start ")
+ String vfcAdapterUrl = execution.getVariable("vfcAdapterUrl")
String jobId = execution.getVariable("jobId")
String nsOperationKey = execution.getVariable("nsOperationKey");
- String url = host + vfcUrl + "/jobs/" + execution.getVariable("jobId")
+ String url = vfcAdapterUrl + "/jobs/" + execution.getVariable("jobId")
Response apiResponse = postRequest(execution, url, nsOperationKey)
String returnCode = apiResponse.getStatus()
String apiResponseAsString = apiResponse.readEntity(String.class)
@@ -206,9 +219,12 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
try{
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Accept", "application/json")
- httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+ // 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 HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
apiResponse = httpClient.post(requestBody)
@@ -216,7 +232,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
msoLogger.trace("Completed Execute VF-C adapter Post Process ")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
return apiResponse
@@ -234,14 +250,18 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
try{
URL Url = new URL(url)
- HttpClient httpClient = new HttpClient(Url, "application/json", TargetEntity.VNF_ADAPTER)
- httpClient.addAdditionalHeader("Accept", "application/json")
- httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
+ // 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 HttpClient(url, "application/json", TargetEntity.VNF_ADAPTER)
+ httpClient.addAdditionalHeader("Accept", "application/json")
+ httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
+
r = httpClient.delete(requestBody)
msoLogger.trace("Completed Execute VF-C adapter Delete Process ")
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while executing VF-C Post Call. Exception is: \n" + e, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e);
+ msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
throw new BpmnError("MSOWorkflowException")
}
return r
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
index f6a8a1558c..06c7002dff 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy
@@ -25,11 +25,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.GenericVnf
import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.CatalogDbUtils
+import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.bpmn.common.scripts.VfModule
import org.onap.so.bpmn.common.scripts.VfModuleBase
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
@@ -38,7 +38,6 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
-import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.entities.uri.AAIResourceUri
@@ -46,14 +45,12 @@ import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
-import org.springframework.web.util.UriUtils
-
public class DoUpdateVfModule extends VfModuleBase {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoUpdateVfModule.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
- CatalogDbUtils catalog = new CatalogDbUtils()
+ CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
/**
* Initialize the flow's variables.
@@ -255,7 +252,7 @@ public class DoUpdateVfModule extends VfModuleBase {
String serviceType =""
try{
- String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
+ String json = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid )
serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType")
}catch(BpmnError e){
throw e
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index 1a47ef88e2..a8e3b2040b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -24,7 +24,6 @@ import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.VidUtils
@@ -55,7 +54,6 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
/**
* This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process.
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
index 7a6fd72a7d..7a40ef978b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy
@@ -21,13 +21,10 @@ package org.onap.so.bpmn.vcpe.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.bpmn.common.scripts.AaiUtil
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.CatalogDbUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.VidUtils
-import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MessageEnum
@@ -40,10 +37,6 @@ import org.onap.so.client.aai.entities.Relationships
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import javax.ws.rs.NotFoundException
-import org.json.JSONObject
-
-import static org.apache.commons.lang3.StringUtils.isBlank
-
/**
* This groovy class supports the <class>DeleteVcpeResCustService.bpmn</class> process.
@@ -60,7 +53,6 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils()
- CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
NetworkUtils networkUtils = new NetworkUtils()
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 7f1c2fd9b1..ac341886ba 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -622,7 +622,9 @@ public class ServicePluginFactory {
// in demo we have only one VPN. no cross VPNs, so get first item.
Map<String, Object> returnRoute = getReturnRoute(returnList);
Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
- vpnRequestInputs.putAll(returnRoute);
+ if(null!=vpnRequestInputs) {
+ vpnRequestInputs.putAll(returnRoute);
+ }
String newRequest = getJsonString(uuiObject);
return newRequest;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
index 26d3ab8d9d..53c164ab45 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2Test.groovy
@@ -35,6 +35,7 @@ import org.mockito.runners.MockitoJUnitRunner
import org.onap.aai.domain.yang.GenericVnf
import org.onap.aai.domain.yang.Volume
import org.onap.aai.domain.yang.VolumeGroup
+import org.onap.aai.domain.yang.VolumeGroups
import org.onap.so.bpmn.common.scripts.MsoGroovyTest
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.client.aai.AAIObjectPlurals
@@ -160,9 +161,11 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
when(mockExecution.getVariable(volumeGroupName)).thenReturn(volumeGroupName)
when(mockExecution.getVariable(lcpCloudRegionId)).thenReturn(lcpCloudRegionId)
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), lcpCloudRegionId).queryParam("volume-group-name", volumeGroupName)
+ VolumeGroups volumeGroups = new VolumeGroups();
VolumeGroup volumeGroup = new VolumeGroup()
volumeGroup.setVolumeGroupId("volumeGroupId")
- when(client.get(VolumeGroup.class,uri)).thenReturn(Optional.of(volumeGroup))
+ volumeGroups.getVolumeGroup().add(volumeGroup);
+ when(client.get(VolumeGroups.class,uri)).thenReturn(Optional.of(volumeGroups))
doCreateVfModuleVolumeV2.callRESTQueryAAIVolGrpName(mockExecution,null)
verify(mockExecution).setVariable("DCVFMODVOLV2_AaiReturnCode",200)
}
@@ -250,6 +253,7 @@ class DoCreateVfModuleVolumeV2Test extends MsoGroovyTest {
when(mockExecution.getVariable(cloudOwner)).thenReturn(cloudOwner)
when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData())
doCreateVfModuleVolumeV2.callRESTCreateAAIVolGrpName(mockExecution,null)
+ verify(mockExecution).setVariable("queriedVolumeGroupId", "volumeGroupId")
}
@Test