Accept vCPE vfModuleNames in NB API 19/72819/1
authorRob Daugherty <rd472p@att.com>
Thu, 15 Nov 2018 20:09:30 +0000 (15:09 -0500)
committerRob Daugherty <rd472p@att.com>
Thu, 15 Nov 2018 20:20:04 +0000 (15:20 -0500)
This affects the vCPE custom flow.  You can specify zero or more
VF Module names (correlated with the model invariant UUID) in the
user parameters, like this:

  "userParams": [
    .
    .
    .
    {
      "name": "VfModuleNames",
      "value": [
        {
          "VfModuleModelInvariantUuId": "5366deab-be06-44c7-b4f7-77e657b78b25",
          "VfModuleName": "VGW:e2:25:25:25:%"
        }
      ]
    }
  ]

Change-Id: I673c04775bf5796079dc0ed19890e73e76820ac0
Issue-ID: SO-1213
Signed-off-by: Rob Daugherty <rd472p@att.com>
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy [new file with mode: 0644]
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json
bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn

index d3dbd91..31f2977 100644 (file)
@@ -121,7 +121,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)
 
@@ -140,9 +143,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
@@ -154,7 +165,6 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor {
           msoLogger.trace("COMPLETED DoCreateVnfAndModules PreProcessRequest Process")
    }
 
-
    public void queryCatalogDB (DelegateExecution execution) {
         
           execution.setVariable("prefix",Prefix)
@@ -162,8 +172,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()
@@ -211,6 +221,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 ")
@@ -225,6 +236,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
                           }               
@@ -287,6 +300,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)
 
@@ -463,5 +478,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
+   }
+}
index 187189c..eea784f 100644 (file)
@@ -99,7 +99,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)
@@ -211,14 +211,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)
                                     }
@@ -240,7 +239,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)
@@ -249,11 +248,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)
+                        }
                 }
             }
 
@@ -263,7 +285,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/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 (file)
index 0000000..47db6b3
--- /dev/null
@@ -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
+       }
+}
index d0ded39..160eee2 100644 (file)
@@ -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")
index dc4669e..766d27a 100644 (file)
@@ -23,6 +23,7 @@
                                },
                        "cloudConfiguration":
                                {
+                                       "cloudOwner":"CloudOwner",
                                        "lcpCloudRegionId":"mdt1",
                                        "tenantId":"8b1df54faa3b49078e3416e21370a3ba"
                                },
                                {
                                        "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:%"
+                                                               }
+                                                       ]
                                                }
+                                       ]
                                }
-                               
                }
 }
index bfbdc25..2dbf127 100644 (file)
@@ -488,6 +488,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s
         <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
         <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
         <camunda:in source="serviceDecomposition" target="serviceDecomposition" />
+        <camunda:in source="vfModuleNames" target="vfModuleNames" />
       </bpmn2:extensionElements>
       <bpmn2:incoming>SequenceFlow_0ws7fjn</bpmn2:incoming>
       <bpmn2:outgoing>SequenceFlow_1mkdhw9</bpmn2:outgoing>
index b598853..dec841c 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
   <bpmn:process id="DoCreateVnfAndModules" name="DoCreateVnfAndModules" isExecutable="true">
     <bpmn:startEvent id="StartEvent_1">
       <bpmn:outgoing>SequenceFlow_0o4vuzt</bpmn:outgoing>
@@ -42,7 +42,8 @@ doCreateVnfAndModules.preProcessRequest(execution)]]></bpmn:script>
         <camunda:in source="false" target="usePreload" />
         <camunda:in source="aLaCarte" target="aLaCarte" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_1hf7k7q</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0tbhtk8</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_10nwzbe</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1ixcnb6</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_0o4vuzt" sourceRef="StartEvent_1" targetRef="PreProcessRequest" />
@@ -79,6 +80,7 @@ doCreateVnfAndModules.preProcessRequest(execution)]]></bpmn:script>
         <camunda:in source="aLaCarte" target="aLaCarte" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_1lh21yl</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_12ffqm1</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1llbx0k</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:scriptTask id="Task_1lfmdks" name="Validate Create Add-On VF Module Response" scriptFormat="groovy">
@@ -132,7 +134,6 @@ doCreateVnfAndModules.validateAddOnModule(execution)]]></bpmn:script>
         <camunda:in source="vnfResourceDecomposition" target="vnfResourceDecomposition" />
       </bpmn:extensionElements>
       <bpmn:incoming>SequenceFlow_19ohb1a</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_07u8e3l</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:scriptTask id="PreProcessAddOnModule" name="PreProcess Add-On Module" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_0jz6bqn</bpmn:incoming>
@@ -157,12 +158,11 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]></bpmn:script>
     <bpmn:sequenceFlow id="SequenceFlow_0jz6bqn" name="yes" sourceRef="ExclusiveGateway_1vyqr5o" targetRef="PreProcessAddOnModule">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("addOnModulesDeployed") <  execution.getVariable("addOnModulesToDeploy")}]]></bpmn:conditionExpression>
     </bpmn:sequenceFlow>
-    <bpmn:sequenceFlow id="SequenceFlow_0kld3qt" name="yes" sourceRef="ExclusiveGateway_1hx9s0y" targetRef="GenerateAddOnModuleName">
+    <bpmn:sequenceFlow id="SequenceFlow_0kld3qt" name="yes" sourceRef="ExclusiveGateway_1hx9s0y" targetRef="ExclusiveGateway_03anzqd">
       <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("instancesOfThisModuleDeployed") < execution.getVariable("initialCount")}]]></bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:sequenceFlow id="SequenceFlow_1mguf2m" sourceRef="Task_1lfmdks" targetRef="ExclusiveGateway_1hx9s0y" />
     <bpmn:sequenceFlow id="SequenceFlow_1vrogpr" name="no" sourceRef="ExclusiveGateway_1hx9s0y" targetRef="PostProcessAddOnModule" />
-    <bpmn:sequenceFlow id="SequenceFlow_1hf7k7q" sourceRef="GenerateBaseModuleName" targetRef="CreateBaseVfModule" />
     <bpmn:callActivity id="GenerateBaseModuleName" name="Generate Base Module Name" calledElement="GenerateVfModuleName">
       <bpmn:extensionElements>
         <camunda:in source="vnfId" target="vnfId" />
@@ -173,8 +173,8 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]></bpmn:script>
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_07u8e3l</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_1hf7k7q</bpmn:outgoing>
+      <bpmn:incoming>SequenceFlow_19ecf9p</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0tbhtk8</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:callActivity id="GenerateAddOnModuleName" name="Generate Add-On Module Name" calledElement="GenerateVfModuleName">
       <bpmn:extensionElements>
@@ -186,7 +186,7 @@ doCreateVnfAndModules.queryCatalogDB(execution)]]></bpmn:script>
         <camunda:out source="WorkflowException" target="WorkflowException" />
         <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
       </bpmn:extensionElements>
-      <bpmn:incoming>SequenceFlow_0kld3qt</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_0ulldxo</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1lh21yl</bpmn:outgoing>
     </bpmn:callActivity>
     <bpmn:sequenceFlow id="SequenceFlow_1lh21yl" sourceRef="GenerateAddOnModuleName" targetRef="CreateAddOnVfModule" />
@@ -240,7 +240,6 @@ dcvam.postProcessRollback(execution)]]></bpmn:script>
       </bpmn:startEvent>
     </bpmn:subProcess>
     <bpmn:sequenceFlow id="SequenceFlow_19ohb1a" sourceRef="QueryCatalogDB" targetRef="CreateVNF" />
-    <bpmn:sequenceFlow id="SequenceFlow_07u8e3l" sourceRef="CreateVNF" targetRef="GenerateBaseModuleName" />
     <bpmn:sequenceFlow id="SequenceFlow_0j52dxv" sourceRef="PostProcessAddOnModule" targetRef="ExclusiveGateway_1vyqr5o" />
     <bpmn:scriptTask id="PostProcessAddOnModule" name="PostProcess Add-On Module" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_1vrogpr</bpmn:incoming>
@@ -250,7 +249,7 @@ def doCreateVnfAndModules = new DoCreateVnfAndModules()
 doCreateVnfAndModules.postProcessAddOnModule(execution)]]></bpmn:script>
     </bpmn:scriptTask>
     <bpmn:sequenceFlow id="SequenceFlow_1t407j7" sourceRef="Task_1mrb29r" targetRef="Task_0qrf3e8" />
-    <bpmn:sequenceFlow id="SequenceFlow_0baw1tl" sourceRef="Task_0qrf3e8" targetRef="GenerateBaseModuleName" />
+    <bpmn:sequenceFlow id="SequenceFlow_0baw1tl" sourceRef="Task_0qrf3e8" targetRef="ExclusiveGateway_06ccv8x" />
     <bpmn:scriptTask id="Task_1mrb29r" name="Create Platform" scriptFormat="groovy">
       <bpmn:incoming>SequenceFlow_07u8e3l</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_1t407j7</bpmn:outgoing>
@@ -265,6 +264,25 @@ doCreateVnfAndModules.createPlatform(execution)]]></bpmn:script>
 def doCreateVnfAndModules = new DoCreateVnfAndModules()
 doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
     </bpmn:scriptTask>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_06ccv8x" name="Need to Generate Name?" default="SequenceFlow_10nwzbe">
+      <bpmn:incoming>SequenceFlow_0baw1tl</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_19ecf9p</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_10nwzbe</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_19ecf9p" name="yes" sourceRef="ExclusiveGateway_06ccv8x" targetRef="GenerateBaseModuleName">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("baseVfModuleName") == null}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0tbhtk8" sourceRef="GenerateBaseModuleName" targetRef="CreateBaseVfModule" />
+    <bpmn:sequenceFlow id="SequenceFlow_10nwzbe" name="no" sourceRef="ExclusiveGateway_06ccv8x" targetRef="CreateBaseVfModule" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_03anzqd" name="Need to Generate Name?" default="SequenceFlow_12ffqm1">
+      <bpmn:incoming>SequenceFlow_0kld3qt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0ulldxo</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_12ffqm1</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_0ulldxo" name="yes" sourceRef="ExclusiveGateway_03anzqd" targetRef="GenerateAddOnModuleName">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("addOnVfModuleName") == null}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_12ffqm1" name="no" sourceRef="ExclusiveGateway_03anzqd" targetRef="CreateAddOnVfModule" />
   </bpmn:process>
   <bpmn:error id="Error_1" name="Java Lang Exception" errorCode="java.lang.Exception" />
   <bpmn:error id="Error_2" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
@@ -303,16 +321,16 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
         <dc:Bounds x="2239" y="57" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_1h41bs7_di" bpmnElement="EndEvent_0v6povc">
-        <dc:Bounds x="2362" y="147" width="36" height="36" />
+        <dc:Bounds x="1524" y="37" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="2380" y="183" width="0" height="0" />
+          <dc:Bounds x="1497" y="73" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1llbx0k_di" bpmnElement="SequenceFlow_1llbx0k">
         <di:waypoint xsi:type="dc:Point" x="2200" y="97" />
         <di:waypoint xsi:type="dc:Point" x="2239" y="97" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="2220" y="82" width="0" height="0" />
+          <dc:Bounds x="2175" y="82" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ExclusiveGateway_1vyqr5o_di" bpmnElement="ExclusiveGateway_1vyqr5o" isMarkerVisible="true">
@@ -323,11 +341,9 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_132bohl_di" bpmnElement="SequenceFlow_132bohl">
         <di:waypoint xsi:type="dc:Point" x="1542" y="140" />
-        <di:waypoint xsi:type="dc:Point" x="1542" y="36" />
-        <di:waypoint xsi:type="dc:Point" x="2380" y="36" />
-        <di:waypoint xsi:type="dc:Point" x="2380" y="147" />
+        <di:waypoint xsi:type="dc:Point" x="1542" y="73" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1962" y="21" width="16" height="12" />
+          <dc:Bounds x="1548" y="98.99999999999997" width="16" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0zr4ioh_di" bpmnElement="CreateVNF">
@@ -356,10 +372,10 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0kld3qt_di" bpmnElement="SequenceFlow_0kld3qt">
         <di:waypoint xsi:type="dc:Point" x="1869" y="140" />
-        <di:waypoint xsi:type="dc:Point" x="1869" y="89" />
-        <di:waypoint xsi:type="dc:Point" x="1952" y="89" />
+        <di:waypoint xsi:type="dc:Point" x="1869" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="1974" y="97" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1886" y="96" width="16" height="12" />
+          <dc:Bounds x="1890.6265060240964" y="103.99999999999983" width="20" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_1mguf2m_di" bpmnElement="SequenceFlow_1mguf2m">
@@ -377,27 +393,21 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
         <di:waypoint xsi:type="dc:Point" x="1869" y="301" />
         <di:waypoint xsi:type="dc:Point" x="1751" y="301" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1878" y="247" width="14" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_1hf7k7q_di" bpmnElement="SequenceFlow_1hf7k7q">
-        <di:waypoint xsi:type="dc:Point" x="1191" y="165" />
-        <di:waypoint xsi:type="dc:Point" x="1239" y="165" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="1215" y="150" width="0" height="0" />
+          <dc:Bounds x="1878" y="247" width="15" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="CallActivity_0rz8zl9_di" bpmnElement="GenerateBaseModuleName">
-        <dc:Bounds x="1091" y="125" width="100" height="80" />
+        <dc:Bounds x="1077" y="245" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0otq8mo_di" bpmnElement="GenerateAddOnModuleName">
-        <dc:Bounds x="1952" y="57" width="100" height="80" />
+        <dc:Bounds x="1949" y="-53" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1lh21yl_di" bpmnElement="SequenceFlow_1lh21yl">
-        <di:waypoint xsi:type="dc:Point" x="2052" y="97" />
-        <di:waypoint xsi:type="dc:Point" x="2100" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="2049" y="-13" />
+        <di:waypoint xsi:type="dc:Point" x="2150" y="-13" />
+        <di:waypoint xsi:type="dc:Point" x="2150" y="57" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="2076" y="82" width="0" height="0" />
+          <dc:Bounds x="2054.5" y="-28" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_12x4dvf_di" bpmnElement="SequenceFlow_12x4dvf">
@@ -485,13 +495,6 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
           <dc:Bounds x="546" y="140" width="0" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_07u8e3l_di" bpmnElement="SequenceFlow_07u8e3l">
-        <di:waypoint xsi:type="dc:Point" x="674" y="165" />
-        <di:waypoint xsi:type="dc:Point" x="742" y="165" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="708" y="150" width="0" height="0" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0j52dxv_di" bpmnElement="SequenceFlow_0j52dxv">
         <di:waypoint xsi:type="dc:Point" x="1651" y="301" />
         <di:waypoint xsi:type="dc:Point" x="1543" y="301" />
@@ -512,9 +515,9 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0baw1tl_di" bpmnElement="SequenceFlow_0baw1tl">
         <di:waypoint xsi:type="dc:Point" x="1016" y="165" />
-        <di:waypoint xsi:type="dc:Point" x="1091" y="165" />
+        <di:waypoint xsi:type="dc:Point" x="1100" y="165" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="1054" y="150" width="0" height="0" />
+          <dc:Bounds x="1013" y="150" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ScriptTask_0i9vj5o_di" bpmnElement="Task_1mrb29r">
@@ -523,6 +526,56 @@ doCreateVnfAndModules.createLineOfBusiness(execution)]]></bpmn:script>
       <bpmndi:BPMNShape id="ScriptTask_0stghuy_di" bpmnElement="Task_0qrf3e8">
         <dc:Bounds x="916" y="125" width="100" height="80" />
       </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_06ccv8x_di" bpmnElement="ExclusiveGateway_06ccv8x" isMarkerVisible="true">
+        <dc:Bounds x="1102" y="140" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1083" y="102" width="87" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_19ecf9p_di" bpmnElement="SequenceFlow_19ecf9p">
+        <di:waypoint xsi:type="dc:Point" x="1127" y="190" />
+        <di:waypoint xsi:type="dc:Point" x="1127" y="215" />
+        <di:waypoint xsi:type="dc:Point" x="1127" y="215" />
+        <di:waypoint xsi:type="dc:Point" x="1127" y="245" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1132" y="209" width="20" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0tbhtk8_di" bpmnElement="SequenceFlow_0tbhtk8">
+        <di:waypoint xsi:type="dc:Point" x="1177" y="285" />
+        <di:waypoint xsi:type="dc:Point" x="1289" y="285" />
+        <di:waypoint xsi:type="dc:Point" x="1289" y="205" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1233" y="264" width="0" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_10nwzbe_di" bpmnElement="SequenceFlow_10nwzbe">
+        <di:waypoint xsi:type="dc:Point" x="1152" y="165" />
+        <di:waypoint xsi:type="dc:Point" x="1239" y="165" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1188" y="144" width="15" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ExclusiveGateway_03anzqd_di" bpmnElement="ExclusiveGateway_03anzqd" isMarkerVisible="true">
+        <dc:Bounds x="1973.884115884116" y="71.89710289710288" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="1957" y="126" width="87" height="24" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_0ulldxo_di" bpmnElement="SequenceFlow_0ulldxo">
+        <di:waypoint xsi:type="dc:Point" x="1999" y="72" />
+        <di:waypoint xsi:type="dc:Point" x="1999" y="27" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2004" y="44" width="20" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_12ffqm1_di" bpmnElement="SequenceFlow_12ffqm1">
+        <di:waypoint xsi:type="dc:Point" x="2024" y="97" />
+        <di:waypoint xsi:type="dc:Point" x="2100" y="97" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="2055" y="76" width="15" height="12" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn:definitions>