aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy4
-rwxr-xr-xbpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy63
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy19
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy39
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy40
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java21
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java15
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy5
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy452
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json33
22 files changed, 691 insertions, 97 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
index b912b64145..a8da95aa7c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
@@ -53,7 +53,6 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
MsoUtils msoUtils = new MsoUtils()
public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
msoLogger.info(" ***** Started preProcessRequest *****")
try {
@@ -64,7 +63,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String resourceInput = execution.getVariable("resourceInput")
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
- execution.setVariable(Prefix + "resourceInput", resourceInputObj)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
@@ -125,8 +124,8 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug( msg)
+ String msg = "Exception in preProcessRequest " + ex.getMessage()
+ msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
@@ -398,7 +397,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug( exceptionMessage)
+ msoLogger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
@@ -415,21 +414,21 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void sendSyncResponse(DelegateExecution execution) {
- msoLogger.dubug(" *** sendSyncResponse *** ")
+ msoLogger.info("started sendsyncResp")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug( msg)
+ msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.dubug(" ***** Exit sendSyncResponse *****")
+ msoLogger.info("exited send sync Resp")
}
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
index 6ef446b490..02ae6a6f48 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy
@@ -302,7 +302,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
xmlns:ns="http://org.onap.so/requestsdb">
<soapenv:Header/>
<soapenv:Body>
- <ns:updateServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
+ <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb">
<serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId>
<operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
<operationType>${MsoUtils.xmlEscape(operationType)}</operationType>
@@ -311,7 +311,7 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
<operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent>
<progress>${MsoUtils.xmlEscape(progress)}</progress>
<reason>${MsoUtils.xmlEscape(reason)}</reason>
- </ns:updateServiceOperationStatus>
+ </ns:initServiceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>"""
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
index 9763960bfd..848785e5f3 100755
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
@@ -165,6 +165,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
inputMap.put(userParam.name, userParam.value)
}
+ if ("Orchestrator".equalsIgnoreCase(userParam?.name)) {
+ execution.setVariable("orchestrator", userParam.value)
+ inputMap.put("orchestrator", userParam.value)
+ }
}
}
@@ -344,6 +348,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
inputMap.put(userParam.name, userParam.value)
}
+ if ("Orchestrator".equalsIgnoreCase(userParam?.name)) {
+ execution.setVariable("orchestrator", userParam.value)
+ inputMap.put("orchestrator", userParam.value)
+ }
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index b2c278b64c..9301f3d508 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -203,7 +203,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-ltp-id", inputParameters.get("local-access-ltp-id"))
uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-node-id", inputParameters.get("local-access-node-id"))
resourceInputObj.setResourceParameters(uResourceInput)
- execution.setVariable(Prefix + "resourceInput", resourceInputObj)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
}
break
@@ -539,10 +539,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
private def getInstnaceId(DelegateExecution execution) {
def response = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse"))
- def data = response.toString()
- data = data.substring(data.indexOf("<"))
- def resp = new XmlSlurper().parseText(data)
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
def val = ""
@@ -551,17 +548,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
case ~/[\w\s\W]*Site[\w\s\W]*/:
- val = resp."vnf-response-information"."instance-id"
+ val = response."response-data"."RequestData"."output"."vnf-response-information"."instance-id"
break
case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
- val = resp."connection-attachment-response-information"."instance-id"
+ val = response."response-data"."RequestData"."output"."connection-attachment-response-information"."instance-id"
break
// for SDWANConnectivity and SOTNConnectivity and default:
default:
- val = resp."network-response-information"."instance-id"
+ val = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
break
}
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 aa1eed95bb..6096f16b18 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
@@ -104,7 +104,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
// get Sequence from csar(model)
if(resourceSequence == null) {
- resourceSequence = ResourceRequestBuilder.getResourceSequence(execution, serviceModelUuid)
+ resourceSequence = ResourceRequestBuilder.getResourceSequence(serviceModelUuid)
msoLogger.info("Get Sequence from csar : " + resourceSequence)
}
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 1d3d3331ef..53e3525036 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
@@ -41,10 +41,12 @@ 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.VfModuleBase
+import org.onap.so.bpmn.common.util.OofInfraUtils
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.domain.VnfResource
+import org.onap.so.bpmn.core.json.DecomposeJsonUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.aai.AAIObjectPlurals
@@ -56,6 +58,7 @@ import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.constants.Defaults
+import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
@@ -78,7 +81,9 @@ public class DoCreateVfModule extends VfModuleBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
+ OofInfraUtils oofInfraUtils = new OofInfraUtils()
CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create()
+ DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil()
private final HttpClientFactory httpClientFactory = new HttpClientFactory()
/**
@@ -235,12 +240,37 @@ public class DoCreateVfModule extends VfModuleBase {
String globalSubscriberId = execution.getVariable("globalSubscriberId")
execution.setVariable("DCVFM_globalSubscriberId", globalSubscriberId)
msoLogger.debug("globalSubsrciberId: " + globalSubscriberId)
- //OofDirectives
- String oofDirectives = execution.getVariable("oofDirectives")
+
+ // Set Homing Info
+ String oofDirectives = null
+ try {
+ HomingInstance homingInstance = oofInfraUtils.getHomingInstance(serviceInstanceId, execution)
+ if (homingInstance != null) {
+ execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId())
+ rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId())
+ msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
+ homingInstance.getCloudRegionId())
+ execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner())
+ rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner())
+ msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " +
+ homingInstance.getCloudOwner())
+ oofDirectives = homingInstance.getOofDirectives()
+ execution.setVariable("DCVFM_oofDirectives", oofDirectives)
+ }
+ } catch (Exception exception) {
+ msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId +
+ "... continuing")
+ msoLogger.debug("Could not find homing information for service instance error: " + exception)
+ }
+ //OofDirectives to Input Params
Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams")
- if (oofDirectives != null) {
- vfModuleInputParams.put("oofDirectives", oofDirectives)
- logDebug("OofDirectives are: " + oofDirectives, isDebugLogEnabled)
+ if (oofDirectives != null && vfModuleInputParams != null) {
+ vfModuleInputParams.put("oof_directives", oofDirectives)
+ vfModuleInputParams.put("sdnc_directives", "{}")
+ msoLogger.debug("OofDirectives are: " + oofDirectives)
+ } else if (vfModuleInputParams != null) {
+ vfModuleInputParams.put("oof_directives", "{}")
+ vfModuleInputParams.put("sdnc_directives", "{}")
}
if (vfModuleInputParams != null) {
execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams)
@@ -467,11 +497,30 @@ public class DoCreateVfModule extends VfModuleBase {
}
//OofDirectives
- String oofDirectives = execution.getVariable("oofDirectives")
+ String oofDirectives = null
+ try {
+ HomingInstance homingInstance = oofInfraUtils.getHomingInstance(serviceInstanceId, execution)
+ if (homingInstance != null) {
+ execution.setVariable("DCVFM_cloudSiteId", homingInstance.getCloudRegionId())
+ rollbackData.put("VFMODULE", "aiccloudregion", homingInstance.getCloudRegionId())
+ msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
+ homingInstance.getCloudRegionId())
+ execution.setVariable("DCVFM_cloudOwner", homingInstance.getCloudOwner())
+ rollbackData.put("VFMODULE", "cloudOwner", homingInstance.getCloudOwner())
+ msoLogger.debug("Overwriting cloudOwner with homing cloudOwner: " +
+ homingInstance.getCloudOwner())
+ oofDirectives = homingInstance.getOofDirectives()
+ execution.setVariable("DCVFM_oofDirectives", oofDirectives)
+ }
+ } catch (Exception exception) {
+ msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId +
+ "... continuing")
+ msoLogger.debug("Could not find homing information for service instance error: " + exception)
+ }
if (oofDirectives != null) {
Map<String, String> paramsMap = execution.getVariable("DCVFM_vnfParamsMap")
paramsMap.put("oofDirectives", oofDirectives)
- logDebug("OofDirectives are: " + oofDirectives, isDebugLogEnabled)
+ msoLogger.debug("OofDirectives are: " + oofDirectives)
execution.setVariable("DCVFM_vnfParamsMap", paramsMap)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index b35aab1176..deb0bffaf9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.db.catalog.beans.HomingInstance
+
import static org.apache.commons.lang3.StringUtils.*
import org.camunda.bpm.engine.delegate.BpmnError
@@ -31,6 +33,7 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.common.scripts.VidUtils
+import org.onap.so.bpmn.common.util.OofInfraUtils
import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
@@ -61,6 +64,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
VidUtils vidUtils = new VidUtils(this)
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
+ OofInfraUtils oofInfraUtils = new OofInfraUtils()
/**
* This method gets and validates the incoming
@@ -238,6 +242,21 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
execution.setVariable("DoCVNF_nfFunction", nfFunction)
msoLogger.debug("NF Function is: " + nfFunction)
+ // Set Homing Info
+ try {
+ HomingInstance homingInstance = oofInfraUtils.getHomingInstance(serviceInstanceId, execution)
+ if (homingInstance != null) {
+ execution.setVariable("DoCVNF_cloudSiteId", homingInstance.getCloudRegionId())
+ rollbackData.put("VNF", "cloudSiteId", homingInstance.getCloudRegionId())
+ msoLogger.debug("Overwriting cloudSiteId with homing cloudSiteId: " +
+ homingInstance.getCloudRegionId())
+ }
+ } catch (Exception exception) {
+ msoLogger.debug("Could not find homing information for service instance: " + serviceInstanceId +
+ "... continuing")
+ msoLogger.debug("Could not find homing information for service instance error: " + exception)
+ }
+
rollbackData.put("VNF", "rollbackSDNCAssign", "false")
rollbackData.put("VNF", "rollbackSDNCActivate", "false")
rollbackData.put("VNF", "rollbackVnfCreate", "false")
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 232336b0ee..88e7b34dcd 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
@@ -118,7 +118,10 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("vnfId", vnfId)
-
+
+ Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames")
+ msoLogger.debug("Incoming vfModuleNames: " + vfModuleNames)
+
// Set aLaCarte to false
execution.setVariable("aLaCarte", false)
@@ -137,9 +140,17 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
rollbackData.put("VNFANDMODULES", "numOfCreatedAddOnModules", "0")
execution.setVariable("rollbackData", rollbackData)
- sleep (20000)
+ String delayMS = execution.getVariable("delayMS")
+ long longDelayMS = 20000;
+ if (delayMS != null && !delayMS.isEmpty()) {
+ longDelayMS = Long.parseLong(delayMS);
+ }
+ if (longDelayMS > 0) {
+ msoLogger.debug("Delaying workflow " + longDelayMS + "ms");
+ sleep(longDelayMS)
+ }
}catch(BpmnError b){
msoLogger.debug("Rethrowing MSOWorkflowException")
throw b
@@ -151,7 +162,6 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process")
}
-
public void queryCatalogDB (DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
@@ -159,8 +169,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
msoLogger.trace("STARTED DoCreateVnfAndModules QueryCatalogDB Process")
try {
VnfResource vnf = null
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
// if serviceDecomposition is specified, get info from serviceDecomposition
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
if (serviceDecomposition != null) {
msoLogger.debug("Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString())
List<VnfResource> vnfs = serviceDecomposition.getVnfResources()
@@ -208,6 +218,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
}
ModuleResource baseVfModule = null
+ Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames")
for (int i = 0; i < vfModules.size; i++) {
msoLogger.debug("handling VF Module ")
@@ -222,6 +233,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("baseVfModuleLabel", baseVfModuleLabel)
String basePersonaModelId = baseVfModuleModelInfoObject.getModelInvariantUuid()
execution.setVariable("basePersonaModelId", basePersonaModelId)
+ String baseVfModuleName = getPredefinedVfModuleName(execution, basePersonaModelId)
+ execution.setVariable("baseVfModuleName", baseVfModuleName)
baseVfModule = vfModule
break
}
@@ -284,6 +297,8 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
execution.setVariable("addOnVfModuleLabel", addOnVfModuleLabel)
String addOnPersonaModelId = addOnVfModuleModelInfoObject.getModelInvariantUuid()
execution.setVariable("addOnPersonaModelId", addOnPersonaModelId)
+ String addOnVfModuleName = getPredefinedVfModuleName(execution, addOnPersonaModelId)
+ execution.setVariable("addOnVfModuleName", addOnVfModuleName)
int addOnInitialCount = addOnModule.getInitialCount()
execution.setVariable("initialCount", addOnInitialCount)
@@ -460,5 +475,19 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
msoLogger.trace("Exit createLineOfBusiness")
}
+ public String getPredefinedVfModuleName(DelegateExecution execution, String vfModuleModelInvariantUuid) {
+ Map<String,String> vfModuleNames = execution.getVariable("vfModuleNames")
+
+ if (vfModuleNames == null) {
+ return null
+ }
+
+ String vfModuleName = vfModuleNames.get(vfModuleModelInvariantUuid)
-} \ No newline at end of file
+ if (vfModuleName != null) {
+ msoLogger.debug("Using vfModuleName='" + vfModuleName + "' for vfModuleModelInvariantUuid=" + vfModuleModelInvariantUuid)
+ }
+
+ return vfModuleName
+ }
+}
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 6109d8631f..7c8a1d70e1 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
@@ -149,7 +149,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
}
/**
- * instantiate NS task
+ * terminate NS task
*/
public void terminateNetworkService(DelegateExecution execution) {
@@ -247,19 +247,19 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
msoLogger.trace("Started Execute VFC adapter Delete Process ")
msoLogger.info("url:"+url +"\nrequestBody:"+ requestBody)
- Response r
+ Response r
try{
- URL Url = new URL(url)
+ URL Url = new URL(url)
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
-
- r = httpClient.delete(requestBody)
-
+ httpClient.addAdditionalHeader("Content-Type", "application/json")
+ r = httpClient.delete(requestBody)
+
msoLogger.trace("Completed Execute VF-C adapter Delete Process ")
}catch(Exception e){
msoLogger.error("Exception occured while executing VF-C Post Call. Exception is: \n" + e.getMessage());
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 a8e3b2040b..13d5aad2b0 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
@@ -97,7 +97,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
InitializeProcessVariables(execution)
//Config Inputs
- String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay")
+ String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay", execution)
if (isBlank(aaiDistDelay)) {
String msg = "workflowAaiDistributionDelay is null"
msoLogger.debug(msg)
@@ -209,14 +209,13 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
def userParams = reqMap.requestDetails?.requestParameters?.userParams
Map<String, String> inputMap = [:]
- if (userParams) {
+ if (userParams) {
userParams.each {
- userParam ->
+ userParam ->
if ("Customer_Location".equals(userParam?.name)) {
Map<String, String> customerMap = [:]
userParam.value.each {
param ->
-
inputMap.put(param.key, param.value)
customerMap.put(param.key, param.value)
}
@@ -238,7 +237,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
param.getClass() , isDebugEnabled)
}
execution.setVariable("homingModelIds", modelIdLst)
- }
+ }
if ("BRG_WAN_MAC_Address".equals(userParam?.name)) {
execution.setVariable("brgWanMacAddress", userParam.value)
inputMap.put("BRG_WAN_MAC_Address", userParam.value)
@@ -247,7 +246,34 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable("homingService", userParam.value)
execution.setVariable("callHoming", true)
inputMap.put("Homing_Solution", userParam.value)
- }
+ }
+ if ("Orchestrator".equalsIgnoreCase(userParam?.name)) {
+ execution.setVariable("orchestrator", userParam.value)
+ inputMap.put("orchestrator", userParam.value)
+ }
+ if ("VfModuleNames".equals(userParam?.name)) {
+ utils.log("DEBUG", "VfModuleNames: " + userParam.value.toString(), isDebugEnabled)
+ def vfModuleNames = [:]
+ userParam.value.each {
+ entry ->
+ String vfModuleModelInvariantUuid = null;
+ String vfModuleName = null;
+ entry.each {
+ param ->
+ if ("VfModuleModelInvariantUuid".equals(param.key)) {
+ vfModuleModelInvariantUuid = param.value;
+ } else if ("VfModuleName".equals(param.key)) {
+ vfModuleName = param.value;
+ }
+ }
+
+ if (vfModuleModelInvariantUuid != null && !vfModuleModelInvariantUuid.isEmpty() && vfModuleName != null && !vfModuleName.isEmpty()) {
+ vfModuleNames.put(vfModuleModelInvariantUuid, vfModuleName)
+ utils.log("DEBUG", "VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName, isDebugEnabled)
+ }
+ }
+ execution.setVariable("vfModuleNames", vfModuleNames)
+ }
}
}
@@ -257,7 +283,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
}
msoLogger.debug("User Input Parameters map: " + userParams.toString())
- execution.setVariable("serviceInputParams", inputMap)
+ execution.setVariable("serviceInputParams", inputMap) // DOES NOT SEEM TO BE USED
msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index e9b0bc77b2..c1ddf2e04e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -27,7 +27,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
import com.google.common.base.Strings;
-import java.util.regex.Pattern;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
@@ -39,8 +38,7 @@ import org.springframework.stereotype.Component;
@Component
public class PnfCheckInputs implements JavaDelegate {
- private static final Pattern UUID_PATTERN = Pattern
- .compile("(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$");
+ public static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class);
private String defaultTimeout;
@@ -69,7 +67,7 @@ public class PnfCheckInputs implements JavaDelegate {
if (Strings.isNullOrEmpty(pnfUuid)) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid variable not defined");
}
- if (!UUID_PATTERN.matcher(pnfUuid).matches()) {
+ if (!pnfUuid.matches(UUID_REGEX)) {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid is not a valid UUID");
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
index 60f109a81f..0d7c4abeee 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/properties/BPMNProperties.java
@@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.properties;
import java.util.Arrays;
import java.util.List;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.logger.MsoLogger;
@@ -37,7 +38,7 @@ public class BPMNProperties {
}
public static List<String> getResourceSequenceProp(String input) {
- String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null);
+ String resourceSequence = UrnPropertiesReader.getVariable("mso.workflow.custom."+ input + ".resource.sequence");
if (resourceSequence != null) {
return Arrays.asList(resourceSequence.split(","));
}
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 ac341886ba..48c78632dd 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
@@ -430,14 +430,19 @@ public class ServicePluginFactory {
Map<String, String> keys = uri.getURIKeys();
String uriString = uri.build().toString();
- AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, keys.get("pnf-name"));
-
- AAIResultWrapper wrapper = client.get(parent);
- Optional<Relationships> optRelationships = wrapper.getRelationships();
- if (optRelationships.isPresent()) {
- Relationships relationships = optRelationships.get();
-
- return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
+
+ if (uriString != null) {
+ // get the pnfname
+ String[] token = uriString.split("/");
+ AAIResourceUri parent = AAIUriFactory.createResourceUri(AAIObjectType.PNF, token[4]);
+
+ AAIResultWrapper wrapper = client.get(parent);
+ Optional<Relationships> optRelationships = wrapper.getRelationships();
+ if (optRelationships.isPresent()) {
+ Relationships relationships = optRelationships.get();
+
+ return !relationships.getRelatedAAIUris(AAIObjectType.EXT_AAI_NETWORK).isEmpty();
+ }
}
return false;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 3c4a35737b..3108adaa53 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -93,7 +93,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("AbstractSdncOperationTask.updateResOperStatus begin!");
String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
HttpPost httpPost = new HttpPost(requestsdbEndPoint);
- httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
+ httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
String postBody = getPostStringBody(resourceOperationStatus);
httpPost.setEntity(new StringEntity(postBody, ContentType.APPLICATION_XML));
@@ -174,7 +174,7 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
logger.info("AbstractSdncOperationTask.getResourceOperationStatus begin!");
String requestsdbEndPoint = env.getProperty("mso.adapters.openecomp.db.endpoint");
HttpPost httpPost = new HttpPost(requestsdbEndPoint);
- httpPost.addHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk");
+ httpPost.addHeader("Authorization", "Basic YnBlbDpwYXNzd29yZDEk");
httpPost.addHeader("Content-type", "application/soap+xml");
String getBody = getGetStringBody(serviceId, operationId, resourceTemplateUUID);
httpPost.setEntity(new StringEntity(getBody, ContentType.APPLICATION_XML));
@@ -289,9 +289,8 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
protected boolean isSend2SdncDirectly() {
logger.info("AbstractSdncOperationTask.isSend2SdncDirectly begin!");
- String sdncIp = UrnPropertiesReader.getVariable("sdnc-ip");
- String sdncPort = UrnPropertiesReader.getVariable("sdnc-port");
- if (!StringUtils.isBlank(sdncIp) && isIp(sdncIp) && !StringUtils.isBlank(sdncPort)) {
+ String sdncHost = UrnPropertiesReader.getVariable("sdnc.host");
+ if (!StringUtils.isBlank(sdncHost)) {
logger.info("AbstractSdncOperationTask.isSend2SdncDirectly = true.");
return true;
}
@@ -317,6 +316,12 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
return returnPort;
}
+ protected String getSdncHost() {
+ String sdncHost = UrnPropertiesReader.getVariable("sdnc.host");
+ logger.info("AbstractSdncOperationTask.getSdncPort: returnPort = {}", sdncHost);
+ return sdncHost;
+ }
+
private GenericResourceApi getGenericResourceApiClient() {
logger.info("AbstractSdncOperationTask.getGenericResourceApiClient begin!");
String msbIp = System.getenv().get(ONAP_IP);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
index 8e41d0d88e..dc625d35c3 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java
@@ -72,7 +72,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask
private void send2SdncDirectly(String defaulAuth,
RpcServiceTopologyOperationInputEntity inputEntity) throws RouteException {
sdncLogger.info("SdncServiceTopologyOperationTask.send2SdncDirectly begin!");
- String url = "http://" + getSdncIp() + ":" + getSdncPort() + URL;
+ String url = getSdncHost() + URL;
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Authorization", defaulAuth);
httpPost.addHeader("Content-type", "application/json");
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
index 820c14eb94..8dde45be81 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResourceTest.groovy
@@ -129,10 +129,7 @@ class CreateSDNCNetworkResourceTest extends GroovyTestCase {
private getInstanceId() {
def response = new XmlSlurper().parseText(sdncAdapterWorkflowResponse)
- def data = response.toString()
- data = data.substring(data.indexOf("<"))
- def resp = new XmlSlurper().parseText(data)
- def instanceId = resp."network-response-information"."instance-id"
+ def instanceId = response."response-data"."RequestData"."output"."network-response-information"."instance-id"
return instanceId
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy
new file mode 100644
index 0000000000..47db6b3b7b
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy
@@ -0,0 +1,452 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule
+import org.camunda.bpm.engine.ProcessEngineServices
+import org.camunda.bpm.engine.RepositoryService
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import org.camunda.bpm.engine.repository.ProcessDefinition
+import org.junit.Assert
+import org.junit.Before
+import org.junit.Rule
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.ArgumentCaptor
+import org.mockito.Captor
+import org.mockito.Mockito
+import org.mockito.MockitoAnnotations
+import org.mockito.runners.MockitoJUnitRunner
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.domain.AllottedResource
+import org.onap.so.bpmn.core.domain.HomingSolution
+import org.onap.so.bpmn.core.domain.InventoryType
+import org.onap.so.bpmn.core.domain.License
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.ModuleResource
+import org.onap.so.bpmn.core.domain.NetworkResource
+import org.onap.so.bpmn.core.domain.ResourceInstance
+import org.onap.so.bpmn.core.domain.ResourceType
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.domain.ServiceInstance
+import org.onap.so.bpmn.core.domain.VnfResource
+
+import static org.mockito.Mockito.*
+
+@RunWith(MockitoJUnitRunner.class)
+class DoCreateVnfAndModulesTest {
+
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(28090)
+
+ @Captor
+ static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class)
+
+ @Before
+ void init() throws IOException {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ void testPreProcessRequest() {
+ ExecutionEntity mockExecution = setupMock()
+ setupBasicProcessInputs(mockExecution)
+
+ ServiceDecomposition serviceDecomposition = createServiceDecomposition()
+ when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition)
+
+ Map<String,String> vfModuleNames = new HashMap<String,String>()
+ vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%")
+ vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%")
+ when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames)
+
+ DoCreateVnfAndModules obj = new DoCreateVnfAndModules()
+ obj.preProcessRequest(mockExecution)
+
+ Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture())
+
+ List list = captor.getAllValues()
+ for (int i = 0; i < list.size(); i+=2) {
+ System.out.println("captor[" + i/2 + "]: " + list.get(i)
+ + (i+1 < list.size() ? ("=" + list.get(i+1)) : ""))
+ }
+
+ String someKey = list.get(18)
+ Assert.assertEquals("numOfCreatedAddOnModules", someKey)
+ Integer someValue = list.get(19)
+ Assert.assertEquals(0, someValue)
+
+ String lastKey = list.get(20)
+ Assert.assertEquals("rollbackData", lastKey)
+ }
+
+ @Test
+ void testQueryCatalogDB() {
+ ExecutionEntity mockExecution = setupMock()
+ setupBasicProcessInputs(mockExecution)
+
+ ServiceDecomposition serviceDecomposition = createServiceDecomposition()
+ when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition)
+
+ DoCreateVnfAndModules obj = new DoCreateVnfAndModules()
+ obj.queryCatalogDB(mockExecution)
+
+ Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture())
+
+ List list = captor.getAllValues()
+ for (int i = 0; i < list.size(); i+=2) {
+ System.out.println("captor[" + i/2 + "]: " + list.get(i)
+ + (i+1 < list.size() ? ("=" + list.get(i+1)) : ""))
+ }
+
+ String vfModuleNameKey = list.get(12)
+ Assert.assertEquals("baseVfModuleName", vfModuleNameKey)
+ String vfModuleNameValue = list.get(13)
+ Assert.assertEquals(null, vfModuleNameValue)
+
+ String lastKey = list.get(20)
+ Assert.assertEquals("baseVfModuleId", lastKey)
+ }
+
+ @Test
+ void testQueryCatalogDBWithVfModuleNames() {
+ ExecutionEntity mockExecution = setupMock()
+ setupBasicProcessInputs(mockExecution)
+
+ ServiceDecomposition serviceDecomposition = createServiceDecomposition()
+ when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition)
+
+ Map<String,String> vfModuleNames = new HashMap<String,String>()
+ vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%")
+ vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%")
+ when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames)
+
+ DoCreateVnfAndModules obj = new DoCreateVnfAndModules()
+ obj.queryCatalogDB(mockExecution)
+
+ Mockito.verify(mockExecution, times(11)).setVariable(captor.capture(), captor.capture())
+
+ List list = captor.getAllValues()
+ for (int i = 0; i < list.size(); i+=2) {
+ System.out.println("captor[" + i/2 + "]: " + list.get(i)
+ + (i+1 < list.size() ? ("=" + list.get(i+1)) : ""))
+ }
+
+ String vfModuleNameKey = list.get(12)
+ Assert.assertEquals("baseVfModuleName", vfModuleNameKey)
+ String vfModuleNameValue = list.get(13)
+ Assert.assertEquals("VGWA:e2:25:25:25:%", vfModuleNameValue)
+
+ String lastKey = list.get(20)
+ Assert.assertEquals("baseVfModuleId", lastKey)
+ }
+
+ @Test
+ void testPreProcessAddonModule() {
+ ExecutionEntity mockExecution = setupMock()
+ setupBasicProcessInputs(mockExecution)
+
+ ServiceDecomposition serviceDecomposition = createServiceDecomposition()
+ when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition)
+
+ VnfResource vnf = serviceDecomposition.getVnfResources().get(0);
+ List<ModuleResource> vfModules = vnf.getAllVfModuleObjects()
+
+ for (int i = vfModules.size()-1; i >= 0; i--) {
+ if (vfModules.get(i).getIsBase()) {
+ vfModules.remove(i);
+ }
+ }
+
+ when(mockExecution.getVariable("addOnModules")).thenReturn(vfModules)
+ when(mockExecution.getVariable("addOnModulesDeployed")).thenReturn(0)
+
+ DoCreateVnfAndModules obj = new DoCreateVnfAndModules()
+ obj.preProcessAddOnModule(mockExecution)
+
+ Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture())
+
+ List list = captor.getAllValues()
+ for (int i = 0; i < list.size(); i+=2) {
+ System.out.println("captor[" + i/2 + "]: " + list.get(i)
+ + (i+1 < list.size() ? ("=" + list.get(i+1)) : ""))
+ }
+
+ String vfModuleNameKey = list.get(14)
+ Assert.assertEquals("addOnVfModuleName", vfModuleNameKey)
+ String vfModuleNameValue = list.get(15)
+ Assert.assertEquals(null, vfModuleNameValue)
+
+ String lastKey = list.get(16)
+ Assert.assertEquals("initialCount", lastKey)
+ }
+
+ @Test
+ void testPreProcessAddonModuleWithVfModuleNames() {
+ ExecutionEntity mockExecution = setupMock()
+ setupBasicProcessInputs(mockExecution)
+
+ ServiceDecomposition serviceDecomposition = createServiceDecomposition()
+ when(mockExecution.getVariable("serviceDecomposition")).thenReturn(serviceDecomposition)
+
+ Map<String,String> vfModuleNames = new HashMap<String,String>()
+ vfModuleNames.put("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45", "VGWA:e2:25:25:25:%")
+ vfModuleNames.put("cc250e7e-746b-4d84-8064-df20c74213a6", "VGWB:f9:32:32:32:%")
+ when(mockExecution.getVariable("vfModuleNames")).thenReturn(vfModuleNames)
+
+ VnfResource vnf = serviceDecomposition.getVnfResources().get(0);
+ List<ModuleResource> vfModules = vnf.getAllVfModuleObjects()
+
+ for (int i = vfModules.size()-1; i >= 0; i--) {
+ if (vfModules.get(i).getIsBase()) {
+ vfModules.remove(i);
+ }
+ }
+
+ when(mockExecution.getVariable("addOnModules")).thenReturn(vfModules)
+ when(mockExecution.getVariable("addOnModulesDeployed")).thenReturn(0)
+
+ DoCreateVnfAndModules obj = new DoCreateVnfAndModules()
+ obj.preProcessAddOnModule(mockExecution)
+
+ Mockito.verify(mockExecution, times(9)).setVariable(captor.capture(), captor.capture())
+
+ List list = captor.getAllValues()
+ for (int i = 0; i < list.size(); i+=2) {
+ System.out.println("captor[" + i/2 + "]: " + list.get(i)
+ + (i+1 < list.size() ? ("=" + list.get(i+1)) : ""))
+ }
+
+ String vfModuleNameKey = list.get(14)
+ Assert.assertEquals("addOnVfModuleName", vfModuleNameKey)
+ String vfModuleNameValue = list.get(15)
+ Assert.assertEquals("VGWB:f9:32:32:32:%", vfModuleNameValue)
+
+ String lastKey = list.get(16)
+ Assert.assertEquals("initialCount", lastKey)
+ }
+
+ private static setupBasicProcessInputs(ExecutionEntity mockExecution) {
+ when(mockExecution.getVariable("prefix")).thenReturn("DCVAM_")
+ when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
+ when(mockExecution.getVariable("msoRequestId")).thenReturn("28a7f01e-a6aa-44fd-b25e-e06e14873cd7")
+ when(mockExecution.getVariable("serviceInstanceId")).thenReturn("7d34a7df-d6c3-4f1c-8710-576412134a5a")
+ when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+ when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RegionOne")
+ when(mockExecution.getVariable("tenantId")).thenReturn("b8ad3842ab3642f7bf3fbe4e4d3b9f86")
+ when(mockExecution.getVariable("disableRollback")).thenReturn("true")
+ when(mockExecution.getVariable("delayMS")).thenReturn("0")
+
+ }
+
+ private static ExecutionEntity setupMock() {
+ ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
+ when(mockProcessDefinition.getKey()).thenReturn("DoCreateVnfAndModules")
+ RepositoryService mockRepositoryService = mock(RepositoryService.class)
+ when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
+ when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoCreateVnfAndModules")
+ when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
+ ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
+ when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
+
+ ExecutionEntity mockExecution = mock(ExecutionEntity.class)
+ // Initialize prerequisite variables
+ when(mockExecution.getId()).thenReturn("100")
+ when(mockExecution.getProcessDefinitionId()).thenReturn("DoCreateVnfAndModules")
+ when(mockExecution.getProcessInstanceId()).thenReturn("DoCreateVnfAndModules")
+ when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
+ when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
+
+ return mockExecution
+ }
+
+ public static ServiceDecomposition createServiceDecomposition() {
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition()
+
+ ServiceInstance serviceInstance = new ServiceInstance()
+ serviceInstance.setInstanceId("7d34a7df-d6c3-4f1c-8710-576412134a5a")
+ serviceDecomposition.setServiceInstance(serviceInstance)
+ serviceDecomposition.setServiceType("")
+ serviceDecomposition.setServiceRole("")
+
+ ModelInfo serviceModelInfo = new ModelInfo()
+ serviceDecomposition.setModelInfo(serviceModelInfo)
+ serviceModelInfo.setModelName("vcpesvc_rescust_1111")
+ serviceModelInfo.setModelUuid("1dffd5f9-bb29-4a47-8073-9b9b07f4943a")
+ serviceModelInfo.setModelVersion("1.0")
+ serviceModelInfo.setModelCustomizationUuid("")
+ serviceModelInfo.setModelCustomizationName("")
+ serviceModelInfo.setModelInstanceName("")
+ serviceModelInfo.setModelType("")
+
+ List<VnfResource> vnfResources = new ArrayList<VnfResource>()
+ serviceDecomposition.setVnfResources(vnfResources)
+
+ VnfResource vnfResource = new VnfResource()
+ vnfResources.add(vnfResource)
+ vnfResource.setResourceId("9504b6b3-d346-4387-952c-8f9b7570b055")
+ vnfResource.setResourceType(ResourceType.VNF)
+ ModelInfo vnfModelInfo = new ModelInfo()
+ vnfResource.setModelInfo(vnfModelInfo)
+ vnfModelInfo.setModelName("vcpevsp_vgw_1111")
+ vnfModelInfo.setModelUuid("289e96fd-a679-4286-a8a2-d76f930d650b")
+ vnfModelInfo.setModelInvariantUuid("0327af89-f836-4086-aadb-17d5c9bd8a83");
+ vnfModelInfo.setModelVersion("1.0");
+ vnfModelInfo.setModelCustomizationUuid("cf151beb-9510-44a1-a165-c783e673baa1");
+ vnfModelInfo.setModelCustomizationName("");
+ vnfModelInfo.setModelInstanceName("vcpevsp_vgw_1111 0")
+ vnfModelInfo.setModelType("")
+ vnfResource.setResourceInstance(new ResourceInstance())
+ vnfResource.setHomingSolution(new HomingSolution())
+ vnfResource.setToscaNodeType("org.openecomp.resource.vf.VcpevspVgw1111")
+ vnfResource.setMultiStageDesign("false")
+ vnfResource.setMultiStageDesign("false")
+
+ List<ModuleResource> moduleResources = new ArrayList<ModuleResource>()
+ vnfResource.setModules(moduleResources)
+
+ ModuleResource moduleResource = new ModuleResource()
+ moduleResources.add(moduleResource)
+ moduleResource.setResourceType(ResourceType.MODULE)
+ ModelInfo moduleModelInfo = new ModelInfo()
+ moduleResource.setModelInfo(moduleModelInfo);
+ moduleModelInfo.setModelName("VcpevspVgw1111..base_vcpe_vgw..module-0")
+ moduleModelInfo.setModelUuid("cf35b6b8-1f31-4efc-87a7-d53f840b8fdf")
+ moduleModelInfo.setModelInvariantUuid("3ec98c7a-ac20-49a1-9e0d-09fea7e8db45")
+ moduleModelInfo.setModelVersion("1")
+ moduleModelInfo.setModelCustomizationUuid("281085b3-4598-4c94-811d-58cc685763e7")
+ moduleModelInfo.setModelCustomizationName("")
+ moduleModelInfo.setModelInstanceName("")
+ moduleModelInfo.setModelType("")
+ moduleResource.setResourceInstance(new ResourceInstance())
+ moduleResource.setHomingSolution(new HomingSolution())
+ moduleResource.setHasVolumeGroup(false)
+ moduleResource.setIsBase(true)
+ moduleResource.setVfModuleLabel("base_vcpe_vgw")
+ moduleResource.setInitialCount(1)
+
+ // For testing an add-on module; not in the actual vCPE model
+ moduleResource = new ModuleResource()
+ moduleResources.add(moduleResource)
+ moduleResource.setResourceType(ResourceType.MODULE)
+ moduleModelInfo = new ModelInfo()
+ moduleResource.setModelInfo(moduleModelInfo);
+ moduleModelInfo.setModelName("VcpevspVgw1111..addon_vcpe_vgw..module-1")
+ moduleModelInfo.setModelUuid("8c8b41b2-8466-41b4-ae8d-5924830c40e8")
+ moduleModelInfo.setModelInvariantUuid("cc250e7e-746b-4d84-8064-df20c74213a6")
+ moduleModelInfo.setModelVersion("1")
+ moduleModelInfo.setModelCustomizationUuid("99424afc-1fb4-4598-a99b-3e0690b4cb03")
+ moduleModelInfo.setModelCustomizationName("")
+ moduleModelInfo.setModelInstanceName("")
+ moduleModelInfo.setModelType("")
+ moduleResource.setResourceInstance(new ResourceInstance())
+ moduleResource.setHomingSolution(new HomingSolution())
+ moduleResource.setHasVolumeGroup(false)
+ moduleResource.setIsBase(false)
+ moduleResource.setVfModuleLabel("addon_vcpe_vgw")
+ moduleResource.setInitialCount(1)
+
+ serviceDecomposition.setNetworkResources(new ArrayList<NetworkResource>())
+
+ List<AllottedResource> allottedResources = new ArrayList<AllottedResource>()
+ serviceDecomposition.setAllottedResources(allottedResources)
+
+ AllottedResource ar = new AllottedResource()
+ allottedResources.add(ar)
+ ar.setResourceId("ed4a3a9a-1411-4924-a9ee-61a41871a040")
+ ar.setResourceType(ResourceType.ALLOTTED_RESOURCE)
+ ModelInfo arModelInfo = new ModelInfo()
+ ar.setModelInfo(arModelInfo)
+ arModelInfo.setModelName("vcpear_tunnelxconn_1111")
+ arModelInfo.setModelUuid("d99e5442-c5e4-4197-ad8d-54f7ad43dd83")
+ arModelInfo.setModelInvariantUuid("61c17371-e824-4587-a9bb-21782aa28391")
+ arModelInfo.setModelVersion("1.0")
+ arModelInfo.setModelCustomizationUuid("506bb474-b8c2-41fd-aeec-4371c3ef58a4")
+ arModelInfo.setModelCustomizationName("")
+ arModelInfo.setModelInstanceName("vcpear_tunnelxconn_1111 0")
+ arModelInfo.setModelType("")
+ ar.setResourceInstance(new ResourceInstance())
+ HomingSolution homingSolution = new HomingSolution()
+ ar.setHomingSolution(homingSolution)
+ homingSolution.setInventoryType(InventoryType.service)
+ homingSolution.setServiceInstanceId("d600c1c0-ff45-40e4-bf29-45a95fa64556")
+ homingSolution.setCloudOwner("CloudOwner")
+ homingSolution.setCloudRegionId("RegionOne")
+ VnfResource vnf = new VnfResource()
+ homingSolution.setVnf(vnf)
+ vnf.setResourceId("cea5e96e-9c67-437c-bf94-2329d277be09")
+ vnf.setResourceType(ResourceType.VNF)
+ vnf.setResourceInstance(new ResourceInstance())
+ vnf.setHomingSolution(new HomingSolution())
+ vnf.setVnfHostname("vnfHostName")
+ homingSolution.setLicense(new License())
+ homingSolution.setRehome(false)
+ ar.setToscaNodeType("org.openecomp.resource.vf.VcpearTunnelxconn1111")
+ ar.setAllottedResourceType("TunnelXConnect")
+ ar.setAllottedResourceRole("TunnelXConn")
+ ar.setProvidingServiceModelName("org.openecomp.service.VcpesvcVgmux1111")
+ ar.setProvidingServiceModelInvariantUuid("d5751cb3-b9e9-470b-9c29-76a5e3ea12d0")
+ ar.setProvidingServiceModelUuid("61b6e96a-f0c6-4f34-a91c-dab3574dd025")
+ ar.setNfType("TunnelXConn")
+ ar.setNfRole("TunnelXConn")
+
+ ar = new AllottedResource()
+ allottedResources.add(ar)
+ ar.setResourceId("3b1b3686-ccfe-4e7c-9d6b-76419db398f9")
+ ar.setResourceType(ResourceType.ALLOTTED_RESOURCE)
+ arModelInfo = new ModelInfo()
+ ar.setModelInfo(arModelInfo)
+ arModelInfo.setModelName("vcpear_brg_1111")
+ arModelInfo.setModelUuid("6b0a5aa5-98d8-455c-8cd1-618a3f1ac859")
+ arModelInfo.setModelInvariantUuid("531f9aa5-dea4-4958-89ad-ef03f77cbf07")
+ arModelInfo.setModelVersion("1.0")
+ arModelInfo.setModelCustomizationUuid("d23ac3fe-ea54-4060-a7c1-ec9178c79620")
+ arModelInfo.setModelCustomizationName("")
+ arModelInfo.setModelInstanceName("vcpear_brg_1111 0")
+ arModelInfo.setModelType("")
+ ar.setResourceInstance(new ResourceInstance())
+ homingSolution = new HomingSolution()
+ ar.setHomingSolution(homingSolution)
+ homingSolution.setInventoryType(InventoryType.service)
+ homingSolution.setServiceInstanceId("bc28ebca-0cc3-4bf8-9ce9-d1524e4bec79")
+ homingSolution.setCloudOwner("CloudOwner")
+ homingSolution.setCloudRegionId("RegionOne")
+ vnf = new VnfResource()
+ homingSolution.setVnf(vnf)
+ vnf.setResourceId("65183e95-e6f1-46cb-9315-2da27a24c2b9")
+ vnf.setResourceType(ResourceType.VNF)
+ vnf.setResourceInstance(new ResourceInstance())
+ vnf.setHomingSolution(new HomingSolution())
+ vnf.setVnfHostname("vnfHostName")
+ homingSolution.setLicense(new License())
+ homingSolution.setRehome(false)
+ ar.setToscaNodeType("org.openecomp.resource.vf.VcpearBrg1111")
+ ar.setAllottedResourceType("BRG")
+ ar.setAllottedResourceRole("BRG")
+ ar.setProvidingServiceModelName("org.openecomp.service.VcpesvcVbrg1111")
+ ar.setProvidingServiceModelInvariantUuid("6eff53bf-0045-41b0-bd48-b4e1284e5b7a")
+ ar.setProvidingServiceModelUuid("0e500bca-15ac-42eb-a2f1-4bfd3b2828ff")
+ ar.setNfType("BRG")
+ ar.setNfRole("BRG")
+
+ return serviceDecomposition
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
index d0ded39146..160eee2337 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
@@ -85,10 +85,10 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
// ***** preProcessRequest *****
@Test
- @Ignore // 1802 merge
public void preProcessRequest() {
ExecutionEntity mex = setupMock()
def map = setupMap(mex)
+
initPreProcess(mex)
CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
@@ -96,7 +96,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
verify(mex).getVariable(DBGFLAG)
verify(mex).setVariable("prefix", Prefix)
- verify(mex).setVariable("aaiDistDelay", "aaidelay")
verify(mex).setVariable("createVcpeServiceRequest", request)
verify(mex).setVariable("msoRequestId", "mri")
assertEquals("sii", map.get("serviceInstanceId"))
@@ -118,6 +117,8 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
def reqinfo = map.get(Prefix+"requestInfo")
assertTrue(reqinfo.indexOf("<request-id>mri</") >= 0)
assertTrue(reqinfo.indexOf("<source>VID</") >= 0)
+
+ assertTrue(map.containsKey("vfModuleNames"))
}
@Test
@@ -127,7 +128,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
def map = setupMap(mex)
initPreProcess(mex)
- when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(null)
+ when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn(null)
CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
@@ -209,7 +210,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
.replace('"mdt1"', '"CloudOwner_CloudRegion1"')
when(mex.getVariable("bpmnRequest")).thenReturn(req)
- when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S")
when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
@@ -230,8 +230,6 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
.replace('"mdt1"', '"CloudRegion1_"')
when(mex.getVariable("bpmnRequest")).thenReturn(req)
- when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(60)
- when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S")
when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
@@ -1122,7 +1120,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
private void initPreProcess(ExecutionEntity mex) {
when(mex.getVariable(DBGFLAG)).thenReturn("true")
when(mex.getVariable("bpmnRequest")).thenReturn(request)
- when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("aaidelay")
+ when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
when(mex.getVariable("mso-request-id")).thenReturn("mri")
when(mex.getVariable("serviceInstanceId")).thenReturn("sii")
when(mex.getVariable("requestAction")).thenReturn("ra")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
index 6bfbac0791..c487125ea6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
@@ -53,4 +53,4 @@ public class CreatePnfEntryInAaiDelegateTest {
assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
assertThat(createdEntry.isInMaint()).isNull();
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
index 763a4546e8..8a1cdfa4c0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java
@@ -28,8 +28,6 @@ import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Test;
public class GeneratePnfUuidDelegateTest {
- private static final String UUID_REGEX = "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$";
-
@Test
public void execute_shouldSetValidUuidAsPnfUuid() {
// given
@@ -38,6 +36,6 @@ public class GeneratePnfUuidDelegateTest {
// when
delegate.execute(execution);
// then
- assertThat((String) execution.getVariable(PNF_UUID)).matches(UUID_REGEX);
+ assertThat((String) execution.getVariable(PNF_UUID)).matches(PnfCheckInputs.UUID_REGEX);
}
-} \ No newline at end of file
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
index d670305a9a..1888831e2e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -4,8 +4,6 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
- * Modifications Copyright 2018 Nokia
- * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -23,7 +21,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
@@ -56,18 +54,6 @@ public class PnfCheckInputsTest {
}
@Test
- public void shouldThrowException_whenCorrelationIdIsEmptyString() {
- PnfCheckInputs testedObject = prepareExecutionForCorrelationId("");
- assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
- }
-
- @Test
- public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() {
- PnfCheckInputs testedObject = prepareExecutionForTimeout(null, null);
- assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
- }
-
- @Test
public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() {
PnfCheckInputs testedObject = prepareExecutionForTimeout(null, "");
assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
index dc4669e8d9..766d27a26d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
@@ -23,6 +23,7 @@
},
"cloudConfiguration":
{
+ "cloudOwner":"CloudOwner",
"lcpCloudRegionId":"mdt1",
"tenantId":"8b1df54faa3b49078e3416e21370a3ba"
},
@@ -30,11 +31,37 @@
{
"subscriptionServiceType":"123456789",
"aLaCarte":"false",
- "userParams":
+ "userParams":[
{
- "BRG_WAN_MAC_Address" : "brgmac"
+ "name":"BRG_WAN_MAC_Address",
+ "value":"brgmac"
+ },
+ {
+ "name":"Customer_Location",
+ "value":{
+ "customerLatitude":"32.897480",
+ "customerLongitude":"-97.040443",
+ "customerName":"some_company"
+ }
+ },
+ {
+ "name":"Homing_Solution",
+ "value":"sniro"
+ },
+ {
+ "name":"VfModuleNames",
+ "value":[
+ {
+ "VfModuleModelInvariantUuid":"c0e70c86-9813-4441-93c7-ad356a9a8d3b",
+ "VfModuleName":"VGWA:f4:56:56:56:%"
+ },
+ {
+ "VfModuleModelInvariantUuid":"5366deab-be06-44c7-b4f7-77e657b78b25",
+ "VfModuleName":"VGWB:a9:18:18:18:%"
+ }
+ ]
}
+ ]
}
-
}
}