summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java23
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json67
12 files changed, 280 insertions, 18 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 074652e221..9c1fba62e9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -141,6 +141,19 @@ public class AAIUpdateTasks {
}
}
+ public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ CloudRegion cloudRegion = gBBInput.getCloudRegion();
+
+ aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
try {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
@@ -281,6 +294,16 @@ public class AAIUpdateTasks {
}
}
+ public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
+ try {
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
/**
* BPMN access method to update L3Network after it was created in AIC
* @param execution
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index f94b967643..c45a47bc12 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -23,8 +23,12 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -42,6 +46,12 @@ public class UnassignNetworkBB {
@Autowired
private NetworkBBUtils networkBBUtils;
+
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ private AAINetworkResources aaiNetworkResources;
/**
* BPMN access method to prepare overall error messages.
@@ -54,9 +64,11 @@ public class UnassignNetworkBB {
public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception {
try {
- AAIResultWrapper aaiResultWrapper = execution.getVariable("l3NetworkAAIResultWrapper");
- Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
- if (networkBBUtils.isRelationshipRelatedToExists(l3network, relatedToValue)) {
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
+ Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+ if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 5f922e0c99..1d87b70754 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -187,7 +187,9 @@ public class VnfAdapterVfModuleObjectMapper {
paramsMap.put("vf_module_id", vfModule.getVfModuleId());
paramsMap.put("vf_module_name", vfModule.getVfModuleName());
paramsMap.put("environment_context",serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
+ paramsMap.putIfAbsent("environment_context", "");
paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ paramsMap.putIfAbsent("workload_context", "");
Integer vfModuleIndex = vfModule.getModuleIndex();
if (vfModuleIndex != null) {
paramsMap.put("vf_module_index", vfModuleIndex.toString());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
index 7fef56d965..a641d43ba3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java
@@ -67,6 +67,15 @@ public class AAIVfModuleResources {
injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
}
+ public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) {
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
+ VfModule copiedVfModule = vfModule.shallowCopyId();
+
+ copiedVfModule.setHeatStackId(vfModule.getHeatStackId());
+ org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule);
+ injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule);
+ }
+
public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) {
AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId());
org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
index 70c6724921..af97e55c14 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java
@@ -74,4 +74,12 @@ public class AAIVolumeGroupResources {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
injectionHelper.getAaiClient().delete(uri);
}
+
+ public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId());
+ VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId();
+
+ copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId());
+ injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
index 20c95dd55e..5b23707cb9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
@@ -54,7 +54,7 @@ public class ServiceTopologyOperationMapper{
GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
- servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceId());
+ servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
servOpInput.setSdncRequestHeader(sdncRequestHeader);
servOpInput.setRequestInformation(reqInfo);
@@ -64,7 +64,7 @@ public class ServiceTopologyOperationMapper{
if(requestContext.getUserParams()!=null){
for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) {
GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
- serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceId());
+ serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index 6ad263a935..c9433a6212 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -203,6 +203,24 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
}
@Test
+ public void updateHeatStackIdVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
+
+ aaiUpdateTasks.updateHeatStackIdVfModule(execution);
+
+ verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void updateHeatStackIdVfModuleExceptionTest() throws Exception {
+ doThrow(Exception.class).when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
+
+ expectedException.expect(BpmnError.class);
+
+ aaiUpdateTasks.updateHeatStackIdVfModule(execution);
+ }
+
+ @Test
public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception {
doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
@@ -249,7 +267,23 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
expectedException.expect(BpmnError.class);
doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution);
- }
+ }
+ @Test
+ public void updateHeatStackIdVolumeGroupTest() throws Exception {
+ doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ }
+
+ @Test
+ public void updateHeatStackIdVolumeGroupExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
+ }
+
@Test
public void updateOstatusAssignedNetworkTest() throws Exception {
doNothing().when(aaiNetworkResources).updateNetwork(network);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
index 6a117902ea..32c285b0fe 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -20,48 +20,58 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.doReturn;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Test;
+import org.mockito.Mock;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.springframework.beans.factory.annotation.Autowired;
public class UnassignNetworkBBTest extends BaseTaskTest {
+
+ @Mock
+ private NetworkBBUtils networkBBUtils;
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
@Autowired
private UnassignNetworkBB unassignNetworkBB;
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/";
+ private L3Network network;
@Test
public void checkRelationshipRelatedToTrueTest() throws Exception {
expectedException.expect(BpmnError.class);
+ network = setL3Network();
+ network.setNetworkId("testNetworkId1");
final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
- execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper);
-
+ Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
+ doReturn(network).when(extractPojosForBB).extractByKey(execution, ResourceKey.NETWORK_ID, "testNetworkId1");
+ doReturn(aaiResultWrapper).when(aaiNetworkResources).queryNetworkWrapperById(network);
+ doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(l3network, "vf-module");
unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
- }
-
- @Test
- public void checkRelationshipRelatedToFalseTest() throws Exception {
- final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json")));
- AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse);
- execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper);
-
- unassignNetworkBB.checkRelationshipRelatedTo(execution, "kfc-module");
- //expected result is no exception
+ assertThat(execution.getVariable("ErrorUnassignNetworkBB"), notNullValue());
}
@Test
public void getCloudSdncRegion25Test() throws Exception {
CloudRegion cloudRegion = setCloudRegion();
cloudRegion.setCloudRegionVersion("2.5");
+ doReturn("AAIAIC25").when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC);
unassignNetworkBB.getCloudSdncRegion(execution);
assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc"));
}
@@ -71,6 +81,7 @@ public class UnassignNetworkBBTest extends BaseTaskTest {
CloudRegion cloudRegion = setCloudRegion();
cloudRegion.setCloudRegionVersion("3.0");
gBBInput.setCloudRegion(cloudRegion);
+ doReturn(cloudRegion.getLcpCloudRegionId()).when(networkBBUtils).getCloudRegion(execution, SourceSystem.SDNC);
unassignNetworkBB.getCloudSdncRegion(execution);
assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc"));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
index 9c51ee8006..1bb59e7b8d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java
@@ -129,6 +129,76 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest {
}
@Test
+ public void createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+ modelInfoServiceInstance.setEnvironmentContext(null);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value2");
+ requestContext.setMsoRequestId("requestId");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("vnfId");
+ vnf.setVnfType("vnfType");
+ vnf.setVnfName("vnfName");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ Integer vfModuleIndex = 1;
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setVfModuleName("vfModuleName");
+ vfModule.setModuleIndex(vfModuleIndex);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid");
+ modelInfoVfModule.setModelName("vfModuleModelName");
+ modelInfoVfModule.setModelVersion("vfModuleModelVersion");
+ modelInfoVfModule.setModelUUID("vfModuleModelUuid");
+ modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ CloudRegion cloudRegion = new CloudRegion();
+ cloudRegion.setLcpCloudRegionId("cloudRegionId");
+ cloudRegion.setTenantId("tenantId");
+
+ OrchestrationContext orchestrationContext = new OrchestrationContext();
+ orchestrationContext.setIsRollbackEnabled(false);
+
+ String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json")));
+ String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json")));
+
+ CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper(
+ requestContext, cloudRegion, orchestrationContext, serviceInstance,
+ vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
+
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json")));
+
+ CreateVfModuleRequest reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ CreateVfModuleRequest.class);
+
+ assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl"));
+ }
+
+ @Test
public void createVfModuleAddonRequestMapperTest() throws Exception {
// prepare and set service instance
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index 0c4c8fc443..477be816aa 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -124,4 +124,17 @@ public class AAIVfModuleResourcesTest extends TestDataSetup{
aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, cloudRegion);
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
+
+ @Test
+ public void updateHeatStackIdVfModuleTest() throws Exception {
+ vfModule.setHeatStackId("testHeatStackId");
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class));
+
+ aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class));
+
+ assertEquals("testHeatStackId", vfModule.getHeatStackId());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
index de15e0a550..f60f29fa34 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -129,4 +129,17 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup{
verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class));
}
+
+ @Test
+ public void updateHeatStackIdVolumeGroupTest() throws Exception {
+ volumeGroup.setHeatStackId("testVolumeHeatStackId");
+
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class));
+
+ aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class));
+
+ assertEquals("testVolumeHeatStackId", volumeGroup.getHeatStackId());
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json
new file mode 100644
index 0000000000..fd3b0a3d58
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json
@@ -0,0 +1,67 @@
+{
+ "cloudSiteId": "cloudRegionId",
+ "tenantId": "tenantId",
+ "vnfId": "vnfId",
+ "vnfType": "vnfType",
+ "vfModuleId": "vfModuleId",
+ "vfModuleName": "vfModuleName",
+ "vfModuleType": "vfModuleModelName",
+ "vnfVersion": "serviceModelVersion",
+ "modelCustomizationUuid": "vfModuleModelCustomizationUuid",
+ "skipAAI": true,
+ "backout": false,
+ "failIfExists": true,
+ "msoRequest":
+ {
+ "requestId": "requestId",
+ "serviceInstanceId": "serviceInstanceId"
+ },
+
+ "vfModuleParams":
+ {
+ "vnf_id": "vnfId",
+ "vnf_name": "vnfName",
+ "vf_module_id": "vfModuleId",
+ "vf_module_index": "1",
+ "vf_module_name": "vfModuleName",
+ "environment_context": "",
+ "fw_0_subint_ctrl_port_0_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_net_ids": "networkId0",
+ "fw_0_subint_ctrl_port_0_net_names": "1",
+ "fw_subint_ctrl_port_0_subintcount": "1",
+ "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1",
+ "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0",
+ "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1",
+ "fw_0_subint_ctrl_port_0_vlan_ids": "1",
+ "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40",
+ "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60",
+ "workload_context": "",
+ "key1": "value2",
+ "availability_zone_0": "zone0",
+ "availability_zone_1": "zone1",
+ "availability_zone_2": "zone2",
+ "vnfNetworkRole0_net_fqdn": "netFqdnValue0",
+ "vnfNetworkRole0_net_id": "neutronId0",
+ "vnfNetworkRole0_net_name": "netName0",
+ "vnfNetworkRole0_subnet_id": "subnetId0",
+ "vnfNetworkRole0_v6_subnet_id": "subnetId1",
+ "vmType0_name_0": "vmName0",
+ "vmType0_name_1": "vmName1",
+ "vmType0_names": "vmName0,vmName1",
+ "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40",
+ "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60",
+ "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]",
+ "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1",
+ "vmType0_vmNetworkRole0_ip_0": "ip0",
+ "vmType0_vmNetworkRole0_ip_1": "ip1",
+ "vmType0_vmNetworkRole0_ips": "ip0,ip1",
+ "vmType0_vmNetworkRole0_v6_ip_0": "ip2",
+ "vmType0_vmNetworkRole0_v6_ip_1": "ip3",
+ "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3",
+ "paramOne": "paramOneValue",
+ "paramTwo": "paramTwoValue",
+ "paramThree": "paramThreeValue"
+ }
+} \ No newline at end of file