aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java98
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql52
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java28
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json65
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java19
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java6
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java153
9 files changed, 479 insertions, 24 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
new file mode 100644
index 0000000000..2a5a739075
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CvnfcCatalogDbQueryTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 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.adapters.catalogdb.catalogrest;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClientPortChanger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.server.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import org.springframework.beans.BeanUtils;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class CvnfcCatalogDbQueryTest {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CvnfcCatalogDbQueryTest.class);
+
+ @LocalServerPort
+ private int port;
+ boolean isInitialized;
+
+ @Autowired
+ CatalogDbClientPortChanger client;
+
+ @Before
+ public void initialize(){
+ client.wiremockPort= String.valueOf(port);
+ }
+
+ @Test
+ public void cVnfcTest() {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+
+ List<CvnfcCustomization> foundCvnfcCustomization = client.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671","cb82ffd8-252a-11e7-93ae-92361f002671");
+ assertNotNull(foundCvnfcCustomization);
+ assertTrue(foundCvnfcCustomization.size() > 0);
+ CvnfcCustomization found = foundCvnfcCustomization.get(0);
+
+ CvnfcCustomization templateCvnfcCustomization = new CvnfcCustomization();
+ BeanUtils.copyProperties(found, templateCvnfcCustomization, "vnfVfmoduleCvnfcConfigurationCustomization");
+
+ assertThat(cvnfcCustomization, sameBeanAs(templateCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+ }
+
+ protected CvnfcCustomization setUpCvnfcCustomization(){
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("9bcce658-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelInstanceName("testModelInstanceName");
+ cvnfcCustomization.setModelUUID("b25735fe-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelInvariantUUID("ba7e6ef0-9b37-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelVersion("testModelVersion");
+ cvnfcCustomization.setModelName("testModelName");
+ cvnfcCustomization.setToscaNodeType("testToscaNodeType");
+ cvnfcCustomization.setDescription("testCvnfcCustomzationDescription");
+ cvnfcCustomization.setNfcFunction("testNfcFunction");
+ cvnfcCustomization.setNfcNamingCode("testNfcNamingCode");
+ return cvnfcCustomization;
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 3e92b5d7ba..75015e589d 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -241,3 +241,55 @@ INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, I
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
('Service-Create', '1', 'AssignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Create' and CLOUD_OWNER = 'my-custom-cloud-owner' and SERVICE_TYPE = 'TRANSPORT'));
+
+INSERT INTO `vnfc_customization`
+ (`model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `creation_timestamp`)
+VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'toscaNodeType',
+ 'testVnfcCustomizationDescription',
+ '2018-07-17 14:05:08');
+
+INSERT INTO `cvnfc_customization`
+ (`id`,
+ `model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `nfc_function`,
+ `nfc_naming_code`,
+ `creation_timestamp`,
+ `vnf_resource_cust_model_customization_uuid`,
+ `vf_module_cust_model_customization_uuid`,
+ `vnfc_cust_model_customization_uuid`)
+VALUES ( '1',
+ '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaNodeType',
+ 'testCvnfcCustomzationDescription',
+ 'testNfcFunction',
+ 'testNfcNamingCode',
+ '2018-07-17 14:05:08',
+ '68dc9a92-214c-11e7-93ae-92361f002671',
+ 'cb82ffd8-252a-11e7-93ae-92361f002671',
+ '9bcce658-9b37-11e8-98d0-529269fb1459');
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 0c0e1464b2..0082545fa1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -68,6 +68,8 @@ import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Networks;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -198,7 +200,7 @@ public class WorkflowAction {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte, cloudOwner, serviceType);
}
- orchFlows = filterOrchFlows(orchFlows, resourceType, execution);
+ orchFlows = filterOrchFlows(sIRequest, orchFlows, resourceType, execution);
String key = "";
ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
if(modelInfo.getModelType().equals(ModelType.service)) {
@@ -1103,10 +1105,22 @@ public class WorkflowAction {
return listToExecute;
}
- protected List<OrchestrationFlow> filterOrchFlows(List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) {
+ protected List<OrchestrationFlow> filterOrchFlows(ServiceInstancesRequest sIRequest, List<OrchestrationFlow> orchFlows, WorkflowType resourceType, DelegateExecution execution) {
List<OrchestrationFlow> result = new ArrayList<>(orchFlows);
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = sIRequest.getRequestDetails().getModelInfo().getModelCustomizationUuid();
+ RelatedInstanceList[] relatedInstanceList = sIRequest.getRequestDetails().getRelatedInstanceList();
+ if (relatedInstanceList != null) {
+ for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
+ vnfCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
+ }
+ }
+ }
+
if (resourceType.equals(WorkflowType.VFMODULE)) {
- List<String> fabricCustomizations = traverseCatalogDbForConfiguration((String)execution.getVariable("vnfId"), (String)execution.getVariable("vfModuleId"));
+ List<String> fabricCustomizations = traverseCatalogDbForConfiguration(vnfCustomizationUUID, vfModuleCustomizationUUID);
if (fabricCustomizations.isEmpty()) {
result = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION)).collect(Collectors.toList());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 7b348c8cb3..24b87277c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -37,9 +37,11 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
+import java.util.Set;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -70,6 +72,8 @@ import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResource;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.InstanceGroup;
@@ -77,6 +81,7 @@ import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -854,6 +859,63 @@ public class WorkflowActionTest extends BaseTaskTest {
,"DeleteNetworkCollectionBB");
}
+ @Test
+ public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "VfModule";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB");
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception{
+ String gAction = "createInstance";
+ String resource = "VfModule";
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("apiVersion", "7");
+ execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setToscaNodeType("FabricConfiguration");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> custSet = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+ custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(custSet);
+ cvnfcCustomizations.add(cvnfcCustomization);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction,resource,true,"my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae", "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs,"AssignVfModuleBB","CreateVfModuleBB","ActivateVfModuleBB","AssignFabricConfigurationBB","ActivateFabricConfigurationBB");
+ }
+
/**
* WorkflowActionBB Tests
*/
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
index 297d75a104..2dd4033aa2 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java
@@ -57,6 +57,10 @@ import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@RunWith(MockitoJUnitRunner.class)
public class WorkflowActionUnitTest {
@@ -87,9 +91,16 @@ public class WorkflowActionUnitTest {
"flow y",
"ActivateFabricConfigurationBB",
"flow z");
- doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.isNull(), ArgumentMatchers.isNull());
+ doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(ArgumentMatchers.any(String.class), ArgumentMatchers.isNull());
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
+ ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ ModelInfo modelInfo = new ModelInfo();
+ requestDetails.setModelInfo(modelInfo);
+ RelatedInstance relatedInstance = new RelatedInstance();
+ sIRequest.setRequestDetails(requestDetails);
+
+ List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
assertThat(result, is(flows));
}
@@ -103,7 +114,14 @@ public class WorkflowActionUnitTest {
"ActivateFabricConfigurationBB",
"flow z");
- List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
+ ServiceInstancesRequest sIRequest = new ServiceInstancesRequest();
+ RequestDetails requestDetails = new RequestDetails();
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelCustomizationUuid("");
+ requestDetails.setModelInfo(modelInfo);
+ sIRequest.setRequestDetails(requestDetails);
+
+ List<OrchestrationFlow> result = workflowAction.filterOrchFlows(sIRequest, flows, WorkflowType.VFMODULE, mock(DelegateExecution.class));
List<OrchestrationFlow> expected = createFlowList(
"flow x",
"flow y",
@@ -147,7 +165,7 @@ public class WorkflowActionUnitTest {
doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean(), any(), any());
workflowAction.selectExecutionList(execution);
- verify(workflowAction, times(1)).filterOrchFlows(eq(flows), any(), any());
+ verify(workflowAction, times(1)).filterOrchFlows(any(), eq(flows), any(), any());
flow = new OrchestrationFlow();
flow.setFlowName("flow y");
@@ -155,7 +173,7 @@ public class WorkflowActionUnitTest {
when(execution.getVariable(eq("aLaCarte"))).thenReturn(false);
workflowAction.selectExecutionList(execution);
- verify(workflowAction, never()).filterOrchFlows(eq(flows), any(), any());
+ verify(workflowAction, never()).filterOrchFlows(any(), eq(flows), any(), any());
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json
new file mode 100644
index 0000000000..332ad4500c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModuleCreateWithFabric.json
@@ -0,0 +1,65 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelCustomizationName": "model-cust-name",
+ "modelInvariantId": "db86e4a6-c027-452e-a559-3a23b3128367",
+ "modelType": "vfModule",
+ "modelName": "test-model-name",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9a6d01fd-19a7-490a-9800-460830a12e0b",
+ "modelVersionId": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60",
+ "modelCustomizationId": "9a6d01fd-19a7-490a-9800-460830a12e0b",
+ "modelUuid": "14c8f313-fb0f-4cf6-8caf-c7cce8137b60",
+ "modelInvariantUuid": "db86e4a6-c027-452e-a559-3a23b3128367",
+ "modelInstanceName": "test-model-instance-name"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "instanceName": "instanceName",
+ "suppressRollback": false,
+ "requestorId": "user"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "f647e3ef-6d2e-4cd3-bff4-8df4634208de",
+ "modelInfo": {
+ "modelInvariantId": "86adb376-5303-441a-b50e-96c0cd643b0f",
+ "modelType": "service",
+ "modelName": "model-name",
+ "modelVersion": "1.0",
+ "modelVersionId": "599e21ed-803d-4d1f-83df-20005339b83f",
+ "modelUuid": "599e21ed-803d-4d1f-83df-20005339b83f",
+ "modelInvariantUuid": "86adb376-5303-441a-b50e-96c0cd643b0f"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d",
+ "modelInfo": {
+ "modelCustomizationName": "modle-cust-name",
+ "modelInvariantId": "5cca9285-4ed4-4e11-a609-921ed3344811",
+ "modelType": "vnf",
+ "modelName": "modle-name",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "fc25201d-36d6-43a3-8d39-fdae88e526ae",
+ "modelVersionId": "7cae703a-b20d-481a-863a-b862236c00f7",
+ "modelCustomizationId": "fc25201d-36d6-43a3-8d39-fdae88e526ae",
+ "modelUuid": "7cae703a-b20d-481a-863a-b862236c00f7",
+ "modelInvariantUuid": "5cca9285-4ed4-4e11-a609-921ed3344811",
+ "modelInstanceName": "model-inst-name"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration": {
+ "tenantId": "872f331350c54e59991a8de2cbffb40c",
+ "cloudOwner": "my-custom-cloud-owner",
+ "lcpCloudRegionId": "cloud-region"
+ },
+ "requestParameters": {
+ "usePreload": true
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 828b2ff920..ac123b280d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -223,7 +223,7 @@ public class CatalogDbClient {
private final Client<CloudifyManager> cloudifyManagerClient;
- private Client<CvnfcCustomization> cvnfcCustomizationClient;
+ private final Client<CvnfcCustomization> cvnfcCustomizationClient;
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
@@ -695,18 +695,11 @@ public class CatalogDbClient {
}
public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
- return this.getMultipleVnfcCustomizations(
- UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID")
- .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID)
- .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build());
- }
-
- private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) {
- Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri);
- List<CvnfcCustomization> vnfcList = new ArrayList<>();
- Iterator<CvnfcCustomization> it = vnfcIterator.iterator();
- it.forEachRemaining(vnfcList::add);
- return vnfcList;
+
+ return this.getMultipleResources(cvnfcCustomizationClient,getUri(UriBuilder
+ .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
+ .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
+ .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
}
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
index 0c82b84c0f..a4281aea6c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
@@ -24,6 +24,7 @@ import java.util.List;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@@ -31,6 +32,7 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> {
CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
- List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,
- @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
+
+ @Query(value = "SELECT * FROM cvnfc_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID = ?2", nativeQuery = true)
+ List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,@Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
index ae3c49ec7d..63bd99f730 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -51,7 +51,7 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
@Test
@Transactional
- public void createAndGetTest() throws Exception {
+ public void createAndGetAllTest() throws Exception {
CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
@@ -100,4 +100,155 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest {
}
Assert.assertTrue(matchFound);
}
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationListTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ boolean matchFound = false;
+ for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) {
+ if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) {
+
+ assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ matchFound = true;
+ break;
+ }
+ }
+ Assert.assertTrue(matchFound);
+ }
+
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ CvnfcCustomization cvnfcCustomizationList = cvnfcCustomizationRepository.findOneByModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ assertThat(cvnfcCustomization, sameBeanAs(cvnfcCustomizationList)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ }
+
+ @Test
+ @Transactional
+ public void createAndGetCvnfcCustomizationsTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findByVnfResourceCustomizationAndVfModuleCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459","cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ boolean matchFound = false;
+ for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) {
+ if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) {
+
+ assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ matchFound = true;
+ break;
+ }
+ }
+ Assert.assertTrue(matchFound);
+ }
}