diff options
Diffstat (limited to 'bpmn')
6 files changed, 156 insertions, 112 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index 276b6f0500..59decb56a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -669,6 +669,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() AllocateTnNssi allocateTnNssi = new AllocateTnNssi() + allocateTnNssi.setNssiId(sliceTaskInfo.suggestNssiId) //todo: AllocateTnNssi //todo: endPointId -> set into tn List<TransportSliceNetwork> transportSliceNetworks = new ArrayList<>() diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml index 9f78182811..d09442424a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/pom.xml +++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml @@ -177,7 +177,6 @@ <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId> - <version>3.4.2</version> </dependency> <dependency> <groupId>com.h2database</groupId> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java index 786ee1e239..f93492bea5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/CreateVcpeResCustServiceSimplifiedTest.java @@ -116,6 +116,8 @@ public class CreateVcpeResCustServiceSimplifiedTest extends BaseBPMNTest { mockAai(); mockDmaapForPnf(); + grpcNettyServer.resetList(); + final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put("mso-request-id", msoRequestId); diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java index 1c00f3628d..35853a3794 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java +++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/GenericPnfSoftwareUpgradeTest.java @@ -107,6 +107,8 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { mockRequestDb(); mockAai(); + grpcNettyServer.resetList(); + final String msoRequestId = UUID.randomUUID().toString(); executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId); @@ -146,7 +148,6 @@ public class GenericPnfSoftwareUpgradeTest extends BaseBPMNTest { fail("GenericPnfSoftwareUpgrade request exception", e); } assertTrue(count == actionNames.length); - grpcNettyServer.resetList(); } private boolean isProcessInstanceEnded() { diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml index 881cb30548..9f7d09575c 100644 --- a/bpmn/so-bpmn-tasks/pom.xml +++ b/bpmn/so-bpmn-tasks/pom.xml @@ -105,7 +105,7 @@ <pluginExecutions> <pluginExecution> <pluginExecutionFilter> - <groupId>io.swagger</groupId> + <groupId>io.swagger.codegen.v3</groupId> <artifactId>swagger-codegen-maven-plugin</artifactId> <goals> <goal>generate</goal> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java index 6c6bd61041..3a7dd5772f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java @@ -44,6 +44,7 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.io.IOException; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Map; import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE; @@ -58,6 +59,9 @@ public class UserParamsServiceTraversal { private final CatalogDbClient catalogDbClient; private final ExceptionBuilder exceptionBuilder; + private boolean foundVfModuleOrVG; + private String vnfCustomizationUUID; + private String vfModuleCustomizationUUID; UserParamsServiceTraversal(CatalogDbClient catalogDbClient, ExceptionBuilder exceptionBuilder) { this.catalogDbClient = catalogDbClient; @@ -67,131 +71,170 @@ public class UserParamsServiceTraversal { protected List<Resource> getResourceListFromUserParams(DelegateExecution execution, List<Map<String, Object>> userParams, String serviceModelVersionId, String requestAction) throws IOException { - List<Resource> resourceList = new ArrayList<>(); - boolean foundVfModuleOrVG = false; - String vnfCustomizationUUID = ""; - String vfModuleCustomizationUUID = ""; if (userParams != null) { for (Map<String, Object> params : userParams) { if (params.containsKey(USER_PARAM_SERVICE)) { ObjectMapper obj = new ObjectMapper(); String input = obj.writeValueAsString(params.get(USER_PARAM_SERVICE)); Service validate = obj.readValue(input, Service.class); - resourceList.add( - new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false)); - if (validate.getResources().getVnfs() != null) { - for (Vnfs vnf : validate.getResources().getVnfs()) { - resourceList.add(new Resource(WorkflowType.VNF, - vnf.getModelInfo().getModelCustomizationId(), false)); - if (vnf.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) { - vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid(); - } - if (vnf.getVfModules() != null) { - for (VfModules vfModule : vnf.getVfModules()) { - VfModuleCustomization vfModuleCustomization = - catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID( - vfModule.getModelInfo().getModelCustomizationUuid()); - if (vfModuleCustomization != null) { - - if (vfModuleCustomization.getVfModule() != null - && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null - && vfModuleCustomization.getVolumeHeatEnv() != null) { - resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, - vfModuleCustomization.getModelCustomizationUUID(), false)); - foundVfModuleOrVG = true; - } - - if ((vfModuleCustomization.getVfModule() != null) - && ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null - && vfModuleCustomization.getHeatEnvironment() != null)) - || (vfModuleCustomization.getVfModule() != null - && vfModuleCustomization.getVfModule().getModelName() != null - && vfModuleCustomization.getVfModule().getModelName() - .contains("helm"))) { - foundVfModuleOrVG = true; - Resource resource = new Resource(WorkflowType.VFMODULE, - vfModuleCustomization.getModelCustomizationUUID(), false); - resource.setBaseVfModule( - vfModuleCustomization.getVfModule().getIsBase() != null - && vfModuleCustomization.getVfModule().getIsBase()); - resourceList.add(resource); - if (vfModule.getModelInfo() != null - && vfModule.getModelInfo().getModelCustomizationUuid() != null) { - vfModuleCustomizationUUID = - vfModule.getModelInfo().getModelCustomizationUuid(); - } - if (!vnfCustomizationUUID.isEmpty() - && !vfModuleCustomizationUUID.isEmpty()) { - List<CvnfcConfigurationCustomization> configs = - traverseCatalogDbForConfiguration( - validate.getModelInfo().getModelVersionId(), - vnfCustomizationUUID, vfModuleCustomizationUUID); - for (CvnfcConfigurationCustomization config : configs) { - Resource configResource = new Resource(WorkflowType.CONFIGURATION, - config.getConfigurationResource().getModelUUID(), false); - resource.setVnfCustomizationId( - vnf.getModelInfo().getModelCustomizationId()); - resource.setVfModuleCustomizationId( - vfModule.getModelInfo().getModelCustomizationId()); - resourceList.add(configResource); - } - } - } - if (!foundVfModuleOrVG) { - buildAndThrowException(execution, - "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); - } - } - } - } - } - } - if (validate.getResources().getPnfs() != null) { - for (Pnfs pnf : validate.getResources().getPnfs()) { - resourceList.add(new Resource(WorkflowType.PNF, - pnf.getModelInfo().getModelCustomizationId(), false)); - } - } - if (validate.getResources().getNetworks() != null) { - for (Networks network : validate.getResources().getNetworks()) { - resourceList.add(new Resource(WorkflowType.NETWORK, - network.getModelInfo().getModelCustomizationId(), false)); - } - if (requestAction.equals(CREATE_INSTANCE)) { - String networkColCustId = - queryCatalogDbForNetworkCollection(execution, serviceModelVersionId); - if (networkColCustId != null) { - resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false)); - } - } - } - break; + return getResourceList(execution, serviceModelVersionId, requestAction, validate); } } } + return Collections.emptyList(); + } + + private List<Resource> getResourceList(DelegateExecution execution, String serviceModelVersionId, + String requestAction, Service validate) { + List<Resource> resourceList = new ArrayList<>(); + resourceList.add(new Resource(WorkflowType.SERVICE, validate.getModelInfo().getModelVersionId(), false)); + if (validate.getResources().getVnfs() != null) { + setResourceListForVnfs(execution, resourceList, validate); + } + if (validate.getResources().getPnfs() != null) { + setResourceListForPnfs(resourceList, validate); + } + if (validate.getResources().getNetworks() != null) { + setResourceListForNetworks(execution, serviceModelVersionId, requestAction, resourceList, validate); + } return resourceList; } + private void setResourceListForVnfs(DelegateExecution execution, List<Resource> resourceList, Service validate) { + for (Vnfs vnf : validate.getResources().getVnfs()) { + setVnfCustomizationUUID(vnf); + resourceList.add(new Resource(WorkflowType.VNF, vnf.getModelInfo().getModelCustomizationId(), false)); + setResourceListForVfModules(execution, resourceList, validate, vnf); + } + } - private List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID, - String vnfCustomizationUUID, String vfModuleCustomizationUUID) { - List<CvnfcConfigurationCustomization> configurations = new ArrayList<>(); - try { - List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID, - vnfCustomizationUUID, vfModuleCustomizationUUID); - for (CvnfcCustomization cvnfc : cvnfcCustomizations) { - for (CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()) { - if (customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { - configurations.add(customization); + private void setResourceListForVfModules(DelegateExecution execution, List<Resource> resourceList, Service validate, + Vnfs vnf) { + if (vnf.getVfModules() != null) { + for (VfModules vfModule : vnf.getVfModules()) { + setVfModuleCustomizationUUID(vfModule); + VfModuleCustomization vfModuleCustomization = + catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(vfModuleCustomizationUUID); + if (vfModuleCustomization != null && vfModuleCustomization.getVfModule() != null) { + setVolumeGroupWorkFlowTypeToResourceList(resourceList, vfModuleCustomization); + setVfModuleAndConfigurationWorkFlowTypeToResourceList(resourceList, validate, vnf, vfModule, + vfModuleCustomization); + if (!foundVfModuleOrVG) { + buildAndThrowException(execution, + "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null"); } } } - logger.debug("found {} fabric configuration(s)", configurations.size()); - return configurations; + } + } + + private void setVolumeGroupWorkFlowTypeToResourceList(List<Resource> resourceList, + VfModuleCustomization vfModuleCustomization) { + if (vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null + && vfModuleCustomization.getVolumeHeatEnv() != null) { + foundVfModuleOrVG = true; + resourceList.add( + new Resource(WorkflowType.VOLUMEGROUP, vfModuleCustomization.getModelCustomizationUUID(), false)); + } + } + + private void setVfModuleAndConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Service validate, + Vnfs vnf, VfModules vfModule, VfModuleCustomization vfModuleCustomization) { + if ((vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null + && vfModuleCustomization.getHeatEnvironment() != null) + || (vfModuleCustomization.getVfModule().getModelName() != null + && vfModuleCustomization.getVfModule().getModelName().contains("helm"))) { + foundVfModuleOrVG = true; + Resource resource = setVfModuleWorkFlowTypeToResourceList(resourceList, vfModuleCustomization); + setConfigurationWorkFlowTypeToResourceList(resourceList, validate, vnf, vfModule, resource); + } + } + + private Resource setVfModuleWorkFlowTypeToResourceList(List<Resource> resourceList, + VfModuleCustomization vfModuleCustomization) { + Resource resource = + new Resource(WorkflowType.VFMODULE, vfModuleCustomization.getModelCustomizationUUID(), false); + resource.setBaseVfModule(vfModuleCustomization.getVfModule().getIsBase() != null + && vfModuleCustomization.getVfModule().getIsBase()); + resourceList.add(resource); + return resource; + } + + private void setConfigurationWorkFlowTypeToResourceList(List<Resource> resourceList, Service validate, Vnfs vnf, + VfModules vfModule, Resource resource) { + if (!vnfCustomizationUUID.isEmpty() && !vfModuleCustomizationUUID.isEmpty()) { + List<CvnfcConfigurationCustomization> configs = + traverseCatalogDbForConfiguration(validate.getModelInfo().getModelVersionId()); + for (CvnfcConfigurationCustomization config : configs) { + Resource configResource = new Resource(WorkflowType.CONFIGURATION, + config.getConfigurationResource().getModelUUID(), false); + resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId()); + resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId()); + resourceList.add(configResource); + } + } + } + + private void setVfModuleCustomizationUUID(VfModules vfModule) { + if (vfModule.getModelInfo() != null && vfModule.getModelInfo().getModelCustomizationUuid() != null) { + vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid(); + } else { + vfModuleCustomizationUUID = ""; + } + } + + private void setVnfCustomizationUUID(Vnfs vnf) { + if (vnf.getModelInfo() != null && vnf.getModelInfo().getModelCustomizationUuid() != null) { + vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid(); + } else { + vnfCustomizationUUID = ""; + } + } + + private void setResourceListForPnfs(List<Resource> resourceList, Service validate) { + for (Pnfs pnf : validate.getResources().getPnfs()) { + resourceList.add(new Resource(WorkflowType.PNF, pnf.getModelInfo().getModelCustomizationId(), false)); + } + } + + private void setResourceListForNetworks(DelegateExecution execution, String serviceModelVersionId, + String requestAction, List<Resource> resourceList, Service validate) { + for (Networks network : validate.getResources().getNetworks()) { + resourceList + .add(new Resource(WorkflowType.NETWORK, network.getModelInfo().getModelCustomizationId(), false)); + } + if (requestAction.equals(CREATE_INSTANCE)) { + String networkColCustId = queryCatalogDbForNetworkCollection(execution, serviceModelVersionId); + if (networkColCustId != null) { + resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, networkColCustId, false)); + } + } + } + + + private List<CvnfcConfigurationCustomization> traverseCatalogDbForConfiguration(String serviceModelUUID) { + try { + List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomization(serviceModelUUID, + vnfCustomizationUUID, vfModuleCustomizationUUID); + return getCvnfcConfigurationCustomizations(cvnfcCustomizations); } catch (Exception ex) { logger.error("Error in finding configurations", ex); - return configurations; + return Collections.emptyList(); + } + } + + private List<CvnfcConfigurationCustomization> getCvnfcConfigurationCustomizations( + List<CvnfcCustomization> cvnfcCustomizations) { + List<CvnfcConfigurationCustomization> configurations = new ArrayList<>(); + for (CvnfcCustomization cvnfc : cvnfcCustomizations) { + for (CvnfcConfigurationCustomization customization : cvnfc.getCvnfcConfigurationCustomization()) { + if (customization.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) { + configurations.add(customization); + } + } } + logger.debug("found {} fabric configuration(s)", configurations.size()); + return configurations; } private String queryCatalogDbForNetworkCollection(DelegateExecution execution, String serviceModelVersionId) { @@ -216,9 +259,7 @@ public class UserParamsServiceTraversal { count++; } } - if (count == 0) { - return null; - } else if (count > 1) { + if (count > 1) { buildAndThrowException(execution, "Found multiple Network Collections in the Service model, only one per Service is supported."); } |